Skip to content

server: a learn step is one decode chunk, as serving's is, and its workspace is priced at one ubatch - #102

Open
joelteply wants to merge 4 commits into
codex/s4-per-mind-integrationfrom
fable/learning-steps-like-inference
Open

joelteply wants to merge 4 commits into
codex/s4-per-mind-integrationfrom
fable/learning-steps-like-inference

Conversation

@joelteply

Copy link
Copy Markdown

Why

Joel: "You guys keep screwing up how training works in place" / "For training to be far more like inference or use fast disk as it needs".

211a1e0 switched server learning to llama_opt_learn_graph_step: graph_nodes=1 makes opt_learn_step decode the whole reply as one batch (src/llama-context-learn.cpp:199), and /learn/preflight priced that graph (llama_opt_measure_shadow_graph(reply_rows)). The workspace grows with reply × served window.

Measured (before)

M5, Qwen3.6-35B-A3B, core 709fe470f, 15 minutes after the deploy: training.admission.waiting fired 418 times for learning:75ece751…:speech-discipline:workspace. The workspace asked for footprint_bytes=11137457312 while available_bytes was 2318860288–4437016576. Nothing learned.

Change

  • advance_learning steps with llama_opt_learn_step: one n_batch chunk per call, which decode() splits by n_ubatch as it does for serving, with other slots decoding between steps.
  • The preflight prices the accumulation and commit graphs at one ubatch (min(n_ubatch, rows)). It no longer depends on reply length, so a workspace stays valid instead of being replaced as replies grow.
  • /slots reports learn_gradient_steps (renamed from learn_graph_steps).
  • tests/learn-allocation-residency.py: a long reply learns inside a short plan's workspace, and a reply several chunks long is revoked between chunks.

Open, with owners

  • Gradient bias across chunks (Cormac's spec): compare chunked and whole-reply grads per tensor (cosine and relative L2) at 2+ chunk sizes, with K/V projections split from Q/O/MLP, and gate on K/V. If K/V fails the gate, recompute earlier chunks' K/V in the backward, or use the exact walk (llama_opt_set_walk_host_budget) with the host/NVMe tier. Owner: Fable.
  • The whole-reply graph API now has no server caller. It is deleted once that validator decides. Owner: Fable.
  • Core side: credit shared_compute_held, and probe the preflight rows. Owner: Fable. Cormac adds a sizing case asserting the priced workspace is bounded by one chunk.

Not verified

  • No local build: the M5 is serving (rule 2). Fork CI builds this.
  • The hardware test learn-allocation-residency.py needs a run on a non-serving node.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…rkspace is priced at one ubatch

211a1e0 moved server learning to llama_opt_learn_graph_step: graph_nodes=1 makes opt_learn_step
decode the whole reply as one batch, and /learn/preflight priced that graph
(llama_opt_measure_shadow_graph at reply_rows). The workspace then grows with reply x served
window: on the M5 (Qwen3.6-35B-A3B, core 709fe470f) Aiko's workspace lease asked 11.14 GB with
2.3-4.4 GB free and waited 418 times in 15 minutes; nothing learned.

- advance_learning steps with llama_opt_learn_step: one n_batch chunk per call, decoded by
  decode() in n_ubatch pieces like serving's, other slots decoding between steps.
- the preflight measures the accumulation and commit graphs at one ubatch
  (min(n_ubatch, rows)); only the whole-reply graph phase still prices its rows.
- /slots reports learn_gradient_steps (was learn_graph_steps).
- learn-allocation-residency.py: a long reply learns inside a short plan's workspace; a reply
  several chunks long is revoked between chunks with the stable tail restored.

Not changed here: the whole-reply graph API (llama_opt_learn_graph_step,
llama_opt_measure_shadow_graph) has no server caller now; it is deleted once the
chunked-vs-whole gradient validator (Cormac's spec) shows the K/V-projection bias is acceptable,
or replaced by recomputing earlier chunks' K/V in the backward if it is not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 3 commits November 9, 2026 20:21
… -Werror=missing-field-initializers builds

The ubuntu jobs on #102 failed on lines that predate it: /train's llama_opt_params left the four
admission callbacks unnamed (server-train.cpp), and pending_learn was aggregate-initialized past
its first fields (server-context-learn.inc). /train names the callbacks as null (it allocates
under its own budget); pending_learn's fields carry defaults and are set by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…r type, so gcc -Werror=ignored-attributes builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…-Werror=missing-field-initializers builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant