[GH-ISSUE #5128] [Engine] Add sampling.thinking.temperature: thinking and answer share one temperature today #2400

Open
opened 2026-11-04 01:58:59 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @xunying7860 on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5128

Area

[Engine]

What do you want to do?

Set the thinking segment's sampling temperature separately from the answer's, per request and as a run-config default, so a reply can "think wide, answer steady" — thinking at 1.0 while the answer stays at 0.3–0.7. For Qwen3.8-Flash-Next that is a real quality win: exploration where it matters, a steadier final text.

Today model_card_sampling(arch, thinking) already picks one of two sets per request, and reasoning_budget_tokens already proves the server can inject text mid-generation and continue from the prefix the engine holds. What is missing is the user-facing knob to set the two segments independently — the data path exists.

Proposed surface, each layer optional and defaulting to today's behaviour:

  • run config: "sampling": { "temperature": 0.3, "thinking": { "temperature": 1.0 } }
  • request (OpenAI): "thinking_temperature": 1.0
  • request (Anthropic): "thinking": { "type": "enabled", "budget_tokens": N, "temperature": 1.0 }

Priority per request: request thinking_temperature → request thinking.temperature → run config sampling.thinking → inherit the answer segment's value. Nothing set anywhere keeps one temperature for the whole reply, byte for byte as today.

This can be done in serve/server.py alone, without touching the engine: take the thinking segment's parameters before sampling, break the pass when the parser leaves the reasoning state with a clean buffer and no pending detokeniser bytes, then prompt = prompt + seg and continue with the answer's parameters — the same "continue from the prefix the engine already holds" primitive reasoning_budget_tokens uses. reasoning_loop_recovery=recover should raise the thinking segment's temperature only, never the answer's.

What do you do today instead?

Run the whole reply at one temperature. A run config's sampling block applies to both segments, so a steady 0.3 answer makes the thinking 0.3 as well — and low-temperature reasoning loops (as reported in #728) get easier to trigger; 1.0 for the thinking leaves the answer loose.

I have a working local patch against 0.2.10 (7 anchored edits in serve/server.py, idempotent, py_compile-gated) with four regression tests: two passes with 1.0 then the answer's value, no-thinking replies still single-pass, request thinking_temperature overriding the config, and the Anthropic route reading the same block. Measured here: dual sampling: thinking 1.0 -> answer 0.3 at 42 tokens, with the thinking segment and the answer segment reporting their own tok/s. Happy to send it as a PR if the scope is acceptable.

Originally created by @xunying7860 on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5128 ### Area [Engine] ### What do you want to do? Set the thinking segment's sampling temperature separately from the answer's, per request and as a run-config default, so a reply can "think wide, answer steady" — thinking at 1.0 while the answer stays at 0.3–0.7. For Qwen3.8-Flash-Next that is a real quality win: exploration where it matters, a steadier final text. Today `model_card_sampling(arch, thinking)` already picks one of two sets per request, and `reasoning_budget_tokens` already proves the server can inject text mid-generation and continue from the prefix the engine holds. What is missing is the user-facing knob to set the two segments independently — the data path exists. Proposed surface, each layer optional and defaulting to today's behaviour: - run config: `"sampling": { "temperature": 0.3, "thinking": { "temperature": 1.0 } }` - request (OpenAI): `"thinking_temperature": 1.0` - request (Anthropic): `"thinking": { "type": "enabled", "budget_tokens": N, "temperature": 1.0 }` Priority per request: request `thinking_temperature` → request `thinking.temperature` → run config `sampling.thinking` → inherit the answer segment's value. Nothing set anywhere keeps one temperature for the whole reply, byte for byte as today. This can be done in `serve/server.py` alone, without touching the engine: take the thinking segment's parameters before sampling, break the pass when the parser leaves the reasoning state with a clean buffer and no pending detokeniser bytes, then `prompt = prompt + seg` and continue with the answer's parameters — the same "continue from the prefix the engine already holds" primitive `reasoning_budget_tokens` uses. `reasoning_loop_recovery=recover` should raise the thinking segment's temperature only, never the answer's. ### What do you do today instead? Run the whole reply at one temperature. A run config's `sampling` block applies to both segments, so a steady 0.3 answer makes the thinking 0.3 as well — and low-temperature reasoning loops (as reported in #728) get easier to trigger; 1.0 for the thinking leaves the answer loose. I have a working local patch against 0.2.10 (7 anchored edits in `serve/server.py`, idempotent, py_compile-gated) with four regression tests: two passes with 1.0 then the answer's value, no-thinking replies still single-pass, request `thinking_temperature` overriding the config, and the Anthropic route reading the same block. Measured here: `dual sampling: thinking 1.0 -> answer 0.3 at 42 tokens`, with the thinking segment and the answer segment reporting their own tok/s. Happy to send it as a PR if the scope is acceptable.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6607803884 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
bsakaguchi changed title from [GH-ISSUE #5128] Allow a different temperature for the thinking segment than for the answer to [GH-ISSUE #5128] [Engine] Add sampling.thinking.temperature: thinking and answer share one temperature today 2026-11-07 14:37:39 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6617248766 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks, this follows the format now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2400
No description provided.