sgl-project/sglang · error · ValueError
DFLASH requires explicit layer_ids for aux hidden capture.
Error message
DFLASH requires explicit layer_ids for aux hidden capture.
What it means
Same DFLASH guard as other Qwen models: enabling aux hidden state capture for DFLASH speculative decoding requires an explicit list of layer ids; None is rejected.
Source
Thrown at python/sglang/srt/models/qwen3_moe.py:1104
self.capture_aux_hidden_states = True
if layer_ids is None:
num_layers = self.config.num_hidden_layers
self.model.set_eagle3_layers_to_capture(
[
2,
num_layers // 2,
num_layers - 3,
]
) # Specific layers for EAGLE3 support
else:
self.model.set_eagle3_layers_to_capture([val + 1 for val in layer_ids])
def set_dflash_layers_to_capture(self, layer_ids: List[int]):
if not self.pp_group.is_last_rank:
return
if layer_ids is None:
raise ValueError(
"DFLASH requires explicit layer_ids for aux hidden capture."
)
self.capture_aux_hidden_states = True
self.model.set_dflash_layers_to_capture([val + 1 for val in layer_ids])
def load_weights(
self, weights: Iterable[Tuple[str, torch.Tensor]], is_mtp: bool = False
):
stacked_params_mapping = [
# (param_name, shard_name, shard_id)
("qkv_proj", "q_proj", "q"),
("qkv_proj", "k_proj", "k"),
("qkv_proj", "v_proj", "v"),
("gate_up_proj", "gate_proj", 0),
("gate_up_proj", "up_proj", 1),
]
View on GitHub (pinned to 0132848349)
Solutions
- Pass explicit layer indices, e.g. via --dflash-capture-layers
- Verify the spec algorithm config computes layer ids before model init
- Update to a config where capture layers default to a computed set
Example fix
# before model.set_dflash_layers_to_capture(None) # after model.set_dflash_layers_to_capture([0, 1, 2, 3])
Defensive patterns
Strategy: validation
Validate before calling
if layer_ids is None: raise SystemExit("specify --dflash-capture-layers")
model.set_dflash_layers_to_capture(layer_ids) Type guard
def valid_layer_ids(x) -> bool:
return isinstance(x, list) and all(isinstance(i, int) and i >= 0 for i in x) and len(x) > 0 Prevention
- Always configure explicit capture layers with DFLASH
When it happens
Trigger: Calling Qwen3MoeForCausalLM.set_dflash_layers_to_capture(None) on the last pipeline rank while enabling DFLASH.
Common situations: DFLASH/spec config missing the capture-layer list when serving a Qwen3-MoE model.
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
- DFLASH speculative decoding only supports CUDA and NPU devic
- Currently DFLASH speculative decoding does not support dp at
- Currently DFLASH speculative decoding only supports pp_size
- DFLASH speculative decoding requires setting --speculative-d
- DFLASH requires --speculative-dflash-block-size to be positi
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/962a79938d81e089.
Report an issue: GitHub.