Files
leleka/docs/laptop-vs-vanilla.md
T
Pavlo RatushnyiandClaude Sonnet 5.5 03794d5fa8 prefix cache: log why a checkpoint is not taken; re-judge a LowMemory refusal after the working-set trim (turn 2 resumes at the prompt-end tail)
The prompt-end tail and some grid points were refused against the admit floor (soft + reserve) while the host read 8.9 GiB: on Windows the
mapped expert pages count as used, and the periodic trim only runs below the soft floor. Which checkpoint was lost varied from run to
run (turn 2 reused 43,008 / 36,864 tokens). Now the refusal is re-judged once after Governor::available_after_relief. after_prefill /
after_decode always log their outcome with available / additional / floor; the admit line of the prompt-end tail is no longer behind
LELEKA_PREFIX_TRACE. Smoke under the shipped defaults: 7 grid points + tail admitted, turn 2 cached_tokens 45,765.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 00:57:14 +01:00

32 KiB

Laptop (RTX 3080 16 GB, native Windows): Leleka against vanilla Strata on the 256k agent session

Branch claude/laptop-vs-vanilla, started 2026-10-27 from main (3bedec6). Machine: RTX 3080 Laptop 16 GB (driver 617.42), i9-11900H (8 cores / 16 threads, AVX-512, no AVX-VNNI), 47.7 GB RAM, Samsung PM9A1 NVMe, Windows 11, WSL shut down for every run. Model Qwen3.8-Flash-Next IQ3_S (the pinned pack, digest sha256:80d5e333...66a3).

Owner's rule: on large-context work our end-to-end speed has to be better than vanilla Strata on the same machine, a 1 % gain counts. The measure is the 5-turn long session (scripts/e2e/long_session.py --turns 5 --target-tokens 245000 --max-output 300 --context 262144, source snapshot C:\Users\pavel\work\wsrun\src-snap\crates, turn 1 = 45,766 input tokens), nothing shorter.

1. The reference: what vanilla does on this laptop (engine log wsrun\vanilla\engine-vanilla.log, engine/strata sources, release 0.2.6 / engine 0.1.50)

vanilla Strata ours before this work (workstation, dist build c40531f)
TTFT per turn (s) 230 / 260 / 279 / 236 / 243 432 / 490 / 707 / 514 / 360 (run 1), 449 / 528 / 743 / 611 / - (run 4)
prefill tok/s on the tokens actually read 199.5 / 192.6 / 191.3 / 199.3 / 187.8 105-115
decode tok/s 15.8 / 17.5 / 16.1 / 15.0 / 17.1 5.9-7.5
total wall of the session 1,341 s about 2,500 s
prompt chunk 8192 (ring 96 slots; the prompt path borrows 1,781 of 2,661 cache slots, 3.41 GiB) 2048 (borrows 1,154 of 2,234 slots)
VRAM left for the desktop 459 MiB free (it warns, and runs) 2.8 GiB (workstation: budget 13 GiB of 16)
expert cache 2,661 slots (5.10 GiB), profile fill, adaptive 2,234 slots (4.29 GiB), same profile (identical file, sha256 8f59b4aa...)
CPU pool 7 workers pinned to logical processors 2,4,...,14 (one per physical core), host thread on 0, 24 tasks per phase 12 workers (the preset counts logical cores), 7 pinned, 5 spinning unpinned
PCIe share pcie_frac auto-balanced 0.20 -> 0.40 -> 0.30 -> 0.35 from the measured CPU-pool speed 0 (pageable bank)
route tail skip ON by default (STRATA_ROUTE_TAIL_SKIP=7, changes the answer): 25-30 % of the missed experts are never computed off (experimental, quality gate failed on the 5090)
exact sm_86 speed switches 9 on by default (ADAPT_NOWAIT, ADAPT_LAG=2, CPU_IQ_ALL_EXACT1, SIDE_MIXER=2, ATTN_DAILY, GR_UP75, GU_SWIGLU, QSA_ROWS, B6_MMVQ_ROWS) none (rows 2.1 / 2.2 of the port plan, other agent)
experts on disk one packed experts.bin (46.8 GB, one blob per expert, layer-major) mapped, file tier 41.7 GiB the two GGUF shards mapped, gate/up/down of an expert in three different tensors
PLE rows direct (unbuffered, overlapped) reads, 146k rows/s probe, on a worker thread KAR level-2 PLE: three positional reads of random 4 KiB pages per row, on the prompt's critical path

Vanilla's decode is 107 ms per speculation round (300 tokens = 177 rounds, 123 of 227 drafts accepted); ours is 240 ms for the same 1.7 tokens per round.

2. Where the time goes (ours, measured with the engine's own PREFILL-PROFILE lines)

One 2048-token chunk at the old setting (job ab2, 18.9 s): moe 14.5 s of which moe.ring (the expert stream) 11.8 s, input 2.5-5.0 s (all of it input.ple), gdn 1.1 s, qsa 0.5-0.6 s. At 6144 tokens (33 s, steady state): input.ple 10.3 s, moe 15.6 s (ring 14.3), gdn 3.8 s, qsa 2-2.9 s.

  • PLE: 16 rows per token, derived from the token and the two before it (n-gram hash), almost never in the 64 MiB device cache; each row is three random 4 KiB reads in the KAR archive. The reads are latency-bound, 20-45 k per second, and happen before the chunk starts. That is 13-26 % of every 2048-token chunk and 31 % of a 6144-token one.
  • MoE ring: every expert the GPU does not hold streams once per chunk, from the page cache or the NVMe. The cost per chunk is nearly constant (11.8 s at 2048 tokens, 14.3 s at 6144), so a bigger chunk divides it.

3. Gaps, ranked by expected gain on the 256k session (about 85 % of a turn is prefill)

# Gap Evidence Explains State
1 Prompt chunk 2048 against 8192. The prefix grid (block_tokens) caps every chunk, and 8192 needs a loan of about 2,450 cache slots while the workstation preset (13 GiB budget) leaves 2,234. PREFILL-PROFILE: 108-113 tok/s at 2048, 185-197 at 6144 (same machine, same session). reconfigure --prefill-capacity 8192 is refused (original_prefill_arena: InputAllocation); 6144 borrows 2,016 of 2,234 slots, 4096 borrows 1,585, 3072 1,369, 2048 1,154. prefill 110 -> 176 tok/s done by configuration: leleka reconfigure --prefill-capacity 6144 --prefix-cache-block 6144. It changes the chunk-order rounding, so it is not a default (section 5). 8192 needs about 0.6 GiB more VRAM (--gpu-budget-gib 14, not tried)
2 PLE rows on the prompt's critical path. 16 rows per token, 3 random 4 KiB reads each, read before every chunk through clones of ONE synchronous handle: the I/O manager runs the requests of one file object one at a time, so 32 threads gave a queue depth of 1 (100 k reads in 10 s). input.ple was 5-12 s of every 6144-token chunk (31 %), 39-77 s per turn. After the change (own file objects through ReOpenFile, and the next chunk's rows read on a thread while the chunk computes) it is 0.47-0.9 s per chunk (run d, GPU power-capped). Decode paid 8-10 ms per window for it (window.ple, 48 sequential reads per token). prefill, about 25 % of a chunk done (ee4cb59, 3461b86), default on for Windows
3 CPU pool: 12 workers on 8 cores (the preset counts logical processors); 5 spin unpinned and take cycles from the pinned ones. Vanilla: 7, pinned one per physical core. decode 7.98 / 7.75 tok/s (7 workers, run c turns 1-2) against 7.57 / 6.58 (12 workers, run b): +5 to +18 %, two turns, not a clean A/B (run c also had the PLE read-ahead). decode, about 10 % done (449b7a1): 7 on this laptop, 15 on the 16-core server
4 Decode is dominated by the CPU misses' page-in, not by their compute. Per 2-row window (BRINGUP_TRACE): 216 distinct experts, fetch (will_need on 3 ranges each, then a touching phase) 58.7 ms, compute join 35 ms, of 117 ms in the verifier. cpu.open is 2.2 ms per layer against 1.3 ms of compute. run c profile: round 203 ms = GPU chain about 106 ms + pool.cpu 3.6 ms x 48 (open 2.2, compute 1.3). Vanilla's 107 ms round has 25-30 % of the misses removed by its default route tail skip. decode 2.2x open. Candidates: skip the prefetch pass when the pages are resident, more RAM for the page cache (pinned 8 GiB + about 10 GiB standby against vanilla's 27.5 GiB), PcieAuto
5 Route tail skip is ON by default in vanilla (STRATA_ROUTE_TAIL_SKIP=7): 25-30 % of the missed experts are never computed and the answer differs. Ours stays off (quality gate failed: p99 d_top1 1.005 against a limit of 0.499). engine-vanilla.log: 25,065 missed experts skipped in turn 1 (168,623 lookups). part of decode not taken. The fair decode comparison is vanilla with STRATA_ROUTE_TAIL_SKIP=0, not yet run
6 Page cache churn of the expert scan: every chunk reads all experts the GPU does not hold (about 37 GiB), layer 0 to 47, through about 10 GiB of cache, so a cyclic LRU scan finds nothing again. wsrun-lvv\iobench.ps1: a cyclic scan of 12 GiB through about 7 GiB of cache took 3.0-3.7 s per pass; with the first half read at memory priority 1 and the second at 5, 0.8 s per pass. moe.ring (14.3 s of 33 s per chunk) implemented, opt-in LELEKA_STAGE_PRIORITY=on (73c67a6). Run d had it on, but the GPU was capped, so its effect is not measured
7 VRAM left to the desktop: 2.8 GiB (workstation) against 459 MiB (vanilla). Cache 2,234 against 2,661 slots. The dGPU shows 0 MiB in use at idle on this Optimus laptop. engine logs decode hit rate, the 8192 loan owner's policy; --gpu-budget-gib 14 is the knob
8 Experts in one packed layer-major file (vanilla) against three tensors per expert in the GGUF. disk microbench: page-fault touch with 32 threads reaches 4.2 GB/s on 640 KiB pieces, the same as PrefetchVirtualMemory first (4.3) and unbuffered 8 MiB reads (4.9); the ring runs at about 3 GB/s none measured not pursued

Which gap explains what: prefill 110 against 199 tok/s is gap 1 (chunk 2048, about three quarters of it) and gap 2 (PLE, a quarter); decode 6.5-7.5 against 15-17.6 is mostly gap 4 plus gap 5 (the lossy default), with gap 3 and the sm_86 kernel switches (port plan rows 2.1 / 2.2) behind them.

4. Measurements (5-turn 245k session, workstation, native, WSL off)

Prefill tok/s is tokens read (input minus reused) over the sum of the chunk times in the engine's PREFILL-PROFILE lines.

run build / settings TTFT per turn (s) decode tok/s wall (s)
vanilla 0.2.6 defaults (tail skip on) 230 / 260 / 279 / 236 / 243 15.8 / 17.5 / 16.1 / 15.0 / 17.1 1,341
ours before c40531f, chunk 2048, tail reply 432-449 / 490-528 / 707-743 / 514-611 / 360 5.9-7.5 about 2,500
b same build, reconfigure to chunk 6144 / grid 6144 / tail prompt 262.6 / 291.8 / 301.2 / 276.7 / 286.3 (sum 1,419) 7.57 / 6.58 / 7.38 / 7.40 / 8.41 1,621
c + PLE read-ahead (shared handle), 7 workers 244.4 / 277.4 / - 7.98 / 7.75 stopped after turn 2
d + own file objects, stage priority on not a valid run (GPU at a 30 W cap) - -
A 2cb26cc (= the above + tail-keep 85fd803), chunk 6144 / grid 6144 / tail prompt, PLE read-ahead on own file objects, 7 workers, stage priority off; 2026-10-27 21:14, AC, P0, max 71 C, max 131 W 173.7 / 203.8 / 208.4 / 195.9 / 216.5 (sum 998) 6.85 / 6.40 / 6.65 / 6.94 / 6.14 1,226 (217 / 251 / 254 / 239 / 265)

Run A against vanilla: TTFT sum 998 s against 1,248 s (-20 %, every turn faster: 174 / 204 / 208 / 196 / 217 against 230 / 260 / 279 / 236 / 243); total wall 1,226 s against 1,341 s (-8.6 %), against 1,621 s for run b and about 2,500 s before this work. Prefill 285 / 260 / 269 / 253 / 222 tok/s on the tokens read (vanilla 199 / 193 / 191 / 199 / 188); input.ple 1 s per turn (b: 39-77 s). cached_tokens 0 / 45,761 / 95,950 / 149,371 / 196,388 (vanilla reuses 45,761 / 95,828 / 149,192 / 196,189): exact reuse, 45,766 / 50,194 / 53,426 / 47,022 / 45,552 tokens read per turn (vanilla 45,766 / 50,072 / 53,369 / 47,002 / 45,541). Decode is still 2.4x slower than vanilla (6.1-6.9 against 15-17.6 tok/s: 45 s against 18 s per 300 tokens, 225 s against 92 s over the session), so ours is ahead by 250 s in prefill and behind by 133 s in decode. The expert tier in the decode windows is 46-48 % VRAM / 52-54 % CPU, 178-210 rounds per 300 tokens (vanilla 177). One run; no repetition yet, and the GPU was in a different state from run b (70-130 W against 40-90 W), so part of the b-to-A step is the machine, not the code (gdn and qsa per turn are also 2x shorter than in b).

Run b: prefill 182 / 176 / 183 / 175 / 164 tok/s (vanilla 199 / 193 / 191 / 199 / 188), input.ple 75 / 77 / 60 / 47 / 39 s per turn, moe.ring 114-132 s, qsa 18 -> 82 s from 46k to 240k tokens. Reuse was exact (45,761 of 45,766 tokens) - but not because of tail prompt: see section 13, the prefix cache was off in runs b, A and A3.

Run d was stopped by the guard at 20:18 and is not a measurement. The GPU sat at P5, 285-1545 MHz and 25-47 W with SW Power Cap and SW Thermal Slowdown active at a 30 W power limit (default 115 W), at 52-55 C, while Windows reports the battery as discharging with the power plan on Turbo. The earlier runs drew 70-90 W. Under that cap the same chunks took 47 s instead of 30 s (gdn 10.3 s against 3.8, moe.ring 24 s against 13), so no comparison with vanilla is valid. The 30 W profile is also the one that blue-screened this laptop (0x19C), so no further GPU run was started. The machine has to be back in its full-power state (charger, OEM performance mode) before the next run.

5. Quality

  • PLE read-ahead and own file objects: non-lossy. A packet is a function of the archive bytes; LELEKA_PLE_AHEAD_VERIFY=1 compares every packet taken from the read-ahead with a direct read: 605,716 rows (run c, shared handle) and 754,127 rows (run d, own file objects), 0 mismatches. The device sees the same bytes, so the tensors are bit-identical by construction.
  • CPU workers 7 and the stage priority change no value (thread count; which pages stay cached).
  • Chunk 6144 changes the rounding order of the prompt path (docs/prefill-throughput.md: 16,000 tokens answered identically at 2048, 4096 and 6144 and differently at 8192 on one prompt). It stays an explicit setting and is not the default until scripts/quality/q_pair.py (or the LELEKA_TRACE_PREFILL_R residual hashes) has been run with 2048 / 6144 arms and a control. Not run.
  • Run A's settings (chunk 6144, tail prompt) were not checked with q_pair or greedy-id equality: the reply hashes of two runs of the same prompt already differ (turn 1: e3b0... empty in runs b-d, 0230c278... in run A, because the reasoning-only reply varies), the port is not bit-deterministic between processes, and the harness needs a capture that is not on this laptop. The tail mode only moves where a checkpoint is taken (the state after a chunk is a function of the tokens before it), the chunk size changes rounding.
  • Route tail skip stays off.

6. Not verified / next

  • A paired full run of the final build against vanilla (blocked by the power state); the effect of LELEKA_STAGE_PRIORITY; 8192 with --gpu-budget-gib 14.
  • Vanilla with STRATA_ROUTE_TAIL_SKIP=0 for an exact-for-exact decode comparison.
  • Next gap: gap 4 (decode page-in: the will_need pass, and the working-set trims the governor does every 13 s at the 8 GiB soft floor), then PcieAuto.

7. Decode-only A/B at 233k tokens of context (2026-10-27 22:12-22:33, build 2cb26cc + f1634e1 + the toggles, AC, P0, max 70 W)

Method (scripts/e2e/decode_ab.py, driver wsrun-lvv\run-ab.sh): one prompt of the last turn's depth (232,878 tokens, chunk 6144, tail prompt) is read once (790 s), then the same prompt is sent 8 times, 300 output tokens each; the prefix cache serves 232,873 of the tokens (TTFT 3.2 s), so what differs between requests is the decode. An arm is a file whose existence the engine checks per group, so the arms alternate inside one engine (order A B B A A B B A).

  • CPU kernels: engine.log now says kernel family on this core: AVX-512 (F/BW/VL/DQ/VBMI/VNNI all present on the i9-11900H; IQ rows 512-bit on). Vanilla's AVX2-exact single-token path is also off on an AVX-512 CPU, so both engines run the 512-bit rows.
  • Arm B = skip the prefetch pass (PrefetchVirtualMemory on the three matrices of each missed expert, then a touching phase on all workers, both before the compute):
arm decode tok/s per request mean window ms (mean of the requests) fetch ms / window join (compute) ms / window window ms per expert
A, pass on 8.32, 8.84, 8.70, 8.95 8.70 172.8, 162.4, 170.6, 166.8 69.5-74.7 62.4-64.8 0.484-0.526
B, pass skipped 9.72, 9.55, 11.60, 11.44 10.58 (+21.6 %) 152.4, 142.4, 128.9, 143.2 0 83.3-97.0 0.340-0.425

Every B request is faster than the A requests next to it; both arms speed up over the run (the page cache warms), so the pairs, not the means, are the evidence. The page-in did not go away, it moved: the compute's own faults overlap with its work, the separate pass did not. experts per window 328-401 (2-row windows), 46-48 % of the entries in VRAM. Changed: the pass is skipped by default on Windows (LELEKA_CPU_PREFETCH=on restores it; Linux unchanged). Bit-identical (same bytes, same arithmetic); the replies of the 8 requests are reasoning-only (equal hash e3b0...), so there is no text to compare, and greedy-id equality was not checked.

  • Working-set trims are not the cost, they are what holds the engine up. A first A/B (ab4) had an arm with the trims disabled: within three requests the host went from normal to shed (available 8,073 MiB below the 8,192 MiB soft floor) and to reject (3,349 MiB below the hard floor), the prefix cache was evicted and the next request re-read the whole 233k prompt. The engine's mapped expert pages sit in its working set and count against available; the trim (about every 13 s) moves them to the standby list. Left as is.
  • Not done in the 60 minutes: PcieAuto (the pageable-source PCIe share was slower than the CPU pool in the earlier A/B), the more-pinned-RAM variant (resident_budget_gib 8 -> 14, the policy knob: it trades the desktop's 18 GiB), a packed one-blob-per-expert file, and vanilla with STRATA_ROUTE_TAIL_SKIP=0 at this depth, so how much of vanilla's 15-17.6 tok/s is the tail skip is still unknown. The page-in counters (Pages Input/sec, disk queue) were not captured: the sampler wrote one counter instead of six.
  • Decode now: 10.6 tok/s in the best arm, 11.4-11.6 in the warmest pair, against vanilla's 15-17.6 (vanilla windows: 107 ms per round at about 1.7 tokens per round; ours 129-153 ms per window with the pass skipped).

8. Run A2 (current main defaults, 2026-10-27 22:38) - stopped at turn 3 by the power cap

Build = d84d465 equivalent (9e33932 + A's settings, prefetch pass skipped, workers 7, PLE read-ahead, chunk 6144, tail prompt). Turn 1: TTFT 164.4 s (run A 173.7), prefill 300 tok/s, wall 221.7 s, decode 5.22 tok/s (run A 6.85). Turn 2: TTFT 179.6 s (A 203.8), prefill 292 tok/s, wall 221.7 s, decode 7.13 (A 6.40). At 22:48 the GPU fell to P5, 285 MHz, 26-35 W with the power limit back at 30 W (Windows: battery "discharging" although PowerOnline is true); the guard stopped the engine during turn 3 (STOP P5 stall, 22:49:47). Turns 3-5 and the vanilla run with STRATA_ROUTE_TAIL_SKIP=0 were not run; not retried, as instructed. Max 68 C, max 121 W before the cap.

New finding in the turn-1 decode: with the prefetch pass skipped the first decode of a freshly started engine is slower (window 214 ms, 0.74 ms per expert, window.ple 10.5 ms) than with the pass (run A turn 1: 6.85 tok/s), while the warm decode of turn 2 is faster (143-160 ms per window). The pass issues the page-ins of a group's experts in parallel and is worth it while the page cache is cold; once the experts are cached it is pure overhead (section 7, measured at 233k depth after 15 minutes of prefill, i.e. warm). So the Windows default of skipping the pass should become adaptive (time both modes per expert, keep the faster, probe the other every N windows) or be on for the first decode windows of a process; that change is not made yet.

9. Adaptive page-touch pass (CPU-only change, not yet run on the GPU)

prefetch_policy.rs replaces the fixed Windows default of section 7: each CPU group measures its cost per expert (open + compute, over the experts the CPU served) and the policy keeps a moving average per mode. It starts with 16 groups with the pass, then 16 without, uses the cheaper mode from then on (the other one has to be 3 % cheaper to take over), and tries the other mode on every 16th group so a change in the page cache is noticed (cold start: the pass wins, a warm cache: the skip wins; section 8). LELEKA_CPU_PREFETCH=on|off are hard overrides (unset: adaptive on Windows, the pass everywhere else, as before); LELEKA_CPU_PREFETCH_OFF_FILE still forces the skip for an A/B inside one engine. Seven model-free unit tests (cold start order, cheaper mode wins and about 1/16 probes, cold -> warm -> cold following, near-tie hysteresis, hard overrides never measure, nonsense samples ignored) and the 5 existing pool tests pass; the release engine builds. The cost of the probes is about 1/16 of the groups in the slower mode (about 1.5 % when the modes differ by 25 %). Expected effect: run A's first decode (6.85 tok/s) is kept and the warm decode keeps the +21 %; not measured, the GPU was power-capped.

10. Run A3: full session on df6f35a (adaptive prefetch policy), 2026-10-27 23:00-23:23, OEM Turbo restored

turn TTFT (s) A3 / A / vanilla decode tok/s A3 / A / vanilla wall (s) A3 / A
1 171.7 / 173.7 / 230 6.97 / 6.85 / 15.8 214.7 / 217.3
2 191.0 / 203.8 / 260 6.67 / 6.40 / 17.5 236.0 / 250.7
3 239.7 / 208.4 / 279 7.88 / 6.65 / 16.1 277.7 / 253.6
4 231.7 / 195.9 / 236 8.86 / 6.94 / 15.0 265.5 / 239.1
5 249.3 / 216.5 / 243 8.19 / 6.14 / 17.1 286.0 / 265.4
sum 1,083.4 / 998 / 1,248 1,281 / 1,226 / 1,341

Prefill 290 / 273 / 231 / 211 / 190 tok/s (A: 285 / 260 / 269 / 253 / 222). No guard fired (max 68 C, max 92 W, no P5), but the GPU was power-limited again from turn 3 on: mean draw 54 / 56 / 42 / 45 / 49 W and mean SM clock 1894 / 1665 / 1275 / 1268 / 1063 MHz over the five fifths of the run, SW Power Cap active, gdn 26-29 s per turn against 12-13 s in turns 1-2 (and in run A). So turns 3-5 of A3 are not comparable with run A; turns 1-2 are (TTFT -2 and -13 s against A, wall -2.6 and -14.7 s). The ratio gdn(turn 3)/gdn(turn 2) = 2.2 explains the 30-40 s of extra prefill per turn; the rest of A3 matches A.

Decode: 6.97 / 6.67 / 7.88 / 8.86 / 8.19 tok/s. The first decode of a fresh engine (6.97) kept run A's value (A2 without the pass: 5.22), turns 3-5 are 15-45 % above run A's 6.1-6.9, with a slower GPU. The policy log (every 64 groups, 621 lines): preferred = pass in 458, skip in 163; the per-group averages are noisy (pass 0.36-0.65, skip 0.21-0.80 ms per expert) and the choice flips between the two about every 1,000-2,000 groups, 29 % of the groups ran the skip (12,020 of 41,733). So in this run the policy mostly sat on the pass with excursions to the skip, and did not reproduce the 0.34-0.43 ms per expert of the all-skip arm of section 7 (window/expert 0.455-0.559 in A3), though the throttled GPU lengthens every window and the two effects cannot be separated from this run. A decode A/B at depth (adaptive / always on / always off) would tell; not run.

11. Vanilla with STRATA_ROUTE_TAIL_SKIP=0 (exact), clean run g2-vanilla-noskip, 2026-10-27 23:31-23:55

The first attempt (23:24) overlapped a Balanced OEM profile and was stopped in turn 1; this run started at 23:31 with the limit at 110 W rising to 127 W in the first minutes (Current Power Limit is now a column of mon.csv: 110.0-126.6 W over the whole run, max 67 C, max 95 W, no P5). The engine log of this run has no "ROUTE_TAIL_SKIP=7 is ON" line and no skip counters, so the skip was off.

turn TTFT (s) exact / default vanilla / our A3 decode tok/s exact / default / A3 wall (s) exact / default
1 238.1 / 230 / 171.7 9.03 / 15.8 / 6.97 271.3 / 249.0
2 261.9 / 260 / 191.0 10.97 / 17.5 / 6.67 289.2 / 277.4
3 297.8 / 279 / 239.7 12.02 / 16.1 / 7.88 322.7 / 297.8
4 238.5 / 236 / 231.7 11.23 / 15.0 / 8.86 265.2 / 256.0
5 245.3 / 243 / 249.3 13.00 / 17.1 / 8.19 268.3 / 260.3
sum 1,281.6 / 1,248 / 1,083 1,416.6 / 1,341 / 1,281 (A3), 1,226 (A)

Vanilla's prefill is the same with or without the skip (192 / 192 / 179 / 197 / 186 tok/s; the skip only acts in decode). Its decode is 9.0-13.0 tok/s without the skip against 15.0-17.6 with it: the lossy default is worth 30-40 % of its decode speed (about 33 s instead of 18-20 s per 300 tokens), and the expert-cache hit rate it reports falls from 62-70 % to 53-60 % (more lookups: 178-189 k per turn against 150-168 k). Against this exact vanilla: our wall 1,226 s (run A) / 1,281 s (A3, GPU power-limited from turn 3) is 10-13 % lower than 1,417 s, TTFT sum 998-1,083 s against 1,282 s; decode is still behind (ours 6.1-8.9, vanilla exact 9.0-13.0, 1.4-1.5x).

12. Shipped defaults of the laptop profile and the workstation preset: the audit

Rule of the owner: the defaults are the speed-optimal ones. For each setting, what the measurements say and what was done (deploy/rust-runtime/profiles/rtx3080-16g.json, crates/deploy/src/resources.rs):

setting before measured now gate / risk
prefill_capacity + memory.prefix_cache_block (the grid caps the chunk) 2048 / 2048 (unset) prefill 110 tok/s at 2048, 176-290 at 6144; TTFT sum 2,100+ s -> 998-1,083 s (runs b, A, A3); 8192 needs about 2,575 cache slots and the workstation budget has 2,234 (refused) 6144 / 6144; the preset lowers it when the GPU budget cannot lend it (prefill_capacity_for_budget: 14+ GiB 8192, 13 GiB 6144, 12 GiB 3072, less 2048; never raises), so a smaller budget cannot stop the engine from opening no quality gate yet: the chunk size changes the rounding order of the prompt path (docs/prefill-throughput.md: identical greedy ids at 2048 / 4096 / 6144 on one 16k prompt, different at 8192); q_pair / R-hash arms 2048 against 6144 not run. Rounding-level, not lossy
memory.prefix_cache_tail reply corrected in section 13: runs b, A, A3 had the prefix cache OFF (the exact reuse was the conversation cache); with the prefix cache on and grid 6144 the shipped defaults reuse 43,008 (prompt) or 36,864 (reply, one run, GPU limit dipped) tokens on turn 2, not 45,761 prompt (one run each; no data that reply is better) no numerics (only where a checkpoint is taken). The cost: a reply that the next request repeats verbatim (an agent echoing text) is re-read (about 300 tokens, 1-2 s)
context_tokens 8192 the owner's work is 256k; every run in this document ran --context-tokens 262144 under the workstation preset (KV: 0.65 GiB VRAM, 3.1 GiB pinned host; the preset's 11 GiB engine-fixed figure was measured at 256k) 262144; the preset needs nothing else for 256k none; max_output_tokens follows (32768). A host with less than the preset assumes still fails the preflight
CPU workers 12 (preset: logical cores - 4) 7 pinned workers, one per physical core (vanilla's choice); +5 to +18 % decode in the partial A/B 7 (449b7a1, already on main); 15 on the 16-core server none
PLE read-ahead + own file objects - input.ple 39-77 s per turn -> 1 s on by default on Windows (ee4cb59) non-lossy, 1.36M rows compared
prefetch pass always on 8.70 -> 10.58 tok/s warm, 6.85 -> 5.22 cold adaptive (824f3c3); LELEKA_CPU_PREFETCH=on/off override non-lossy; A3: the policy flips between the modes, no gain over the pass shown yet
LELEKA_STAGE_PRIORITY off the cyclic-scan microbench says 4x on the scan; end-to-end effect not measured (run d invalid) off non-lossy, unmeasured -> stays opt-in
resident_budget_gib (pinned experts), RAM left to the desktop (18 GiB), gpu_budget (13 GiB, margin 2 GiB) planner values not varied in any run; the decode page-in (gap 4) suggests more pinned RAM, the 8192 chunk and a bigger cache suggest 14 GiB unchanged owner's policy (desktop headroom against speed)
route tail skip off vanilla's default is worth 30-40 % of its decode (section 11) off lossy, quality gate failed on the 5090
PcieAuto / pcie_frac 0 (pageable bank) pageable-source PCIe was slower than the CPU pool (docs/windows.md); vanilla's auto share not tried here unchanged not done

13. Smoke of the shipped laptop defaults (2026-10-28 00:00-00:25, build c97ffd0 code, leleka up --native --preset workstation with no tuning flags) and a correction

Start. The stack reaches ready in 77-89 s; the plan prints the workstation preset (7 workers, VRAM budget 13.0 GiB, 13,312 MiB, 7 GiB page-locked experts); the engine args carry --context-tokens 262144 --original-prefill-capacity 6144 --prefix-cache-tail prompt --prefix-cache-block 6144; the log prints leleka-serve cpu: ... kernel family on this core: AVX-512, leleka-serve gpu: CUDA driver 13.4 ... sm_86 companions in this build: yes, prefix cache on: block/grid 6144 tokens, budget 5449 MiB, expert cache 2234 slots ... the prompt path borrows its last 2016 slots (the 13 GiB clamp keeps 6144: 2016 + 128 <= 2234). Power limit 117-126 W, max 67 C. No memory-governor shed or reject, no error; one working-set trim line.

turn TTFT (s) decode tok/s cached_tokens wall (s)
1 179.7 6.66 0 224.7
2 205.6 6.42 43,008 252.3

Correction of earlier statements. cached_tokens on turn 2 is 43,008 (7 grid points of 6144), not the 45,761 of runs b, A and A3. In those three runs the reconfigure (which I used to set the chunk) reopened the stack with the prefix cache off (prefix cache off (budget Auto, available host memory ~20 GiB): the automatic budget is 0 after the reopen), so their requests were served by the Original's conversation cache, which resumes exactly at the turn boundary (45,761, then 95,837 ...). My statements that tail prompt gave exact reuse were wrong: with the prefix cache on (the shipped path) a request resumes at the last grid checkpoint (43,008 of 45,761: 2,753 tokens, about 13 s more TTFT on turn 2; up to 6,143 tokens per turn), because the prompt-end checkpoint sits at n-1 while the next turn's prompt diverges at n-5 (the generation prompt of the template). So the shipped defaults are about 13 s per turn slower than runs A / A3 (about +5 % wall, estimate), and runs b / A / A3 measure the configuration chunk 6144 + prefix cache off + conversation cache. That configuration is faster on this single-conversation session; its cost is the loss of the cross-request prefix reuse (several agents sharing a prompt prefix) - the owner's call (memory.prefix_cache_mib: "off"), not changed here.

A second smoke with prefix_cache_tail: reply (to see whether that default is better): turn 1 TTFT 168.0 s, decode 6.38; turn 2 cached 36,864 (6 grid points: one block fewer admitted), TTFT 235.0 s, decode 7.08, but the GPU's power limit fell from 110-126 W to 51 W (P3) during turn 2 (the guard watches P5 only), so turn 2 is not comparable. No data favours reply, so the shipped value stays prompt.

14. Why the prompt-end checkpoint went missing, and the fix (2026-10-28)

The coordinator was right that my "diverges at n-5" explanation was wrong: the tail is taken at n - 1 and the 5090 resumes there (resume=45765). The laptop logs showed no prefix tail admit (prompt end) line for a trivial reason, that line was printed only with LELEKA_PREFIX_TRACE, and every non-admitted outcome of after_prefill was dropped silently (Ok(_) => {}). Now after_prefill / after_decode always log what they did, and a refusal carries its numbers (prefix tail (prompt end) not taken: LowMemory: low memory at 45765 tokens: available X MiB, additional Y MiB (...), floor Z MiB; grid points under LELEKA_PREFIX_TRACE).

Cause, seen in the first run with the logging (smoke without the fix): prefix admit (grid point 36864) not taken: LowMemory: available 8895 MiB, additional 226 MiB, floor 9216 MiB. The checkpoint admission wants available - additional >= soft floor + reserve (8192 + 1024 MiB). On Windows the engine's touched mapped expert pages sit in its working set and count as used, and the governor's trim only runs when the reading is below the soft floor, so a host that reads between the soft floor and the admit floor (the normal state of this laptop: 6.5-9 GiB between trims) refuses every checkpoint until the next trim happens to land. Which checkpoint is refused depends on the moment: the earlier smokes lost the 7th grid point or the tail (43,008 and 36,864 tokens reused), this one lost the 6th grid point but kept the tail (turn 2 reused 45,765). The tail refusal in the earlier smoke was inferred from the same mechanism, it was not logged then.

Fix: a refused checkpoint is judged again once after the governor hands the trimmable pages back (Governor::available_after_relief(needed), at most one trim per 250 ms; unknown telemetry stays closed; no effect off Windows). Run with the fix, shipped defaults, LELEKA_PREFIX_TRACE=1: all seven grid points (6144 ... 43008) and the prompt-end tail (45765) admitted, no refusal; turn 2 cached_tokens 45,765 (smoke: 43,008). TTFT 192.5 s / 218.9 s for turns 1 / 2 and decode 6.82 / 7.26 tok/s, but the GPU power limit read 51 W (P3) for the whole run (the cap is partly back, the guard only reacts to P5), so these times are not comparable with the 179.7 / 205.6 s of the 117-126 W smoke; the saving is the 2,757 tokens of turn 2 that are no longer re-read (about 10-13 s at the uncapped prefill speed). 71 prefix tests and the 545 runtime / 80 memory unit tests pass.