Enhancing Diffusion Models with Text-Encoder Reinforcement Learning

Chaofeng Chen, Annan Wang, Haoning Wu, Liang Liao, Wenxiu Sun, Qiong Yan, Weisi Lin

Introduction

Text-to-image diffusion models, such as Stable Diffusion, have revolutionized content creation. However, these models often struggle to align perfectly with complex user prompts or human aesthetic preferences. Traditionally, alignment efforts have focused on fine-tuning the U-Net—the component responsible for image synthesis—while keeping the text encoder fixed. This approach assumes the text encoder provides optimal embeddings, which is often not the case. We present TexForce, a framework that shifts the focus of reinforcement learning (RL) to the text encoder, unlocking latent potential in the generation process.

Methodology: The TexForce Framework

TexForce introduces a modular approach to model alignment by applying RL directly to the text encoder.

Reinforcement Learning with DDPO

The framework utilizes Denoising Diffusion Policy Optimization (DDPO), an algorithm derived from Proximal Policy Optimization (PPO). Instead of updating the U-Net's pixel-prediction capabilities, the RL policy optimizes the text encoder to maximize rewards derived from human-preference models like ImageReward or HPSv2.

Efficiency via LoRA

To maintain computational efficiency and prevent catastrophic forgetting of the original text-understanding capabilities, TexForce employs Low-Rank Adaptation (LoRA). Only a small set of adapter weights within the text encoder are trained, making the process significantly faster than full-parameter fine-tuning.

Modular Fusion

A standout feature of TexForce is its modularity. Because the text encoder and U-Net are tuned independently using LoRA, their respective weights can be fused "zero-shot." This allows users to combine a text encoder optimized for prompt adherence with a U-Net optimized for artistic style without additional joint training.

Figure 4: Qualitative comparison showing improvements in aesthetic quality, hand generation, and facial realism across various tasks.

Experimental Results

The authors evaluated TexForce across diverse prompt sets, ranging from simple animal descriptions to complex long-form prompts from the ImageReward and HPSv2 benchmarks.

Quantitative Performance

On the ImageReward benchmark, TexForce improved the base Stable Diffusion v1.4 score from 0.2154 to 0.4556. When fused with a previously tuned U-Net (ReFL), the combined model achieved a score of 0.6553, demonstrating that text-encoder tuning provides orthogonal benefits to U-Net tuning.

Qualitative and Specialized Improvements

TexForce effectively mitigates common diffusion errors such as "color bleeding" (e.g., misattributing colors to the wrong objects) and incorrect object counts. Furthermore, by using specialized reward functions—such as detection confidence scores—the model can be steered to excel at notoriously difficult tasks like generating anatomically correct human hands and realistic faces.

Figure 1: An example of high-quality hand generation achieved through specialized text-encoder tuning.

Discussion and Limitations

While TexForce offers significant advantages, optimizing the text encoder is inherently more complex and time-consuming than U-Net tuning. Interestingly, the study found that simultaneous training of both components led to instability and lower performance compared to separate training and fusion. This suggests that a stable U-Net acts as a necessary "anchor" for the text encoder during the RL process.

Conclusion

TexForce demonstrates that the text encoder is a powerful, yet underutilized, lever for aligning diffusion models with human intent. By treating the encoder as a tunable policy, researchers can achieve superior image-text alignment and aesthetic quality in a modular, "plug-and-play" fashion. Future work will explore scaling this approach to larger architectures like SDXL.

Summary updated

BibTeX
@inproceedings{chen2024enhancing,
  author = {Chaofeng Chen and Annan Wang and Haoning Wu and Liang Liao and Wenxiu Sun and Qiong Yan and Weisi Lin},
  title = {{Enhancing Diffusion Models with Text-Encoder Reinforcement Learning}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72698-9\_11},
}
Figure