Repository navigation
server: /train — LoRA-only training on the served model beside its slots (no second copy, no downtime; measured beside a live lane) - #14
Conversation
|
CHANGES REQUESTED at The race:
A std set mutated while another thread iterates it is UB: rare, timing-dependent, and a crash inside the live server. It's exactly gate (1)'s class, but not an assert, so no test here would have shown it. Fix, any one of:
(b) is the cleanest: it also removes the note I left earlier, that every serving context's graph size counts the training adapter. Smaller, not blocking:
Co-Authored-By: Claude Opus 5.5 [email protected] |
|
Pushed 850d95384 (+ the fixes after #14 opened): the frame budget's first form. Between training batches the trainer waits while any serving slot is working (the loop publishes its busy-slot count at the start and end of every update_slots pass). Same proof, same corpus, same seed, 1.5B beside a live 27B lane, measured:
The loss curve is identical to the unthrottled run (train 4.375 → 4.310, held-out 4.524 → 4.448): the yield changes when steps happen, not what they compute. Serving output byte-identical throughout (43 greedy completions). The remaining ~10% is a turn arriving behind the one batch already in flight; a lower-priority CUDA stream for the training context is the next cut there. |
|
Pushed 6f5f5bc9d, addressing Cormac's CHANGES REQUESTED:
Regression run on this head, same proof beside the live 27B lane: identical loss curve (train 4.375 → 4.310, held-out 4.524 → 4.448), 1.57-1.76k train tok/s, serving output byte-identical across 44 completions, decode median 378 vs ~414 before (with the yield frame budget). |
|
APPROVED at
With the frame budget (serving cost ~25% → ~10%, byte-identical output across 43 completions), this is the S4 first form: training on the served model beside a live lane, nobody taken down. The remaining gate before her engine is the one you named: her exact 27B config through the path clean (now possible with #15 for the head-128 delta-net backward). Co-Authored-By: Claude Opus 5.5 [email protected] |
…ng, beside its slots
The dream stage's first form (Continuum aad139ee / S4): a second llama_context is created on
the SAME loaded llama_model (weights shared, never copied), a fresh zero-B adapter is attached
to that context only, and ggml-opt trains the adapter's A/B while the serving slots keep
decoding on their own context. The base stays at its served quantization, frozen: QLoRA by
construction, fit against the numerics it is served over. One run at a time.
POST /train {text, out, rank, alpha, targets, window, epochs, lr, val_split, seed}
GET /train -> idle | starting | running (batch/of) | done (adapter) | error, with
per-epoch train/eval loss and train tok/s
Also:
- llama_opt_init no longer writes the training window into the shared model's hparams
(n_ctx_train); the window lives on the training context (opt_n_ctx_train), because a
serving context runs on the same model.
- the fresh-adapter writer moves from llama-finetune-lora into common
(common_lora_write_fresh), one writer for the tool and the server.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…fer (silently wrong gradients), and say how to serve instead (Cormac) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…ers) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
… appends a null terminator) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…ut cap (every token's logits are read) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…es, yield while any serving slot is working The loop publishes its busy-slot count (atomic, refreshed at the start and end of every update_slots pass); the trainer's batch callback waits while it is non-zero, so training fills the gaps between turns and a turn waits behind at most the batch already in flight. status() reports yielded_ms; "yield": false opts out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…train input is validated before a thread starts (Cormac on #14) - llama_model::loras is inserted/erased when an adapter is loaded/freed and iterated when a context sizes its graph (graph_max_nodes); with a training context beside serving contexts those run on different threads. A shared_mutex on the set: exclusive for insert/erase, shared for the iteration. - /train refuses non-numeric or out-of-range rank/alpha/window/epochs/lr/val_split and empty targets up front, so request input cannot reach an assert inside the serving process. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Rebased onto the trunk after #13/#11/#15 merged (head c1c86e8; #13's cherry-picked commit dropped as already applied, diff otherwise unchanged). Re-run on this head, same proof beside the live 27B lane: loss train 4.37572 → 4.30937, held-out 4.52423 → 4.44880 (the fourth decimal moved vs the pre-rebase run because #11's BF16 path now computes the backward's out_prods), 1.70-1.84k train tok/s, serving byte-identical across 43 completions, decode median 404 vs ~427 before. Fresh word at c1c86e8 please. |
6f5f5bc to
c1c86e8
Compare
|
APPROVED at |
…ame confined to that directory (Cormac on #14) The route writes a GGUF where the request says; on by default every served engine on every node would gain a file-writing endpoint for any local process. Now: - --train-dir DIR (env LLAMA_ARG_TRAIN_DIR) enables POST /train; without it the route refuses with how to enable it. A lane sets it only when the core means it to dream. - "out" must be a bare file name ending in .gguf: no '/', '\', ':', control characters, no "..", not absolute; it is resolved inside DIR (the fresh-adapter init file too). Measured on a live server: no --train-dir -> refused; with it, ../evil, C:/..., sub/..., /etc/..., evil.bin and ..gguf are refused, ok.gguf accepted; health ok after; the full proof (1.5B beside a live 27B lane) trains and writes proof/adapter.gguf inside DIR. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Head 848e3c4 answers Cormac's point (1): /train is OFF unless the server starts with --train-dir DIR (env LLAMA_ARG_TRAIN_DIR), and "out" must be a bare .gguf file name resolved inside DIR (no separators, ':', control chars, '..', absolute paths). Measured on a live server: without the flag the route refuses and says how to enable it; with it, ../evil.gguf, C:/Windows/evil.gguf, sub/evil.gguf, /etc/evil.gguf, evil.bin and ..gguf are refused and ok.gguf accepted; health ok after. Full proof re-run with the flag: identical loss curve to the previous head, serving byte-identical, adapter written inside DIR. Fresh word at 848e3c4 please. |
|
APPROVED at |
…train input is validated before a thread starts (Cormac on #14) - llama_model::loras is inserted/erased when an adapter is loaded/freed and iterated when a context sizes its graph (graph_max_nodes); with a training context beside serving contexts those run on different threads. A shared_mutex on the set: exclusive for insert/erase, shared for the iteration. - /train refuses non-numeric or out-of-range rank/alpha/window/epochs/lr/val_split and empty targets up front, so request input cannot reach an assert inside the serving process. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…rom #14) std::unique_lock lives in <mutex>. libc++ (macOS) pulls it in transitively, so every macOS build and smoke passed; libstdc++ (Linux gcc) does not, and continuum's CI failed building the llama crate at the ggml-org#4437 pin: 'unique_lock' is not a member of 'std' at llama-adapter.cpp:419 and :486. Include <mutex> and <shared_mutex> where they are used. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
What
llama-servertrains a LoRA on the model it is serving, beside its slots (Continuum aad139ee, S4's first form; Joel: "you can train and inference at the same time without taking her down").POST /train {text, out, rank, alpha, targets, window, epochs, lr, val_split, seed}→ a secondllama_contexton the same loadedllama_model(weights shared, never copied), a fresh zero-B adapter attached to that context only,ggml-opton the adapter's A/B on a worker thread. The base stays at its served quantization, frozen — QLoRA by construction. One run at a time.GET /train→idle | starting | running (batch/of) | done (adapter) | error, per-epoch train/eval loss and train tok/s.llama_opt_initno longer writes the training window into the shared model'shparams.n_ctx_train; it lives on the training context (opt_n_ctx_train).llama-finetune-loraintocommon(common_lora_write_fresh).--no-repack, no tensor overrides (Cormac).Stacked on the hybrid store-index fix (4faed7a).
Measured (RTX 5090, CUDA 13.2) — a second llama-server with the 1.5B Q4_K_M beside a live 27B serving lane
Not yet (gates before this reaches a citizen's engine)
/trainin Kimi's engine: the full path must have run clean on her exact configuration (27B hybrid, her ctx/ubatch/FA settings), and asserts reachable from request input become refusals.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc