refactor(spec-decode): simplify Qwen3.5 NextN attention path for #217 (2/3)#429
Open
rjzhb wants to merge 28 commits into
Open
refactor(spec-decode): simplify Qwen3.5 NextN attention path for #217 (2/3)#429rjzhb wants to merge 28 commits into
rjzhb wants to merge 28 commits into
Conversation
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
…tion-hooks # Conflicts: # python/tokenspeed/runtime/execution/drafter/eagle.py # python/tokenspeed/runtime/models/llama_eagle3.py
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
This reverts commit 404279b.
Signed-off-by: rjzhb <rjzhb222@163.com>
LorrinWWW
reviewed
Jun 12, 2026
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d52f2f7bc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
…kv_cache Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
Signed-off-by: rjzhb <rjzhb222@163.com>
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.
Summary
This is the second PR in the series refactoring the spec-decode attention path from #217. It applies the same base-hook pattern introduced in #390 (1/3) for Llama Eagle3, now to Qwen3.5 NextN.
Qwen3_5DraftForCausalLM/Qwen3_5DraftAttentionDecoderLayercollapse the bespoke draft forward path into a two-method subclass of the baseQwen3_5AttentionDecoderLayer:_attnoverrides the draft first-step dispatch path: correction + q-slice +DECODE.super()._attn.The correction logic,
spec_num_tokens - accept_lengthstrimming ofdraft_seq_lens_buf, now lives in a single_apply_correctionmethod next to its only consumer, and is plumbed throughForwardContext, mirroring #390 (1/3)._maybe_narrow_residualhandles the NextN residual narrowing.This is restricted to single-layer drafts for now, asserted in
__init__._apply_correctionmutates per-layer state, so multi-layer NextN support needs the trim to be hoisted before this restriction can be relaxed.