Encoder-based Domain Tuning for Fast Personalization of Text-to-Image Models

Rinon Gal, Moab Arar, Yuval Atzmon, Amit H. Bermano, Gal Chechik, Daniel Cohen-Or · DOI

TL;DR

This paper introduces a novel "encoder-based domain-tuning" approach that dramatically speeds up the personalization of text-to-image models. By training a dedicated encoder and a set of "weight offsets" on a domain-specific dataset, the model can learn new concepts from a single image in seconds, rather than minutes or hours, while maintaining high quality and identity preservation.

What Problem Does This Paper Address?

Personalizing large-scale text-to-image models (like Stable Diffusion) to understand novel concepts (e.g., a specific person's face, a unique object, or an artistic style) is a powerful capability for content creation. However, existing methods face significant hurdles: they are slow, requiring extensive fine-tuning sessions that can take hours; they demand substantial storage for each personalized model; and they often require multiple images of the target concept to avoid overfitting and maintain identity. This makes large-scale personalization impractical.

Methods

The core of the proposed method, dubbed "Encoder for Tuning" (E4T), lies in two key components trained together:

  • Inversion Encoder: This neural network takes a single image of a target concept and learns to map it into a word embedding that represents the concept. Crucially, it's designed to predict embeddings that reside in an "editable region" of the latent space, balancing reconstruction accuracy with editability for downstream prompts. It uses an iterative refinement process, leveraging the diffusion model's own U-Net encoder to improve predictions over time.
  • Weight Offsets: Instead of fine-tuning the entire diffusion model, E4T tunes only a carefully selected subset of its weights, specifically the projection matrices (Wq, Wk, Wv) within the attention layers. These weights are modified by learned "offsets" that are regularized by a neural network. This approach restricts the complexity of the learned changes, preventing overfitting and promoting a smoother, more generalizable adaptation.

These two components are jointly pre-trained on a large dataset from a specific domain (e.g., faces, cats, art styles). For inference-time personalization, both the encoder and the weight offsets are then fine-tuned on a single image of the new concept, along with the diffusion model itself.

Datasets

The paper mentions the following datasets used for pre-training and evaluation:

  • Faces: FFHQ, CelebA-HQ
  • Cats: LSUN-Cat
  • Artistic Styles: WikiArt
  • Identity Preservation Evaluation: Labeled Faces in the Wild (LFW) dataset was used for quantitative evaluation of identity preservation.

Key Insights and Ideas

  • Domain-Specific Pre-training is Key: By pre-training the encoder and weight offsets on a large dataset from a specific domain (e.g., faces), the model learns a generalized understanding of that domain. This "domain prior" makes it much easier and faster to adapt to new, unseen concepts within the same domain.
  • Underfitting for Generalization: The core idea is that by "underfitting" on a large set of concepts from a domain, the model becomes more amenable to quickly learning novel concepts from that domain. This is achieved through the restricted weight offsets and the encoder's design.
  • Iterative Refinement for Better Inversion: Using an iterative approach for the encoder, where it refines its prediction based on intermediate denoising steps, significantly improves the quality of the concept embedding.
  • Attention Layers are Crucial for Tuning: Analysis showed that cross-attention and self-attention layers are the most sensitive to tuning, making them the ideal targets for weight offsets.
  • Single Image Personalization is Achievable: The combination of domain pre-training, an effective encoder, and optimized weight offsets allows for high-quality personalization with just a single input image.

Key Results

  • Speed: Personalization takes seconds (around 11 seconds on an NVIDIA A100 GPU) compared to dozens of minutes or hours for previous methods.
  • Data Efficiency: Achieves competitive or better results than baselines using only a single image, whereas baselines often require multiple images.
  • Quality: Qualitative results show comparable or superior detail and identity preservation compared to Textual Inversion and DreamBooth.
  • Pareto Front: The method achieves a strong balance between identity similarity and prompt similarity, outperforming existing single-image methods and competing well with few-shot approaches.
  • Domain Applicability: Demonstrated success on faces, cats, and abstract concepts like artistic styles.

Limitations and Future Work

  • Domain Dependency: The method relies on large, domain-specific datasets for pre-training. This limits its direct applicability to domains where such datasets are scarce or non-existent.
  • Inference-Time Tuning: While fast, the personalization still requires a tuning step at inference time, which demands computational resources capable of tuning a model.
  • Memory Requirements: Tuning the encoder and diffusion model in tandem requires more memory than direct fine-tuning.
  • Future Work: The authors suggest further investigating HyperNetwork-based approaches for even faster, potentially training-free personalization with proper regularization. They also aim to explore applications beyond the current primary use-cases of faces and artistic styles.

Summary updated

BibTeX
@article{gal2023encoder,
  author = {Rinon Gal and Moab Arar and Yuval Atzmon and Amit H. Bermano and Gal Chechik and Daniel Cohen-Or},
  title = {{Encoder-based Domain Tuning for Fast Personalization of Text-to-Image Models}},
  journal = {ACM Trans. Graphics},
  year = {2023},
  doi = {10.1145/3592133},
}
Figure