Skip to content

docs: add DeepSeek-V4.1 DSpark cookbook recipes - #364

Open
Joey-gvwal wants to merge 2 commits into
MooreThreads:v0.32.0-devfrom
Joey-gvwal:docs/dsv41-cookbook-dspark-adaptive
Open

Joey-gvwal wants to merge 2 commits into
MooreThreads:v0.32.0-devfrom
Joey-gvwal:docs/dsv41-cookbook-dspark-adaptive

Conversation

@Joey-gvwal

Copy link
Copy Markdown
Collaborator

Summary

  • Add DeepSeek-V4.1-Flash-1017 FP8 and W4AFP8 cookbook recipes.
  • Document DSpark Fixed-4 and Adaptive-5 launch commands, including adaptive verification.
  • Record FP8 adaptive-scheduling performance from Documents/develop/workspace-bak.

Performance

Compared with Fixed-4:

Concurrency Output throughput Mean TPOT
C1 115.94 → 110.85 tok/s (-4.39%) 8.09 → 8.49 ms (+4.87%)
C4 136.27 → 165.15 tok/s (+21.19%) 27.43 → 22.39 ms (-18.37%)
C8 163.75 → 216.46 tok/s (+32.19%) 44.10 → 32.09 ms (-27.24%)
C16 270.36 → 293.51 tok/s (+8.56%) 52.15 → 47.12 ms (-9.64%)

Adaptive scheduling benefits multi-concurrency workloads. It is not recommended
for single-request C1 workloads, where throughput decreases by 4.39% and mean
TPOT increases by 4.87%.

@yeahdongcn yeahdongcn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge verdict: no blocking findings — ready to merge.
Verified 5adb13bad760: every flag the two new pages add exists in the pinned vLLM (VLLM_COMMIT=5df63a7, v0.32.0), and the cookbook site build passed at this head.

Findings: 0 blocking · 3 nit

nit location problem fix
nit docs/cookbook/deepseek/deepseek-v4.1-flash-1017-w4afp8.md:92 8195 matches no block or DSpark-step multiple; looks like a typo use 8192 in both blocks and the table row
nit docs/cookbook/deepseek/deepseek-v4.1-flash-1017-fp8.md:39 checkpoint path names no registry artifact or revision add the ModelScope id + revision, as the 0731 page does
nit docs/cookbook/deepseek/deepseek-v4.1-flash-1017-w4afp8.md:33 omits the Model runner row and V2 env its FP8 sibling sets state the runner this profile actually uses
What changed · what I could not verify

Two new DeepSeek-V4.1 cookbook pages plus two rows in docs/cookbook/README.md; no code, pins, or Dockerfile changes. docs/cookbook/deepseek/ has no README of its own, so the top-level index is the link surface — the PR updates it.

Verified at this head (gh api ...?ref=5adb13bad760 for repo files; upstream repos/vllm-project/vllm/contents/...?ref=5df63a7203cdb9328d824a27b682e77c7b9928be for the pinned vLLM):

  • "method":"dspark" and enable_adaptive_verification exist in the pin: vllm/config/speculative.py:69 (DSparkModelTypes = Literal["dspark"]) and :551 (enable_adaptive_verification: bool = False, "Currently only supported for method="dspark""). draft_sample_method is also there.
  • --tokenizer-mode deepseek_v41 is a documented mode at vllm/config/model.py:181 ("will use the DeepSeek V4.1 prompt encoder"); the TokenizerMode Literal is narrower (:89), but the field is TokenizerMode | str and the code sets the same value itself at :751. --reasoning-parser deepseek_v41 is registered at vllm/reasoning/__init__.py:35.
  • VLLM_USE_V2_MODEL_RUNNER exists (vllm/envs.py:2151); max_cudagraph_capture_size, cudagraph_capture_sizes, cudagraph_copy_inputs exist (vllm/config/compilation.py); FLASHMLA exists (vllm/v1/attention/backends/registry.py:95).
  • --enable-expert-parallel and the TP8+EP8 claim in the index row agree with the W4AFP8 page's --tensor-parallel-size 8 + --enable-expert-parallel.
  • CI: Cookbook site run 45173468064, head 5adb13bad760 — build pass (step "Build the site"), deploy skipped. No failing or cancelled check.
  • Earlier rounds: reviews is [] and pulls/364/comments is [], so there is nothing to re-check; this is the first round.

Gate: 9/9 hooks passed @ 5adb13b

Not verified, by absence of hardware or scope: the recorded response 5, and the throughput/TPOT table in the PR description (no perf section appears in the pages, and nothing in the diff reproduces those numbers).

One unconfirmed observation: cudagraph_capture_sizes stops at 64, and gpu_model_runner.py consumes those as token counts (self.cudagraph_batch_sizes = sorted(self.compilation_config.cudagraph_capture_sizes)). At --max-num-seqs 16 with Adaptive-5, a full decode batch is 16 × 6 = 96 tokens, above the largest graph. A run with --max-num-seqs 16 and the eager-fallback counter would confirm whether the C16 numbers in the PR description were captured or eager.

auto-review round 1/3 · verdict: clean

@Joey-gvwal
Joey-gvwal force-pushed the docs/dsv41-cookbook-dspark-adaptive branch from 5adb13b to f4c9a59 Compare November 23, 2026 12:30

@yeahdongcn yeahdongcn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge verdict: 1 blocking finding — not ready to merge.
Reviewed f4c9a593fc63: the FP8 page's conversion step leaves FP4 experts for a launch command that declares expert_dtype=fp8.

Findings: 1 blocking · 2 nit
Earlier: nit-1 unchanged (8195) · nit-2 partly fixed @f4c9a59 (ModelScope link added, no revision pin) · nit-3 unchanged (no Model runner row on the W4AFP8 page)

nit location problem fix
nit docs/cookbook/deepseek/deepseek-v4.1-flash-1017-w4afp8.md:74 graphs stop at 6 of 64 sequences; higher decode runs eager use multiples of num_speculative_tokens + 1, as the 0731 page does
nit docs/cookbook/deepseek/deepseek-v4.1-flash-1017-fp8.md:42 no ## Validation table; every sibling deepseek page has one add checkpoint @ revision, versions, served request
What changed · what I could not verify

Two new cookbook pages plus two rows in docs/cookbook/README.md; no code, pins, or workflow changes. Against the previously reviewed head 5adb13bad760 the only change is a new ## Model source section in each page (f4c9a593 is an amended single commit; compare/A...B reports both files as added because the merge base is v0.32.0-dev).

Verified at this head:

  • Pin unchanged: third_party/PINS has VLLM_TAG=v0.32.0, VLLM_COMMIT=5df63a7203cdb9328d824a27b682e77c7b9928be.
  • DSpark fields exist at that pin: vllm/config/speculative.py:69 DSparkModelTypes = Literal["dspark"], :551 enable_adaptive_verification: bool = False, :600 draft_sample_method; vllm/envs.py:311/2151 VLLM_USE_V2_MODEL_RUNNER.
  • Both registry links resolve: GET modelscope.cn/api/v1/models/MooreThreads/DeepSeek-V4.1-Flash-1017-W4AFP8-mt → {"Code":200,...,"Architectures":["DeepseekV41ForCausalLM"]}; same for deepseek-ai/DeepSeek-V4.1-Flash-1017. Its inference/ tree contains convert.py and README.md.
  • w4afp8 is a registered quant method here: vllm_musa/model_executor/layers/quantization/w4afp8.py:31 returns "w4afp8".
  • --limit-mm-per-prompt '{"image":0}' fits the checkpoints: both config.json files carry image_token_id, so the model is image-capable and the flag disables images.
  • Layout: one H1 per page, no heading jumps, ../README.md resolves, and the two index rows agree with the pages (TP8 + EP8, DSpark Adaptive-5 / Fixed-4).
  • CI for head f4c9a593: build pass 16s, deploy skipping (run 45174990398). No failing or cancelled check.

Blocking evidence (FP8 conversion): the cited inference/convert.py declares parser.add_argument("--expert-dtype", type=str, choices=["fp8","fp4"], default=None) (:197) and only calls cast_e2m1fn_to_e4m3fn when expert_dtype == "fp8" (:175-181); otherwise experts are kept as torch.float4_e2m1fn_x2. Upstream's own inference/README.md example passes --expert-dtype fp4. The page then passes --hf-overrides '{"expert_dtype":"fp8"}', and the pinned model reads that key to pick the weight mapper: expert_dtype = getattr(config, "expert_dtype", "fp4") / _make_deepseek_v4_weights_mapper(expert_dtype, ...) (vllm/models/deepseek_v41/nvidia/model.py:1564-1567), with a different scale-param name for fp4 (:1444-1446).

Nit mechanism (capture sizes): with DSpark on, one decode step is num_seqs x (1 + num_speculative_tokens) tokens. CompilationConfig.adjust_cudagraph_sizes_for_spec_decode rounds each size up to a multiple of 6 and drops any that exceed max_cudagraph_capture_size (vllm/config/compilation.py:1530-1558), so [1,2,4,8,16,32,64] becomes [6,12,18,36]; CudagraphDispatcher.dispatch then returns CUDAGraphMode.NONE for any batch above 36 tokens (vllm/v1/cudagraph_dispatcher.py:270-279). The 0731 page avoids this with multiples of 5 up to 320.

Not verified, by absence of hardware: the recorded response 5, the PR body's throughput/TPOT table, and the exact load-time exception for the dtype mismatch above; the mismatch itself is read from the pinned code and the cited script, not from a run.

Gate: 9/9 hooks passed @ f4c9a59

auto-review round 1/3 · verdict: blockers

Co-authored-by: R0CKSTAR <xiaodong.ye@mthreads.com>
@Joey-gvwal

Copy link
Copy Markdown
Collaborator Author

Waiting for the FP8 model weights to be uploaded to MT public URL.

@yeahdongcn yeahdongcn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge verdict: 1 blocking finding — not ready to merge.
Reviewed 79804db5c985: the rewritten conversion step still cannot produce a directory vllm serve loads.

Findings: 1 blocking · 0 nit
Earlier: P1-1 fixed @79804db5 · nit-1 unchanged (8195) · nit-2 changed (base model named, still no revision) · nit-3 unchanged (no Model runner row) · nit-4 unchanged (captures stop at 6 of 64) · nit-5 unchanged (no ## Validation)

Delta, evidence, what I could not verify

Delta f4c9a593...79804db5 is one hunk: the FP8 page's ## Model source paragraph (lines 18-21). The W4AFP8 page and both index rows are untouched, and no flag, pin or Dockerfile moved, so the earlier flag verification still stands.

P1 evidence, read from source (nothing run): inference/convert.py:194-197 declares --hf-ckpt-path, --save-path, --model-parallel with required=True; after writing model{i}-mp{mp}.safetensors it copies only tokenizer.json and tokenizer_config.json (:185-190). The base repo (59 files) keeps config.json and chat_template.jinja at its root, and its tokenizer_config.json has no chat_template key (grep -c chat_template → 0). The pinned vLLM fails config resolution without one: vllm/transformers_utils/config.py:839 — "Could not detect config format for no config file found. With config_format 'auto', ensure your model has either config.json (HF format) or params.json (Mistral format)." So the mount path in Prerequisites has no config to serve, and --hf-overrides has no base config to override.

CI: build pass 9s, deploy skipping — "Cookbook site" run 45179613373, head 79804db5c985, conclusion success. No failing or cancelled check reported.

Unchanged checks at this head: third_party/PINS (VLLM_TAG=v0.32.0, VLLM_COMMIT=5df63a72); --async-scheduling (vllm/engine/arg_utils.py:1774) and --limit-mm-per-prompt (:1463) exist at the pin; docs/cookbook/deepseek/ has no README, so the updated top-level index is the only link surface and ../README.md resolves; one H1 per page, no heading jumps.

Not verified: no hardware here, so the recorded response 5 and the PR body's throughput/TPOT table remain unconfirmed.

Gate: 9/9 hooks passed @ 79804db

auto-review round 2/3 · verdict: blockers

Comment on lines +18 to +21
The MoE FP8 weights are not published; build them from the
[DeepSeek-V4.1-Flash-1017 ModelScope model](https://modelscope.cn/models/deepseek-ai/DeepSeek-V4.1-Flash-1017)
with `inference/convert.py --expert-dtype fp8`. Any other `--expert-dtype`
leaves FP4 experts that the commands below load under FP8 weight names.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — Give the full convert.py command and copy config.json

convert.py --expert-dtype fp8 alone fails: --hf-ckpt-path, --save-path and --model-parallel are required=True, and the save path receives only tokenizer.json and tokenizer_config.json. The pinned get_config then raises "Could not detect config format for no config file found" on that directory, so the commands below never start. Fix: show the required flags and copy the base checkpoint's config.json and chat_template.jinja into the save path.

Suggested change
The MoE FP8 weights are not published; build them from the
[DeepSeek-V4.1-Flash-1017 ModelScope model](https://modelscope.cn/models/deepseek-ai/DeepSeek-V4.1-Flash-1017)
with `inference/convert.py --expert-dtype fp8`. Any other `--expert-dtype`
leaves FP4 experts that the commands below load under FP8 weight names.
The MoE FP8 weights are not published; build them from the
[DeepSeek-V4.1-Flash-1017 ModelScope model](https://modelscope.cn/models/deepseek-ai/DeepSeek-V4.1-Flash-1017)
with `inference/convert.py --hf-ckpt-path <base> --save-path
/models/DeepSeek-V4.1-Flash-1017-FP8 --model-parallel 8 --expert-dtype fp8`,
then copy that model's `config.json` and `chat_template.jinja` into the save
path. Any other `--expert-dtype` leaves FP4 experts that the commands below
load under FP8 weight names.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the description here once the FP8 model is uploaded.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants