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.
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 将 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 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.
原始 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.
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.
在线 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.
在三类任务上评估 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.
| 模型Model | Overall | Single Obj. | Two Obj. | Counting | Colors | Position | Attr. Binding |
|---|---|---|---|---|---|---|---|
| FLUX.1 Dev | 0.66 | 0.98 | 0.81 | 0.74 | 0.79 | 0.22 | 0.45 |
| GPT-4o | 0.84 | 0.99 | 0.92 | 0.85 | 0.92 | 0.75 | 0.61 |
| SD3.5-M(基线)SD3.5-M (baseline) | 0.63 | 0.98 | 0.78 | 0.50 | 0.81 | 0.24 | 0.52 |
| SD3.5-M + Flow-GRPO | 0.95 | 1.00 | 0.99 | 0.95 | 0.92 | 0.99 | 0.86 |
| 模型Model | GenEval | OCR Acc. | PickScore | Aesthetic | DeQA | ImgRwd | UniRwd |
|---|---|---|---|---|---|---|---|
| SD3.5-M | 0.63 | 0.59 | 21.72 | 5.39 | 4.07 | 0.87 | 3.33 |
| Flow-GRPO w/o KL(GenEval)Flow-GRPO w/o KL (GenEval) | 0.95 | — | — | 4.93 | 2.77 | 0.44 | 2.94 |
| Flow-GRPO w/ KL(GenEval)Flow-GRPO w/ KL (GenEval) | 0.95 | — | — | 5.25 | 4.01 | 1.03 | 3.51 |
| Flow-GRPO w/ KL(OCR)Flow-GRPO w/ KL (OCR) | — | 0.92 | — | 5.32 | 4.06 | 0.95 | 3.42 |
| Flow-GRPO w/ KL(PickScore)Flow-GRPO w/ KL (PickScore) | — | — | 23.31 | 5.92 | 4.22 | 1.28 | 3.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.
本工作聚焦于文本到图像任务(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.
当前奖励函数使用对象检测器、文字识别等规则信号。对于鼓励物理真实性或时序一致性等复杂语义,需要更先进的奖励模型,目前还是挑战。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.
视频生成比 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 版本的最终高奖励,但需要更长的训练时间。此外,在某些提示词上仍会偶发 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).