Aligning Text-to-Image Diffusion Models with Reward Backpropagation

Anonymous Authors

AlignProp is a direct backpropagation-based approach to finetune text-to-image diffusion models for desired reward function. Above we show finetuning results for various reward functions.

Abstract

Text-to-image diffusion models have recently emerged at the forefront of image generation, powered by very large-scale unsupervised or weakly supervised text-to-image training datasets. Due to the unsupervised training, controlling their behavior in downstream tasks, such as maximizing human-perceived image quality, image-text alignment, or ethical image generation, is difficult. Recent works finetune diffusion models to downstream reward functions using vanilla reinforcement learning, notorious for the high variance of the gradient estimators. In this paper, we propose AlignProp, a method that aligns diffusion models to downstream reward functions using end-to-end backpropagation of the reward gradient through the denoising process. While naive implementation of such backpropagation would require prohibitive memory resources for storing the partial derivatives of modern text-to-image models, AlignProp finetunes low-rank adapter weight modules and uses gradient checkpointing, to render its memory usage viable. We test AlignProp in finetuning diffusion models to various objectives, such as image-text semantic alignment, aesthetics, compressibility and controllability of the number of objects present, as well as their combinations. We show AlignProp achieves higher rewards in fewer training steps than alternatives, while being conceptually simpler, making it a straightforward choice for optimizing diffusion models for differentiable reward functions of interest.

Comparision with baselines at different epochs during training.

In the results below we compare AlignProp with all other baselines, during different iterations of training. A single iteration of training represents a single step of gradient descent. As can be seen from the visuals, DDPO is very sample inefficient, it rarely shows any improvements from the Stable Diffusion generations. ReFL while being sample efficient doesn't result in changes at a semantic level, also it results in overoptimization at training iteration 14.

<-----------Click here for More Results on Aesthetic Reward--------->

Comparision with baselines on HPS reward

In the results below we compare AlignProp with all other baselines for image-text alignment, while using HPSv2 reward function.

A pair of planes parked in a small rural airfield.

Stable Diffusion

016_A pair of planes parked in a small rural airfield..png

DDPO

016_A pair of planes parked in a small rural airfield..png

ReFL

016_A pair of planes parked in a small rural airfield..png

AlignProp

016_A pair of planes parked in a small rural airfield..png

A bunch of people on skiing on a hill

Stable Diffusion

073_a bunch of people on skiing on a hill.png

DDPO

073_a bunch of people on skiing on a hill.png

ReFL

073_a bunch of people on skiing on a hill.png

AlignProp

073_a bunch of people on skiing on a hill.png

<-----------Click here for More Results on HPS Reward--------->

Interactive Mixing Results

In this context, we demonstrate the ability of AlignProp to interpolate between different reward functions during the inference phase. We draw inspiration from the concept presented in ModelSoup, which showcases how averaging the weights of multiple fine-tuned models can enhance image classification accuracy.Expanding upon this idea, we extend it to the domain of image editing, revealing that averaging the LoRA weights of diffusion models trained with distinct reward functions can yield images that satisfy multiple reward criteria. AlignProp adeptly demonstrates its capacity to interpolate between distinct reward functions, achieving the highest overall reward when the mixing coefficient is set to 0.5. Please move the slider to visualize results with different mixing coefficients.

Aesthetic Model

Seg Acc Curve.

Hybrid Model

Seg Acc Curve.

Compression Model

Seg Acc Curve.

Aesthetic Model

Seg Acc Curve.

Hybrid Model

Seg Acc Curve.

Compression Model

Seg Acc Curve.

Hybrid Model - Mixing Coefficient (α)