# DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation

Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, Kfir Aberman · arXiv · 2022-8-25

- **Problem** Large text-to-image diffusion models render generic concepts well but cannot reproduce one particular subject from a few reference photos.
- **Method** Fine-tunes a pretrained diffusion model on three to five images of one subject, binds a rare-token identifier to it, and adds a prior-preservation term built from the model's own class samples.
- **Results** Reached 0.668 DINO subject fidelity with Stable Diffusion, against 0.569 for Textual Inversion on the same backbone.

![Figure 3: Fine-tuning. Given ∼ 3−5 images of a subject we ﬁne- tune a text-to-image diffusion model with the input images paired with a text prompt containing…](https://refivu.com/papers/be406a52-c06c-4d4e-849c-ca0a795fcb8a/figures/figure-901917f803f73594566f97844c85115e.png?thumb=512)

**Figure 3** . Fine-tuning. Given ∼ 3−5 images of a subject we ﬁne- tune a text-to-image diffusion model with the input images paired with a text prompt containing a unique identiﬁer and the name of the class the subject belongs to (e.g., “A \[V\] dog”), in parallel, we apply a class-speciﬁc prior preservation loss, which leverages the semantic prior that the model has on the class and encourages it to generate diverse instances belong to the subject’s class using the class name in a text prompt (e.g., “A dog”).

[Original paper](https://arxiv.org/abs/2208.12242v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, Kfir Aberman · DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation · Original paper figure · Extracted the figure area from page 4 of the original PDF.

## Why a specific subject is hard to reproduce

Large text-to-image models produce high-quality and varied images from a natural-language prompt, and their strength comes from a semantic prior learned over image-caption pairs. That prior links a word such as dog to many different dogs, but it does not single out one dog that appears in a handful of photos. The gap lies in the output domain: even a detailed textual description of an object may produce instances that look different from the original.

Shared language-vision embeddings have the same limit, since they generate variations of the image content without reconstructing the given subject.

Earlier composition methods clone a subject into a new background, and 3D reconstruction can handle novel poses but mainly for rigid objects with many views. Text-driven editing built on GANs or diffusion models mostly changes global properties or edits locally, so none of these methods produces new renditions of a given subject in new contexts.

## Binding a rare identifier to the subject

The base model is a denoiser \\(\\hat{x}\_\\theta\\) that receives a noisy input \\(z\_t=\\alpha\_t x+\\sigma\_t\\epsilon\\) and a conditioning vector \\(c=\\Gamma(P)\\), where \\(\\Gamma\\) is a text encoder and \\(P\\) is the prompt. Training minimizes the weighted squared error \\(w\_t\\\|\\hat{x}\_\\theta(\\alpha\_t x+\\sigma\_t\\epsilon,c)-x\\\|\_2^2\\) between the denoised output and the ground-truth image, with \\(t\\sim U(\[0,1\])\\).

The method starts from only a few casually captured images of one subject and no textual description, so the training signal comes entirely from those images and the prompts written for them.

Rather than writing detailed captions, every subject image is labelled 'a \[identifier\] \[class noun\]', with a coarse class noun such as cat, dog or watch that the user supplies or a classifier provides. The class noun ties the identifier to the prior of that class, and the authors report that a wrong class noun or no class noun increases training time and language drift while lowering performance.

Common English words such as unique or special carry meanings the model would have to unlearn before reusing them for a subject. The authors report that the best subject fidelity comes from fine-tuning all layers, including those conditioned on the text embeddings.

## Prior preservation against language drift

Fine-tuning all layers risks language drift, in which the model gradually loses its knowledge of the class: the authors observe that the fine-tuned model slowly forgets how to generate other instances of the subject's class. A second risk is lost diversity, where the model snaps to the few-shot views and poses, and the authors observe this especially when training runs for a long time.

The total objective adds to the subject term a prior term computed on these class samples, weighted by \\(\\lambda\\), which sets the relative weight of the prior term. The full objective is \\(\\mathbb{E}\[w\_t\\\|\\hat{x}\_\\theta(\\alpha\_t x+\\sigma\_t\\epsilon,c)-x\\\|\_2^2+\\lambda w\_{t'}\\\|\\hat{x}\_\\theta(\\alpha\_{t'}x\_{pr}+\\sigma\_{t'}\\epsilon',c\_{pr})-x\_{pr}\\\|\_2^2\]\\), and Figure 3 shows the fine-tuning with these class samples.

About 1000 'a \[class noun\]' samples are generated, although fewer can be used, and training takes about 5 minutes on one TPUv4 for Imagen and about 5 minutes on an NVIDIA A100 for Stable Diffusion.

## Super-resolution fine-tuning for Imagen

Imagen cascades a 64×64 base model with two text-conditional super-resolution models, 64×64→256×256 and 256×256→1024×1024. Without fine-tuning, the super-resolution models may hallucinate high-frequency details or miss the subject's details, so they are fine-tuned on the subject images.

The authors find fine-tuning of the 64×64→256×256 model essential for most subjects, while the 256×256→1024×1024 model can help subjects with fine detail.

## Dataset and fidelity metrics

The dataset has 30 subjects, of which 21 are objects and 9 are live subjects or pets, collected by the authors or sourced from Unsplash. There are 25 prompts: 20 recontextualization and 5 property modification prompts for objects, and 10 recontextualization, 10 accessorization and 5 property modification prompts for live subjects. Four images per subject and prompt give 3,000 images in the evaluation suite.

CLIP-I is the average pairwise cosine similarity between CLIP embeddings of generated and real images. Prompt fidelity, CLIP-T, is the average cosine similarity between prompt and image CLIP embeddings.

Against normalized human preference scores, DINO has a Pearson correlation coefficient of 0.32, while the CLIP-I metric used in Gal et al. has 0.27.

## DreamBooth against Textual Inversion

The comparison covers DreamBooth on Imagen, DreamBooth on Stable Diffusion, and Textual Inversion on Stable Diffusion, using the hyperparameters provided in the Textual Inversion work. Figure 4 shows the same vase prompts for each of these three rows, with four input images.

On Stable Diffusion, DreamBooth reached DINO 0.668, CLIP-I 0.803 and CLIP-T 0.305, against DINO 0.569, CLIP-I 0.780 and CLIP-T 0.255 for Textual Inversion on the same backbone. DreamBooth on Imagen reached DINO 0.696, CLIP-I 0.812 and CLIP-T 0.306, and real images reached DINO 0.774 and CLIP-I 0.885. The Imagen and Stable Diffusion rows use different backbones, so their gap is not a controlled comparison, and the authors attribute the Imagen advantage to its larger expressive power and higher output quality.

A user study with 72 users answered 25 comparative questions per questionnaire with 3 users each, giving 1800 answers. For subject fidelity, DreamBooth on Stable Diffusion was preferred in 68% of answers against 22% for Textual Inversion, with 10% undecided. For prompt fidelity, DreamBooth was preferred in 81% against 12% for Textual Inversion, with 7% undecided, using majority voting over the answers.

The authors read DINO differences of around 0.1 and CLIP-T differences of 0.05 as meaningful in terms of user preference.

## What the prior loss and the class noun contribute

Imagen was fine-tuned on 15 subjects with and without the prior-preservation loss. With the loss, PRES is 0.493 against 0.664 without it, DIV is 0.391 against 0.371, DINO is 0.684 against 0.712, CLIP-I is 0.815 against 0.828, and CLIP-T is 0.308 against 0.306. The authors read a higher PRES as collapse of the prior toward the subject, and they report that the loss trades slightly diminished subject fidelity for higher diversity.

Imagen was fine-tuned on five subjects with the correct class noun, a wrong class noun and no class noun. The correct class noun gave DINO 0.744 and CLIP-I 0.853, a wrong class noun gave DINO 0.454 and CLIP-I 0.728, and no class noun gave DINO 0.303 and CLIP-I 0.607. With the wrong noun 'can' for a backpack, the authors observed contention between the subject and the class prior, sometimes producing cylindrical backpacks, while with no class noun training converged poorly and produced erroneous samples.

## How many input images are needed

Models were trained with one to five input images for a backpack and a dog, with four images generated for each of 10 recontextualization prompts per subject. DINO for the backpack ran 0.494, 0.515, 0.596, 0.604 and 0.597 across one to five images, and for the dog 0.798, 0.851, 0.871, 0.876 and 0.864. The DINO score peaks at four images for both subjects, which is why the authors settle on 3-5 images.

A common subject such as the Corgi was close to captured from one image, while the rarer backpack needed more.

## Limitations

Figure 9 shows three failure modes: the model may not generate a rarely prompted context, context and subject appearance can become entangled, and the model can overfit to images similar to the training set. Entanglement appears as colour changes of the backpack driven by the prompted context, and overfitting appears when the prompt resembles the original setting of the subject.

The ablations on the prior loss and the class noun were run on Imagen only, so their effects were not measured on Stable Diffusion. The user study compares DreamBooth on Stable Diffusion with Textual Inversion on Stable Diffusion only.

## Paper info

- **Authors**: Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, Kfir Aberman
- **Venue**: arXiv · Preprint
- **First published**: 2022-8-25
- **Added**: 2026-10-20
- **Updated**: 2023-3-15
- **Version**: v2
- **arXiv**: 2208.12242
- **Category**: cs.CV · cs.GR · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2208.12242v2) · [PDF ↗](https://arxiv.org/pdf/2208.12242v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Large text-to-image models achieved a remarkable leap in the evolution of AI, enabling high-quality and diverse synthesis of images from a given text prompt. However, these models lack the ability to mimic the appearance of subjects in a given reference set and synthesize novel renditions of them in different contexts. In this work, we present a new approach for "personalization" of text-to-image diffusion models. Given as input just a few images of a subject, we fine-tune a pretrained text-to-image model such that it learns to bind a unique identifier with that specific subject. Once the subject is embedded in the output domain of the model, the unique identifier can be used to synthesize novel photorealistic images of the subject contextualized in different scenes. By leveraging the semantic prior embedded in the model with a new autogenous class-specific prior preservation loss, our technique enables synthesizing the subject in diverse scenes, poses, views and lighting conditions that do not appear in the reference images. We apply our technique to several previously-unassailable tasks, including subject recontextualization, text-guided view synthesis, and artistic rendering, all while preserving the subject's key features. We also provide a new dataset and evaluation protocol for this new task of subject-driven generation. Project page: https://dreambooth.github.io/

## Quote from the paper

Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, Kfir Aberman (2022). DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation. arXiv:2208.12242v2. https://arxiv.org/abs/2208.12242v2

**BibTeX**

```
@misc{ruiz2022dreambooth,
  title = {{DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation}},
  author = {Nataniel Ruiz and Yuanzhen Li and Varun Jampani and Yael Pritch and Michael Rubinstein and Kfir Aberman},
  year = {2022},
  eprint = {2208.12242},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.12242v2}
}
```

## Other paper commentary

- [Scalable Diffusion Models with Transformers](https://refivu.com/en/papers/20637697-d13d-4af8-bc4d-7f97df178df2-scalable-diffusion-models-with-transformers.md)
- [Spectral Normalization for Generative Adversarial Networks](https://refivu.com/en/papers/a69a23bf-3dd6-4b32-9fb1-444f7f67a6e8-spectral-normalization-for-generative-adversarial-networks.md)
- [Denoising Diffusion Implicit Models](https://refivu.com/en/papers/211aa1a1-08e2-40a7-b187-72384021f47a-denoising-diffusion-implicit-models.md)
- [Diffusion Models Beat GANs on Image Synthesis](https://refivu.com/en/papers/c4296a34-b538-4422-b11f-4a805621a24f-diffusion-models-beat-gans-on-image-synthesis.md)
- [A Style-Based Generator Architecture for Generative Adversarial Networks](https://refivu.com/en/papers/4dbbd963-fe20-4e79-9ec9-730023411ef1-a-style-based-generator-architecture-for-generative.md)
- [Wasserstein GAN](https://refivu.com/en/papers/6fbb2587-49dc-4b1a-9bb9-ee89b40b9221-wasserstein-gan.md)
- [Generative Agents: Interactive Simulacra of Human Behavior](https://refivu.com/en/papers/3638efc4-db4a-48d9-bc16-5a758d9198fd-generative-agents-interactive-simulacra-of-human-behavior.md)
- [SWE-bench: Can Language Models Resolve Real-World GitHub Issues?](https://refivu.com/en/papers/1cf41e87-39dc-4e23-9d0c-22ab7bc2a24b-swe-bench-can-language-models-resolve-real-world.md)
- [STaR: Bootstrapping Reasoning With Reasoning](https://refivu.com/en/papers/2942117a-1b64-4434-bef7-4f70b61ab603-star-bootstrapping-reasoning-with-reasoning.md)
- [Voyager: An Open-Ended Embodied Agent with Large Language Models](https://refivu.com/en/papers/39fe0a31-1bf8-4ca2-bc7b-151ae7a6faa4-voyager-an-open-ended-embodied-agent-with-large.md)
- [Image-to-Image Translation with Conditional Adversarial Networks](https://refivu.com/en/papers/92d09be2-7a1b-4f53-9d24-569d7cc94149-image-to-image-translation-with-conditional-adversarial.md)
- [HexaShell: A Thin Harness for Exploring the Limits of VLM Agents as Robot Coding Agents](https://refivu.com/en/papers/987b0722-81e4-41f3-8104-a1d8a65def66-hexashell-a-thin-harness-for-exploring-the-limits.md)

## Terms in this paper

- [CLIP](https://refivu.com/en/terms/b5b5b48d5f4e-clip)
- [diffusion models](https://refivu.com/en/terms/39b044617fcd-diffusion-models)
- [DDIM](https://refivu.com/en/terms/6c24451d09a5-ddim)
- [DINO](https://refivu.com/en/terms/1dfe38658e15-dino)
- [T5-XXL](https://refivu.com/en/terms/c60352eaa086-t5-xxl)
- [SentencePiece tokenizer](https://refivu.com/en/terms/7aa62ebfdbbe-sentencepiece-tokenizer)
- [ancestral sampler](https://refivu.com/en/terms/87375c22aaf8-ancestral-sampler)
- [CLIP-I](https://refivu.com/en/terms/2c53f49daa94-clip-i)
- [DreamBooth](https://refivu.com/en/terms/0469e4e7700d-dreambooth)
- [squared error loss](https://refivu.com/en/terms/84e1e32d5ea9-squared-error-loss)
- [Text-to-Image Diffusion Models](https://refivu.com/en/terms/6f09420315a8-text-to-image-diffusion-models)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/be406a52-c06c-4d4e-849c-ca0a795fcb8a-dreambooth-fine-tuning-text-to-image-diffusion-models)
