Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨ Rethinking On-Policy Distillation in Diffusion Models ✨

Phenomenology, Mechanistic Insights, and PrefixOPD

Wei Chow1, XiuYu Zhang1, Yuxiang Wei2, Bo Chen8, Yingshuo Wang3, Xian Sun4, Yifei Dong5,
Xuan Zhang1, Meng Chu6, Pengyu Li1, Xin Li10, Dongyue Lu1, Alan Liang1, Ce Zhang7,
Feng Cheng9, Jason Li10, Lingdong Kong1, Leigang Qu1,†, Tat-Seng Chua1

NUS 1 NUS  ·  PolyU 2 PolyU  ·  UC Berkeley 3 UC Berkeley  ·  Duke 4 Duke  ·  UW 5 UW
HKUST 6 HKUST  ·  CMU 7 CMU  ·  8 Independent Research  ·  UNC 9 UNC-Chapel Hill  ·  NTU 10 NTU

† Corresponding author

arXiv Project Page GitHub Code HF Models HF Train Data HF Benchmark Apache 2.0 License

Open-Source Assets • PrefixOPD • Main Results • Diagnostics • Installation • Reproduction • Evaluation • Citation


Overview of diffusion on-policy distillation and PrefixOPD

🔥 TL;DR: We dissect what diffusion on-policy distillation transfers, what governs transfer, and when distillation is worthwhile across 13 routes (T2I, I2I, MI2I + held-out) and 2 backbones (SD3.5-Medium & Z-Image). Grounded in these mechanisms, PrefixOPD cuts active training time by 44.5% while improving T2I by +3.7%, overall eight-route editing by +9.3%, and the three-route editing diagnostic suite by +15.5% (+23.6% structure, +28.7% edit min), outperforming equal-compute baselines by up to +17.4% and surpassing equal-data $\lambda=2$ extrapolation at nearly half the cost (85.9% cross-judge winner agreement across 32 endpoints).


📌 Abstract

On-policy distillation (OPD) combines diffusion specialists into one shared student by supervising the student's own denoising trajectories. Yet what diffusion OPD transfers, what governs student gains, and when it is worthwhile over direct joint reinforcement learning have remained unclear.

Through budget-controlled comparisons, held-out evaluation, frozen-trajectory interventions, temporal supervision audits, teacher-source swaps, and direct joint RL across SD3.5-Medium and Z-Image, we uncover four core mechanisms:

  1. Budget reverses method rankings via query count: Sparse methods (DanceOPD) lead at equal training time (3/4 settings) whereas dense methods (DiffusionOPD) lead at equal condition exposure (3/4 settings), flipping winners in 32.7% (17/52) of route comparisons; query count per trajectory lifts dense velocity equal-data gain to +10.9% and accounts for 83.0% of DiffusionOPD's equal-data lead.
  2. Generation and editing have opposite trajectory timing: Early high-noise steps already capture 80.2% of the final edit direction in image editing (at step $k=1$), whereas 5.75× wider late solver steps under shifted schedules amplify low-noise supervision in generation (leading 10/13 routes by up to +5.9% T2I and +6.3% editing mean).
  3. Stronger narrow single-route RL teachers can teach weaker students: Narrow single-route RL without cross-route regularization boosts teacher target scores by up to +28.2% (10/12 editing pairs) yet degrades held-out editing in 12/12 (100%) pairs, reducing student held-out editing by up to −42.5%.
  4. Distillation and joint RL are complementary: Online joint RL preserves the broadest task profile when online rewards are available, whereas frozen-teacher distillation excels at modular capability consolidation without online reward servers (limiting within-interface HPSv2.1 general-T2I degradation from 30.6% to 9.6%, +8.2% over direct joint RL).

Grounded in these mechanisms, we propose PrefixOPD, coupling task-asymmetric query timing, prefix rollout truncation (81.8% of editing forwards skipped — 9 of 11 forwards per 10-step trajectory — while exactly preserving the corresponding full-rollout stop-gradient update), and initialization-referenced target extrapolation ($\alpha=0.25$ on early editing queries).


🌟 Highlights

  • Asymmetric Prefix OPD (prefixopd): Places T2I queries at low-noise late steps ($5.75\times$ wider $|\Delta\sigma_k|$) and editing queries at step $k=1$ ($80.2%$ edit direction), truncates rollouts after $k_{\max}$ (exactly preserving the corresponding full-rollout stop-gradient update for causal, suffix-independent queries), and applies $25%$ initialization-referenced extrapolation ($\tilde{u}_k = u_k + 0.25(u_k - b_k)$).
  • Unified Multi-Method Trainer: Native implementations of prefixopd, danceopd, diffusionopd, and flowopd (Flow-OPD) sharing explicit task routing, rank-32 LoRA training, and clean multi-image conditioning (up to 10 references) on both SD3.5-Medium and original non-Turbo Z-Image.
  • Full Open-Source Ecosystem on Hugging Face: 78 checkpoints (48 SFT/RL specialist teachers, 20 OPD students, 10 reward & joint-RL policies), 33,000 paired training samples across 11 routes, and a 13-route / 1,300-sample benchmark with pinned judging metadata and native Q-Judger / GPT evaluation.

📦 Open-Source Release

All checkpoints, training data, benchmark splits, and pinned upstream model revisions are hosted on Hugging Face for full end-to-end reproduction.

Asset Contents Scale Pinned HF Revision Access
Model Checkpoints 78 bundles: 26 SFT + 22 RL Teachers, 20 OPD Students, 10 Reward/Joint-RL Policies 7.188 GB (218 files) af3d86a3 WeiChow/Rethink-Model (Public)
Training Dataset 33,000 pairs: 11 task routes × 3,000 self-contained Parquet rows 37.681 GB (11 files) 41517ef2 WeiChow/Rethink-Train
13-Route Benchmark 1,300 test cases: 13 routes × 100 (incl. I2I-HELDOUT & MI2I-HELDOUT) + benchmark_metadata.json.gz (459 KB) 3.005 GB (13 splits) Images ed8c1f7b · Meta 775652c2 WeiChow/Rethink-Bench

Authentication note: WeiChow/Rethink-Model is directly accessible with unpacked checkpoint directories (teachers/, students/, e5/, MODEL_INDEX.json). While WeiChow/Rethink-Train and WeiChow/Rethink-Bench are private prior to public flip, authenticate once via hf auth login or export HF_TOKEN=<your_token> before running rethink-resources / rethink-eval.

📋 Complete Inventory: 78 Checkpoints, 11 Training Parquets, 13 Benchmark Splits & Pinned Upstream Models

1. Model Checkpoints (WeiChow/Rethink-Model, 78 Bundles · 7.188 GB)

Every bundle contains pytorch_lora_weights.safetensors, TEACHER_CARD.json, and (for I2I/MI2I) EDIT_ADAPTER.safetensors, indexed by MODEL_INDEX.json and src/resources/model_registry.json.

Category Count Size HF Directory Layout Notes
SFT Specialist Teachers 26 2.66 GB teachers/sft/{sd35,zimage}/<task>/ 13 per backbone: general-i2i, general-mi2i, + 11 task specialists (rank 32)
RL Specialist Teachers 22 2.36 GB teachers/rl/{sd35,zimage}/<task>/ 11 per backbone across T2I (5), I2I (3), MI2I (3) (rank 64)
Consolidated OPD Students 20 1.05 GB students/B1[-ZI]-{TI,TIM}-{Dance,Diffusion,Flow}/{final,time-matched}/ DanceOPD (final), DiffusionOPD & Flow-OPD (final + time-matched) on both backbones (rank 32)
Reward & Joint-RL Policies 10 1.13 GB e5/E5-A/{pickscore,clipscore,hpsv2.1,direct}/, e5/E5-B/{UR2B,EC4}/* Includes e5/E5-B/UR2B/edit-r2 (UnifiedReward-Edit teacher used in Table 3 PrefixOPD) & e5/E5-B/EC4/i2i (rank 96)

Run rethink-resources list-models to print all 78 friendly aliases (e.g., teacher/rl/sd35/t2i-general, reward/sd35/joint/ur2b/edit-r2, student/zimage/tim/diffusionopd/final).

2. Training Data (WeiChow/Rethink-Train, 33,000 Rows · 37.681 GB)

All 11 Parquet files share the self-contained schema idx, mode, prompt, target, input_1 ... input_14 (one row per row group, Zstd-compressed, seed 2026, zero train/test overlap):

Interface Task Split Parquet File Rows Size
T2I T2I_GENERAL T2I-GENERAL.parquet 3,000 0.969 GB
T2I T2I_TEXT T2I-TEXT.parquet 3,000 5.749 GB
T2I T2I_PORTRAIT T2I-PORTRAIT.parquet 3,000 0.844 GB
T2I T2I_DESIGN T2I-DESIGN.parquet 3,000 0.909 GB
T2I T2I_REALISM T2I-REALISM.parquet 3,000 4.615 GB
I2I I2I_LOCAL I2I-LOCAL.parquet 3,000 9.579 GB
I2I I2I_GLOBAL I2I-GLOBAL.parquet 3,000 2.569 GB
I2I I2I_TEXT I2I-TEXT.parquet 3,000 0.740 GB
MI2I MI2I_IDENTITY MI2I-IDENTITY.parquet 3,000 4.170 GB
MI2I MI2I_COMPOSITION MI2I-COMPOSITION.parquet 3,000 4.292 GB
MI2I MI2I_SPATIAL MI2I-SPATIAL.parquet 3,000 3.244 GB
Total 11 splits 11 Parquet files 33,000 37.681 GB
  • I2I-GENERAL view (3K): Automatically constructed as I2I-GLOBAL (idx 1..1500) + I2I-LOCAL (idx 1..1500) without duplicating image bytes.
  • TI mixture (6K): T2I-GENERAL (3K) + I2I-GENERAL (3K). TIM mixture (9K): TI (6K) + MI2I-COMPOSITION (3K).

3. Benchmark (WeiChow/Rethink-Bench, 1,300 Rows · 3.005 GB)

13 splits × 100 samples: 5 T2I (T2I_GENERAL, T2I_TEXT, T2I_PORTRAIT, T2I_DESIGN, T2I_REALISM), 4 I2I (I2I_LOCAL, I2I_GLOBAL, I2I_TEXT, I2I_HELDOUT), and 4 MI2I (MI2I_IDENTITY, MI2I_COMPOSITION, MI2I_SPATIAL, MI2I_HELDOUT), paired with pinned benchmark_metadata.json.gz (458,686 bytes).

4. Pinned Upstream Base Models & Reward Scorers

Resource Pinned Hugging Face Revision Role
SD3.5-Medium stabilityai/stable-diffusion-3.5-medium@b940f670 Primary flow backbone
Z-Image (non-Turbo) Tongyi-MAI/Z-Image@04cc4abb Cross-backbone single-stream DiT
PickScore v1 yuvalkirstain/PickScore_v1@a4e4367c + CLIP-ViT-H-14@1c2b8495 Within-interface T2I reward
CLIPScore openai/clip-vit-base-patch32@3d74acf9 T2I alignment reward
HPSv2.1 xswu/HPSv2@697403c7 Human preference reward
UnifiedReward 2B UnifiedReward-2.0-qwen3vl-2b@64b2f51d & UnifiedReward-Edit-qwen3vl-2b@932ec7de Cross-interface T2I + Edit rewards
EditScore 4B EditScore-Qwen3-VL-4B-Instruct@87dcfd0e + Qwen3-VL-4B-Instruct@ebb281ec Cross-interface Edit reward

🧠 Method: PrefixOPD

Overview of multi-teacher distillation and PrefixOPD

Given a condition $x = (p, I^{\text{src}}, \mathbf{I}^{\text{ref}})$ routed to frozen teacher $T_r$ and frozen reference $B_r = S_0$ (student initialization), PrefixOPD aligns supervision with task-specific trajectory dynamics:

  1. Task-asymmetric query placement: Keep T2I queries at late low-noise steps ($\text{Beta}(5,2)$, where shifted solver steps $|\Delta\sigma_k|$ expand by $5.75\times$), and place editing queries at step $k=1$ (first step after pure noise, where $80.2%$ of target edit direction forms).
  2. Prefix rollout truncation: Terminate each student rollout immediately after $k_{\max} = \max \mathcal{I}r$. For a causal ODE solver with suffix-independent query sets $\mathcal{I}r$ and detached velocity targets (holding visited states and trajectory distribution $p\theta$ fixed during differentiation), omitting unused suffix steps $k > k{\max}$ exactly preserves the stop-gradient update of the corresponding full rollout while skipping 81.8% of editing forwards (cutting 10 rollout + 1 gradient forward down to 1 rollout + 1 gradient forward — 9 of 11 forwards per 10-step trajectory).
  3. Initialization-referenced target extrapolation: Keep T2I targets unchanged ($\alpha_{\text{T2I}} = 0$) and apply mild $25%$ extrapolation ($\alpha_{\text{I2I}} = 0.25$) referenced to student initialization $S_0$:

$$\widetilde{u}_{r,k}(\lambda_r) = u_{r,k} + \alpha_r\bigl(u_{r,k} - b_{r,k}\bigr), \qquad \mathcal{L}_{\mathrm{vel}}(\theta) = \mathbb{E}_{x,;\tau_{\le k_{\max}}}!\left[\frac{1}{|\mathcal{I}_r|}\sum_{k \in \mathcal{I}_r}\operatorname{MSE}!\bigl(v_\theta(\operatorname{sg}(z_k),\sigma_k,x),;\operatorname{sg}(\widetilde{u}_{r,k})\bigr)\right].$$

Minimal pseudocode (src/methods/prefixopd.py):

indices = route_query_indices(route, rollout_steps, options)  # T2I: low-noise Beta(5,2); Edit: [1]
trajectory = backend.prefix_rollout(sample, max(indices))     # prefix rollout truncation (−81.8% edit fwds)

for k in indices:
    z_k = trajectory[k]
    with torch.no_grad():
        u_k = teacher[route].velocity(z_k, sample)
        target = u_k + alpha[route] * (u_k - ref_init.velocity(z_k, sample)) if alpha[route] else u_k
    loss = velocity_mse(student.velocity(z_k, sample), target)
    loss.backward()

Supported Distillation Objectives

Method Config Key Rollout & Query Policy Objective
PrefixOPD (ours) prefixopd Prefix ODE truncation (same stop-grad update); T2I low-noise, Edit step $k=1$ Velocity MSE + init-referenced extrapolation ($\alpha_{\text{edit}}=0.25$)
DanceOPD danceopd ODE rollout; sparse low-noise query ($K=1$) Uniform velocity MSE
DiffusionOPD diffusionopd ODE rollout; dense transition queries Backbone-weighted transition-mean matching
Flow-OPD flowopd Flow-SDE rollout; detached scalar KL advantages Clipped PPO ratio + manifold anchor regularization (MAR)

📊 Main Results

A. Three-Route Editing Diagnostic Suite & Generation Benchmarks (Table 3)

Evaluated across the three-route editing diagnostic suite (I2I-Text, MI2I-Spatial, MI2I-Held-out) and all 5 T2I routes on SD3.5-M TI, SD3.5-M TIM, and Z-Image TI (synchronized active GPU-hours on 8× NVIDIA H100-80GB):

Setting Method GPU-h ↓ Edit (3-rt) ↑ Structure ↑ Edit Min ↑ T2I Mean ↑
SD3.5-M TI DanceOPD (full rollout) 15.5 1.811 1.423 0.870 0.694
DanceOPD, prefix truncated 13.2 1.816 1.428 0.870 0.693
DiffusionOPD, equal compute 8.6 1.781 1.408 0.850 0.663
STEP-OPD, equal compute 8.6 1.862 1.458 0.910 0.688
DreOPD, equal compute 8.6 1.884 1.465 0.920 0.676
DanceOPD ($\lambda=2$), equal compute 8.6 1.895 1.472 0.930 0.678
PrefixOPD (ours) 8.6 (−44.5%) 2.091 (+15.5%) 1.759 (+23.6%) 1.120 (+28.7%) 0.719 (+3.7%)
SD3.5-M TIM DanceOPD (full rollout) 23.3 3.191 2.864 1.790 0.722
PrefixOPD (ours) 13.8 (−40.8%) 3.512 (+10.1%) 3.248 (+13.4%) 2.090 (+16.8%) 0.741 (+2.6%)
Z-Image TI DanceOPD (full rollout) 17.8 3.623 3.184 2.110 0.978
DiffusionOPD, equal compute 9.9 3.714 3.246 2.160 0.916
PrefixOPD (ours) 9.9 (−44.4%) 4.052 (+11.8%) 3.772 (+18.5%) 2.570 (+21.8%) 0.989 (+1.1%)

Even against equal-data full-rollout $\lambda=2$ extrapolation in Table 9 (2.035 DanceOPD at 16.4 GPU-h; 2.025 DiffusionOPD), PrefixOPD (2.091, 8.6 GPU-h) leads by +2.8% to +3.3% on Editing Mean and +8.7% to +14.3% on Editing Min at nearly half the cost. Across all 13 routes on SD3.5-M TI, PrefixOPD raises T2I Mean by +3.7%, trained I2I Mean by +16.2%, and overall eight-route Editing Mean by +9.3%, achieving a 66.5% non-tie win rate across all 800 editing conditions (67.7% on the three-route diagnostic suite). Independent cross-judge auditing between GPT-5.5 and InternVL2.5-8B confirms $r=0.928$ (Structure) and $r=0.921$ (Mean) with 85.9% pairwise winner agreement across all 32 evaluated endpoints (84.1% / $r=0.92$ on the six-endpoint 96-condition audit, with PrefixOPD ranked #1 under both judges).

B. Cross-Interface Distillation vs. Direct Joint RL (Table 2)

Model UR2B T2I Rew UR2B I2I Rew UR2B Gen T2I UR2B Gen I2I UR2B Held-out CLIP+EC4 T2I Rew CLIP+EC4 I2I Rew CLIP+EC4 Gen T2I CLIP+EC4 Gen I2I CLIP+EC4 Held-out
Student init. ($S_0$) 3.23 15.49 0.73 6.55 0.60 0.83 4.83 0.73 6.55 0.60
Model merge (midpoint) 3.31 18.65 0.75 6.93 0.95 0.82 4.86 0.71 6.18 0.75
Direct joint RL (online reward) 3.32 18.66 0.77 6.98 1.16 0.83 6.06 0.73 7.03 1.03
DanceOPD (frozen teachers) 3.33 18.52 0.63 7.05 0.72 0.83 5.58 0.60 6.82 0.95
DiffusionOPD ET (frozen teachers) 3.32 18.96 0.65 7.03 0.82 0.83 5.48 0.58 7.11 0.74
DiffusionOPD ED (frozen teachers) 3.34 19.22 0.64 7.16 0.88 0.83 5.54 0.61 6.91 0.87

🔬 Mechanistic Diagnostics

Budget transitions and query density Frozen-trajectory interventions and edit direction
1. Budget flips the winner (17/52 routes). Query count per trajectory lifts dense velocity equal-data gain to +10.9% and explains 83.0% of DiffusionOPD's equal-data lead. 2. Early step k=1 locks edit direction (80.2%). Directed teacher steps exceed random controls (2.04× T2I, +41.0% I2I, +57.3% MI2I) and fixed early placement matches the oracle (68.8%).
Temporal supervision across benchmark routes Solver step amplification and schedule generality
3. Low-noise supervision leads 10/13 routes. Exceeds alternative schedules & solver controls by up to +5.9% T2I and +6.3% editing mean; step-damped and uniform-Δσ controls win 0/13. 4. 5.75× late solver step amplification. Despite 3.62× larger early MSE, shifted schedules enlarge late DPM-2 updates by 1.48× (1.43×–1.75× across solvers); removing shift reverses preference.
Teacher-source transfer and narrow single-route RL retention Target extrapolation and PrefixOPD frontier
5. Narrow single-route RL forgets (12/12 pairs). Boosts target routes (10/12) yet degrades held-out I2I in 100% of pairs (mean −1.63); motivates Validation Rules 1 & 2. 6. PrefixOPD quality–efficiency frontier. Step k=1 I2I queries account for 83.9% of gains; at half budget (4.3h), exceeds full DanceOPD by +9.4% in roughly a quarter of the time.

Cross-judge agreement audit between GPT-5.5 and InternVL2.5-8B

Cross-judge agreement audit (Fig. 18): GPT-5.5 vs. InternVL2.5-8B reaches r = 0.928 (Structure) and r = 0.921 (Mean) with 85.9% pairwise agreement across all 32 endpoints (84.1% / r = 0.92 on the 6-endpoint 96-condition audit; PrefixOPD ranked #1 under both judges).


🖼️ Qualitative Gallery

Qualitative comparison of PrefixOPD vs baselines across local removal, text editing, and global restoration

⚙️ Installation

Python 3.11+ and CUDA GPUs are recommended for training and generation.

git clone https://github.com/worldbench/Rethinking-OPD-DM.git
cd Rethinking-OPD-DM

python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip

# Core training, Hugging Face data loading, and evaluation
python -m pip install -e ".[train,data,eval]"

# Optional: local reward servers (InternVL3.5 / PickScore / UnifiedReward / EditScore)
python -m pip install -e ".[reward]"

# Optional: official Q-Judger runtime for T2I benchmark routes
python -m pip install -e ".[qjudger]"

Configure Accelerate for multi-GPU training:

accelerate config

🚀 Quick Start & Reproduction

1. Authenticate & Download Open-Sourced Assets from Hugging Face

# Authenticate once if accessing private dataset repos (Rethink-Train / Rethink-Bench)
# or upstream gated backbones (SD3.5-Medium)
hf auth login
# Alternatively: export HF_TOKEN="hf_..."

# Option A: Download everything (all 78 checkpoints, both bases, 33K training data, 13-route bench)
bash scripts/download_resources.sh all

# Option B: Minimal download to reproduce PrefixOPD Table 3 (only 3 SD3.5 checkpoints + bases + train data)
bash scripts/download_resources.sh prefixopd-minimal
bash scripts/download_resources.sh bases
bash scripts/download_resources.sh train-data

Or invoke rethink-resources directly (supporting selective --model downloads or local pre-downloaded Parquet directories via --source-dir):

rethink-resources list-models                           # Inspect all 78 checkpoint aliases
rethink-resources models --output resources/models      # Pull unpacked WeiChow/Rethink-Model@af3d86a3
rethink-resources bases --output resources/bases        # Pull pinned SD3.5-M & Z-Image bases
rethink-resources train-data --output resources/train   # Build zero-copy descriptors for 33K Parquet rows

2. Export Portable Path Variables

All YAML configs expand these five variables explicitly (zero hardcoded cluster paths):

export RETHINK_MODEL_ROOT="$PWD/resources/models"
export RETHINK_DATA_ROOT="$PWD/resources/train"
export RETHINK_OUTPUT_ROOT="$PWD/runs"
export SD35_BASE="$PWD/resources/bases/sd35"
export ZIMAGE_BASE="$PWD/resources/bases/zimage"

3. Dry-Run Validation (No GPU Needed)

Validate method registries, routing, and config contracts before launching GPUs:

rethink-train --list-methods
bash scripts/train_prefixopd.sh sd35_ti_ur2b --dry-run
bash scripts/train_opd.sh zimage ti prefixopd --dry-run

4. Train PrefixOPD & Baseline OPD Methods

# Primary Table 3 PrefixOPD recipe (SD3.5-M TI, T2I RL + UnifiedReward-Edit I2I, init ref S0, α=0.25)
bash scripts/train_prefixopd.sh sd35_ti_ur2b

# 3-teacher consolidation (SD3.5-M TIM: T2I + I2I + MI2I)
bash scripts/train_prefixopd.sh sd35_tim

# Cross-backbone consolidation (Z-Image TI)
bash scripts/train_prefixopd.sh zimage_ti

# Run DanceOPD, DiffusionOPD, or Flow-OPD on any backbone/mixture
bash scripts/train_opd.sh sd35 ti danceopd
bash scripts/train_opd.sh sd35 tim diffusionopd
bash scripts/train_opd.sh zimage tim flowopd
🔧 Specialist SFT (26 configs) & Specialist RL (22 configs) Training Commands

Specialist SFT (configs/teachers/{sd35,zimage}/*.yaml)

rethink-teacher validate --config configs/teachers/sd35/t2i-general.yaml --check-files
accelerate launch --num_processes 8 -m src.cli.teacher train \
  --config configs/teachers/sd35/t2i-general.yaml

Specialist RL (configs/rl/{sd35,zimage}/*.yaml)

For I2I / MI2I RL, materialize input conditions first (targets remain in Parquet):

rethink-resources conditions --dataset-root "$RETHINK_DATA_ROOT" \
  --route I2I-GLOBAL --output "$RETHINK_DATA_ROOT/conditions"

Start the pointwise InternVL3.5-38B reward server on dedicated GPUs and launch policy RL on the remaining GPUs:

# Terminal 1: 2 GPUs for the pointwise reward service
CUDA_VISIBLE_DEVICES=6,7 rethink-reward-server \
  --snapshot-dir /path/to/pinned/InternVL3_5-38B \
  --devices 0,1 --port 18082 --compute-dtype bfloat16_fp32_head \
  --candidate-microbatch-size 1 --checkpoint-policy all \
  --rubric-path configs/rl/rubrics/t2i-general.md

# Terminal 2: 6 GPUs for specialist RL
export RETHINK_REWARD_ENDPOINT="http://127.0.0.1:18082"
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5 accelerate launch --num_processes 6 \
  -m src.cli.rl_pointwise run --config configs/rl/sd35/t2i-general.yaml

# Export completed RL checkpoint into a self-contained Teacher bundle
rethink-rl export --config configs/rl/sd35/t2i-general.yaml \
  --checkpoint "$RETHINK_OUTPUT_ROOT/teachers/rl/sd35/t2i-general/post-rl.pt" \
  --output "$RETHINK_OUTPUT_ROOT/teachers/rl/sd35/t2i-general/export"

5. Inference with Any Released Checkpoint

# Text-to-image with a specialist RL teacher
rethink-infer --model teacher/rl/sd35/t2i-general \
  --model-root "$RETHINK_MODEL_ROOT" \
  --config configs/teachers/sd35/t2i-general.yaml \
  --prompt "A glass teapot on a sunlit wooden table." \
  --output runs/demo_t2i.png

# Single-image editing with a consolidated TI student (40 steps, CFG 4.5 paper eval protocol)
rethink-infer --model student/sd35/ti/danceopd/final \
  --model-root "$RETHINK_MODEL_ROOT" \
  --config configs/teachers/sd35/i2i-global.yaml \
  --input /path/to/source.png --prompt "Change the scene to winter." \
  --steps 40 --guidance 4.5 --output runs/demo_i2i.png

# Multi-image composition with a TIM student (pass 2..10 ordered --input images)
rethink-infer --model student/zimage/tim/diffusionopd/final \
  --model-root "$RETHINK_MODEL_ROOT" \
  --config configs/teachers/zimage/mi2i-composition.yaml \
  --input /path/to/ref1.png --input /path/to/ref2.png \
  --prompt "Place both subjects in a bright sunlit studio." \
  --steps 50 --guidance 4.0 --output runs/demo_mi2i.png

📏 Evaluation

Prepare all 13 benchmark splits (1,300 conditions + verified benchmark_metadata.json.gz) from WeiChow/Rethink-Bench:

rethink-eval prepare-hf --output-root resources/bench

Generate, index, validate, judge, and aggregate scores on any checkpoint (including newly trained PrefixOPD checkpoints):

# 1. Generate + index + verify all 100 images for a split
bash scripts/eval_checkpoint.sh \
  configs/teachers/sd35/i2i-text.yaml \
  "$RETHINK_OUTPUT_ROOT/opd/sd35/ti/prefixopd_ur2b/final" \
  I2I_TEXT sd35-prefixopd 40 4.5

# 2a. Editing / MI2I routes: native GPT / Azure-GPT rubric judging
export OPENAI_API_KEY="..."
rethink-eval judge \
  --manifest resources/bench/I2I_TEXT/manifest.jsonl \
  --generations "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/I2I_TEXT/generations.jsonl" \
  --output "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/I2I_TEXT/scores.jsonl" \
  --backend gpt --model gpt-5.5

# 2b. T2I routes: vendored Qwen-Image-Bench Q-Judger
rethink-eval export-qjudger \
  --manifest resources/bench/T2I_GENERAL/manifest.jsonl \
  --generations "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/T2I_GENERAL/generations.jsonl" \
  --output "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/T2I_GENERAL/qjudger-input.jsonl"

# 3. Aggregate macro metrics
rethink-eval aggregate \
  --results "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/I2I_TEXT/scores.jsonl" \
  --output "$RETHINK_OUTPUT_ROOT/bench/sd35-prefixopd/aggregate.json"

📁 Repository Structure

.
├── assets/                   # Paper figures & qualitative grids for README
├── configs/
│   ├── opd/                  # 17 OPD recipes: {sd35,zimage}/{ti,tim}/{prefixopd*,danceopd,diffusionopd,flowopd}.yaml
│   ├── teachers/             # 26 Specialist SFT configs (13 per backbone)
│   └── rl/                   # 22 Specialist RL configs + 5 T2I rubrics
├── eval/
│   ├── hf_dataset.py         # Pinned HF benchmark + metadata preparation
│   ├── judgers/              # Native GPT/Azure, OCR, and base judge adapters
│   └── vendor/qwen_image_bench/  # Vendored Q-Judger (Apache 2.0)
├── scripts/                  # Helper launchers (download, PrefixOPD/OPD train, eval)
├── src/
│   ├── backends/             # SD3.5-Medium & Z-Image Diffusers adapters + edit conditioning
│   ├── cli/                  # Entrypoints: train, teacher, rl, infer, evaluate, resources
│   ├── data/                 # Zero-copy HF Parquet adapters & formal route streams
│   ├── methods/              # prefixopd.py, danceopd.py, diffusionopd.py, flowopd.py
│   ├── resources/            # 78-checkpoint model_registry.json
│   ├── rewards/              # Preference reward services & adapters
│   ├── rl/                   # Pointwise DiffusionNFT / DiffusionOPSD RL engine
│   └── teacher/              # Specialist SFT trainer & checkpoint-bound generator
├── pyproject.toml
└── LICENSE

🔁 Reproducibility Scope

  • Directly reproducible: All 78 published checkpoints can be evaluated out-of-the-box on all 13 benchmark routes; all 17 OPD recipes (including PrefixOPD Table 3 configs/opd/sd35/ti/prefixopd_ur2b.yaml, TIM, and Z-Image TI) run directly on the released Rethink-Train conditions and Rethink-Model teachers.
  • Teacher retraining scope: The 26 SFT and 22 RL specialist configs are fully portable and run on the released 3K-per-task subset; the original published Teacher endpoints were trained on larger curated source pools (100K T2I / 1.95M I2I / 510K MI2I) that remain subject to their upstream licenses.
  • License & notices: Repository code is licensed under Apache 2.0. Vendored Qwen-Image-Bench evaluation code retains its Apache 2.0 license (eval/vendor/qwen_image_bench/LICENSE). Upstream base models, reward models, and datasets remain governed by their respective licenses.

📚 Citation

@misc{chow2026rethinkingonpolicydistillationdiffusion,
  title={Rethinking On-Policy Distillation in Diffusion Models: Phenomenology and Insights},
  author={Wei Chow and XiuYu Zhang and Yuxiang Wei and Bo Chen and Yingshuo Wang and Xian Sun and Yifei Dong and Xuan Zhang and Meng Chu and Pengyu Li and Xin Li and Dongyue Lu and Alan Liang and Ce Zhang and Feng Cheng and Jason Li and Lingdong Kong and Leigang Qu and Tat-Seng Chua},
  year={2026},
  eprint={2611.39838},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2611.39838}
}

🙏 Acknowledgements

We gratefully acknowledge the authors and maintainers of the open-source methods, backbones, benchmarks, and reward models that enabled this study:

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages