serve + engine: opt-in "effort_position": "end" keeps the cached conversation when the effort changes (#458)

The effort's instruction is the first thing the template renders, so a
request that only changes reasoning_effort (or turns thinking off) read
the whole prompt again. With "effort_position": "end" in the run config
the server renders every prompt's start as the default effort's and puts
a low/medium effort in a short system turn right before the answer
(thinking off: just the template's empty thinking block); the rendering
is template-agnostic (history + turn + the generation prompt).

Engine: --tail-role-token ID (default -1, off) moves the turn checkpoint
in front of such a trailing turn, so it holds the conversation and not the
effort text; INFO reports tail_role_token. The server passes the id of
"system" only when the engine binary knows the flag, and says so when it
does not. Without the key nothing changes: the same prompt ids, no flag.
This commit is contained in:
Niko1221 committed 2026-10-03 18:26:01 +02:00
1 parent c16f31f850
commit 9eceb375ab
4 files changed
+195 -4

No files matched your search

+8
View File
@@ -473,6 +473,14 @@ print(r.choices[0].message.content)
part of the thinking the client sees and counts as output tokens. `"reasoning_budget_tokens": N` in
`strata-<model>.json` sets it for every request; a request's own value wins, and `0` means no budget. Off by default;
Anthropic's `"thinking": {"budget_tokens": N}` still only chooses the level, as above.
- **Changing the effort without re-reading the prompt (opt-in, 0.1.39, #458).** The effort's instruction is the
first thing in the prompt, so a request that only changes the effort (an agent's "think harder" switch, `none` for
a quick tool step) reads the whole conversation again. `"effort_position": "end"` in `strata-<model>.json` renders
every request's prompt start as the default effort's and puts a `low` / `medium` effort in a short system turn
right before the answer (no thinking: the empty thinking block, as always); the engine (0.1.39+, which the server
checks) keeps its checkpoint in front of that turn, so the next request reuses the conversation whatever its
effort. The default (`"start"`) prompt is unchanged. The model sees a level that is not the default in another
place than it was trained with; how well it follows it there is not measured yet.
- **Anthropic requests that don't ask for thinking (opt-in, 0.1.32, #278).** By default a `/v1/messages` request
with no `"thinking"`, effort or budget thinks as the model's template does. `"anthropic_thinking": "on_request"` in
`strata-<model>.json` renders such a request without thinking - Anthropic's own rule, and what Claude Code's short