Repository navigation
Conversation
zhihengy
added this pull request to stack #332
October 19, 2026 20:42
zhihengy
marked this pull request as ready for review
October 19, 2026 21:30
This branch has not been deployed
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.
First of a stacked series that adds DMD2 distillation. Lets the sync driver run several colocated trainer groups, keyed by role, instead of the single actor group. Every run still has exactly one group (the actor); the critic group arrives in [DMD2 4/7].
Critic-related components are included in 4th pr of this series
What
create_training_modelsbuilds oneRayTrainGroupper entry ofcompute_trainer_args(args)(role → args) and returns them as a dict keyed by role. For nowcompute_trainer_argsreturns only{"actor": args}.TRAIN_ACTOR_GPU / Nof a bundle, so the rollout engine and reward shares do not change; with one group it is still 0.7.train_diffusion.pytrains every group on each rollout in declared order, then saves and offloads all of them. Only the actor pushes weights to the rollout engines.train_sft.pyandtrain_diffusion_async.pytake the actor group from the dict and are otherwise unchanged.Why
DMD2 trains a fake-score critic next to the few-step generator. Like upstream miles' PPO critic, the critic runs as its own colocated trainer group rather than as a second trainable model inside the actor. That way the actor's optimizer, checkpoint and weight-sync paths stay as they are. Keying the groups by role leaves room for more trainers later.
Upstream precedent: miles builds its trainers from a config list, creates the actor and then the optional critic, and asserts that both restored the same rollout (
miles/ray/placement_group.py). Its colocated trainer workers take a 0.4 GPU share each, next to a 0.2 engine share.Tests
tests/fast/rollout/test_placement_group.py, with 1, 2 and 3 trainers:TRAIN_ACTOR_GPU / N(the shares stay within 0.7 after Ray's 0.0001 truncation);tests/fast/test_train_diffusion.py: two groups train each rollout in declared order, the second only after the first finished. Both save and offload, and only the actor pushes weights.tests/fast/test_train_sft.py: updated for the dict return.Checklist
pre-commithooks (black, isort, ruff at the pinned versions) pass on the changed filespytest tests/fastis green (515 passed, 6 skipped; 510 on main)python3 train_diffusion.py --helpstill parses (no flags changed)Stack
DMD2: distill a flow-matching teacher into a few-step student with distribution matching. The critic (fake score) and the frozen teacher live in their own colocated trainer group; the actor holds only the student. Merge in order:
external_data--loss-type dmd2on the actorTodo: