From 1de90369300b11b2d47c3f5692a616af174fd223 Mon Sep 17 00:00:00 2001 From: Joel Teply Date: Tue, 17 Nov 2026 23:20:58 -0600 Subject: [PATCH] One mind decodes at a time: the serving plan holds one engine slot, never one per resident Joel, 2026-11-18: "Never run the parallel." demand.rs planned residents + 1 lanes, so the M5 launched llama-server with --parallel 5 -c 745985: five minds resident in the engine at once. Each switch's page save waited behind another mind's decode, up to 11.6 s (inference.kv_page.action 05:13-05:16Z: saves 6.8 / 8.7 / 13.1 s, of which the engine's own copy was 0.8-1.5 s). The plan is now one slot: the active mind. Every other resident is paged out and her page moves in on the switch; a helper call borrows the one slot through the existing single-slot save-and-lend path (inference/slots). No scratch slot: helper calls decoding beside the mind is parallel decode too. Measured after deploy (owner Fable): page-action wait_ms near zero, decode tok/s per act at the single-stream rate, acts/hour at 4 residents vs the 05:14Z health line (23 acts, 87% reuse). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --- .../src/modules/serving_daemon/demand.rs | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/core/continuum-serving/src/modules/serving_daemon/demand.rs b/core/continuum-serving/src/modules/serving_daemon/demand.rs index c76dfdcbda..0eae1d41e9 100644 --- a/core/continuum-serving/src/modules/serving_daemon/demand.rs +++ b/core/continuum-serving/src/modules/serving_daemon/demand.rs @@ -138,22 +138,13 @@ impl ServingDaemonModule { .as_deref() .and_then(crate::inference::prefill_knee::knee_for); let knee = crate::inference::prefill_knee::tighter_knee(decode_knee, prefill_knee); - // +1 SCRATCH LANE: the adapter's traffic-class placement - // (`inference/slots`) reserves the HIGHEST slot for sidecar/background/ - // probe traffic whenever n_slots ≥ 3 — so a plan sized to the resident - // count leaves residents−1 warm slots for residents minds, and one - // citizen is ALWAYS being LRU-evicted (measured 2026-09-01: interleaved - // hit_rate=0.0 turns between 0.55–0.77 ones — the rotation thrash). - // Fund the scratch slot HERE, in the demand the fixpoint solves for: - // the window shrinks slightly to pay for it (floor-guarded at one full - // assembled turn), and every resident keeps her prefilled prefix warm. - // residents < 2 keeps the old shape (the adapter reserves nothing - // below n_slots 3, so asking for the extra lane would waste it). - let lanes = if residents >= 2 { - residents + 1 - } else { - residents - }; + // ONE MIND DECODES AT A TIME (Joel, 2026-11-18: "Never run the parallel"). The engine holds + // ONE sequence: the active mind. Every other resident is paged out, and the switch moves + // her page in; a helper call borrows the one slot through the single-slot save-and-lend + // path (`inference/slots`). One slot per resident (the old `residents + 1`) put five minds + // in the engine at once on the M5 (`--parallel 5`): each switch's save waited up to 11.6 s + // behind another mind's decode (`inference.kv_page.action`, 05:13-05:16Z 2026-11-18). + let lanes = residents.min(1); // The knee bounds the TOTAL slot count, scratch included: the curve is measured on // in-flight model calls, and the scratch slot is one of them (first cut clamped the // resident count and the +1 put the plan right back on the collapsed side).