Skip to main content
Miles-diffusion scores generated images (or video frames) after each rollout microgroup. Reward computation lives in miles/rollout/rm_hub/ and is invoked from sglang_diffusion_rollout.generate_and_rm_microgroup. For --custom-rm-path, --custom-reward-post-process-path, and other --*-path hooks, see Customization.

1. At a glance

2. Built-in reward models

PickScore (--rm-type pickscore)

Implementation: miles/rollout/rm_hub/pickscore.py. PickScore scores text–image alignment using a CLIP model pair:
  • Processor: --pickscore-processor-path (e.g. laion/CLIP-ViT-H-14-laion2B-s32B-b79K)
  • Model: --pickscore-model-path (e.g. yuvalkirstain/PickScore_v1)
Scoring formula:
The / 26.0 scaling maps raw PickScore logits (~0–26) to roughly 0–1. PickScore runs as a Ray actor pool (PickScoreRewardActor) with round-robin batching. For video outputs, frames are uniformly sampled (--pickscore-num-frames) and scores are averaged. Example from scripts/run_diffusion_nft_sd3_pickscore.py:

OCR (--rm-type ocr)

Implementation: miles/rollout/rm_hub/ocr.py. OCR reward compares PaddleOCR output against target text embedded in the prompt. The target is the string between the first pair of double quotes. Simplified scoring:
The implementation also lowercases both sides, strips spaces, treats a substring hit as perfect (dist=0), and caps dist at len(target) — see miles/rollout/rm_hub/ocr.py. OCR runs on CPU Ray actors (--ocr-num-workers, default 4). Used by the SD3 Flow-GRPO recipe (scripts/run_diffusion_grpo_sd3_ocr_sglang.py).

Remote RM (--rm-type remote_rm)

The CLI exposes --rm-url for a remote reward service, but rm_hub does not implement remote_rm today — selecting it raises NotImplementedError. Use --custom-rm-path to call an external service instead (see below).

3. Call chain

After rollout, RolloutManager._post_process_rewards subtracts the mean and optionally divides by std to produce normalized advantages for training. Override that path with --custom-reward-post-process-path — see Customization § Reward.

4. Prompt data

JSONL format

Training prompts are loaded from .jsonl files via miles/utils/diffusion_data.py:

Dataset subsets

Dataset repo: rockdu/miles-diffusion-datasets

Per-sample rm_type override

JSONL metadata.rm_type overrides the global --rm-type for that sample:
Mixed rm_types within one microgroup fall back to per-sample dispatch (no batched PickScore fast path).