Repository navigation
Conversation
A request with max_output_tokens=N got N+1 tokens from Whisper, Orpheus, Qwen3.5, Higgs Audio and Qwen3-Omni's thinker. Prefill samples the first token, then the decode loop ran N more: check_stop reads the zero-based loop index from before this iteration is counted, so `index + 1 >= N` stops on the Nth decode iteration, and get_loop_caps capped decode at N. Count the prefill token and this iteration's (`index + 2`) and cap decode at max(1, N - 1), as Command A+, BAGEL and Cosmos3 already do. N=1 still returns two tokens: a loop runs at least once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Is this different than #604? |
Collaborator
Author
|
Lol you're right |
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.
A request with
max_output_tokens=Ngets N+1 tokens from Whisper, Orpheus, Qwen3.5, Higgs Audio and Qwen3-Omni. For example,max_output_tokens=3returns 4 tokens.Prefill samples the first token, then the decode loop ran N more.
check_stopreads the decode loop's index before the current step is counted. The index starts at 0, soindex + 1 >= Nstops on the Nth decode step.get_loop_capsalso capped decode at N.This counts the prefill token too (
index + 2) and caps decode atmax(1, N - 1), which is what Command A+, BAGEL and Cosmos3 already do.max_output_tokens=1still returns two tokens, because a loop runs at least once.Changed: Whisper, Orpheus, Qwen3.5 (both stop paths), Higgs Audio and Qwen3-Omni's thinker. Qwen3-Omni's talker keeps its own codec budget.
How it was tested
test/modular/test_model_kv_layouts.py: each model's loop-cap test now also checks that prefill's token plus decode's add up tomax_output_tokens. These fail on main and pass with this change.🤖 Generated with Claude Code