sgl-project/sglang · error · ValueError

experimental_sgl_marlin LoRA requires --lora-use-virtual-exp

Error message

experimental_sgl_marlin LoRA requires --lora-use-virtual-experts

What it means

Startup validation in validate_experimental_sgl_marlin_server_args: when LoRA is enabled for the experimental SGLang Marlin runner (either explicit --enable-lora or an adapter path implicitly enabling it) but --lora-use-virtual-experts is off, the server refuses to start. The experimental kernels require the virtual-experts representation of LoRA.

Source

Thrown at python/sglang/srt/lora/marlin_lora_temp/policy.py:33

) -> None:
    """Validate startup options before the experimental runner is constructed."""
    from sglang.srt.arg_groups.overrides import resolving_view

    cfg = resolving_view(server_args)

    if resolved_args.ep_size > 1 and resolved_args.moe_a2a_backend != "none":
        raise ValueError("experimental_sgl_marlin EP requires --moe-a2a-backend none")

    # A provided adapter path implicitly enables LoRA later unless it was
    # explicitly disabled. No-LoRA delegates to the stock Marlin fused path.
    lora_enabled = bool(resolved_args.enable_lora) or (
        resolved_args.enable_lora is None and bool(cfg.lora_paths)
    )
    if not lora_enabled:
        return

    if not cfg.lora_use_virtual_experts:
        raise ValueError(
            "experimental_sgl_marlin LoRA requires --lora-use-virtual-experts"
        )
    if cfg.lora_backend != "triton":
        # The temporary dense/sink kernels consume Triton SGEMM batch metadata
        # directly; other global backends are not adapted in this tree.
        raise ValueError("experimental_sgl_marlin LoRA requires --lora-backend triton")
    if resolved_args.ep_size <= 1:
        return

    if (
        cfg.init_expert_location != "trivial"
        or cfg.ep_num_redundant_experts != 0
        or cfg.enable_eplb
        or cfg.elastic_ep_backend is not None
        or cfg.enable_elastic_expert_backup
        or cfg.elastic_ep_rejoin
    ):
        raise ValueError(

View on GitHub (pinned to 0132848349)

Solutions

  1. Add --lora-use-virtual-experts to the launch command
  2. Also ensure --lora-backend triton and --max-lora-rank > 0 as required by sibling checks
  3. Remove LoRA paths if LoRA is not intended

Example fix

# before
--enable-lora --lora-paths /ckpt/a
# after
--enable-lora --lora-paths /ckpt/a --lora-use-virtual-experts --lora-backend triton
Defensive patterns

Strategy: validation

Validate before calling

lora_enabled = bool(server_args.enable_lora) or bool(server_args.lora_paths)
if lora_enabled:
    assert server_args.lora_use_virtual_experts, 'add --lora-use-virtual-experts'

Prevention

When it happens

Trigger: Starting with the experimental_sgl_marlin runner plus lora_paths / --enable-lora, while cfg.lora_use_virtual_experts is False. This is the startup-time twin of the runtime check in moe_runner.py.

Common situations: Enabling LoRA for benchmarking the marlin path but forgetting the virtual-experts flag; lora implicitly enabled by --lora-paths without the accompanying flag.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/a5ea67ded832f149. Report an issue: GitHub.