Direct Consistency Optimization for Robust Customization of Text-to-Image Diffusion models

Kyungmin Lee, Sangkyung Kwak, Kihyuk Sohn, Jinwoo Shin

Personalizing text-to-image (T2I) diffusion models has become a favorite pastime for AI researchers and hobbyists alike. Whether it’s putting your pet dog in a Van Gogh painting or generating a specific brand of backpack in a futuristic city, techniques like DreamBooth and LoRA have made this possible with just a handful of images.

However, these models often suffer from a "tug-of-war" problem: if you fine-tune them too much, they become perfectly consistent with your subject but "forget" how to follow complex text prompts (overfitting). If you fine-tune too little, the subject doesn't look right (underfitting). A new paper introduces Direct Consistency Optimization (DCO), a principled way to navigate this trade-off and produce robust, customizable models that play well with others.

TL;DR

Direct Consistency Optimization (DCO) is a novel fine-tuning objective that prevents "knowledge forgetting" in personalized diffusion models by minimizing the deviation from the original pretrained model. It achieves a superior balance between subject fidelity and text alignment, allowing for seamless merging of separately trained subject and style models without the usual interference.

The "Tug-of-War" in Customization

When we fine-tune a model like Stable Diffusion on a few images of a specific subject, we are essentially trying to "teach" it a new concept. Standard fine-tuning (using the regular diffusion loss) is prone to overfitting. The model becomes so focused on the reference images that it loses its ability to "recontextualize"—for example, it might learn what your dog looks like but lose the ability to generate that dog "wearing a spacesuit on Mars" because it has forgotten what a spacesuit or Mars looks like.

Previous attempts to fix this, like DreamBooth’s "prior preservation loss," require generating a separate "prior" dataset of similar objects to act as a regularizer. This is computationally expensive and often results in a model that is a "jack of all trades, master of none," losing subject fidelity in exchange for better prompt following.

DCO achieves a superior balance between identity preservation and text alignment, and allows seamless merging of subject and style models.

Methods: How DCO Works

The core innovation is the DCO loss function. Inspired by Direct Preference Optimization (DPO) used in Large Language Models, the authors treat the fine-tuning process as a constrained policy optimization problem.

  1. DCO Loss: Instead of just minimizing the error on the new images, DCO looks at the difference between the noise prediction error of the fine-tuning model and the original pretrained model. It uses a log-sigmoid loss that penalizes the fine-tuned model if it deviates too far from the pretrained model's "knowledge" while still pushing it to learn the new subject.
  2. Consistency Guidance Sampling: During inference, the authors introduce a new guidance scale. Similar to Classifier-Free Guidance (CFG), this allows users to dynamically dial in how much they want the model to prioritize subject consistency versus following the text prompt.
  3. Comprehensive Captioning: The authors found that the standard practice of using simple prompts (e.g., "a photo of [V] dog") causes the model to "leak" background details into the subject concept. They propose using Vision-Language Models (like LLaVA) to generate highly detailed captions for reference images, which helps the model disentangle the subject from its environment.

Key Insights and Results

The researchers evaluated DCO across subject personalization (DreamBooth dataset), style personalization (StyleDrop dataset), and 1-shot personalization tasks.

  • Superior Pareto Frontier: In quantitative tests, DCO consistently outperformed DreamBooth and prior-preservation baselines. It sits on a better "Pareto frontier," meaning for any given level of subject consistency, DCO provides better text alignment than other methods.
  • Merging Without Post-Optimization: One of the most impressive findings is that DCO-trained models can be merged (e.g., a "dog" model and a "watercolor" model) using simple arithmetic merging of LoRA weights. Unlike standard models, which often require complex post-optimization (like ZipLoRA) to avoid interference, DCO models maintain their individual identities during the merge. DCO significantly outperformed ZipLoRA in subject-style composition tasks, achieving a subject similarity score of 0.462 vs. ZipLoRA's 0.406, while maintaining better text alignment.
  • Adaptive Weighting: Gradient analysis of the DCO loss reveals that it naturally performs adaptive loss weighting. If the deviation between the new model and the old model becomes too large, the loss "abstains" from updating, preventing the model from drifting too far into overfitted territory.
  • User Preference: A user study showed that participants favored DCO over standard DreamBooth by a wide margin: 81.9% preferred DCO for subject fidelity and 63.0% for overall image quality compared to DreamBooth with prior preservation.

Limitations and Future Work

While highly effective, DCO does introduce computational overhead. It requires running inference on both the fine-tuning model and the pretrained model during training, increasing training time by about 30%. Consistency guidance also doubles the computation needed during image generation. Furthermore, while DCO excels at mixing a subject with a style, it still struggles with composing multiple similar subjects (e.g., two different dogs in one frame), as the concepts tend to "bleed" into each other.

Future directions include exploring more efficient ways to measure LoRA compatibility and improving the model's ability to disentangle semantically similar concepts.

Summary updated

BibTeX
@inproceedings{lee2024direct,
  author = {Kyungmin Lee and Sangkyung Kwak and Kihyuk Sohn and Jinwoo Shin},
  title = {{Direct Consistency Optimization for Robust Customization of Text-to-Image Diffusion models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=VazkRbCGxt},
}
Figure