Skip to main content
A miles-diffusion training job is a loop over four objects. Once you understand what each one is and how data flows between them, the major flag groups are easier to place.

The four objects

The training loop

The whole of train_diffusion.py is three calls per iteration:
Every flag in miles-diffusion configures one of these four phases.

The batch-knob invariant

In miles-diffusion a sample is a whole denoising trajectory, and the fan-out continues below it: a step strategy picks the trained timesteps, and micro-batching counts (x_t → x_) pairs. One equation per level. Trajectory level — the four-knob invariant, enforced in miles/utils/arguments.py. rollout_batch_size is required and n_samples_per_prompt defaults to 1; of the right-hand pair, set one and the other is derived (passing both with contradicting values aborts):
Pair level — what each optimizer step actually trains:
The step strategy picks trained_timesteps_per_trajectory. Each rank then trains its 1 / dp_size share, micro_batch_size pairs per forward, accumulating gradients until the optimizer step. Two independent knobs control physical batching, one per side of the loop: And one knob controls the trajectory→pair fan-out itself: --diffusion-step-strategy-path picks the SDE step subset per rollout (sde_window, epoch_global_random_choice, or your own function in miles/rollout/step_strategy_hub.py). Training the full 10-step schedule would multiply the pair count by 10× in the example below. Here is a full example with the numbers:

Next