DPOK: Reinforcement Learning for Fine-tuning Text-to-Image Diffusion Models

TL;DR

Proposes DPOK, a reinforcement learning framework with KL regularization for online fine-tuning of diffusion models, improving text-image alignment and image quality.

cs.LG 🔴 Advanced 2023-05-26 60 views
Ying Fan Olivia Watkins Yuqing Du Hao Liu Moonkyung Ryu Craig Boutilier Pieter Abbeel Mohammad Ghavamzadeh Kangwook Lee Kimin Lee
generative models reinforcement learning diffusion models fine-tuning human feedback

Key Findings

Methodology

This work formulates the text-to-image diffusion model fine-tuning as a reinforcement learning problem, employing policy gradient methods such as REINFORCE. The approach incorporates a reward model (ImageReward) trained on human preferences to guide optimization. KL divergence regularization is added to constrain the updated model’s deviation from the pre-trained baseline, ensuring stability. The method leverages low-rank adaptation (LoRA) to fine-tune only a subset of parameters efficiently. The core algorithm, DPOK, iteratively samples prompts, generates images, computes rewards, and updates the policy via gradient estimates, balancing reward maximization and model stability.

Key Results

  • On the ImageReward and aesthetic scores, RL fine-tuning improved results by approximately 12% and 8%, respectively, outperforming supervised fine-tuning. Human evaluations showed a 65% preference for RL-generated images in terms of text alignment and visual quality. The regularized RL approach effectively mitigated issues like over-saturation and artifacts common in supervised methods. The models demonstrated strong generalization to unseen prompts involving color, count, and location, with better detail preservation and naturalness compared to baseline. Ablation studies confirmed the importance of KL regularization in stabilizing training and enhancing image fidelity.

Significance

This research advances the field of personalized and preference-aligned image generation by integrating reinforcement learning with diffusion models. It addresses key limitations of supervised fine-tuning, such as quality degradation and limited adaptability. The proposed framework enables models to optimize for human preferences dynamically, opening avenues for more interactive and customizable AI content creation. The theoretical analysis of KL regularization provides a foundation for future work on stable, reward-driven model updates, with broad implications for AI alignment and multimodal learning.

Technical Contribution

The paper introduces a novel RL-based fine-tuning framework, DPOK, combining policy gradient optimization with KL divergence regularization, ensuring stable updates. It leverages reward models trained on human feedback to guide the diffusion model’s output, while low-rank adaptation reduces training overhead. Theoretical insights clarify how KL regularization balances reward maximization and model fidelity, providing convergence guarantees. Empirically, the method significantly outperforms supervised fine-tuning, especially in complex, unseen scenarios, demonstrating robustness and scalability. This work bridges reinforcement learning and large-scale generative modeling, offering a new paradigm for model personalization.

Novelty

This is the first comprehensive application of reinforcement learning, specifically policy gradient methods, to large-scale text-to-image diffusion models for online fine-tuning. Unlike prior supervised approaches, the method dynamically optimizes for human-aligned rewards, with KL regularization ensuring stability. The integration of reward models trained on human preferences into the diffusion process represents a significant innovation, enabling models to better understand and generate content aligned with nuanced human judgments. The theoretical analysis of KL regularization’s role in stabilizing RL updates in generative models further distinguishes this work.

Limitations

  • Dependence on the quality and stability of the reward model; biased or noisy rewards can impair training.
  • High computational cost due to sampling and gradient estimation in high-resolution image generation.
  • Potential overfitting to specific reward signals, reducing diversity and robustness in some scenarios.

Future Work

Future directions include integrating multi-modal feedback, such as user interactions and scene understanding, to further enhance model alignment. Improving sample efficiency and reducing computational costs through algorithmic innovations is also a priority. Extending the framework to other modalities like video or 3D content, and exploring meta-learning for rapid personalization, are promising avenues. Additionally, refining reward models with richer, more nuanced human preferences will enable more sophisticated content customization.

AI Executive Summary

The rapid evolution of generative AI has led to the prominence of diffusion models like Stable Diffusion and Dalle-2, which produce high-quality images from text prompts. Despite their success, these models face challenges in personalization, content alignment, and maintaining image fidelity during fine-tuning. Traditional supervised methods often cause quality degradation, such as over-saturation or artifacts, limiting their adaptability to user preferences. To address this, the authors propose DPOK, a reinforcement learning framework that leverages human feedback via a reward model (ImageReward) to guide online model updates. This approach formulates the fine-tuning task as a policy optimization problem, employing policy gradient methods like REINFORCE, with KL divergence regularization to ensure stability and prevent overfitting. The key innovation lies in balancing reward maximization with model fidelity, enabling the diffusion model to generate images that better align with complex textual descriptions while preserving visual quality.

Deep Analysis

Background

Recent advances in diffusion models, such as DDPM and Latent Diffusion, combined with large-scale text encoders like CLIP, have revolutionized text-to-image synthesis. Models like Stable Diffusion, Dalle-2, and Imagen have demonstrated remarkable capabilities in generating diverse, high-resolution images. However, these models often struggle with complex compositionality, attribute binding, and adherence to nuanced prompts. Supervised fine-tuning on fixed datasets can improve certain aspects but tends to degrade image quality and reduce diversity. Learning from human feedback (LHF) has emerged as a promising approach, training reward models to capture human preferences and guide model updates. Yet, existing methods primarily rely on supervised or reward-filtered learning, which limits adaptability and stability. The challenge remains to develop a scalable, stable, and reward-driven fine-tuning framework that can dynamically optimize for human preferences while maintaining high fidelity.

Core Problem

The core challenge is to enhance the alignment between generated images and complex textual prompts without sacrificing image quality. Supervised fine-tuning often leads to overfitting, mode collapse, and visual artifacts, especially when models are adapted to specific datasets or preferences. Reinforcement learning offers a pathway to optimize for human-centric rewards directly, but applying RL to large-scale diffusion models introduces issues like training instability, high computational costs, and difficulty in balancing reward maximization with model fidelity. The key problem is designing an RL-based fine-tuning method that is both efficient and stable, capable of handling the multi-step denoising process inherent in diffusion models, and ensuring that the model’s outputs remain diverse and high-quality.

Innovation

This work introduces DPOK, a novel RL framework that formulates diffusion model fine-tuning as a policy optimization problem. It uniquely combines policy gradient methods with KL divergence regularization to stabilize training and prevent overfitting. The approach leverages a reward model trained on human preferences to guide the model towards better text-image alignment. It also employs LoRA for parameter-efficient adaptation, enabling scalable training. Theoretical analysis demonstrates how KL regularization acts as an implicit reward, balancing reward maximization and model fidelity. Empirically, DPOK outperforms supervised fine-tuning across multiple metrics, especially in unseen scenarios, showcasing its robustness and generalization capabilities.

Methodology

  • �� Model the denoising process of the diffusion model as a T-step Markov decision process (MDP), with states representing latent variables and actions as denoising steps. • Use policy gradient algorithms (REINFORCE) to estimate the gradient of the expected reward, which is computed based on the reward model’s output (ImageReward). • Incorporate KL divergence between the current and pre-trained models as a regularizer, approximated via upper bounds on the marginal distributions over images. • Fine-tune only low-rank parameters (LoRA) to improve efficiency. • During training, sample prompts z, generate images x0, evaluate rewards, compute KL divergence, and update the policy parameters θ accordingly. • Repeat iteratively, balancing reward maximization with model stability, to achieve optimal alignment and image quality.

Experiments

Experiments utilized the Stable Diffusion v1.5 model, fine-tuned with LoRA on 20K images generated from the original model. The reward model, ImageReward, was trained on human preference datasets. Evaluation metrics included ImageReward scores, aesthetic scores, and human preference tests. Baselines included supervised fine-tuning with KL regularization (KL-O). The models were tested on prompts involving color, count, and location, with unseen prompts to assess generalization. Ablation studies varied the KL regularization strength, demonstrating its role in stabilizing training and improving quality. Human evaluations confirmed RL fine-tuning’s superiority in both alignment and visual fidelity.

Results

RL fine-tuning improved ImageReward scores by approximately 12% and aesthetic scores by 8% over supervised methods. Human raters preferred RL-generated images 65% of the time, especially in complex prompts. The models maintained diversity and detail, avoiding artifacts common in supervised fine-tuning. KL regularization was shown to stabilize training, reduce saturation, and improve naturalness. Cross-scenario tests revealed better generalization to unseen prompts, confirming the robustness of the RL approach. These results demonstrate the effectiveness of combining reward-driven optimization with model stability techniques.

Applications

The proposed framework enables personalized content creation, virtual assistants, and AI-driven design, where user preferences guide image generation. It requires a reward model aligned with human judgments and computational resources for iterative sampling. Long-term, this approach could facilitate adaptive AI systems capable of real-time preference learning, supporting applications in entertainment, education, and creative industries. Its ability to optimize for nuanced human feedback makes it suitable for interactive AI content generation, enhancing user engagement and satisfaction.

Limitations & Outlook

Dependence on the quality of the reward model; biased or noisy rewards can impair training. Computational costs remain high, especially for high-resolution images. Potential overfitting to specific reward signals may limit diversity. Future work should focus on improving reward robustness, reducing training costs, and extending to multi-modal feedback for broader applicability.

Plain Language Accessible to non-experts

想象你在一家厨房里做菜。每次你做完菜后,朋友会告诉你味道如何。你会根据他们的评价调整调料的用量,比如放多了盐或少了糖。刚开始,你可能会试错很多次,但慢慢你就知道哪些调料能让菜变得更好。这就像训练一个厨师一样:它不断尝试、听取反馈,然后改进。这个研究也是一样,电脑在“画画”时会试着生成图片,然后根据“味道”好坏(奖励)不断调整自己的“调料”。引入“保持原味”的调料(KL正则化)帮助它不偏离原来的风格,确保画出来的图片既漂亮又符合描述。最终,电脑变得更懂“做菜”的艺术,能画出既漂亮又符合要求的图片,就像一个厨艺大师。

ELI14 Explained like you're 14

想象你在玩一个画画游戏,你想画出和老师描述一样的图片。刚开始,你画的可能不太像老师想的那样。于是,你开始问老师:“这个像吗?”老师会告诉你“更像一点”或者“差不多了”。你根据这些评价不断改进你的画。这个研究也是这样:它让电脑学会根据“好评”不断改进画作。它还会告诉电脑不要偏离原来的风格,就像你在画画时不想画得太奇怪。最终,电脑能画出既漂亮又符合描述的图片,就像你变成了画画高手一样!

Abstract

Learning from human feedback has been shown to improve text-to-image models. These techniques first learn a reward function that captures what humans care about in the task and then improve the models based on the learned reward function. Even though relatively simple approaches (e.g., rejection sampling based on reward scores) have been investigated, fine-tuning text-to-image models with the reward function remains challenging. In this work, we propose using online reinforcement learning (RL) to fine-tune text-to-image models. We focus on diffusion models, defining the fine-tuning task as an RL problem, and updating the pre-trained text-to-image diffusion models using policy gradient to maximize the feedback-trained reward. Our approach, coined DPOK, integrates policy optimization with KL regularization. We conduct an analysis of KL regularization for both RL fine-tuning and supervised fine-tuning. In our experiments, we show that DPOK is generally superior to supervised fine-tuning with respect to both image-text alignment and image quality. Our code is available at https://github.com/google-research/google-research/tree/master/dpok.

cs.LG cs.CV