# An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion

Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik and 1 more · arXiv · 2022-8-2

- **Problem** Adding a personal object or style to a large text-to-image model by retraining or fine-tuning is costly and can erase what the model already knows.
- **Method** Optimizes one new word embedding from 3-5 images under the latent diffusion denoising loss, while the text encoder and denoiser stay fixed.
- **Results** Reached reconstruction comparable to the multi-word baselines and considerably higher editability than all of them, in CLIP-based scores over 64 samples per prompt.

## Teaching a frozen model a personal concept

The study asks how a user can take a personal object, a style or a scene and steer a large text-to-image model toward it with ordinary language, in new prompts. Retraining on an enlarged dataset for each new concept is too costly, and fine-tuning on a handful of examples tends to erase what the model already knows. Methods that freeze the generator and train adapter modules reduce that cost, but they can still lose prior knowledge or struggle to combine it with the new concept.

The authors keep the generator fixed and ask whether a concept can instead be represented as a new word in the text encoder's vocabulary. Once the concept has a word, prompts can use it directly, so the model's existing knowledge still shapes the result.

## Learning a word embedding for the concept

A text encoder splits a prompt into tokens and replaces each token with a vector from an embedding table, and those vectors then pass through the rest of the encoder. Figure 2 traces this path for a prompt that contains the placeholder, ending in the conditioning code that drives the generator. The edit happens at the table: the row for the placeholder S\* is replaced by one learned vector v\*.

With its own row, S\* is treated as an ordinary word, so prompts such as a photo of S\* on the beach can be written with it. Two learned words can appear in one prompt, as in a drawing of S1\* in the style of S2\*, because each has its own row.

The embedding stage is chosen over the image generator because it is continuous and can be optimized directly. Earlier work on this stage used contrastive or language-completion objectives, which do not require a close visual understanding of the image. Because the target is image generation, the authors train the vector with a visual reconstruction objective.

## The reconstruction objective and training setup

The base model is a latent diffusion model: an encoder maps images to a latent code, a decoder maps latents back to images, and a denoising network removes noise from noised latents under a conditioning code. The conditioning code comes from a BERT text encoder in the publicly available model with 1.4 billion parameters, pre-trained on LAION-400M.

The standard loss is \\( \\mathcal{L}\_{\\mathrm{LDM}} := \\mathbb{E}\_{z\\sim\\mathcal{E}(x),\\,y,\\,\\epsilon\\sim\\mathcal{N}(0,1),\\,t}\\left\[\\left\\\|\\epsilon-\\epsilon\_\\theta(z\_t,t,c\_\\theta(y))\\right\\\|\_2^2\\right\] \\), where \\( z\_t \\) is the latent noised to time step \\( t \\) and \\( \\epsilon\_\\theta \\) is the denoiser. Training adjusts the conditioning model and the denoiser to minimize this loss, and at run time a random noise tensor is denoised into a latent and decoded.

Textual Inversion runs the same loss but updates only the placeholder vector, while the conditioning model and the denoiser are held fixed. The optimization is \\( v^\* = \\arg\\min\_v \\mathbb{E}\_{z\\sim\\mathcal{E}(x),\\,y,\\,\\epsilon\\sim\\mathcal{N}(0,1),\\,t}\\left\[\\left\\\|\\epsilon-\\epsilon\_\\theta(z\_t,t,c\_\\theta(y))\\right\\\|\_2^2\\right\] \\), taken over the concept images.

Training prompts are drawn from neutral templates based on CLIP ImageNet prompts, such as a photo of a S\* and a rendition of a S\*, and the full list is in the supplementary material.

Training uses 3-5 images that show the concept under varied backgrounds or poses.

All reported results use 5, 000 optimization steps. Fewer steps or a higher learning rate worked better for some concepts, while these defaults work for most cases.

## Recreating object variations

Mechanical Turk workers saw four images of a concept and wrote short captions of at most 12 words and long captions of at most 30 words, five of each per concept.

Captions of either length name the most prominent parts of an object but miss fine features such as the color pattern of the teapot. The authors note that the skull mug is hard to describe in natural language at all.

The authors report that their single-word samples keep these finer details.

The variations are closer to the source objects, but they are still variations and can differ from the source. The comparison is visual, with several samples per setup generated from a randomly chosen caption, as in Figure 3.

## Scenes, styles and combined concepts

Figures 1 and 4 pair exemplar training images with images generated from new prompts that contain the learned word. The frozen model combines the new concept with its existing knowledge to produce scenes that the training images never show. The authors read this as evidence that a single word embedding is enough to capture varied concepts.

The training goal is generative, yet the learned words still carry semantics the model can use, such as a bowl that can hold food. The Furby example keeps the bird-like head and crown while the palette shifts to fit the prompt.

The resulting words guide generation across abstract subjects, such as the streets of Paris, a black hole and Times Square. The authors stress that this is not conventional style transfer, because the output does not have to keep the content of an input image.

Figure 7 places two learned words in one prompt, and the model combines their semantics. The model struggles with relations between concepts, such as placing two side by side, and the authors hypothesize that training only on single-concept scenes causes this.

## Debiasing a concept and editing with Blended Latent Diffusion

A biased concept can be replaced by a word learned from a small, curated and more diverse set. The DALLE-2 system card reports that the prompt A CEO produced mostly white-passing and male-passing people. Figure 8 contrasts base model samples for A stock photo of a doctor with samples from the learned word, and the authors report more perceived gender and ethnic diversity.

Blended Latent Diffusion edits a masked region by blending in the latent space of a latent diffusion model. The learned words can condition this localized editing without any change to the underlying model. Figure 9 shows examples such as An oil painting of S\* applied to a masked target image.

## Comparisons with PALA VRA and CLIP-guided baselines

The comparison uses a clock mug and a set of new-scene prompts, such as on the beach, on the moon and Elmo holding a S\*. PALA VRA finds a pseudo-word in CLIP's textual embedding space using contrastive and cyclic consistency goals, and the word is then used with VQGAN-CLIP and CLIP-Guided Diffusion. The CLIP-guided baselines jointly minimize distances to the training images and to the target text, or start from an input image of the set.

The authors chose image initialization for the second baseline because it did better than using images in the loss, a choice they say matches observations in Disco Diffusion.

PALA VRA's outputs contain elements of the target prompt but fail to capture the concept and show considerable visual corruption. The authors attribute this to PALA VRA's discriminative objective, which only needs to separate two concepts. Its word search was also not kept in regions of the embedding space that map to natural images.

The image-and-text CLIP methods give output closer to the source image but do not generalize to new texts. The proposed method reuses one pre-trained model, so a single learned word serves many generations, while the CLIP baselines need test-time optimization for every new output.

## Measuring reconstruction and editability

Reconstruction is scored in CLIP space, because each generated sample is a variation of the concept rather than a copy of one image. For each concept, 64 samples are generated with A photo of S\*, and the score is the average pairwise cosine similarity between these samples and the concept's training images.

Editing prompts range from background changes, such as A photo of S\* on the moon, to style changes, such as An oil painting of S\*, and to a composition, Elmo holding a S\*. For each prompt, 64 samples are drawn with 50 DDIM steps, their mean CLIP embedding is computed, and its cosine similarity with the CLIP embedding of the prompt is taken with the placeholder removed.

A higher score means better editing and closer agreement with the prompt, and the score does not optimize a CLIP objective, so the authors argue it avoids the adversarial scoring flaws that Nichol et al. (2021) describe.

The extended latent space represents S\* with two or three learned words, called 2-word and 3-word, to ease a bottleneck from a single vector. Progressive extension starts with one vector, adds a second after 2, 000 steps and a third after 4, 000 steps, so the core details are learned first. Regularization penalizes the L2 distance between the learned embedding and the embedding of the coarse descriptor.

Per-image tokens add one placeholder per training image next to the shared S\*, with prompts such as A photo of S\* with Si, so per-image details go to the unique tokens.

Image Only uses the training images as samples, and Prompt Only uses the evaluation prompts without the pseudo-word. Human captions replace S\* directly, in both short and long versions.

## What the CLIP-based scores and the user study show

By CLIP similarity, the single-word method's reconstruction is comparable to that of randomly sampled real training images, as are many of the baselines. The authors caution that CLIP is less sensitive to shape preservation, so this score does not settle fidelity of shape.

Against the multi-word baselines, the single-word model reaches comparable reconstruction and considerably higher editability. The authors read these points as showing that the textual embedding space can capture a new concept accurately with one pseudo-word.

The baselines form a distortion-editability trade-off curve: embeddings near the word distribution are easier to edit but capture less, while embeddings far from it reconstruct better at a severe cost in editing. The single-embedding model moves along this curve when its learning rate changes, which gives a user some control over the trade-off.

Human captions fail to capture a concept's likeness and also lower editability, and the authors link this to long captions raising the chance that the model ignores the requested setting. They hypothesize that this follows the selective-similarity property of Paiss et al. (2022), in which vision-and-language models attend to a subset of meaningful tokens.

A user study collected 600 responses to each of two questionnaires, 1, 200 in total, comparing five models by similarity to training images and by similarity to a text context. The user results follow the same reconstruction-editability trade-off as the CLIP scores, and the error bars are 95% confidence intervals.

## Training set size and advanced inversion variants

The headless sculpture concept was inverted with the standard model using training sets from one image up to 25 samples. Reconstruction improved little with larger sets, while the embedding moved away from real word embeddings and editability suffered, so the authors find about 5 images works best.

Bipartite inversion follows the closed-form DDIM inversion of Dhariwal & Nichol (2021), finds a latent noise vector for the target image, and then changes only the conditioning text. Reconstructions are more accurate without changing the model, but at LDM's typical guidance scales of 5-10 the denoiser cannot keep the object's structure under prompt changes.

At lower guidance the outline of the original image appears, but alignment with the prompt is poor.

Pivotal tuning first optimizes the pseudo-word and then fine-tunes the generator so that the prompt A photo of S\* reproduces the training images more closely. The pivotal tuning results in the figure use random noise, while the bipartite results fix the noise for each column.

## Limitations

The method may struggle with precise shapes and instead keeps the semantic essence of a concept. The authors consider this often enough for artistic creation, and they hope to gain control over reconstruction accuracy for tasks that need precision.

Learning a single concept takes roughly two hours in the authors' setup. The authors suggest that training an encoder to map images directly to a textual embedding could shorten this, but they did not test that approach.

The reconstruction metric is CLIP-based, so it does not directly test shape preservation. The concept composition experiments use training images with a single concept, so relational scenes are not learned. The authors believe the method applies to larger text-to-image models, but they did not test it on them.

The authors note that text-to-image models inherit biases from their training data and that their own work may exhibit such biases. The ability to learn artistic styles is listed as a copyright risk, and the authors leave this risk open.

## Paper info

- **Authors**: Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, Daniel Cohen-Or
- **Venue**: arXiv · Preprint
- **First published**: 2022-8-2
- **Added**: 2026-10-20
- **Updated**: 2022-8-2
- **Version**: v1
- **arXiv**: 2208.01618
- **Category**: cs.CV · cs.CL · cs.GR · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

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

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.

## Quote from the paper

Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, Daniel Cohen-Or (2022). An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion. arXiv:2208.01618v1. https://arxiv.org/abs/2208.01618v1

**BibTeX**

```
@misc{gal2022image,
  title = {{An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion}},
  author = {Rinon Gal and Yuval Alaluf and Yuval Atzmon and Or Patashnik and Amit H. Bermano and Gal Chechik and Daniel Cohen-Or},
  year = {2022},
  eprint = {2208.01618},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.01618v1}
}
```

## Other paper commentary

- [SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis](https://refivu.com/en/papers/0489caed-4754-4b04-a53a-1a6eb3b53727-sdxl-improving-latent-diffusion-models-for-high-resolution.md)
- [DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation](https://refivu.com/en/papers/be406a52-c06c-4d4e-849c-ca0a795fcb8a-dreambooth-fine-tuning-text-to-image-diffusion-models.md)
- [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)
- [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)

## Terms in this paper

- [BERT](https://refivu.com/en/terms/45b639a1d317-bert)
- [CLIP](https://refivu.com/en/terms/b5b5b48d5f4e-clip)
- [DDIM](https://refivu.com/en/terms/6c24451d09a5-ddim)
- [style transfer](https://refivu.com/en/terms/00f82d672737-style-transfer)
- [Latent Diffusion Models](https://refivu.com/en/terms/5d65023babcd-latent-diffusion-models)
- [DALL-E 2](https://refivu.com/en/terms/f94e354b3972-dall-e-2)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/10be0954-63d9-4478-b280-16d81b4acc93-an-image-is-worth-one-word-personalizing-text)
