Skip to content

[Bug]: DeepSeek-V4-Flash-DSpark fails on H200/SM90 with FlashMLA KV cache shape mismatch #47648

Description

@yy-fighting

Your current environment

  • vLLM version: 0.23.1rc1.dev788+gfa4321de3
  • torch: 2.11.0+cu129
  • GPU: NVIDIA H200 (SM90), 8× GPU
  • Model: deepseek-ai/DeepSeek-V4-Flash-DSpark (local path /data/models/DeepSeek-V4-Flash-DSpark)
  • Command used:
vllm serve /data/models/DeepSeek-V4-Flash-DSpark \
  --trust-remote-code \
  --tensor-parallel-size 8 \
  --kv-cache-dtype fp8 \
  --block-size 256 \
  --max-model-len auto \
  --max-num-seqs 256 \
  --tokenizer-mode deepseek_v4 \
  --reasoning-parser deepseek_v4 \
  --spec-method dspark \
  --spec-model /data/models/DeepSeek-V4-Flash-DSpark \
  --spec-tokens 5 \
  --port 30004

🐛 Describe the bug

Serving DeepSeek-V4-Flash-DSpark without speculative decoding works. Enabling DSpark speculative decoding (--spec-method dspark) causes engine initialization to fail during KV-cache warmup of the draft model.

The model weights load successfully, including the DSpark draft weights:

(Worker_TP0 pid=...) INFO ... [dspark.py:455] DSpark draft model loaded: 96 params

Then the worker crashes in DeepseekV4FlashMLAAttention._forward_decode -> flash_mla_with_kvcache with:

RuntimeError: kv must have shape (num_blocks, page_block_size, h_kv, bytes_per_token)

Full traceback:

(Worker_TP0 pid=4109550) ERROR ... [multiproc_executor.py:1004]     self.forward_mqa(q, kv, positions, out)
(Worker_TP0 pid=4109550) ERROR ... [multiproc_executor.py:1004]   File ".../vllm/models/deepseek_v4/nvidia/flashmla.py", line 219, in _forward_decode
(Worker_TP0 pid=4109550) ERROR ... [multiproc_executor.py:1004]     out, _ = flash_mla_with_kvcache(
...
RuntimeError: kv must have shape (num_blocks, page_block_size, h_kv, bytes_per_token)

What I tried

  1. --kv-cache-dtype fp8 (default/expected): fails with the shape error above.
  2. --kv-cache-dtype bfloat16: fails earlier with AssertionError: DeepseekV4 fp8_ds_mla layout only supports fp8 kv-cache, got bfloat16.
  3. --attention-backend FLASHINFER_MLA_SPARSE_DSV4 for both target and draft: fails with Error in function 'TllmGenFmhaRunner' ... Unsupported architecture on H200/SM90.

So on H200/SM90 there appears to be no working attention backend for DeepSeek-V4-Flash-DSpark with DSpark.

Related issues/PRs

Expected behavior

DeepSeek-V4-Flash-DSpark should start successfully with --spec-method dspark on H200/SM90, or at least have a documented working attention-backend combination.

Additional context

The draft config contains:

{
  "dspark_block_size": 5,
  "dspark_target_layer_ids": [40, 41, 42],
  "compress_ratios": [..., 4, 128, 4, 0, 0, 0]
}

The DSpark draft layers are created at indices num_hidden_layers + i (43, 44, 45) in DSparkDeepseekV4Model, while _remap_dspark_name maps checkpoint mtp.{i}.* to model.layers.{i}.* (0, 1, 2). This looks like a potential weight-loading mismatch in addition to the KV-cache shape issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions