File size: 3,910 Bytes
245e967
6d3c106
 
940c93a
 
 
245e967
 
940c93a
245e967
940c93a
245e967
940c93a
 
245e967
940c93a
 
 
 
 
245e967
940c93a
 
 
 
245e967
6d3c106
8ac1768
6d3c106
940c93a
6d3c106
 
 
245e967
6d3c106
940c93a
6d3c106
940c93a
245e967
940c93a
6d3c106
 
245e967
6d3c106
 
245e967
6d3c106
 
 
 
 
 
256aa56
6d3c106
256aa56
6d3c106
 
245e967
940c93a
245e967
6d3c106
245e967
940c93a
8ac1768
40b5f3c
8ac1768
 
 
 
6d3c106
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
61
62
63
64
65
66
67
68
69
70
---
base_model:
- black-forest-labs/FLUX.1-dev
library_name: diffusers
license: mit
pipeline_tag: text-to-image
---

# FLUX.1-dev-PrefGRPO: Pairwise Preference Reward-based GRPO for Stable Text-to-Image Reinforcement Learning

This model is trained using [Pref-GRPO](https://codegoat24.github.io/UnifiedReward/Pref-GRPO) on the training dataset of [UniGenBench](https://github.com/CodeGoat24/UniGenBench).

## Abstract
Recent advancements highlight the importance of GRPO-based reinforcement learning methods and benchmarking in enhancing text-to-image (T2I) generation. However, current methods using pointwise reward models (RM) for scoring generated images are susceptible to reward hacking. We reveal that this happens when minimal score differences between images are amplified after normalization, creating illusory advantages that drive the model to over-optimize for trivial gains, ultimately destabilizing the image generation process. To address this, we propose Pref-GRPO, a pairwise preference reward-based GRPO method that shifts the optimization objective from score maximization to preference fitting, ensuring more stable training. In Pref-GRPO, images are pairwise compared within each group using preference RM, and the win rate is used as the reward signal. Extensive experiments demonstrate that PREF-GRPO differentiates subtle image quality differences, providing more stable advantages and mitigating reward hacking. Additionally, existing T2I benchmarks are limited by coarse evaluation criteria, hindering comprehensive model assessment. To solve this, we introduce UniGenBench, a unified T2I benchmark comprising 600 prompts across 5 main themes and 20 subthemes. It evaluates semantic consistency through 10 primary and 27 sub-criteria, leveraging MLLM for benchmark construction and evaluation. Our benchmarks uncover the strengths and weaknesses of both open and closed-source T2I models and validate the effectiveness of Pref-GRPO.

## Model Overview
Here are the main components of the Pref-GRPO pipeline:
<div align="center">
    <img src="https://github.com/CodeGoat24/Pref-GRPO/raw/main/assets/pref_grpo_pipeline.png" alt="Pref-GRPO Pipeline" width="100%"/>
</div>

Pref-GRPO addresses the issue of reward hacking in text-to-image generation:
<div align="center">
    <img src="https://github.com/CodeGoat24/Pref-GRPO/raw/main/assets/pref_grpo_reward_hacking.png" alt="Pref-GRPO Reward Hacking" width="100%"/>
</div>

For further details, please refer to the following resources:
- πŸ“° Paper: https://arxiv.org/pdf/2508.20751
- πŸͺ Project Page: https://codegoat24.github.io/UnifiedReward/Pref-GRPO
- πŸ’» Code: https://github.com/CodeGoat24/Pref-GRPO
- πŸ€— UniGenBench: https://github.com/CodeGoat24/UniGenBench
- πŸ€— Leaderboard: https://huggingface.co/spaces/CodeGoat24/UniGenBench_Leaderboard
- πŸ‘‹ Point of Contact: [Yibin Wang](https://codegoat24.github.io)

### Quick Start
```python
pip install -U diffusers
```

```python
import torch
from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained("CodeGoat24/FLUX.1-dev-PrefGRPO", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power

prompt = "A cat holding a sign that says hello world"
image = pipe(
    prompt,
    height=1024,
    width=1024,
    guidance_scale=3.5,
    num_inference_steps=30,
    max_sequence_length=512,
    generator=torch.Generator("cpu").manual_seed(3407)
).images[0]
image.save("flux-dev.png")

```

## Citation

```bibtex
@article{Pref-GRPO&UniGenBench,
  title={Pref-GRPO: Pairwise Preference Reward-based GRPO for Stable Text-to-Image Reinforcement Learning},
  author={Wang, Yibin and Li, Zhimin and Zang, Yuhang and Zhou, Yujie and Bu, Jiazi and Wang, Chunyu and Lu, Qinglin, and Jin, Cheng and Wang, Jiaqi},
  journal={arXiv preprint arXiv:2508.20751},
  year={2025}
}
```