vllm-project/vllm · error · ValueError

dspark_draft_topk is only supported by DSpark

Error message

dspark_draft_topk is only supported by DSpark

What it means

Raised when dspark_draft_topk is set to a non-None value but the speculative method is not 'dspark'. The top-k draft restriction is implemented only in the DSpark drafting worker, so applying the knob to ngram/eagle/mtp etc. is rejected at config validation time.

Source

Thrown at vllm/config/speculative.py:1090

                        self.num_speculative_tokens = n_predict
                    elif (
                        self.num_speculative_tokens > n_predict
                        and self.num_speculative_tokens % n_predict != 0
                    ):
                        # Ensure divisibility for MTP module reuse.
                        raise ValueError(
                            f"num_speculative_tokens:{self.num_speculative_tokens}"
                            f" must be divisible by {n_predict=}"
                        )

                if self.num_speculative_tokens is None:
                    raise ValueError(
                        "A speculative model was provided, but "
                        "`num_speculative_tokens` was not provided"
                    )

                if self.dspark_draft_topk is not None and self.method != "dspark":
                    raise ValueError("dspark_draft_topk is only supported by DSpark")

                dspark_draft_topk = None
                if self.method == "dspark":
                    hf_config = self.draft_model_config.hf_config
                    dspark_draft_topk = self.dspark_draft_topk
                    if dspark_draft_topk is None:
                        dspark_draft_topk = getattr(
                            hf_config, "dspark_draft_topk", None
                        )
                    if dspark_draft_topk is not None:
                        draft_vocab_size = (
                            getattr(hf_config, "draft_vocab_size", None)
                            or hf_config.vocab_size
                        )
                        if not 1 <= dspark_draft_topk <= draft_vocab_size:
                            raise ValueError(
                                "dspark_draft_topk must be between 1 and the "
                                f"draft vocabulary size ({draft_vocab_size})"

View on GitHub (pinned to c794754062)

Solutions

  1. Remove dspark_draft_topk from the speculative_config when method != 'dspark'
  2. Switch method to 'dspark' with a Qwen3DSparkModel draft if the top-k behavior is what you want

Example fix

# before
speculative_config={"method": "ngram", "prompt_lookup_max": 4, "dspark_draft_topk": 4}
# after
speculative_config={"method": "ngram", "prompt_lookup_max": 4}
Defensive patterns

Strategy: validation

Validate before calling

if spec_cfg.get("dspark_draft_topk") is not None and spec_cfg.get("method") != "dspark":
    spec_cfg.pop("dspark_draft_topk")  # or raise in strict mode

Type guard

def is_dspark_topk_usage_valid(method: str, topk: int | None) -> bool:
    return topk is None or method == "dspark"

Prevention

When it happens

Trigger: speculative_config={'method': 'eagle', ..., 'dspark_draft_topk': 4} or a shared config template that sets dspark_draft_topk while switching method to something else.

Common situations: Reusing a DSpark-tuned config for a different speculative method; leaving the key behind after migrating methods in a YAML/JSON config that is copy-edited rather than regenerated.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/b276581e7a1e14f6. Report an issue: GitHub.