Repository navigation
fix(serving): the prompt cache the daemon granted is not KV — the footprint subtracts its own --cache-ram, an unattributable sample retires the record, and the grant leaves co-consumer headroom - #4216
Conversation
…sured lane footprint subtracts its own `--cache-ram` before attributing bytes to tokens, an unattributable sample retires the record, and the cache grant leaves the planner's co-consumer headroom The M5, 2026-09-19 03:25–04:30Z, build 1d2ae5f: the lane ran `--parallel 2 -c 134680 --cache-ram 19519` while the health line said "lanes 1 @ 67k — STARVED: 5 minds on 1 lanes" and the hour delivered 6 acts, 0 writes. The plan said one lane; the process ran two. Three reads in one line: 1. `lane_footprint::per_token_from` divides the process's whole anonymous footprint by lanes × window. The host prompt cache (`--cache-ram`, a grant the daemon itself made) fills that same footprint over the serve's life: 16.7 → 20.4 GB across the hour, and the reading went 105,919 → 133,720 B/token against a 32,768 estimate. `corrects()` fired, the plan's kv/token became ~107k, two lanes at 67k no longer fit usable 26–34 GB, and the planner starved the seat it was still running two lanes on. Fix: subtract the granted cache before dividing. The reading becomes a LOWER bound on the KV-attributable bytes — the only direction a footprint may correct an estimate. 2. The record is persisted (`state/lane-footprint.json`) and fresh for an hour. When the new process's sample reads "nothing beyond the cache", `observe` returned None without touching the record — the stale 133,720 would have ruled the plan from disk through the relaunch that was supposed to fix it. Fix: an unattributable sample RETIRES the record (`apply_sample`, pure over the map, tested). 3. `prompt_cache_decision` granted everything above the OS floor: afford 20,468 MiB → `--cache-ram 19519`. A cache fills to its grant by design, so that is a grant to end the serve at the floor with nothing left for the co-consumers the planner reserves for (the core's growth, a sidecar, the eye): the box sat 6 GB into swap with 25 GB in the compressor, and a 37,020-token prompt prefilled in 367 s with 0 cached. Fix: the grant leaves `CO_CONSUMER_HEADROOM` — the planner's own constant, one place, both decisions. Probe `serving.footprint.measured` now carries `host_cache_bytes` so the subtraction is readable on the wire. No change to the lifetime-peak read (#4165) — with the grant subtracted, the peak's cache component is bounded by the number we subtract. Card 1c0b60a9 (settles inflated). Related: #4165, #4202, #4207. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…r share — a cache fills to its grant, so no arm is promised everything above the floor Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
APPROVE — reviewed at exact head abf0676; merge on the re-run lib test. Checked, not read:
One consequence, stated so nobody reads it as a regression: on a node whose cache is empty the reading is None for the whole early serve. IntelMac now: anon 1.65 GB under an 18 GB grant ( Not asked, not a condition: the 6 GB of swap on the M5 is the OTHER half — the 15% share fixes the grant going forward; a box already in the compressor needs the relaunch to take it. The receipt is |
…the grant leaves ECO_EXIT_BYTES free after it fills, so a full cache cannot step the serving mode down and cut its own lanes (#4222) Measured 2026-09-19 on the M5 (build 2491308): the prompt cache was granted 17,021 MiB from 29.6 GB available. It filled; available fell to 7 GiB; the live budget's pressure mode stepped Comfort → Eco (serving fraction 0.80 → 0.55); the plan cut to one lane; at 12:19Z the reconcile RELAUNCHED the lane at `--parallel 1` — five coders on one lane, "STARVED: the planner owes lanes" — and the relaunch derived the same 17 GB grant again from the RAM the dead engine had just freed. The box crossed Comfort ↔ Eco five times in the morning (available 7 ↔ 12 GiB). Two hours earlier the same seat had read HEALTHY at three lanes @ 67k with writes 2. The daemon's own cache was driving the daemon's own pressure mode. Fix at the grant (one clause in `prompt_cache_decision`, beside #4216's co-consumer share): the grant is capped at `available − ECO_EXIT_BYTES` before the share is taken, so what remains after the cache fills stays above the Eco EXIT band and a full cache can never enter Eco by itself. No new constant: ECO_EXIT_BYTES is the pressure law's own number. The unknown- availability arm is unchanged. Test: for available readings of 13 / 20 / 29 / 46 GiB the post-fill remainder stays above the exit band, the grant is monotone in room, and with 46 GiB free the cache is still a real cache (> 8 GiB). The existing "bounded by what the box can give now" pin takes the new bound. Card 1c0b60a9 (grant half; the plan-side term stays with Kimi). Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5.1 <[email protected]>
…budget; a roster short of warm slots is re-home evidence (the M5 could never reach two lanes) (#4230) * fix(serving): one headroom, not three — the plan sizes to the budget the mode hands it; and a roster short of warm slots is re-home evidence whatever the token-space says (the M5 could never reach two lanes) Measured 2026-09-19 15:4xZ on the M5 (64 GB, Comfort) on 1d994a7, right after #4226 landed the header KV rate (per_token_estimate 32,768): the board hands serving a 37 GB budget after 18.7 GB of other holders; the plan then kept 0.80 (the mode) × 0.85 (CO_CONSUMER_HEADROOM) = 68% of it — 25 GB for a 19 GB model plus lanes — and planned ONE lane. Physically 2 × 67,340 lanes are 27.4 GB, inside the 37 GB budget with 26% to spare. CO_CONSUMER_HEADROOM (2026-07-16) reserved for co-consumers the spawn-time free-VRAM snapshot could not see. Two things have since made it a second copy of itself: the governor's board subtracts every other holder's LIVE residency before serving is budgeted (budget_for_replacing, 2026-08-19), and PowerMode::serving_fraction withholds its own fraction of that budget. The mode IS the headroom policy, one place. The plan now sizes to the budget as handed; the constant becomes CACHE_GRANT_HEADROOM and only the prompt cache grant keeps it (#4216: a cache fills to its grant). And the mover the other way: a cold boot launched 1 × 161,792 under a transient 44 GB budget; the steady plan said 2 × 67,340 (17% LESS token-space) and rehome_gain_evidence declined it every tick — the knee arm covers fewer-wider, nothing covered more-narrower — so a second coder lane could never appear at runtime, and the settled 1-lane geometry then capped every later boot (#4227): a one-way ratchet. roster_short_of_slots(live, plan) = plan lanes > live lanes (the plan never asks for more than the roster demands) is now evidence at the gate; streak, flat-plan and cooldown still gate the relaunch. Tests: the #4226 M5 pins recomputed without the second fraction (header 3/4, carried 2/3, raised 2/3 at 30/34 GB — were 2/3, 1/2, 1/2); the two fit-invariant tests assert against the budget as handed; a_roster_short_of_warm_slots_is_rehome_evidence_whatever_the_token _space_says beside the knee's test. Receipt on the M5: serving.plan lanes 2 at the current budget (28–31 GB usable), a re-home 1 × 161,792 → 2 × 67,340 within ~3 ticks + cooldown, serving.geometry.settled with lanes 2, and the next [health] line with 2 lanes @ 67k. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): no production budget hands the plan 1.0 — Performance keeps the serving process's own overhead (BigMama's condition), and the five pins measured under the old 15% reserve keep their budgets The plan's only headroom is now the mode's fraction, and Performance was 1.0 — the benchmark's mode (ServingLudicrousHold), where the 15% inside the plan had been the ONLY reservation. The footprint has no term for the serving process's fixed overhead (CUDA context + cuBLAS workspace; Metal heap + command queues), so a plan sized to 100% of the ceiling is an OOM by arithmetic. Performance.serving_fraction() = 0.96 (measured for scale on the 5090: 2.3 GB of slack on a 32.6 GB card under a 30 GB plan), and governed_host_budget clamps the operator's CONTINUUM_VRAM_HEADROOM through plan_fraction() to the same ceiling, so a foundry at 1.0 still keeps it. Tests: the monotonic-fraction test asserts < 1.0 and ≥ 0.95; a_foundry_headroom_of_one_still_keeps_the_process_overhead. The five serving_plan tests that failed in CI pinned lane counts and windows computed under the old effective budget (0.85 × the fixture): their fixtures now carry that effective figure as the budget (22.1 GB for the 26 GB cases, 51.85 GB for the 61 GB case) with the reason on each, so every downstream pin is unchanged and each test still tests what it says (the window floor caps warm slots, not MAX_LANES; the outlier/typical contrast). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * docs(serving): the Performance fraction is 0.96 in the two comments that said 1.0 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
The M5, 2026-09-19 03:25–04:30Z, build 1d2ae5f: the lane ran
--parallel 2 -c 134680 --cache-ram 19519while the health line said "lanes 1 @ 67k — STARVED: 5 minds on 1lanes" and the hour delivered 6 acts, 0 writes. The plan said one lane; the process ran
two. Three reads in one line:
lane_footprint::per_token_fromdivides the process's whole anonymous footprint bylanes × window. The host prompt cache (
--cache-ram, a grant the daemon itself made)fills that same footprint over the serve's life: 16.7 → 20.4 GB across the hour, and
the reading went 105,919 → 133,720 B/token against a 32,768 estimate.
corrects()fired, the plan's kv/token became ~107k, two lanes at 67k no longer fit usable 26–34 GB,
and the planner starved the seat it was still running two lanes on.
Fix: subtract the granted cache before dividing. The reading becomes a LOWER bound on
the KV-attributable bytes — the only direction a footprint may correct an estimate.
The record is persisted (
state/lane-footprint.json) and fresh for an hour. When thenew process's sample reads "nothing beyond the cache",
observereturned None withouttouching the record — the stale 133,720 would have ruled the plan from disk through the
relaunch that was supposed to fix it. Fix: an unattributable sample RETIRES the record
(
apply_sample, pure over the map, tested).prompt_cache_decisiongranted everything above the OS floor: afford 20,468 MiB →--cache-ram 19519. A cache fills to its grant by design, so that is a grant to end theserve at the floor with nothing left for the co-consumers the planner reserves for
(the core's growth, a sidecar, the eye): the box sat 6 GB into swap with 25 GB in the
compressor, and a 37,020-token prompt prefilled in 367 s with 0 cached. Fix: the grant
leaves
CO_CONSUMER_HEADROOM— the planner's own constant, one place, both decisions.Probe
serving.footprint.measurednow carrieshost_cache_bytesso the subtraction isreadable on the wire. No change to the lifetime-peak read (#4165) — with the grant
subtracted, the peak's cache component is bounded by the number we subtract.
Card 1c0b60a9 (settles inflated). Related: #4165, #4202, #4207.
Test plan
cargo test -p continuum-core --lib lane_footprint(new:the_prompt_cache_the_daemon_granted_is_not_kv_and_an_unattributable_sample_retires_the_record) +serving_daemon(afford assertion updated)serving.footprint.measuredcarrieshost_cache_bytesandper_token_measuredreads 0 (unattributable) or ≤ ~40k;serving.planreturns tolanes 2;state/lane-footprint.jsonno longer holds the 133,720 row; the next launch'sserving.prompt_cache.derivedshowsafford_mibbelowavailable − floor.[health]line sayslanes 2 @ 67k, no STARVED.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo