Explore topK overflow/non-determinism - #53287
Draft
LopezCastroRoberto wants to merge 3 commits into
Draft
LopezCastroRoberto wants to merge 3 commits into
LopezCastroRoberto wants to merge 3 commits into
Conversation
Co-authored-by: Codex <codex@openai.com> Signed-off-by: LopezCastroRoberto <rocastro@redhat.com>
Co-authored-by: Codex <codex@openai.com> Signed-off-by: LopezCastroRoberto <rocastro@redhat.com>
Co-authored-by: Codex <codex@openai.com> Signed-off-by: LopezCastroRoberto <rocastro@redhat.com>
This was referenced Aug 31, 2026
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
This was referenced Sep 3, 2026
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.
Context: #51782, #52149
The evaluation shows no measurable accuracy regression in MAIN, meaning that either overflow is never hit in real use-cases/data-distributions, or that non-determinism in top-K doesn't affect model accuracy. Note that, even when overflow occurs (which is a rare event) the discarded candidates will have the same high bits as the retained ones. Retained and discarded candidates belong to the same current radix-threshold bin. Therefore, they share the radix prefix, meaning their values are close.
A double-check of this is that no performance regressions were observed in our e2e evals with the current PR, reinforcing the idea that overflow doesn't happen, or it is very rare. Even with this PR, where overflow situations were optimized, there is a non-trivial overhead vs non-overflow cases kernel-wise.
This PR pretends to be a go-to if this becomes a real issue in the future.