Repository navigation
fix: guard against runaway/looping generations - #11
Merged
Merged
Conversation
GLM-5.3-Flash can degrade into repetition loops in long tool-calling sessions (vllm#54337); with no max_tokens a looping request holds a --max-num-seqs slot until the 1M context. - --chat-template-content-format=string so content:null tool-call turns do not render a literal "None" into the template. - max_new_tokens=131072 as the fallback max_tokens for requests that omit one; explicit values still win. - patches/0003 arms vLLM's built-in repetition detector for requests that do not set repetition_detection (>=4-token pattern x16, up to 64 tokens); env TINFOIL_REPETITION_DETECTION overrides, "0" disables.
jdrean
force-pushed
the
fix/runaway-generation-guards
branch
from
September 17, 2026 15:33
a7fa9e6 to
a98d3d7
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.
GLM-5.3-Flash can degrade into repetition loops in long tool-calling sessions (vllm#54337, HF discussion #23). With no
max_tokens, a looping request generates until the 1M context and holds a--max-num-seqsslot the whole time. The upstream fix (vllm#54368) is unmerged and not in the pinned base.Three independent guards:
--chat-template-content-format=string— stopscontent: null+tool_callsassistant turns from rendering a literalNoneinto the GLM template, the trigger identified upstream. Present in the GLM-5 recipe; missing from the 5.3-Flash one.max_new_tokens: 131072in--override-generation-config— vLLM's fallbackmax_tokensfor requests that omit one; explicit client values still win (get_max_tokens()inentrypoints/serve/utils/api_utils.py). Matches OpenAI's GPT-5.x output limit.patches/0003— arms vLLM's built-in repetition detector (SamplingParams.repetition_detection→finish_reason=repetition) for requests that don't set one. Explicit values, including all zeros, are preserved as the opt-out. Default: a ≥4-token pattern repeated 16× back-to-back, patterns up to 64 tokens — catches any loop within ≤1024 tokens while letting wide markdown tables, repeated code lines and rulers through. Tunable at runtime via container envTINFOIL_REPETITION_DETECTION="max,min,count"("0"disables), so no rebuild is needed to adjust.Verification: patch applies to pristine
vllm/sampling_params.pyatmain@385dce36withpatch -p1 --fuzz=0and compiles; thresholds exercised against upstream'scheck_sequence_repetition; config parses.Not included: a nightly bump (patches
0001/0002need rebasing on currentmain) and anytool_choice: "required"handling (vllm#50399).