- Coupled (Flow-GRPO) — training re-scores the same
(x_t → x_{t+1})transitions that rollout produced, so it needs tractable log-probs viaSdeStepBackend. - Decoupled (DiffusionNFT, …) — training samples its own timesteps from the final image; rollout dynamics are irrelevant, so this backend is unused.
1. When it applies
Flow-GRPO (--loss-type policy_loss, the default) calls
SdeStepBackend.sde_step_logprob on each recorded transition. The backend
mirrors sglang-diffusion’s rollout stepping so train-side log-probs match
rollout-side values.
Canonical Flow-GRPO recipe:
scripts/run_diffusion_grpo_sd3_ocr_sglang.py.
Implementation: miles/backends/fsdp_utils/sde_step_backend.py. Override with
--sde-step-backend-path if you need a custom kernel.
2. Dynamics types
--diffusion-noise-level (η) sets the SDE noise scale. DanceGRPO-style constant-η
schedules use the same sde backend with a tuned η
(DanceGRPO).
3. Key flags
These CLI flags configure sglang-diffusion rollout stepping and must stay consistent with the train-side backend:
Example (SD3 Flow-GRPO OCR — full-window SDE):
miles/rollout/step_strategy_hub.py. sde_window picks a
contiguous window; epoch_global_random_choice picks a per-epoch subset via
--diffusion-sde-candidate-steps. Partial windows follow the MixGRPO /
TempFlow-GRPO idea (MixGRPO,
TempFlow-GRPO).
4. Train / rollout alignment
The train-side kernel must reproduce rollout dynamics. Mismatched σ resolution or noise level shows up as a risingtrain/log_prob_mean_abs_diff.
Checklist:
- Match
--diffusion-sde-typeand--diffusion-noise-levelon train and rollout. - Use the same
--diffusion-num-stepsschedule. - Match input dtypes between FSDP forward and the rollout engine for fp32 runs.
- Watch
train/log_prob_mean_abs_diff— near zero before the first optimizer step.
5. Pairs well with
- Customization —
--diffusion-step-strategy-pathand--sde-step-backend-path. - SD3 model guide — Flow-GRPO vs NFT recipe flags.
- Quick Start — SD3.5 Flow-GRPO OCR walkthrough.

