Skip to content

Reuse native prefix checkpoints across resident view turnovers - #6171

Merged
joelteply merged 4 commits into
fable/residents-on-the-schedulerfrom
fable/head-checkpoint
Nov 20, 2026
Merged

joelteply merged 4 commits into
fable/residents-on-the-schedulerfrom
fable/head-checkpoint

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

On the M5, all 17 resident turns in the pre-deployment 900-second window rebuilt from zero. Four residents generated 7,241 tokens at 8.05 wall tokens/s.

This change keeps up to two recurrent snapshots per resident. On a matching-basis miss, the next prefill can save the exact shared native prefix before the view boundary. Reuse selects the furthest valid snapshot. Turn telemetry reports the shared prefix and the boundary chosen for capture.

Built and deployed locally before check-in. The installed binary matched the release artifact at SHA-256 c1244690c1eb1531dc6f042a0d7bf18673347987c41f3007a3172616cdacb66d. Four residents resumed. The five-minute guard observed seven acts with zero inference failures. The 900-second comparison is in progress. The new boot has a larger context window.

Review focus is snapshot lineage after switches and cuts, the memory cost per resident, and whether later turns actually rewind to the learned boundary. Stacked on #6159.

@joelteply

Copy link
Copy Markdown
Contributor Author

M5 candidate 3efa9c8, exact 900 seconds 18:34:19–18:49:19 UTC, PID 53137, artifact c1244690c1eb1531dc6f042a0d7bf18673347987c41f3007a3172616cdacb66d. Four residents completed 31 turns and 25 acts, zero inference failures. Overall 9.77 vs 8.05 tokens/s, decode 33.50 vs 34.57, reuse 54.8% vs zero. Empty outputs rose from 4 to 17; no confirmed training adoption. Context grew from 28,928 to 35,072. RSS range 24.09–24.89 GiB (prior RSS unavailable). Seven divergence restarts, six refused rewinds, eighteen successful rewinds. Fork a6af1232 src/llama-kv-cells.h::mark_checkpoint invalidates the prior checkpoint serial. src/llama-kv-cache.cpp::persona_check_rewind requires the latest serial, so earlier head snapshots cannot survive a later view take. Hold merge until per-checkpoint lineage/cut validation and a real head rewind are proven. No throughput gain attributable to the new checkpoint.

@joelteply
joelteply marked this pull request as draft November 19, 2026 18:51
@joelteply
joelteply marked this pull request as ready for review November 19, 2026 19:32

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fable review at exact head e92f225: approve, with one follow-up carded.

Verified claims:

  • The window receipt. ~/.continuum/handoff/fable/native-lineage-window.log covers [1795115643000, +900000) ms on build 3efa9c8 (PID 23049, SHA256 4c5ff6ef…). It shows 43 turns over 4 minds, reuse 0.770, 41 rewinds and 2 diverged starts, wall 14.00 / decode 33.05 tok/s, busy 987 permille, and 0 inference_failed. The native fault replay in native-lineage-replay.log shows the moved first token byte-identical=1 max|diff|=0.
  • Selection logic, read in reuse.rs::choose and driver.rs::resume.
    • choose rewinds to the furthest same-genes checkpoint whose end is ≤ the shared prefix and < the prompt length.
    • History::cut drops every slot whose end is past the cut, so the Rust side never offers a checkpoint the fork revoked on the same cut.
    • rewind_to_checkpoint(end) resolves the slot by its end, and a refused rewind restarts at 0 with the reason recorded.
    • The learned boundary is taken from the shared token ids, not from grounding_at, which avoids the message-count/token mismatch you raised.

Follow-up (card f0, owner Fable, non-blocking): Turn.boundaries: [Option<usize>; 2] and History.kept: [Option<KeptCheckpoint>; 2] carry meaning by index: 0 is the view, 1 is learned. A later change that swaps an index breaks silently. Replace both with named fields (view, learned) in one struct per owner. choose's doc also still says "her head's checkpoint", and the second slot is the learned shared prefix, so I'll reword that in the same change.

Nit: resume computes common_prefix(held, prompt) and then choose computes it again. It's cheap (one pass over ≤ 50k ids), but it can be passed in. #6174 already touches this line.

@joelteply

Copy link
Copy Markdown
Contributor Author

Correction to my review above: the follow-up card is 539c4ad2-fa6c-416b-8a15-12c3352b59b1 (owner Fable), not the placeholder 'f0'.

@joelteply
joelteply merged commit dbf522f into fable/residents-on-the-scheduler Nov 20, 2026
46 checks passed
@joelteply
joelteply deleted the fable/head-checkpoint branch November 20, 2026 18:15
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