Repository navigation
[Perf] gemma4: Capture single-step frozen-KV drafts - #45771
Merged
Merged
Conversation
alexnails
requested review from
Qiaolin-Yu,
hnyls2002,
kpham-sgl and
pyc96
as code owners
October 22, 2026 07:52
alexnails
force-pushed
the
alexnails/gemma4-mtp-single-step-capture-main
branch
from
October 22, 2026 08:33
cd8e475 to
9ee3115
Compare
Collaborator
Author
|
/rerun-failed-ci |
Collaborator
Author
|
/rerun-test test/registered/spec/test_frozen_kv_mtp.py test/registered/core/test_basic_sanity_dspark.py |
Contributor
|
🚀 |
Collaborator
Author
|
test_frozen_kv_mtp.py passed and the other reproduced as an issue I didn't cause, merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
FrozenKVMTPDraftWorker._capture_cuda_graphsreturns early whenspeculative_num_steps <= 1, so a one-step frozen-KV draft never gets a draft graph. That guard is off by one: a one-step draft still runs the assistant seed forward every decode step, and that forward is exactly what the capture covers. With the guard as written, it always runs eagerly.How it was found
While profiling Gemma 4 E2B frozen-KV MTP with one draft step and two verification tokens, the assistant seed forward showed up as eager work on every decode step, even with full decode graphs enabled.
/server_infoconfirmed it:startup_time.cuda_graph.draft_decodewas0, while the same server with three draft steps reported a nonzero capture time. The cause turned out to be the<= 1early return.Modifications
Change the early-return guard from
<= 1to<= 0, so one-step drafts are captured. The zero-step and graphs-disabled cases are still excluded. Nothing else changes; multi-step drafts take the same path as before.Accuracy Tests
google/gemma-4-E2B-it+google/gemma-4-E2B-it-assistant, one H200, the cookbook E2B MTP command with--speculative-num-steps 1 --speculative-num-draft-tokens 2(the case this PR changes).sgl-eval==0.1.3, 200 examples, greedy (temperature=0,max_tokens=2048,enable_thinking=false): 79.5% on main and 79.5% on this PR, zero errors.Speed Tests and Profiling
Same H200 and launch as above.
bench_servingrandom dataset, 256 input / 256 output tokens fixed, one discarded warmup pass per concurrency, runs ordered main → PR → PR → main.draft_decodecapture timeChecklist
draft_decode> 0), not before.🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #39748596192⚠️ Not enabled -- add
Latest PR Test (Extra):
run-ci-extralabel to opt in.Latest PR Test (AMD ROCm 10): ❌ Run #39748595946