Skip to content

Yield in-place learning through the serving loop and retain served KV - #100

Closed
joelteply wants to merge 3 commits into
889580fc/seq-state-across-stream-countsfrom
codex/s4-resident-microsteps
Closed

joelteply wants to merge 3 commits into
889580fc/seq-state-across-stream-countsfrom
codex/s4-resident-microsteps

Conversation

@joelteply

Copy link
Copy Markdown

Live-sequence learning currently runs every reply batch synchronously and then discards its restored cache. This change lets the existing serving loop advance one native batch at a time while retaining the learning slot, then restores the actual served tail once. A supplied correction can differ from the generated reply; cache metadata continues to describe the actual served tokens.

Validation: Windows static CPU build; Qwen2.5 0.5B and Qwen3.5 0.8B live-sequence gradient/cache/optimizer-generation checks; existing HTTP fairness test; actual two-slot long-reply test with 497 labels and neighbor tokens emitted while the learning state was observable. Revised tail-retention test and hybrid checks pass.

Draft: measured per-chunk duty and latency, cancellation/exception proof, CUDA, and adoption of existing per-mind #85 and grant #87 remain. No resident deployment or full S4 acceptance. Cormac owns the related snapshot/receipt/past-experience stack. This extends the existing inference-context owner without a separate trainer or smaller window.

joelteply added a commit that referenced this pull request Nov 8, 2026
…d while a live reply holds it (Codex on #100)

Between a live reply's chunks the training flags are cleared but the active optimizer and its
accumulators still belong to that reply until its restoration finishes. opt_init (and the
opt_select it makes) and opt_release refuse by name while opt_reply is held; the server's unload
refuses the shadow a learn is training, whether or not any slot's stable set names it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Author

Closing as landed: every commit on this branch is already in codex/s4-per-mind-integration (canary's engine line) by patch identity, git cherry = 0 unmerged at 20b108f (Fable's queue triage, 2026-11-16). Nothing is lost; reopen if a commit is missing.

@joelteply joelteply closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant