Enable index_share_for_mtp_iteration in native MTP EagleProposer.#1682
Enable index_share_for_mtp_iteration in native MTP EagleProposer.#1682fanxingran wants to merge 1 commit into
Conversation
Wire GLM-5.2 draft index_share_for_mtp_iteration like vLLM: step 0 runs the MTP indexer, steps 1+ reuse sparse_kv_indices_buffer via skip_topk and compact_topk_indices. Gated on method=mtp, DSA index_topk, and the config flag so other draft backends are unchanged. Signed-off-by: fanxingran <xingran.fan@amd.com>
|
Hi @whx-sjtu @zejunchen-zejun @ZLkanyo009 — mind taking a look at #1682 when you get a chance? Quick version: GLM-5.2 has Checks: Fair A/B on the same box (valid pre-PR baseline): 1024/8192/10240 end-to-end is roughly flat (~0–3%), accept looks fine. Main win here is parity with vLLM + config, not a big bench bump. (I’ve dropped the old 10240 +70% numbers — bad baseline.) Details + tables are in the PR description. Happy to rerun with recipe/CI settings if you want. Thanks! |
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
|
@junhaha666 @zejunchen-zejun — friendly ping on #1682 🙏 Same story as above, shorter: MTP draft indexer sharing to match vLLM when the flag is on. Unit tests pass, smoke log OK. I also refreshed the benchmark write-up — fair pre/post on one machine; ~0–3% at 1024/8192/10240, no accept regression. Please ignore my earlier ping about +70% @ 10240; PR body is updated. Let me know if anything’s unclear or you want a different bench setup. Thanks! |
Wire GLM-5.2 draft index_share_for_mtp_iteration like vLLM: step 0 runs the MTP indexer, steps 1+ reuse sparse_kv_indices_buffer via skip_topk and compact_topk_indices. Gated on method=mtp, DSA index_topk, and the config flag so other draft backends are unchanged.
Motivation
GLM-5.2-MXFP4 sets
index_share_for_mtp_iteration: trueinconfig.json. Within one MTP draft iteration, step 0 should run the DSA indexer once; steps 1+ should reuse the same top-k indices fromsparse_kv_indices_bufferinstead of re-scoring the full KV cache.vLLM already implements this in the MTP proposer. ATOM native
openai_serverdid not, so each of the 3 draft steps ran a full indexer pass. This PR aligns ATOM draft behavior with vLLM and the model config (correctness / parity), not only a micro-optimization.Scope: draft propose only. Target verify is unchanged (long-ISL gap vs vLLM is mostly verify + acceptance; separate follow-up).
Goals:
index_share_for_mtp_iterationfor GLM-5.2 MTP (n=3)Technical Details
Changed files
atom/models/deepseek_mtp.pyset_skip_topk/compact_topk_indicesonDeepSeekMultiTokenPredictor; delegate fromDeepSeekMTPatom/spec_decode/eagle.pyEagleProposer.propose()tests/test_mtp_index_share.pydeepseek_mtp.pyDeepSeekMultiTokenPredictor.set_skip_topk(skip)— setsself_attn.skip_topkon MTP layers with an indexerDeepSeekMultiTokenPredictor.compact_topk_indices(slot_ids)— copies top-k rows fromlast_token_indicesinto the front ofsparse_kv_indices_bufferDeepSeekMTPdelegates both methodseagle.pyIn
__init__, detect_share_mtp_indicesand log when enabled.In
propose()loop:set_skip_topk(False)set_skip_topk(True)+compact_topk_indices(last_token_indices)skip_topk=TrueEnable gates (all required)
speculative_config.method == "mtp"draft_hf_config.index_share_for_mtp_iteration == Trueindex_topkin config)DeepSeekMultiTokenPredictor.set_skip_topkexistsEagle3, Qwen MTP, DSpark, and models without the flag are unaffected.
Test Plan
Unit tests
Expected: 8 passed.
Server smoke test
Start the GLM-5.2 MXFP4 MTP server per
recipes/GLM-5.md(MI355 FP4 MTP). Confirm log line (per TP rank):MTP draft index_share_for_mtp_iteration enabled: step 0 computes indexer top-k, steps 1+ reuse the buffer.Benchmark (fair A/B methodology)
Use
atom.benchmarks.benchmark_servingwith fixed lengths (random-range-ratio=1.0), 160 prompts, closed-loop (request-rate=inf),--ignore-eos, OSL=1024, CONC=16 — same as internal GLM-5.2 MTP quick bench.Important: Compare pre-PR vs post-PR on the same machine/session, with a clean MTP server and a valid pre-PR baseline (main without this patch). An earlier internal run used a contaminated 10240 baseline (~633 out tok/s); that number is invalid and must not be used to evaluate this PR.
Suggested points: ISL=1024, 8192, 10240.
Acceptance:
accept_length/acceptance_ratewithin ~1pp of baseline.Test Result
0.1.6rc1.dev161+g00266a01f(editable install with this PR)MTP draft index_share_for_mtp_iteration enabled(×4 TP ranks)Unit tests: 8/8 passed
Fair A/B (same container, 2026-07-24)
Pre-PR = main without this patch (
083220/083420/083658). Post-PR = same session after patch + server restart (090112/090310/090546).Interpretation
1521 out tok/s), gap remains (+42%); this PR does not claim to close that gap.Retracted claim: Pre-PR 10240 633 out tok/s / 23 ms TPOT and post-PR +70% were driven by a wrong baseline (stale server / environment), not by this patch alone. Do not use those numbers in review.
Internal artifacts (optional for reviewers):
glm5.2/mxfp4/p0_draft_index_share/bench_dev161/+P0_压测结果_dev161.mdon our fork bench branch.Submission Checklist
Suggested follow-up comment (paste on the PR thread)
Submission Checklist