fix(domino): resume the base-anchor curriculum from the checkpoint step - #63
Open
khazic wants to merge 1 commit into
Open
fix(domino): resume the base-anchor curriculum from the checkpoint step#63khazic wants to merge 1 commit into
khazic wants to merge 1 commit into
Conversation
DominoTrainingModel counted its own forwards to drive lambda_base, and that counter is a plain attribute that no checkpoint carries. Every resume therefore restarted the curriculum at lambda_base_start. The loss is (1 - lambda_base) * final + lambda_base * base, and only the final term depends on the correction head, so the head's gradient scales exactly with 1 - lambda_base. Restarting the curriculum on an already-trained drafter cuts that signal by the full decay factor (1/domino_lambda_base_decay_steps at the first step after resume) and takes a whole decay window to recover, while the backbone is retrained under a curriculum it had already finished. _resume_optimizer_steps is the only step counter that survives a drafter checkpoint, and the LR scheduler already restores itself from it, so seed the curriculum from the same value in DominoTrainerBackend.setup_optimizer. Signed-off-by: khazic <khazzz1c@gmail.com>
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DominoTrainingModeldrives the base-anchor curriculum off a counter it increments itself:That counter is a plain Python attribute on the training wrapper. It is not a buffer, it is not in any
state_dict, and nothing saves or restores it. Every resume therefore rebuilds the wrapper at step 0 and restarts the curriculum atlambda_base_start.The trainer already knows the real step:
optimizer_steps_totalis restored from the checkpoint's trainer state, and_resume_optimizer_stepsis plumbed intodrafter_train_configfor exactly this purpose. Today only the LR scheduler consumes it.Why it matters
The Domino loss is
and only
final_lossdepends on the correction head (prefix_gru,embed_proj). The head's gradient therefore scales exactly with1 - lambda_base. Restarting the curriculum on an already-trained drafter cuts that learning signal by the full decay factor and takes a wholedomino_lambda_base_decay_stepswindow to recover, while the backbone is re-trained under a curriculum it had already finished. Nothing fails loudly:domino_lambda_baseis reported in the diagnostics and simply reads~1.0again.With the default
domino_lambda_base_decay_steps=2000, the first step after a resume gives the correction head 1/2000 of its previous gradient.Fix
Seed the curriculum from
_resume_optimizer_stepsinDominoTrainerBackend.setup_optimizer, next to where the LR scheduler already resumes from the same value. The counter is renamed to_curriculum_stepand gets an explicitset_curriculum_step()entry point so the intent is visible at the call site.Validation
Ran a before/after repro on both
mainand this branch. It walks a fresh wrapper to optimizer step 100 withdomino_lambda_base_decay_steps=100, then simulates a process restart that resumes the drafter at the same step, and reports the curriculum weight plus the correction head's gradient norm. Both sides use identical seeds and identical weights, so the only variable is the curriculum weight.Before/after repro output
Tests
Four new tests in
tests/integration/test_domino_backend_contract.py:test_domino_curriculum_step_is_seedablecovers the curriculum weight across a seeded restart.test_domino_correction_head_gradient_scales_with_curriculumpins the exact1 - lambda_basegradient scaling that makes the regression matter.test_domino_setup_optimizer_seeds_curriculum_from_resume_stepscovers the resume path.test_domino_setup_optimizer_without_resume_starts_curriculum_at_zerocovers the fresh-start path.Full CPU suite (
tests/integration tests/compat tests/config tests/examples) run on both sides:Test suite before/after
The same 9 tests fail on
mainand on this branch. They need optional dependencies (VeOmni, the NPU vLLM stack) that are absent in this environment, so they are pre-existing and unrelated. The+4on this branch are the new tests above.