sgl-project/sglang · error · ValueError

DSpark with dp attention requires --enable-dp-lm-head.

Error message

DSpark with dp attention requires --enable-dp-lm-head.

What it means

When DSpark is combined with real data-parallel attention (dp_size > 1), the lm head must be sharded in DP mode so per-DP-rank logits line up with verification. The hook requires --enable-dp-lm-head in that case.

Source

Thrown at python/sglang/srt/arg_groups/speculative_hook.py:358

    from sglang.srt.speculative.dspark_components.dspark_config import (
        checkpoint_bundles_dspark_draft,
    )

    return checkpoint_bundles_dspark_draft(server_args.get_model_config().hf_config)


def _handle_dspark(server_args: ServerArgs) -> None:
    cfg = resolving_view(server_args)
    _is_npu = cfg.device.startswith("npu")
    if not cfg.device.startswith(("cuda", "npu")):
        raise ValueError(
            "DSpark speculative decoding only supports CUDA or NPU device."
        )

    # dp_size==1 with dp_attention is a degenerate flag under DSV4 CP; skip DP-only checks.
    if cfg.enable_dp_attention and cfg.dp_size > 1:
        if not cfg.enable_dp_lm_head:
            raise ValueError("DSpark with dp attention requires --enable-dp-lm-head.")
        if not _is_npu and cfg.moe_a2a_backend not in ("none", "megamoe"):
            raise ValueError(
                "DSpark with dp attention supports moe_a2a_backend 'none' "
                "(built-in TP MoE) or 'megamoe', got "
                f"{cfg.moe_a2a_backend!r}."
            )
        if not _is_npu and cfg.moe_a2a_backend != "none":
            from sglang.srt.speculative.ragged_verify import (
                RaggedVerifyMode,
                read_ragged_verify_mode,
            )

            if read_ragged_verify_mode() is not RaggedVerifyMode.STATIC:
                raise ValueError(
                    "DSpark with dp attention + "
                    f"moe_a2a_backend={cfg.moe_a2a_backend!r} requires "
                    "SGLANG_RAGGED_VERIFY_MODE=static."
                )

View on GitHub (pinned to 0132848349)

Solutions

  1. Add --enable-dp-lm-head to the launch command
  2. Or drop --enable-dp-attention / set dp_size=1 if DP attention is not required
  3. Verify with dp_size==1 the check is skipped intentionally (degenerate flag) and adjust flags accordingly

Example fix

# before
--speculative-algorithm DSPARK --enable-dp-attention --dp-size 4
# after
--speculative-algorithm DSPARK --enable-dp-attention --dp-size 4 --enable-dp-lm-head
Defensive patterns

Strategy: validation

Validate before calling

if args.enable_dp_attention and args.dp_size > 1 and not args.enable_dp_lm_head:
    raise SystemExit('DSPARK + dp attention requires --enable-dp-lm-head')

Prevention

When it happens

Trigger: Launching with speculative_algorithm=DSPARK, --enable-dp-attention, --dp-size > 1, without --enable-dp-lm-head.

Common situations: Standard DeepSeek-style DP-attention launch (dp attention without DP lm head) reused for DSpark; dp_lm_head omitted because it's optional for non-speculative runs.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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