File size: 2,055 Bytes
de808d3
 
 
2c5c503
de808d3
 
2c5c503
de808d3
2c5c503
de808d3
2c5c503
 
 
de808d3
2c5c503
de808d3
2c5c503
de808d3
2c5c503
de808d3
2c5c503
 
 
 
de808d3
2c5c503
 
 
de808d3
2c5c503
 
 
 
de808d3
2c5c503
 
 
 
de808d3
2c5c503
de808d3
2c5c503
 
 
 
 
de808d3
2c5c503
de808d3
2c5c503
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
base_model: stabilityai/stable-diffusion-3.5-medium
library_name: peft
pipeline_tag: text-to-image
---

# Flow-OPD

<div align="center">

[![arXiv](https://img.shields.io/badge/arXiv-2605.08063-red)](https://arxiv.org/abs/2605.08063)
[![GitHub](https://img.shields.io/badge/🐙_GitHub-Green)](https://github.com/CostaliyA/Flow-OPD)
[![HuggingFace](https://img.shields.io/badge/🤗%20Model-Flow--OPD-yellow)](https://huggingface.co/CostaliyA/Flow-OPD)

> **Flow-OPD: On-Policy Distillation for Flow Matching Models** — Evaluated on SD-3.5-Medium, Flow-OPD achieves **+18pt** average improvement over vanilla GRPO.

</div>

## Quick Start

```python
import torch
from diffusers import StableDiffusion3Pipeline
from peft import PeftModel

model_id = "stabilityai/stable-diffusion-3.5-medium"
lora_ckpt_path = "CostaliyA/Flow-OPD"#dev ckpt
device = "cuda"

pipe = StableDiffusion3Pipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.transformer = PeftModel.from_pretrained(pipe.transformer, lora_ckpt_path)
pipe.transformer = pipe.transformer.merge_and_unload()
pipe = pipe.to(device)

prompt = "a photo of a black kite and a green bear"
image = pipe(prompt, height=512, width=512, num_inference_steps=40, guidance_scale=4.5, negative_prompt="").images[0]
image.save("flow_opd.png")
```

## Results

| Model | GenEval | OCR | DeQA | PickScore | Average |
|---|---|---|---|---|---|
| SD-3.5-M (base) | 0.63 | 0.59 | 4.07 | 21.64 | 0.72 |
| GRPO-Mix | 0.73 | 0.83 | 4.33 | 21.84 | 0.82 |
| **Flow-OPD** | **0.92** | **0.94** | **4.35** | **23.08** | **0.90** |

## Citation

```bibtex
@misc{fang2026flowopdonpolicydistillationflow,
      title={Flow-OPD: On-Policy Distillation for Flow Matching Models},
      author={Zhen Fang and Wenxuan Huang and Yu Zeng and Yiming Zhao and Shuang Chen and Kaituo Feng and Yunlong Lin and Lin Chen and Zehui Chen and Shaosheng Cao and Feng Zhao},
      year={2026},
      eprint={2605.08063},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2605.08063},
}
```