Repository navigation
Studio: stop blaming Max Tokens when a connected model fills its context window - #12567
Merged
danielhanchen merged 3 commits intoOct 3, 2026
Merged
danielhanchen merged 3 commits into
danielhanchen merged 3 commits into
Conversation
Member
Author
|
Reached Codex review convergence at oobabooga#330. |
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 3, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 3, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 3, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 3, 2026
Member
|
Review record for #12567, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#337. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
JoshuaL3000
pushed a commit
to JoshuaL3000/unsloth
that referenced
this pull request
Oct 4, 2026
…ext window (unslothai#12567) * Studio: stop blaming Max Tokens when a connected model fills its context window * Shorten the new length-stop messages to fit the two-line error box * Format the length-stop message test
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.
When a conversation with a connected model fills the model's context window, Studio tells the user to increase Max Tokens, which cannot help. If the reply already had answer text, Studio also auto-continues, and the server rejects the continuation because the window is still full. Reported on Reddit.
Fix
Studio cannot see a connected model's context window, so it now relies on what the server reports:
In those cases Studio suggests starting a new chat or shortening this one, and does not auto-continue. The explanation is kept after a reload.
Other providers' token counts are not used, because some leave out reasoning tokens or stop at their own lower output cap. When the cause is unclear, a thinking-only stop names both limits and everything else behaves as before. Local models and Google-hosted Gemini are unchanged.
Validation
Live A/B against main with Qwen3-1.7B on llama-server (4096-token window), added as a Custom connection:
Before (merge base) and after (this PR):
Thinking fills the window:
Answer fills the window:
The thinking case after a reload:
A server that reports no token count:
Mock servers checked the message that names both limits. The 137 affected tests, typecheck and build pass. The full suite has the same failures as main, apart from timing-dependent tests that pass when run alone.
Limitations
-n, is still reported as a full window.Maintainer verification
Before (merge base 11cc2ab) and after (this PR), each from its own
install.sh --localbuild, driving a real llama-server (Qwen3-1.7B Q4_K_M,-c 1024 -np 1) added as a Custom connection, Max Tokens 8192, reasoning on. Facts were read out of the page, not only from the screenshots.exceed_context_size_errorThinking fills the window:
The same thread after a reload:
Answer fills the window:
A real Max Tokens stop still names Max Tokens: