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

DFLASH aux-hidden capture on Qwen3-VL requires an explicit list of layer ids; None is rejected. Note layer ids are shifted +1 to account for the embedding/decoder offset.

Source

Thrown at python/sglang/srt/models/qwen3_vl.py:1514

        if self.pp_group.is_last_rank:
            if not get_embedding:
                return self.logits_processor(
                    input_ids,
                    hidden_states,
                    self.lm_head,
                    forward_batch,
                    aux_hidden_states,
                )
            else:
                return self.pooler(hidden_states, forward_batch)
        else:
            return hidden_states

    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]]):
        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", "up_proj", 1),
            ("gate_up_proj", "gate_proj", 0),
        ]
        params_dict = dict(self.named_parameters(remove_duplicate=False))
        for name, loaded_weight in weights:
            if "rotary_emb.inv_freq" in name:
                continue

View on GitHub (pinned to 0132848349)

Solutions

  1. Set --dflash-capture-layers or equivalent explicit layer list
  2. Verify the spec worker forwards computed indices

Example fix

# before
model.set_dflash_layers_to_capture(None)
# after
model.set_dflash_layers_to_capture([0, 3, 6])
Defensive patterns

Strategy: validation

Validate before calling

assert layer_ids is not None and len(layer_ids) > 0

Prevention

When it happens

Trigger: Calling Qwen3VLForConditionalGeneration.set_dflash_layers_to_capture(None) on the last PP rank during DFLASH setup.

Common situations: DFLASH speculative decoding enabled for Qwen3-VL without a capture-layer list.

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/7c615eaae2ea9fb9. Report an issue: GitHub.