docker pull to a running Flow-GRPO job on
Stable Diffusion 3.5 Medium with OCR reward. The launch script below
targets 2 GPUs (colocate train + rollout). A single-GPU topology is not
provided or verified. You need Hugging Face access to the gated SD3.5 checkpoint.
Installation and environment setup are documented separately — this page starts
inside a ready container or machine.
Deeper SD3 recipe config, reference curves, and the DiffusionNFT + PickScore
recipe are in the SD3 model guide.
1. Start the container
On the host (experimental image — seedocker/README.md):
Launch recipes live under
scripts/ as Python modules (not bash). Each
script sets recipe-specific env vars (e.g. PYTHONPATH for SD3
/rollout/generate) and submits train_diffusion.py through Ray via
miles.utils.external_utils.command_utils.2. Download model and data
SD3.5 is a gated Hugging Face model. Export your token before any download or training:flowgrpo_ocr subset of
rockdu/miles-diffusion-datasets.
Each prompt embeds the target string in double quotes (e.g. a logo saying
"Miles") — OCR reward compares PaddleOCR output against that target.
The script downloads the dataset automatically if missing. To prefetch:
See Rewards for OCR scoring and prompt format.
3. Launch training
--lora-ipc-weight-sync),
and runs the Flow-GRPO rollout / train loop. With WANDB_API_KEY set, images
and metrics are logged to project miles-diffusion-grpo.
Once rollout begins, you should see rollout/train metrics such as
rollout/reward/raw_mean, train/loss, and train/log_prob_mean_abs_diff
(stdout and WandB when configured).
To finish faster while debugging, override rollout count (default 600):
ScriptArgs field also accepts MILES_SCRIPT_<FIELD> (e.g.
MILES_SCRIPT_NUM_ROLLOUT=2). For train/rollout alignment debugging (skips the
optimizer step; does not run IPC weight-sync checksums):
4. What’s happening
Each rollout iteration runs four steps:- Sample prompts and generate images via sglang-diffusion (SDE window stepping).
- Score images with OCR (
--rm-type ocr) on CPU Ray actors — no reward GPU. - Compute the Flow-GRPO objective (GRPO advantage normalization + SDE log-prob ratios) and step the LoRA optimizer.
- Push updated LoRA weights to rollout engines via
--lora-ipc-weight-sync.
--loss-type policy_loss, the default) with
LoRA-base KL (--diffusion-kl-beta 0.04), noise level 0.7, CFG 4.5, and batch-wide reward-standard-deviation
normalization (--globalize-reward-std). --deterministic-mode and --global-batch-size 64 match the CI e2e recipe.
Which denoising steps enter the loss is selected by a step strategy
(--diffusion-step-strategy-path in miles/rollout/step_strategy_hub.py):
Train-side dynamics and more on these strategies: SDE step backend.
DiffusionNFT + PickScore (3 GPUs, ODE, EMA reference) is a separate recipe
covered in the SD3 model guide.

