Subject-driven Text-to-Image Generation via Preference-based Reinforcement Learning

Yanting Miao, William Loh, Suraj Kothawade, Pascal Poupart, Abdullah Rashwan, Yeqing Li

TL;DR

The paper introduces Reward Preference Optimization (RPO), a highly efficient method for subject-driven text-to-image generation that eliminates the need to fine-tune text encoders or generate thousands of negative samples. By leveraging a novel $\lambda$-Harmonic reward function and preference-based reinforcement learning, RPO cuts training time down to 5–20 minutes while achieving state-of-the-art text-image alignment on DreamBench.

What Problem Does This Paper Address?

Subject-driven text-to-image generation aims to take a few reference images of a specific subject (like your pet dog or a unique toy) and synthesize it naturally into entirely new contexts based on text prompts.

While existing methods like DreamBooth and SuTI have made strides, they suffer from significant drawbacks:

  1. High Computational Cost: DreamBooth requires fine-tuning both the U-Net and the text encoder, generating roughly 1,000 regularization ("negative") samples, and taking up to 70 minutes of training time. SuTI requires training half a million expert models.
  2. Overfitting vs. Underfitting Trade-off: These models easily overfit to the visual features of the reference images, causing them to ignore the text prompt (e.g., failing to change the background or add requested accessories).

The authors set out to design a simpler, faster, and more regularized training framework that achieves excellent text-to-image alignment by fine-tuning only the U-Net component.

Methods

The authors introduce Reward Preference Optimization (RPO), which reframes subject-driven fine-tuning as a preference-based reinforcement learning problem. The framework consists of two core components:

1. The $\lambda$-Harmonic Reward Function

To evaluate how well a generated image balances subject fidelity (Image Alignment) and prompt adherence (Text Alignment), the authors use the pre-trained ALIGN model to compute similarity scores (ALIGN-I and ALIGN-T). Instead of taking the standard arithmetic mean of these scores, they propose a weighted harmonic mean:

$$r(\mathbf{x}, \mathbf{c}; \lambda, \mathcal{I}_{\text{ref}}) := \frac{1}{\frac{\lambda}{\text{ALIGN-I}(\mathbf{x}, \mathcal{I}_{\text{ref}})} + \frac{1 - \lambda}{\text{ALIGN-T}(\mathbf{x}, \mathbf{c})}}$$

2. Reward Preference Optimization (RPO)

Using the $\lambda$-Harmonic reward, the authors apply the Bradley-Terry model to automatically generate pairwise preference labels between the reference images and a small set of generated images (only 32 images from 8 novel prompts, representing just 3% of the data setup required by DreamBooth).

The final objective function minimizes a combined loss:

  • Similarity Loss ($L_{\text{sim}}$): Minimizes the KL divergence between the reference image distribution and the model's target distribution.
  • Preference Loss ($L_{\text{pref}}$): Direct Preference Optimization (DPO) adapted for diffusion models to maximize the likelihood of generating preferred images.
Figure 2: Overview of the finetuning phase for RPO. First, the base diffusion model generates a few images based on novel training prompts. Second, we compute the rewards for both reference and generated images using Equation (5). Then, preference labels are sampled according to the preference distribution, as defined in Equation (6). Finally, the diffusion model is trained by minimizing both the similarity loss (Equation (7)) and preference loss (Equation (8)).

Datasets

The approach was evaluated using DreamBench, the standard benchmark introduced by DreamBooth. It contains 30 different subjects (ranging from backpacks and toys to cats and dogs) and 25 distinct prompt templates per subject designed to test re-contextualization, accessorization, property modification, and attribute editing.

Key Insights and Ideas

  • The Power of the Harmonic Mean: In multi-objective optimization, the arithmetic mean allows a model to cheat by maximizing one score while completely neglecting the other. Because of the AM-GM-HM inequality, the harmonic mean acts as a "pessimistic" lower bound. It is highly sensitive to the lower of the two scores, forcing the model to perform well on both image fidelity and text alignment.
  • Overfitting Happens Fast: The authors discovered that diffusion models tend to overfit to reference images very early in the training process (often within the first 200 gradient steps).
  • Validation-Driven Early Stopping: By using the $\lambda$-Harmonic reward function as a validation metric during training, RPO can implement effective early stopping, preventing the model from losing its text-alignment capabilities as training progresses.

Key Results

Quantitative Performance

RPO achieves state-of-the-art results on DreamBench while using a fraction of the resources:

  • CLIP-T (Text Alignment): Achieved a SOTA score of 0.314, outperforming DreamBooth (0.305) and matching SSR-Encoder.
  • CLIP-I (Image Alignment): Achieved a SOTA score of 0.833, beating DreamBooth (0.803) and SuTI (0.819).
  • Efficiency: The entire fine-tuning process takes only 5 to 20 minutes on a single Cloud TPU V4, requiring only 400 iterations.

Qualitative Performance

As shown in the paper's qualitative comparisons, RPO successfully preserves fine details from reference images (such as text written on objects) while strictly adhering to complex prompt modifications, avoiding the blurring or semantic confusion seen in baseline models.

Qualitative comparison of RPO against SuTI, Re-Imagen, and DreamBooth

Limitations and Future Work

Despite its strong performance, the authors note a few lingering failure modes:

  • Context-Appearance Entanglement: Sometimes the context bleeds into the subject itself (e.g., asking for a "blue house" in the background might accidentally turn a red reference backpack blue).
  • Rare Contexts: The model struggles with highly unusual or rare prompt combinations (e.g., generating a cross between a chow chow and a tiger).
  • Visual Overlap Overfitting: If the background texture of a reference image looks similar to the requested target context (like sand vs. bed sheets), the regularization can break down.

Future Directions: The authors suggest exploring online reinforcement learning to further improve regularization, developing a parameter-efficient LoRA version of RPO, and building larger open-source datasets for subject-driven generation evaluation.

Summary updated

BibTeX
@inproceedings{miao2024subject,
  author = {Yanting Miao and William Loh and Suraj Kothawade and Pascal Poupart and Abdullah Rashwan and Yeqing Li},
  title = {{Subject-driven Text-to-Image Generation via Preference-based Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=TWeVQ5meMW},
}
Figure