[Bugfix][Kimi K3] Split DSpark draft out of the target MLA KV group - #56952
Closed
lucifer1004 wants to merge 1 commit into
Closed
lucifer1004 wants to merge 1 commit into
lucifer1004 wants to merge 1 commit into
Conversation
The K3-native DSpark draft marks its MLA layers non_causal_multi_token_decode=True. MLAAttentionSpec.merge ORs that flag, so when the draft's spec merges with the target's identically-shaped MLA spec, the causal target group inherits it too. That raises the group's TritonMLA reorder threshold and misroutes the target's short prefills and causal verification blocks into a decode path that expects one query row per request, producing corrupted output (and illegal memory accesses during CUDA graph capture) on Kimi-K3 DSpark. Tag the draft's spec with model_version="kimi_k3_dspark" so the group splitter keeps it apart from the target. Co-authored-by: Kimi Code <noreply@moonshot.cn> Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
lucifer1004
requested review from
AndreasKaratzas,
DarkLight1337 and
ywang96
as code owners
September 15, 2026 04:58
This was referenced Sep 15, 2026
GirasoleY
reviewed
Sep 15, 2026
Comment on lines
+439
to
+441
| model_version="kimi_k3_dspark" | ||
| if self.non_causal_multi_token_decode | ||
| else None, |
Contributor
There was a problem hiding this comment.
I feel we may still want to allocate the kv cache as one group, but fix trtion mla behavior.
A quick search in community it feels #51065 is closer to a proper fix. Could you check if this PR fix your use case?
5 tasks
Contributor
Author
|
@GirasoleY Confirmed — I tested #51065 against this exact use case (Kimi-K3 + K3-native DSpark, TP8, SM120, TritonMLA path, no KV-group split): CUDA graph capture is clean (the IMA is gone), generations are coherent (the corruption is gone), and speculative decoding is actively accepting drafts. Agreed the backend fix is the proper root-cause fix; closing this PR in favor of #51065. Details posted in #51065 (comment) |
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.
What
The K3-native DSpark draft marks its MLA layers
non_causal_multi_token_decode=True.MLAAttentionSpec.mergeORs that flag, so when the draft's spec merges with the target's identically-shaped MLA spec, the causal target group inherits it too. That raises the group's TritonMLA reorder threshold and misroutes the target's short prefills and causal verification blocks into a decode path that expects one query row per request — producing corrupted output and illegal memory accesses during CUDA graph capture on Kimi-K3 DSpark.Tag the draft's spec with
model_version="kimi_k3_dspark"so the KV-cache group splitter keeps it apart from the target (mergerequires a uniformmodel_version).Not a duplicate
Tests
tests/models/kimi_k3/test_dspark_kv_group.py(3 tests): the draft spec carries the model version, the target spec does not, andMLAAttentionSpec.mergerefuses to combine them.python -m pytest tests/models/kimi_k3/test_dspark_kv_group.py -q→ 3 passed.Model evaluation
Verified end-to-end as part of #53577: Kimi-K3 DSpark native-draft TP8 and PP2×TP4 serving previously produced corrupted output / capture IMA without this split and are clean with it.
AI assistance was used in preparing this PR.