server : add stuck-loop escape for ngram-mod (WIP) - #25819
Draft
yychyo wants to merge 1 commit into
Draft
Conversation
yychyo
force-pushed
the
ngram-mod-stuck-fix
branch
4 times, most recently
from
July 23, 2026 07:27
22d35b3 to
c01a427
Compare
yychyo
force-pushed
the
ngram-mod-stuck-fix
branch
5 times, most recently
from
August 3, 2026 20:23
e8e80ca to
22becd0
Compare
yychyo
force-pushed
the
ngram-mod-stuck-fix
branch
3 times, most recently
from
August 12, 2026 15:16
d7f3b60 to
14b56c9
Compare
|
This PR fixes reproducable (endless?) loops I get on Nemotron-3.5-Lightning-30B-A3B. EDIT: The PR title implies this is related to ngram-mod but even with only MTP I get loops that are fixed by the changes here. |
Mitigation for a freeze where ngram-mod enters an infinite verification loop. Does not fix the underlying state leak. ggml-org#23268
yychyo
force-pushed
the
ngram-mod-stuck-fix
branch
from
August 13, 2026 13:42
14b56c9 to
e96c2a4
Compare
|
Same for Qwen3.x models, using ngram-mod. Would be great to have a fix merged. |
1 task
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.
❗ This is WiP and a mitigation PR, not an actual fix.
Overview
When ngram-mod speculative decoding fails verification,
spec_draftis set to the accepted tokens (including the correction token) and the checkpoint is restored. On the next iteration the draft is reused instead of regenerated and sometimes fails again, creating a loop with non-deterministic end condition.This PRs adds logs to diagnose the problem, and a "band-aid" mitigation - it detects loop, and breaks out of it. However, the root cause of the loop is not yet clear.
Logs
Here are the logs that shows the issue:
Additional information
Requirements