Repository navigation
feat(tokenizer): serve every effort gear of a template that rejects unknown names - #960
Merged
Merged
Conversation
…is null - an explicit reasoning_effort null counts as no effort, as the template reads it - test the render_prompt path with a toggle-less template - describe the made-up-name case in the EffortProfile validates docstring
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.
The effort probe treated a template as validating its vocabulary (
validates) only after one of the 7 known names (none..max) was rejected. A template that accepts all 7 and rejects any other string therefore looked like one that writes any string into the prompt, andeffective_effortscapped it tolow/medium/high. Inkling 2 (#957) has such a template: it maps every known name to a level and raises on any other string. Its requests were rendered as:nonenoneis 0.2 fromlow, past the 0.15 limit, so it is dropped and the template default applies)minimallow)xhighhigh)maxmaxis reachable only by its own name, so it is dropped)The template has no thinking switch either, so
enable_thinking: false(also what Anthropicthinking: disabledbecomes) rendered the default 0.9: a thinking-off request reasoned at high effort.Changes
probe_effort_profile: each probe round also renders a made-up name (__freetoken_unknown_effort__). A template that reads the effort and rejects that name isvalidates, so its probedsupportedset is served as is and every name in it passes through. A template that accepts the made-up name is handled as before.thinking_off_kwargs, applied inTokenizeManager.render_prompt: a request withenable_thinkingFalse and no effort, on a template without a thinking toggle that serves anonegear, renders withreasoning_effort: "none". Templates with a toggle, and requests that name an effort, are unchanged.Inkling 2 lands in #957; on main today no served model changes. Probed profile, served gears, quantization of the 7 names and the thinking-off render, main vs this PR, on 27 local checkpoints with a chat template (GLM-4.7, Gemma 4 26B / 31B / 12B, Inkling-2-Mini, Llama-3.2-1B, Mistral-7B v0.3, Muse-Glimmer-30B, Qwen2.5, Qwen3, Qwen3-VL, Qwen3.6, Qwen3.8, gpt-oss-20b, with their quantized variants): only Inkling-2-Mini changes. Not checked: DeepSeek-V4, GLM-5.3, MiniMax-M3 (no local checkpoint).
Other engines, Inkling 2
reasoning_effort: "none"enable_thinking: false, no effortthinking: disabledenable_thinkingfor it. SGLang maps Anthropicthinking: disabledto"none"by reasoning parser name; vLLM does it for any template by rendering"none"and checking that it differs from the thinking gears.REASONING_EFFORT_UNKNOWN): levels that render like it are not honored, rejected levels get a 400, others pass verbatim. On Inkling 2 this gives the same gears as this PR. Its Anthropic adapter dropsthinking: disabled.Tests
tests/tokenizer/test_effort.py: an Inkling-shaped template (7 names -> levels, floats pass, other strings raise) isvalidatesand every known name quantizes to itself; thinking-off renders thenonegear on it, and is left unchanged on the same template with a thinking toggle added;TokenizeManager.render_promptrenders thinking-off as thenonegear, also with an explicitreasoning_effort: null.pytest tests/tokenizer tests/server: 760 passed, 24 skipped.