Skip to content

feat(tokenizer): serve every effort gear of a template that rejects unknown names - #960

Merged
jason-fxz merged 2 commits into
mainfrom
feat/effort-gears-of-a-validating-template
Nov 27, 2026
Merged

jason-fxz merged 2 commits into
mainfrom
feat/effort-gears-of-a-validating-template

Conversation

@jason-fxz

@jason-fxz jason-fxz commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

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, and effective_efforts capped it to low / 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:

client effort template level before after
none 0.0 0.9 (none is 0.2 from low, past the 0.15 limit, so it is dropped and the template default applies) 0.0
minimal 0.1 0.2 (low) 0.1
xhigh 0.99 0.9 (high) 0.99
max 0.99 0.9 (max is reachable only by its own name, so it is dropped) 0.99

The template has no thinking switch either, so enable_thinking: false (also what Anthropic thinking: disabled becomes) 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 is validates, so its probed supported set 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 in TokenizeManager.render_prompt: a request with enable_thinking False and no effort, on a template without a thinking toggle that serves a none gear, renders with reasoning_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

SGLang vLLM llama.cpp before this PR
effort vocabulary fixed Inkling table fixed Inkling table probed from the template probed from the template probed from the template
all 7 names honored yes yes yes no (3) yes
reasoning_effort: "none" 0.0 0.0 0.0 0.9 0.0
OpenAI enable_thinking: false, no effort 0.9 0.9 0.9 0.9 0.0
Anthropic thinking: disabled 0.0 0.0 0.9 0.9 0.0
  • SGLang and vLLM serve Inkling through a dedicated renderer with a fixed effort table, and neither reads enable_thinking for it. SGLang maps Anthropic thinking: disabled to "none" by reasoning parser name; vLLM does it for any template by rendering "none" and checking that it differs from the thinking gears.
  • llama.cpp renders the checkpoint template and probes it with a made-up level too (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 drops thinking: disabled.

Tests

  • New in tests/tokenizer/test_effort.py: an Inkling-shaped template (7 names -> levels, floats pass, other strings raise) is validates and every known name quantizes to itself; thinking-off renders the none gear on it, and is left unchanged on the same template with a thinking toggle added; TokenizeManager.render_prompt renders thinking-off as the none gear, also with an explicit reasoning_effort: null.
  • pytest tests/tokenizer tests/server: 760 passed, 24 skipped.

…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
@jason-fxz
jason-fxz merged commit 8a5b38a into main Nov 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant