Repository navigation
Let a template's own thinking kwarg win over the value enableThinking sets - #1513
Merged
Merged
Conversation
Contributor
|
Chat app preview removed for |
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.
Summary
Part of #750 (the #1494 note that MiniMax-M3 and Hy3 map
enableThinkingto their own template settings).Several handlers turn
enableThinkinginto a template's own thinking switch:reasoningandskip_thinkingfor Cohere2 MoE (and Command R7B),reasoning_effortfor Hy3,thinking_modefor MiniMax M3 and the other direct-Jinja formats. They put that value in the render context, which overrideschatTemplateKwargs, so a caller's own setting was silently replaced:{'reasoning_effort': 'low'}rendered Hy3 athigh,{'reasoning_effort': 'none'}left Cohere2 MoE thinking, and{'thinking_mode': 'disabled'}left MiniMax M3 thinking. llama-server renders what the kwarg says.renderTemplatenow takesdefaultsthat kwargs override, and those handlers pass the derived settings there. Cohere2 MoE leavesreasoningundefined when the caller setsreasoning_effort, since its template readsreasoning_effortonly then. The mapping itself stays:enableThinking: falsestill turns thinking off on these templates, which llama-server'senable_thinkingdoes not (they never read it); that divergence is recorded on #750 as intentional.Production-readiness scope
enableThinking: falseand a kwarg that opens the thought (for example Hy3reasoning_effort: high), the kwarg reaches the template but llamadart still ends the thought the prompt leaves open, as documented onLlamaEngine.create.Completeness checklist
LlamaEngine.createdartdoc,llamadart-chat-streamingskill, changelog in both files.)PR type guidance
test/unit/core/template/thinking_template_kwargs_parity_test.dartrenders 10 cases (Cohere2 MoE, Hy3, MiniMax M3, Kimi K3 as a control) against full prompts from llama.cpp620d2225(test/fixtures/thinking_template_kwargs_upstream.json), including three that pinenableThinking: falseto upstream's render with the template's own off setting. Six fail onmain.Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyzedart test -p vm -j 1 --exclude-tags local-only(8971 passed, 123 skipped, at34b66c3a0)dart test -p chrome --exclude-tags local-only(3970 passed, 1 skipped)Matrix Evidence
static-format-analyzeroot-vmroot-chromestructured-output-adversarial620d2225; render matrix belowhigh-risk-exact-head-independent-qa../llamadart-evidence/pr-1513/audit/evidence-1513-5312835-accepted.jsonrelease-metadata-verificationlitert-lm-json-schemaRender matrix (#1494 audit harness, 94 templates, 15,792 renders, base
943d2acd5vs head; its only kwarg isreasoning_effort: high): 51 renders change, prompt only, allenableThinking: falsewith that kwarg: Hy3 (30) now rendersreasoning_effort:highin its system block, and Cohere2 MoE (21) opens the thought from the kwarg and llamadart ends it (<|END_THINKING|>\n). Every other render, and everyenableThinking: truerender, is unchanged; errors 264 on both sides.Mutation check (
test/unit/core/template,test/integration/core/template): 7 of 7 killed — kwargs merged before defaults; Cohere always defaultingreasoning; Hy3reasoning_effortorthinking_modeback in the context; either default dropped; Cohereskip_thinkingdefault dropped.Review Notes
llamadart-evidence/pr-1513/holds the oracle source, render matrix outputs and diff, and the mutation script.34b66c3a0, CI pending.command_r7b_handler.dart, the changelogs and the vendored-template README in different hunks; whichever lands second rebases.High-risk regression review
backendRuntime,structuredOutput)