Kairo LabEngineering forensics · 2026-10-20

Inference-engine forensics · October 8–20, 2026

Forced Full Prefill: Why Kairo's Hybrid 35B Re-prefills Every Turn

Topics: Inference Engineering · Case Studies  ·  Subject: Kairo

A complete forensic record of the “forcing full prompt re-processing” warning in Kairo's production PXA runtime: what the logs measure, what the pinned build actually does, what a controlled CPU-only experiment proved, and why no production change was made.

MEASURED marks numbers taken from production logs, API timings, or the isolated experiment. MECHANISM marks behavior read from the pinned build's own source. EXPERIMENT marks results of the shadow test matrix. DECISION marks the operational conclusion. UNRESOLVED marks an evidential limit.

Executive summary

Kairo's primary chat model, a hybrid attention/recurrent 35B MoE served by a pinned llama.cpp-derived server (PXA v3.1-guardfix), re-processed essentially its entire prompt on almost every conversation turn. Over a five-day production log window, 3,343 turns logged forced full re-processing against only 128 checkpoint restores. The warning blames SWA eviction; in this build that label is wrong.

The verified root cause is a triple: (1) the model's recurrent layers give each sequence a single state position that cannot be rewound, so prefix reuse legally requires a context checkpoint taken strictly before the divergence point; (2) the build's default checkpoint policy creates snapshots only near the end of each prompt; and (3) one shared inference slot interleaves heterogeneous traffic, and every low-overlap interloper erases the checkpoints the next conversation turn would need. A controlled experiment on the same binary confirmed each part independently — and confirmed that the obvious configuration fix (PXA_CKPT_PROMPT_POLICY=0) is neutralized by the erase cascade under interleaved traffic.

Decision. No-go for production. The environment levers that fix checkpoint placement cannot fix checkpoint retention, which is the binding constraint under real traffic. A worthwhile fix requires routing or slot-affinity changes that remain unauthorized. This report preserves the full measurement chain, the mechanism reading, the experiment, and the revisit conditions so the investigation is not repeated.

Scope and method

Production measurements

All lifecycle events over the ~4.5-day span of the two retained 35B error logs (Oct 15–20, 2026), with the 9B gateway on the same build as a cross-check:

Checkpoint lifecycle counts, production logs. The 35B slot serves one slot (-np 1) for all workloads; the 9B instance reproduces the same signature, so this is build-and-traffic behavior, not a 35B anomaly.
Event35B (4.5 d)9B (1.7 d)
Forced full re-processing3,3432,168
Checkpoint restore (success)128 (3.7%)346
Erased invalidated (cascade)13,5747,102
Ring-capacity evictions700
Checkpoints created12,3997,111

Across 3,292 partial-reuse turns on the 35B, the measured token-level longest common prefix between each request and the slot's cached prompt was bimodal: percentiles (min, p10, p25, median, p75, p90, max) of 1, 3, 3, 32, 3,734, 9,923, 155,259 against prompt sizes median 6,552, max 258,037. 57% of turns shared fewer than 512 tokens; 24% shared 4,096+. Sum of reusable prefix tokens: 12.39M of 66.23M prompt tokens (18.7%). An earlier engine-side capture agreed: an 8 Oct conversation turn diverged at token 23,041 of 33,443.

Corroborating measures: 5.74M prompt tokens costing 3,325 s of prefill in an 18.4 h metric window at ~2,100 tok/s; KV-cache usage ~2.4%; 100 durable turns on 16 Oct all reported cached_prompt_tokens = 0; each created checkpoint cost 62.9 MiB and ~63 ms, while each restore cost only 12–37 ms.

The mechanism in the pinned build

MECHANISM Four code facts, read from the pinned server source and verified against the binary's strings and production log lines:

  1. Hybrid rollback is mandatory. The model family mixes 10 attention layers with 30 gated-delta-net recurrent layers. A recurrent sequence has one state position; trimming KV cells cannot move it back. The fork's rollback rule therefore permits prefix reuse only by restoring a checkpoint whose snapshot position is strictly below the re-entry point; otherwise the slot resets to zero and logs forcing full prompt re-processing due to lack of cache data (likely due to SWA…). For this build the SWA attribution in the message is a mislabel: cell eviction is not the trigger; absent checkpoints are.
  2. Checkpoints sit only at prompt ends. PXA_CKPT_PROMPT_POLICY (ON by default) skips mid-prompt checkpoints; only two to four snapshots within ~517 tokens of the prompt end are created. PXA_CKPT_PROMPT_END (OFF by default, unset in production) would add one at the prompt end. Production flags --ctx-checkpoints 64 (capacity; never binding) and -cram 0 (prompt-shift cache, unsafe for this arch by the fork's own bug note) were confirmed non-causal.
  3. The erase cascade. Every partial-match turn deletes all checkpoints above its re-entry position. A turn whose prompt shares nothing with the previous one (measured: p25 = 3 tokens, often the BOS alone) deletes the entire ring — and a zero-overlap interloper performs the cascade without ever logging a forcing line, so the erasures outnumber every visible symptom.
  4. Traffic shape. One shared slot interleaves Discord conversation, memory-worker jobs, research jobs and vision turns. Kairo's own prompts are highly stable within a stream (prefixes up to 155k tokens measured), but re-rendered inline blocks push the conversation divergence point deep into the prompt — above the tail-only checkpoints and below everything the cascade left behind.

Upstream review: issue #20225 (predicate-era checkpoint bug) was fixed differently in this fork; #21831 closed without a fix; #22746 independently documents the identical interleave-erases-ring signature on a Qwen3.6 agent harness, and its candidate fix was never merged and is absent from Kairo's build.

Verified root cause

MEASURED The forced-full-prefill steady state requires all three conditions, and all three hold in production:

The warning count (3,343) understates the cost because zero-overlap turns re-prefill silently. The real cost is visible in the metric counters: nearly every token of every prompt is evaluated on every turn.

Controlled shadow experiment

EXPERIMENT The pinned binary, CPU-only, zero GPU (verified: CUDA initialization reports no device), same qwen35 hybrid architecture at 0.8B, production cache-mechanic flags (-b 2048 -ub 512 --kv-unified --ctx-checkpoints 64 -cram 0 -np 1), greedy decoding, fresh process per cell. Synthetic prompts (no Kairo content): A = 4,560 tokens; C = same first 2,531 tokens then diverges (~56%); B = unrelated ~99-token prompt with zero overlap. Sequences: A→C and A→B→C, each under four configurations:

Tokens actually re-processed by request C, and prefill wall time, per configuration. “Silent” = the erase cascade ran without a forcing log because the interloper's overlap was zero.
ConfigurationA→C: C re-processedA→C: prefillRestoreA→B→C: C re-processed
Production defaults4,563 (full)168.5 snone4,563 (full)
PXA_CKPT_PROMPT_POLICY=02,515 (−45%)98.7 s (−41%)1 @ pos 2047, 10.3 ms4,563 (full; silent wipe)
PXA_CKPT_PROMPT_END=14,563 (full)165.2 snone4,563 (full)
Both levers2,515 (−45%)101.7 s (−40%)1 @ pos 2047, 10.0 ms4,563 (full; silent wipe)

What the matrix established:

Avoidable-latency bounds

MEASURED Upper bound from production logs: 12.39M of 66.23M prefill tokens (18.7%) lay inside reusable prefixes over five days; at the observed 2,100–2,300 tok/s that is roughly 5,200–5,700 s of avoidable prefill, concentrated in the 24% of turns with 4k+ token overlap. The single-turn experiment realizes 41% prefill saving on a consecutive same-stream pair at 56% stability. Under current interleaved traffic, however, a restore can recover at most the interloper's own prompt length (typically ~6.5k tokens), so naive configuration changes recover near zero of the bound — which is exactly what the experiment measured.

Unrelated TTFT components (gateway, queue, network: ~4–14 s per turn on 16 Oct durable data) and one anomaly (~44.8 s prefills of ~1.2k-token turns, candidate: CPU vision projection on multimodal turns) are not addressable by checkpoint work at all.

Unresolved items

UNRESOLVED Three limits are stated rather than papered over: (1) the exact first-diverging component of Kairo's serialized prompt (tool-schema churn versus identity headers versus inline runtime snapshots) could not be isolated without payload capture, which the authorized observation surface did not include; log-derived LCP and the 8 Oct engine-side capture bound the effect but not its authorship. (2) The pathological ~44.8 s small-prompt prefills were not fully attributed. (3) The 2,048-token checkpoint granularity floor and its interaction with a smaller batch size were not qualified.

Decision and revisit conditions

DECISION Production remains unchanged. On this evidence:

Provenance and preservation

Every number above is reproducible from artifacts committed to the Kairo main branch:

No production process, service unit, nginx configuration, model, cache or route was modified during any part of this investigation. The shadow experiment directory on the inference host was deleted after artifact retrieval; nothing remains there.