← All posts

Thinking off: the pi-adapted Qwen 3.8 27B measured in the regime it was trained for

My previous measurement of the pi-adapted Qwen 3.8 27B had a flaw I could document but not fix in time: every one of the 100 agent runs reasoned before answering. pi’s model entries declared no reasoning flag, so pi sent no thinking parameter at all, and Ollama’s OpenAI-compatible endpoint applied the template default, which is thinking on. The adapter was trained with thinking off, so it was measured outside its regime. This post is the re-run: four of the five tasks, leaving out the long Trello card, the same ten repetitions, the same interleaving, the same server, with thinking verifiably off. 80 runs, no errors, no timeouts.

The fix

Four lines in ~/.pi/agent/models.json: the model entries get "reasoning": true and "thinkingLevelMap": {"off": "none"}, the provider gets "supportsReasoningEffort": true, and pi runs with --thinking off (or "defaultThinkingLevel": "off" in settings, which is what I set). Verified end to end: with thinking off, a “reply OK” request returns one generated token and no thinking block; with --thinking medium it reasons; and the server accepts low, medium and high too, so no thinking level can break a request. On the native /api/chat and /api/generate endpoints "think": false always worked; only the OpenAI-compatible /v1 endpoint needed reasoning_effort.

The comparison, same method as before

Median of all 100 base-against-adapted pairings per task, wall clock:

taskthinking onthinking offpairings won, on to off
short Trello card0.780.7877 to 86 of 100
email thread0.920.8855 to 58 of 100
code from a specification1.331.1315 to 28 of 100
bug fix1.040.9244 to 69 of 100

The coding penalty was half thinking, half adapter. With reasoning switched off properly, writing code from a specification improves from 1.33 to 1.13 and the bug fix flips from a wash to a win. Something real remains on the from-spec task: the adapter is still 13% slower there, in the regime it was trained for. The Trello card is unchanged at 0.78 but more decisive (86 of 100 pairings, its best yet). Email stays close to a tie in typical pairings, though underneath that the adapted model’s own email runs got 21% faster while the base model’s got 14% slower.

The adapter is a no-thinking adapter, and the base model is not. Every task got faster for the adapted model (0.72 to 0.91 of its thinking-on wall) and it needed fewer turns to do the same work: 215 across the campaign against 228. The base model tells the opposite story: its reading task got faster, its coding tasks barely moved, and its email runs got slower, because without a reasoning trace it replaces planning with trial and error against the tools. Its median email turns rose from 8 to 11, the tail reached 26 and 28 turns, and across the campaign it needed 51 more turns than with thinking on (229 to 280). Each of those turns is a round trip and a prefill.

Quality flipped to the adapted model. All 40 coding runs passed their own tests with thinking on. With thinking off, the adapted model still passes 20 of 20, and the base model fails one of 20: its final message reported “all 7 tests pass” while the workspace it left behind was empty, except for a bare pytest cache whose own record shows no tests collected. The harness verify caught it. One run is not a rate, but it is the right direction for a model that was reinforced without a thinking trace.

Totals over the four tasks, ten repetitions each:

configurationwallgenerated tokensturns
base, thinking on (the accidental default)6786 s89k229
base, thinking off5469 s50k280
adapted, thinking on6284 s58k228
adapted, thinking off4919 s40k215

The right configuration does the same work in 72% of the wall clock of the accidental one, with 45% of the generated tokens.

Where the rest of the time goes

Thinking off removes generation, but generation was only about a quarter of the wall clock. The rest is prefill, and two measurements show its shape. Ollama’s KV cache works within a session: repeating a conversation with three new messages served 6689 of 6708 tokens from cache, 0.34 s of prefill instead of 64. But it is extension-only: the same system prompt with a different first user message reused 2 tokens and paid the full prefill again. A session therefore pays one cold prefill of the fixed system prompt, then every new token exactly once, then another cold prefill after every compaction.

The fixed prompt is 2469 tokens in an empty directory and 25728 in the repository where I run the agent; the difference is the project context, an 86.7 KB AGENTS.md. At the 100 tok/s prefill floor of the M4 Pro that is 257 s per session start and per post-compaction turn, and with a 32k context window it leaves the conversation about 3k tokens before compaction triggers. The levers that follow are not model-side: run one session at a time (a second client evicts the cache for the first), keep the fixed prompt small (a short core AGENTS.md plus topic files), and put exact commands in task bodies instead of letting the agent discover them at 100 tok/s per token.

One dead end worth recording: the merged model’s 26% decode penalty, which I previously traced to mxfp8 v_proj, k_proj, down_proj and lm_head tensors, is Ollama’s deliberate quantization policy: the first and last eighth of layers plus every third are promoted to 8-bit, and the embedding, which doubles as the output projection, stays 8-bit. It is hardcoded in create/quantpolicy.go, with no knob, and unchanged in 0.40.19. Fighting a quality policy to recover decode on a prefill-dominated workload is a bad trade, so I am leaving it alone.

Next on the list: Ollama 0.40.19, whose changelog claims multiple requests served at once on Apple silicon and a changed mapping for disabled thinking, both of which touch measurements above and need re-verifying.

Reproduce

python3 bench_pi.py --model-a macmini/qwen3.8:27b-nvfp4 \
   --model-b macmini/qwen3.8-pi:27b-nvfp4 --tasks bench_tasks.json \
   --only trello2,email,coding,coding2 --repeat 10 --thinking off \
   --out pi-bench-thinking-off.json

Tools and task definitions: lora-merge-tools (bench_pi.py, bench_tasks.json).