Skip to content

server: --cache-ram is the one host budget of the prompt cache and every slot's checkpoints (4.7.6 step 1) - #138

Open
joelteply wants to merge 1 commit into
codex/s4-per-mind-integrationfrom
fable/one-host-budget-s4
Open

joelteply wants to merge 1 commit into
codex/s4-per-mind-integrationfrom
fable/one-host-budget-s4

Conversation

@joelteply

Copy link
Copy Markdown

Throughput fix for the M5 (CONTINUUM-ENGINE 4.7.6, step 1).

Why

On 2026-11-16 at 19:53Z the engine had been up 2 h 58 m with four residents. Its flags were --cache-ram 9494, --ctx-checkpoints 32 and --parallel 5.

  • vmmap showed 16.1 GB swapped out of the engine (resident 33.2 GB); system swap was 15.0 of 15.4 GB.
  • Decode ran at a median 1.3 tok/s over the last 80 acts. Par is about 56.

The cause is two host holders sized apart, with nothing bounding their sum:

  • checkpoints of 89–103 MiB each, with full stores;
  • prompt-cache entries of up to 2.35 GB, with 224 cache evictions in three hours.

What

  • --cache-ram N (MiB, greater than 0) now bounds the prompt cache and every slot's checkpoints together.
  • Checkpoints are charged first. Each is quoted before it is copied (target and draft parts). The slot holding the most checkpoint bytes gives up its least valuable one, keeping her head, until the new one fits. A checkpoint larger than the whole budget is not made.
  • The prompt cache holds the rest. Its limit is the budget minus the checkpoint bytes, applied after every checkpoint and before every cache save.
  • -1 (no limit) and 0 (disabled) behave as before.

No new flag yet. The one-pool grant ABI (4.7.6 revision) replaces both sizers together with Codex's core change; the arena follows.

Measured

qwen35-0.8b on the M5 with --cache-ram 150 --ctx-checkpoints 32 --parallel 4, four slots by three rounds of growing prompts: 8 budget evictions of 19.3 MiB checkpoints; 0 warnings.

Measured after deploy

Owner: Fable, on the M5 with the real residents. Engine swapped bytes (vmmap) and decode tok/s over 3 hours, against today's 16.1 GB and 1.3 tok/s.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ery slot's checkpoints (CONTINUUM-ENGINE 4.7.6 step 1)

The M5, 2026-11-16 19:53Z: the engine (up 2h58m, 4 residents, --cache-ram 9494, --ctx-checkpoints 32,
--parallel 5) held 16.1 GB SWAPPED (vmmap: resident 33.2G, swapped 16.1G; system swap 15.0 of 15.4 GB) and decode
ran at a median 1.3 tok/s over its last 80 acts (par ~56): two holders sized apart, nothing bounding their sum
(the log: 89-103 MiB checkpoints, stores full; cache entries up to 2.35 GB, 224 cache evictions in 3h).

- --cache-ram N (MiB, > 0) bounds the prompt cache AND every slot's checkpoints together.
- Checkpoints are charged first (they serve the minds in the slots): a checkpoint is quoted before it is copied
  (llama_state_seq_get_size_ext, target + draft parts), and the slot holding the most checkpoint bytes gives up
  its least valuable one (checkpoint_to_evict keeps her head) until it fits; one larger than the whole budget is
  not made.
- The prompt cache holds the rest: its limit is the budget less the checkpoint bytes, applied after every
  checkpoint and before every cache save (the cache then evicts down to it).
- -1 (no limit) and 0 (disabled) behave as before.

Step 1 of 4.7.6: the accounting bound, no new flag (the core's existing --cache-ram figure is the grant until
the one-pool ABI replaces both sizers with Codex's core change). The arena (4.7.6 revision) follows.

Receipt (qwen35-0.8b, M5, --cache-ram 150 --ctx-checkpoints 32 --parallel 4, 4 slots x 3 rounds of growing
prompts): "host budget (prompt cache + checkpoints, all slots): 150 MiB"; 8 budget evictions of 19.3 MiB
checkpoints; 0 warnings. The real-persona read is the M5 deploy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 16, 2026
…nd flashed minds' RAM copies count against --cache-ram; to make room, the coldest parked mind goes down to flash first (her checkpoints with her), before any lane gives one up

The make-room decision counts only what stays resident (a RAM copy is freed within ms of its write landing), so
sending one mind down is seen to free her checkpoints and the loop stops there.

Receipt (qwen35-0.8b hybrid, M5, --cache-ram 60 with three ~38 MiB-of-checkpoints minds through a two-mind pool, 3
rounds): 7 minds sent to flash under the budget before 4 lane-checkpoint evictions; 3 of 6 returns re-prefilled
(cache_n 0) because the lane's checkpoint at their resume point was among those evicted: the budget's trade-off at
an intentionally tight grant (unbounded, every return was cache_n 3300). Choosing which checkpoint goes by value
per byte (keep the one her next resume needs) is 4.7.6's pool policy, next. 0 warnings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant