← 论文海报合集← Paper Notes|
NeurIPS 2025 · 生成模型 · Generative ModelsNeurIPS 2025 · Generative Models

Flow-GRPO:通过在线强化学习训练 Flow Matching 模型Flow-GRPO: Training Flow Matching Models via Online RL

首个将在线策略梯度 RL 引入 Flow Matching 的方法,大幅提升 T2I 组合生成与文字渲染能力The first method to bring online policy-gradient RL into flow matching, greatly improving T2I compositional generation and text rendering
Jie Liu*, Gongye Liu*, Jiajun Liang, Yangguang Li, Jiaheng Liu, Xintao Wang, Pengfei Wan, Di Zhang, Wanli Ouyang†  |  MMlab CUHK · Tsinghua · Kling Team Kuaishou · Nanjing Univ. · Shanghai AI Lab

Flow-GRPO 将 GRPO(Group Relative Policy Optimization)引入 flow matching 生成模型。通过两项核心策略——ODE-to-SDE 转换(保持边缘分布不变的随机化)和 Denoising Reduction(训练时减少去噪步数)——实现了高效的在线 RL 训练,在组合图像生成(GenEval 63%→95%)、视觉文字渲染(59%→92%)和人类偏好对齐上均取得显著提升,且几乎无 reward hacking。Flow-GRPO brings GRPO (Group Relative Policy Optimization) to flow matching generative models. Through two core strategies — ODE-to-SDE conversion (a randomization that leaves the marginal distributions unchanged) and Denoising Reduction (fewer denoising steps during training) — it enables efficient online RL training, yielding marked gains on compositional image generation (GenEval 63%→95%), visual text rendering (59%→92%) and human preference alignment, with almost no reward hacking.

NeurIPS 2025 文本到图像 · T2IText-to-Image · T2I SD3.5-Medium 骨干SD3.5-Medium backbone 📄 arXiv:2505.05470 GitHub 代码GitHub Code
flow matching GRPO 在线强化学习online reinforcement learning ODE-to-SDE reward hacking 文本到图像生成text-to-image generation Denoising Reduction 组合图像生成compositional image generation

01 动机(Motivation)Motivation

Flow matching 模型(如 SD3.5、FLUX)在图像生成上表现出色,但在多对象组合、属性绑定和文字渲染等复杂场景下仍有明显短板。在线强化学习(online RL)已被证明能显著提升大语言模型的推理能力,然而将其应用于 flow matching 模型面临两大根本挑战。Flow matching models (such as SD3.5 and FLUX) excel at image generation, yet still fall clearly short in complex settings such as multi-object composition, attribute binding and text rendering. Online reinforcement learning (online RL) has been shown to markedly improve the reasoning ability of large language models, but applying it to flow matching models faces two fundamental challenges.

"This need for stochasticity in RL conflicts with the deterministic nature of flow matching models." — Flow matching 依赖确定性 ODE 采样,无法直接支持 RL 所需的随机探索;同时 flow model 推理需要大量去噪步数,数据收集代价极高。"This need for stochasticity in RL conflicts with the deterministic nature of flow matching models." — Flow matching relies on deterministic ODE sampling and cannot directly support the stochastic exploration that RL requires; at the same time, flow-model inference needs a large number of denoising steps, making data collection extremely costly.
Flow-GRPO GenEval性能曲线与图像质量对比
Figure 1.(左)GenEval 分数随训练时间稳步提升,最终以 0.95 超越 GPT-4o(0.84)。(右)DrawBench 图像质量指标(Aesthetic、DeQA)在训练后基本保持不变,Preference Score 上升。结果表明 Flow-GRPO 在提升目标能力的同时几乎无图像质量或多样性损失。Figure 1. (Left) The GenEval score rises steadily with training time, finally reaching 0.95 and surpassing GPT-4o (0.84). (Right) Image-quality metrics on DrawBench (Aesthetic, DeQA) stay essentially unchanged after training, while the Preference Score goes up. The results show that Flow-GRPO strengthens the targeted capability with almost no loss of image quality or diversity.
95%GenEval Overall(SD3.5-M + Flow-GRPO),超越 GPT-4o 的 84%GenEval Overall (SD3.5-M + Flow-GRPO), surpassing GPT-4o's 84%
63%→95%组合图像生成准确率提升幅度Gain in compositional image generation accuracy
59%→92%视觉文字渲染(OCR)准确率提升幅度Gain in visual text rendering (OCR) accuracy
Denoising Reduction 带来的训练采样加速比Training-time sampling speedup from Denoising Reduction

核心挑战Key Challenges

02 方法(Method)Method

Flow-GRPO 将 GRPO 扩展到 flow matching 模型,核心包含两项技术创新:(1)ODE-to-SDE 转换,将确定性 ODE 采样转化为保持边缘分布不变的等价 SDE;(2)Denoising Reduction,训练时大幅减少去噪步数以加速数据收集,而推理时保留原始步数以保证质量。Flow-GRPO extends GRPO to flow matching models with two core technical innovations: (1) ODE-to-SDE conversion, which turns deterministic ODE sampling into an equivalent SDE that preserves the marginal distributions; (2) Denoising Reduction, which sharply cuts the number of denoising steps during training to speed up data collection, while keeping the original number of steps at inference time to guarantee quality.

Flow-GRPO 方法总览图
Figure 2. Flow-GRPO 方法总览。给定提示词,通过 ODE-to-SDE 策略引入随机性以支持在线 RL;利用 Denoising Reduction(T=10 步)高效采集低质量但信息丰富的轨迹;轨迹对应的奖励送入 GRPO loss,在线更新模型权重,得到对齐后的策略。右侧的 Group Relative Policy Optimization 通过组内相对优势归一化来估计策略梯度,无需额外 value network。Figure 2. Overview of Flow-GRPO. Given a prompt, the ODE-to-SDE strategy injects stochasticity so that online RL becomes possible; Denoising Reduction (T=10 steps) efficiently collects low-quality but informative trajectories; the rewards of those trajectories feed the GRPO loss, which updates the model weights online and yields the aligned policy. On the right, Group Relative Policy Optimization estimates the policy gradient through group-relative advantage normalization, without any extra value network.

1. Denoising as a Markov Decision Process

Flow matching 的去噪过程被建模为 MDP(S, A, P, R):状态 s_t = (c, t, x_t),动作 a_t = x_{t-1}(模型预测的去噪样本),策略 π_θ 由 flow model 参数化。奖励仅在最终时步给出:R(s_T, a_T) = r(x_0, c)。这一 MDP 视角使得策略梯度方法可以直接适用。The denoising process of flow matching is modeled as an MDP (S, A, P, R): the state is s_t = (c, t, x_t), the action is a_t = x_{t-1} (the denoised sample predicted by the model), and the policy π_θ is parameterized by the flow model. The reward is given only at the final timestep: R(s_T, a_T) = r(x_0, c). This MDP view makes policy-gradient methods directly applicable.

2. ODE-to-SDE 转换(实现随机性)2. ODE-to-SDE Conversion (Introducing Stochasticity)

原始 flow matching 使用确定性 ODE(dx_t = v_t dt),无法满足 RL 的随机采样需求。Flow-GRPO 将其转换为等价的反向时间 SDE:The original flow matching uses a deterministic ODE (dx_t = v_t dt), which cannot meet the random-sampling requirement of RL. Flow-GRPO converts it into an equivalent reverse-time SDE:

dx_t = [v_θ(x_t) + (σ_t²/2t)(x_t + (1-t)v_θ(x_t))] dt + σ_t dw

其中 σ_t = a√(t/(1-t)),a 为控制随机程度的超参数。经 Euler-Maruyama 离散化后,策略 π_θ(x_{t-1} | x_t, c) 成为各向同性高斯分布,可以闭式计算 KL 散度,无需额外打分网络。关键数学保证:此 SDE 与原 ODE 在每个时间步的边缘分布完全相同,即转换不改变模型的生成分布。Here σ_t = a√(t/(1-t)), with a a hyperparameter controlling the degree of stochasticity. After Euler-Maruyama discretization, the policy π_θ(x_{t-1} | x_t, c) becomes an isotropic Gaussian, so the KL divergence can be computed in closed form without an extra scoring network. The key mathematical guarantee: this SDE has exactly the same marginal distribution as the original ODE at every timestep, i.e. the conversion does not change the model's generative distribution.

3. GRPO 目标函数3. GRPO Objective

GRPO 无需 critic/value network,通过组内相对归一化来估计优势:对每个提示词 c,采样 G 张图像,优势 Â_i = (R_i − mean(R)) / std(R)。训练目标:GRPO needs no critic/value network and estimates the advantage by relative normalization within a group: for each prompt c, G images are sampled and the advantage is Â_i = (R_i − mean(R)) / std(R). The training objective:

J_Flow-GRPO = E[f(r, Â, θ, ε, β)],其中 f 包含 clip 截断的 PPO-style 比率项与 KL 正则项 −β·D_KL(π_θ ‖ π_ref)J_Flow-GRPO = E[f(r, Â, θ, ε, β)], where f contains a clipped PPO-style ratio term and the KL regularizer −β·D_KL(π_θ ‖ π_ref)

KL 惩罚是防止 reward hacking 的关键:它将模型约束在预训练权重附近,从而保留图像质量和多样性。The KL penalty is the key to preventing reward hacking: it constrains the model to stay near the pretrained weights, thereby preserving image quality and diversity.

4. Denoising Reduction(训练加速)4. Denoising Reduction (Training Speedup)

在线 RL 训练时,每次采集样本需运行完整去噪链,成本高昂。实验发现:将训练时去噪步数从 T=40 减少到 T=10,可获得超过 4× 的采样加速,而最终奖励和图像质量不受影响。推理时仍使用 T=40,保持生成质量。进一步减少至 T=5 则不一致地降低训练效率。During online RL training, every round of sample collection has to run the full denoising chain, which is costly. Experiments find that reducing the training-time denoising steps from T=40 to T=10 gives more than 4× sampling speedup, while the final reward and image quality are unaffected. Inference still uses T=40 to keep generation quality. Reducing further to T=5 lowers training efficiency inconsistently.

03 实验(Experiments)Experiments

在三类任务上评估 Flow-GRPO:(1)组合图像生成(GenEval benchmark);(2)视觉文字渲染(OCR 准确率);(3)人类偏好对齐(PickScore)。骨干模型为 Stable Diffusion 3.5-Medium(SD3.5-M)。图像质量通过 DrawBench 上的 Aesthetic Score、DeQA、ImageReward 和 UnifiedReward 独立评估以检测 reward hacking。Flow-GRPO is evaluated on three kinds of tasks: (1) compositional image generation (GenEval benchmark); (2) visual text rendering (OCR accuracy); (3) human preference alignment (PickScore). The backbone model is Stable Diffusion 3.5-Medium (SD3.5-M). Image quality is assessed independently with Aesthetic Score, DeQA, ImageReward and UnifiedReward on DrawBench in order to detect reward hacking.

GenEval 基准(组合图像生成)GenEval Benchmark (Compositional Image Generation)

模型ModelOverallSingle Obj.Two Obj.CountingColorsPositionAttr. Binding
FLUX.1 Dev0.660.980.810.740.790.220.45
GPT-4o0.840.990.920.850.920.750.61
SD3.5-M(基线)SD3.5-M (baseline)0.630.980.780.500.810.240.52
SD3.5-M + Flow-GRPO0.951.000.990.950.920.990.86

视觉文字渲染与人类偏好结果(Table 2)Visual Text Rendering and Human Preference Results (Table 2)

模型ModelGenEvalOCR Acc.PickScoreAestheticDeQAImgRwdUniRwd
SD3.5-M0.630.5921.725.394.070.873.33
Flow-GRPO w/o KL(GenEval)Flow-GRPO w/o KL (GenEval)0.954.932.770.442.94
Flow-GRPO w/ KL(GenEval)Flow-GRPO w/ KL (GenEval)0.955.254.011.033.51
Flow-GRPO w/ KL(OCR)Flow-GRPO w/ KL (OCR)0.925.324.060.953.42
Flow-GRPO w/ KL(PickScore)Flow-GRPO w/ KL (PickScore)23.315.924.221.283.66

注:不加 KL 正则时(w/o KL),Aesthetic Score 从 5.39 降至 4.93,DeQA 从 4.07 降至 2.77,出现明显 reward hacking(图像质量下降)。加入 KL 后质量指标几乎与基线持平。Note: without KL regularization (w/o KL), the Aesthetic Score drops from 5.39 to 4.93 and DeQA drops from 4.07 to 2.77, showing obvious reward hacking (degraded image quality). Once KL is added, the quality metrics are almost on par with the baseline.

GenEval 定性对比
Figure 3. GenEval 定性对比。在 Counting(四头长颈鹿)、Colors(棕色长颈鹿 + 白色止停牌)、Attribute Binding(红色橙子 + 紫色西蓝花)和 Position(熊右侧的长椅)等任务上,SD3.5-M + Flow-GRPO(最下行)明显优于 FLUX.1 Dev、GPT-4o 和原始 SD3.5-M。Figure 3. Qualitative GenEval comparison. On tasks such as Counting (four giraffes), Colors (a brown giraffe + a white stop sign), Attribute Binding (a red orange + purple broccoli) and Position (a bench to the right of the bear), SD3.5-M + Flow-GRPO (bottom row) is clearly better than FLUX.1 Dev, GPT-4o and the original SD3.5-M.

Ablation 分析Ablation Analysis

04 局限性(Limitations)Limitations

注:以下局限性均为论文 "Limitations & Future Work" 小节中作者明确陈述(stated)的内容。Note: All of the limitations below are explicitly stated by the authors in the "Limitations & Future Work" section of the paper.
当前仅针对 T2I 任务,视频生成尚未验证Only T2I tasks so far; video generation is not yet validated

本工作聚焦于文本到图像任务(T2I)。虽然 Flow-GRPO 有潜力扩展到视频生成,但视频场景面临更复杂的多目标奖励设计(物理真实性、时序一致性、平滑度等),目前缺乏实验验证。This work focuses on the text-to-image (T2I) task. Although Flow-GRPO has the potential to extend to video generation, video settings face more complex multi-objective reward design (physical realism, temporal consistency, smoothness, etc.), and experimental validation is currently missing.

Reward Design 依赖简单规则,高级奖励有待开发Reward design relies on simple rules; advanced rewards remain to be developed

当前奖励函数使用对象检测器、文字识别等规则信号。对于鼓励物理真实性或时序一致性等复杂语义,需要更先进的奖励模型,目前还是挑战。The current reward functions use rule-based signals such as object detectors and text recognition. Encouraging complex semantics such as physical realism or temporal consistency calls for more advanced reward models, which is still a challenge.

视频生成的可扩展性问题Scalability issues for video generation

视频生成比 T2I 消耗的资源多得多,将 Flow-GRPO 在视频规模上应用需要更高效的数据收集与训练流水线,目前的工程挑战尚未被解决。Video generation consumes far more resources than T2I; applying Flow-GRPO at video scale requires more efficient data collection and training pipelines, and the engineering challenge remains unsolved for now.

KL 正则虽有效,但代价是训练时间更长KL regularization works, but at the cost of longer training

作者指出:加入 KL 约束可以匹配无 KL 版本的最终高奖励,但需要更长的训练时间。此外,在某些提示词上仍会偶发 reward hacking(如人类偏好任务中视觉多样性的下降)。The authors point out that adding the KL constraint can match the final high reward of the KL-free version, but requires longer training. Moreover, reward hacking still occurs occasionally on some prompts (e.g. a drop in visual diversity in the human-preference task).