Skip to main content
GRPO needs n_samples_per_prompt outputs per prompt to normalize advantages within a group. The naive way is N separate requests, which encodes the same prompt N times and denoises N batches of size 1. Miles-diffusion instead sends one request per microgroup: sglang-diffusion encodes the conditioning once, expands it engine-side, and denoises all N outputs as a batch. Engine-side expansion is opt-in per model family in sglang-diffusion.

1. Microgroups

--rollout-microgroup-size M splits each prompt group of n_samples_per_prompt samples into requests of at most M (generate_and_rm_group in miles/rollout/sglang_diffusion_rollout.py). Each request carries num_outputs_per_prompt = M:
Microgroups of one group run as concurrent asyncio tasks, load-balanced across engines; in-flight requests per engine are bounded by --sglang-server-concurrency. Canonical values on main: LTX-2.3 supports engine-side expansion, but the recipe generates one output per request: a multi-output video response is large enough that deserializing and scoring it stops overlapping with other in-flight requests, so single-output requests pipeline better end to end.

2. Seed layout

Rollout stays deterministic and collision-free per sample:
  • sgl-d expands one request’s seed into seed, seed+1, …, seed+M−1 — one RNG stream per output.
  • The trainer spaces request seeds so streams never overlap:
group_index is monotonic across the run, so every (rollout, prompt-group, sample) triple gets a distinct seed. This is what makes rollout replay and deterministic mode possible at microgroup granularity.

3. Pairs well with