Mang/eagle3 similarity - #38079
Draft
mangguo321 wants to merge 1 commit into
Draft
Conversation
mangguo321
force-pushed
the
mang/eagle3_similarity
branch
from
September 11, 2026 03:26
6c90204 to
545b8fd
Compare
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.
Details:
Previously, PaKVReorder changed the Key and Value cache tensors in place, but exposed only a dummy output tensor. In other words, the graph did not explicitly say that the updated K/V caches were results of the operation.
Because of this, the runtime could execute the reorder using temporary internal buffers. The reorder operation modified those buffers, but the updated data was not guaranteed to be written back to the external KV cache used by the next decoding step.
As a result, EAGLE3 could select the correct branch but then continue decoding with stale cache data. This caused token divergence, especially in the FP16 configuration where a small cache difference can more easily change the next selected token.
output 0: updated Key cache
output 1: updated Value cache
The CPU plugin marks each output as in-place with its corresponding input:
Key cache input <-> Key cache output
Value cache input <-> Value cache output
Therefore, no additional full-cache copy is needed.
We also changed the EAGLE3 helper graph and fusion pass so that Key and Value cache updates are separate model outputs. GenAI explicitly binds these outputs to the external KV cache tensors.
Now the runtime knows that the reordered K/V caches are real results that must be preserved for the next decoding step. After the fix, FP16 EAGLE3 produces the same token IDs as target-only decoding in the tested deterministic cases, and the full WWB similarity improved from 0.88574980 to 0.97614926.
Tickets:
AI Assistance: