qwen36: kv-prefix reuse can never engage for standard chat clients — the official template renders history without the think header it was fed (trade-off, maintainer's call)
The conflict, verified: a qwen36 turn is generated from a prompt that ends with <|im_start|>assistant\n + the pre-closed think header (thinking off), so the fed-token record contains the header + the generation. But chat_template.jinja (pinned reference, rendered with jinja2; sha256 e84f32a2…) renders a RESENT history turn as bare text — header dropped, on both thinking branches. kv_prefix_reuse is an all-or-nothing memcmp, so every conversation diverges at its first assistant turn and reuse stays 0 forever: every follow-up re-prefills the full history. Measured (qwen36 int4-gs64, 3-turn dossier conversation, CUDA tier): follow-up TTFT ≈ 96-100 s — the full re-prefill every turn.
Why this is a trade-off and not a plain defect: the template's own semantics make token-exact round-trip impossible for a standard client, so making KV reuse work means choosing between (a) template literalism (status quo), (b) re-rendering past assistant turns with the header they were fed with, or (c) a server-side prefix splice that keeps the template untouched. That choice is yours — this issue presents the evidence and a ready implementation of (b).
(b), ready on a branch (no PR yet): https://github.com/JustVugg/colibri/compare/dev...tarazum:fix/qwen36-kv-roundtrip — 9 lines in render_chat_qwen: when re-rendering a PAST assistant turn with thinking disabled, prepend the pre-closed think header (skipped if the text already starts with <think>, so raw-echo clients don't double it). Measured on top of current dev (which already has the next_special tokenizer boundary): a STANDARD OpenAI client round-trips token-exactly — [PREFIX] reusing 940 of 972 prompt tokens (97%), follow-up TTFT 96 s → 3.7 s. Known cost: it deliberately diverges from chat_template.jinja, so test_qwen36_chat_template.py (byte-equality conformance) needs a carve-out for the past-assistant/thinking-off case.
Scope notes: with thinking ENABLED, reuse stays impossible under any renderer change (the model's reasoning block is not part of the resent history); the /score SUBMIT pin path is unaffected; single-turn requests are unaffected.
We can open the PR (with whichever conformance-test carve-out you prefer) or prototype the server-side splice (c) — happy to do either, or neither if (a) stands. Evidence artifacts (COLI_PREFIX_LOG lines, divergence-index diagnostics, quality battery re-run 6/6) available on request.
Source: JustVugg/colibri