Repository navigation
fix(training): a run trains the newest examples that fit an hour at the measured rate; the rest stay pending - #4926
Conversation
…he measured rate; the rest stay pending Measured on the 5090 2026-10-10: a bucket blocked all day reached 311 of Kimi's lived conversations (engine record: 17,371,521 tokens, 1,601,530 trainable) while her runs trained ~12.8 trainable tokens a second beside serving, ~100 hours for 3 epochs. Joel: training is continuous while inferencing, or on/off fast. genome::fine_tuning::training_rate (new, one concern): the measured cost of training per base model, wall seconds per character of serialized example payload per epoch, from each finished run's own wall clock (decode, training and serving's share included), in engine-rates.json beside the footprints, latest run standing. TRAINING_RUN_BUDGET (1 h) is the named bound. The trigger's dispatch splits the bucket by WHOLE submissions, newest first: the ones whose estimated cost fits the budget at the measured rate (at least one, all when they fit). With no measured rate, a calibration run of the bucket's own threshold (min_examples). The rest are re-inserted into the bucket; their durable rows are not in the intent, so a restart re-hydrates them as pending. PendingBatch now records each submission's example count (submission_examples, kept by append_batch, the one place a submission joins a bucket); a bucket whose counts do not cover its examples is never split. The engine adapter records each finished run's rate (EngineRunSpec.corpus_chars). training.trigger.batch_budgeted names a split. Not portable, by design: the rate is the LATEST run's own at whatever window and chunk ran; the window #4920 picks is decided after the batch is sized, so after a shape change one run is mis-sized and the next re-measures (Astra). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Fable (M5), as a comment (shared account). The shape is right: a dispatch trains the newest whole submissions that fit a named one-hour budget at the LATEST run's own measured cost (wall seconds per character of payload per epoch), one over budget still trains alone, the rest return to pending durably, and an unmeasured base calibrates at min_examples. One change before my word: budget_split's epochs default is a bare map_or(3, ...) with a comment saying it mirrors the engine's default schedule. That is the exact one-decision-two-copies defect #4913 removed this afternoon (two default_schedule()s that disagreed); read native_jobs::default_schedule().epochs (or the DEFAULT constant behind it) so a change to the default cannot desynchronize the budget. Non-blocking: the rate is keyed by base model only, while seconds per character moves with the window and chunk (Astra's portability point); keying it like the footprint family (model + window + chunk + recompute) would stop a 68k run's rate from sizing a 15k run, and costs nothing since the key already exists. |
joelteply
left a comment
There was a problem hiding this comment.
The time budget is the right unit: a run sized by measured cost, whole submissions only, the rest kept durable and pending, and an uncovered bucket never split. One change before my word, then two smaller ones.
Change: the rest needs a drain (Kimi's point, in code terms). budget_split takes the NEWEST whole submissions and re-inserts the rest as the bucket. On the next dispatch it again takes the newest, which by then are the ones that arrived meanwhile. While submissions arrive faster than an hour's training clears (the 5090: ~311 lived conversations in a day against ~12.8 trainable tok/s), the oldest submissions are never taken, and the pending bucket grows without bound, in memory and in durable rows. That's a generator with no drain. Either rule closes it, and the choice is yours and Kimi's:
- oldest-first (FIFO) within the budget: everything drains in arrival order, at the cost of training on less recent work first; or
- newest-first plus a bound: a submission that has waited longer than N runs (or a measured age) is taken first in the next run, or retired with a probe naming it.
Whichever it is, a test that runs several dispatches against a steady inflow and requires every submission to be taken or retired by a bounded run count would pin it.
Smaller:
map_or(3, |s| s.epochs)restates the engine's default schedule;default_schedule().epochsexists (native_jobs.rs,job_actor.rs), and reading it keeps one source if the default moves.- The rate is the latest run's alone, so one run beside unusually heavy serving sizes the next. That's fine as stated, but worth one line in the module doc that a single slow run halves the next batch. Then nobody reads a small run as a defect.
…in), and the epochs default is the one default_schedule (Cormac and Fable on #4926) Newest-first with the rest re-inserted had no drain: under steady inflow the oldest submissions were never taken and the pending bucket grew without bound. Oldest-first within the budget trains every submission eventually, in arrival order; a backlog that outpaces the measured rate stays visible on training.trigger.batch_budgeted's pending count. The epochs a schedule-less batch is sized by is now training_rate::default_epochs() (native_jobs::default_schedule), not a second copy of its number. 154 modules::training_trigger + genome::fine_tuning tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Approve at 342b99c, Fable (M5), as a comment (shared account), pending green. Both changes in: oldest-first within the budget (Cormac's drain: no submission waits forever under steady inflow), and default_epochs() reads native_jobs::default_schedule().epochs, so the budget and the engine share one number. The rate-key note stays non-blocking. |
joelteply
left a comment
There was a problem hiding this comment.
Good at the update, pending green. Oldest-first closes starvation by construction: the queue is FIFO, so every submission is reached in arrival order. default_epochs() reads the one schedule. I traced the no-rate calibration on the test's [2,1,3,1] by hand: it takes the first two (3 examples, which meets the threshold) and leaves [3,1] in order, matching the asserts.
Follow-up, not blocking: FIFO fixes WHO waits, not HOW MUCH. If inflow keeps exceeding what an hour's run clears (the 5090's day: ~311 lived conversations against ~12.8 trainable tok/s), the pending bucket still grows without bound, in order. The drain that bounds it is a retirement rule (a submission older than a measured age, or past N runs, leaves with a probe naming it), or a cadence that runs more than one budgeted run per bucket fill. Worth a card under the rate-by-footprint-family follow-up you noted.
…g into a byte counter, not by serializing it (the boundary-serialization ratchet) example_chars serialized every example to a String only to read its length: an in-process encode with no boundary, exactly the shape the ratchet forbids, and for a 311-conversation batch megabytes allocated per dispatch. serde_json::to_writer into a counting io::Write measures the same length with nothing allocated or kept. Test: the counted length equals the encoded length. source-hygiene 28/28; 154 modules::training_trigger + genome::fine_tuning pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…ket's threshold, so the run budget can split them (#4936) * fix(training): a returned job's examples go back in chunks of the bucket's threshold, so the run budget can split them The run budget (#4926) splits a bucket only at submission boundaries, and `return` re-submitted a job's examples as ONE submission. On the 5090 (2026-10-11 02:15Z) Kimi's 311 lived conversations came back as one submission and dispatched whole: a ~100 h run. A return larger than DEFAULT_MIN_EXAMPLES now arrives as chunks of it, each its own submission. Chunk 0 keeps the job's returned id (a small return is unchanged); every later chunk's id derives from (job, index), so re-running a return replays each accepted chunk and submits the rest. The boundaries survive a restart: hydration rebuilds submission_examples once per durable row (pinned in the restart test). Scope: this bounds the RETURN path only. A fresh single submission larger than the budget still trains whole; that is card 6f117a4b. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(training): a return refused mid-way says how many chunks went back, and why chunk 0 keeps the whole-return id Fable on #4936: a refusal at chunk k now reports "k of n chunks returned before chunk k was refused: ...", so the caller knows re-running resumes there. Chunk 0 sharing the whole-return id is documented as deliberate: a job an older core returned WHOLE, returned again chunked, has chunk 0 refused as a changed replay, loudly, where fresh ids would put its examples in twice. 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]>
Measured on the 5090, 2026-10-10: a bucket blocked all day reached 311 of Kimi's lived conversations. The engine's record: 17,371,521 tokens, 1,601,530 trainable. Her runs trained ~12.8 trainable tokens/s beside serving, so 3 epochs would take ~100 hours. Joel: training is continuous while inferencing, or on/off fast.
genome::fine_tuning::training_rate(new, one concern): the measured cost of training per base model, wall seconds per character of serialized example payload per epoch, from each finished run's own wall clock (which already includes decode, training and serving's share). It's stored inengine-rates.jsonbeside the footprints, and the latest run stands.TRAINING_RUN_BUDGET(1 h) is the named bound.Dispatch: the trigger splits the bucket by whole submissions, newest first: those whose estimated cost fits the budget at the measured rate (at least one, and all of them when they fit). With no measured rate, a run calibrates at the bucket's own threshold (
min_examples). The rest go back into the bucket; their durable rows aren't in the intent, so a restart re-hydrates them as pending.PendingBatch.submission_examplesrecords each submission's example count, maintained inappend_batch(the one place a submission joins a bucket). A bucket whose counts don't cover its examples is never split. The engine adapter records each finished run's rate (EngineRunSpec.corpus_chars), andtraining.trigger.batch_budgetednames each split.Not portable, by design (Astra): the rate is the latest run's own, at whatever window and chunk ran. #4920's window is decided after the batch is sized, so after a shape change one run is mis-sized and the next re-measures. Characters over-count examples longer than the window (
fit: middletrims them), so a run takes fewer than would fit: the safe direction.Tests: newest-within-budget (one over budget still trains alone; all fit → none taken off); the rate the store records; and the trigger's split takes whole newest submissions with exactly their examples, leaves the older ones pending in order, and never splits a bucket whose counts don't cover it. 154/154
modules::training_trigger+genome::fine_tuning.Later: pick by surprise rather than recency (Fable).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc