Repository navigation
fix(serving): the measured lane footprint is its LIFETIME PEAK — the pager dips the instantaneous read 9.0 → 5.9 GB on a live lane - #4165
Merged
Conversation
…he instantaneous read — the pager dips the current figure 9.0 → 5.9 GB in a minute on a live lane Measured 2026-09-17 11:14–11:31Z on the M5: the anonymous footprint of the live server climbed 5.4 → 9.1 GB as the eight slots filled, then FELL back to 5.9 GB over the next minute while swap grew 2 GB — the same process, nothing freed, the pager just moved its pages out. The instantaneous phys_footprint is therefore not the need; the need is the most the process ever held. macOS rusage_info_v4 carries `ri_lifetime_max_phys_footprint` (field 28) beside `ri_phys_footprint` (field 7); the measurement is the larger of the two. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 19, 2026
…tprint subtracts its own `--cache-ram`, an unattributable sample retires the record, and the grant leaves co-consumer headroom (#4216) * fix(serving): the prompt cache the daemon granted is not KV — the measured 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 * test(serving): the three prompt-cache afford pins take the co-consumer 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 --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
2 tasks
joelteply
added a commit
that referenced
this pull request
Sep 19, 2026
…oken cost may not raise it; the excess is fixed residency, named on a probe (#4226) * fix(serving): a header-declared KV rate is physics — the lane's measured per-token cost may not raise it; the excess is fixed residency, named on a probe, never per-token Measured 2026-09-19 on the M5 (build 97f480e, one lane at 67,584): the GGUF header declares 65,536 B/token f16 → 32,768 at the launched q8 cache type. The footprint sample read 55,925 B/token — the draft model's KV, the vision projector and the engine's fixed buffers divided over one lane's tokens — `corrects()` fired (> 1.25 ×), and the plan carried 44,740. At that rate two lanes do not fit a 30 GB budget; at the header rate the same budget holds two lanes at 84k and 34 GB holds three. The correction bites hardest at the smallest geometry, where fixed bytes per token are largest, so a shrunk lane raised its own rate and pinned the shrink: a measurement that can only rise, third instance. "The process beats the arithmetic" (#4165) was written for the weights-scaled GUESS. Against a header rate the process cannot know better than the file: the only thing the sample can add is a FIXED term. `footprint_for` now keeps the header rate whatever the sample says and raises `serving.footprint.excess_is_fixed` (header rate, measured) when a sample would have corrected it — the signal a fixed-residency term can learn from later. A model without a header rate still learns from the process as before. `kv_rate_for_plan` is the pure law, tested. Card 1c0b60a9. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the excess a sample measures beyond the header rate is CARRIED as fixed residency per lane, never dropped — fixed_per_lane_bytes on the footprint, counted in compute_buffer_per_lane (Cormac's condition on #4226) (55,925 − 32,768) × 67,340 ≈ 1.56 GB per lane on the M5. Runtime-learned, serde/ts skipped so the row and the bindings are unchanged. Test: across 28–46 GB budgets the carried plan fits ≤ the header-only plan and ≥ the raised-rate plan, strictly fewer than header-only somewhere. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the two shorthand ModelFootprint literals carry fixed_per_lane_bytes too (CI on #4226) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): footprint_for goes THROUGH kv_rate_for_plan — the law is the code path, not a test-only mirror; apply_measured_cost and measured_per_token had no callers left and are gone (CI on #4226) Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * test(serving): the carried-fixed plan is bounded by the header-only plan, not ordered against the raised-rate plan — a fixed cost bites at small lane counts, a raised rate at large ones (31 GB: carried 1, raised 2); the M5's own numbers pinned 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #4164 (card 36dd5011). Measured on the M5 11:14–11:31Z: the live server's anonymous footprint climbed 5.4 → 9.1 GB as slots filled, then fell to 5.9 GB while swap grew 2 GB — the pager moving pages, nothing freed. The instantaneous
phys_footprintis not the need. rusage_info_v4'sri_lifetime_max_phys_footprint(field 28) is; the reading ismax(phys_footprint, lifetime_max).Tests: lane_footprint 3/3 (the anon-footprint read still positive on our own pid).
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo