Coffee: Controllable Diffusion Fine-tuning

Ziyao Zeng, Jingcheng Ni, Ruyi Liu, Alex WongarXiv 2025 · DOI

Introduction

Personalizing text-to-image diffusion models through fine-tuning (e.g., DreamBooth) often introduces "nuisance variables"—undesired concepts present in the training data that become entangled with the target subject. For instance, if a user provides photos of themselves wearing sunglasses to teach the model their face, the model may incorrectly learn that "sunglasses" are an inherent part of that person's identity.

Coffee (Controllable Diffusion Fine-tuning) addresses this by preventing models from learning these pre-specified undesired concepts during the adaptation process using simple natural language anchors.

The Coffee Framework

The core innovation of Coffee is a text-based regularization loss added to the standard diffusion training objective. Unlike inference-time solutions like negative prompting, which often fail if a concept is deeply baked into the model weights, Coffee intervenes during training to ensure the model's latent space remains "pure."

Overview of the Coffee framework: By specifying an undesired concept like "Sunglasses," the model is regularized to prevent the user prompt from drifting toward that concept in the embedding space during fine-tuning.

Embedding Anchoring and Regularization

When a user provides a prompt (e.g., "A person") and images containing an unwanted attribute (e.g., "Sunglasses"), Coffee calculates the cosine similarity between these two text embeddings. During fine-tuning, a regularization term ($L_{reg}$) penalizes any drift of the prompt embedding toward the undesired concept. This geometric constraint forces the model to find a way to reconstruct the training images without shifting the semantic meaning of the user's prompt toward the unwanted attribute in the latent space.

Key Results and Insights

Coffee was evaluated across major backbones including Stable Diffusion v2.1, SDXL, and SD3.5 using a custom dataset of 8 distinct concept pairs (e.g., "A cat on Mars" vs. "Rifle").

  • Effective Suppression: Coffee achieved a 50% reduction in Mean Cosine Similarity (MCS) compared to standard fine-tuning, doubling the effectiveness of state-of-the-art "immunization" methods like IMMA.
  • Quality Preservation: The framework maintains high image quality and diversity. Inception Scores remained within ~8.5% of the baseline, avoiding the semantic distortions or "hallucinations" common in other steering methods.
  • Efficiency: The researchers found that tuning only the text encoder with this regularization is often sufficient to prevent concept leakage, making the process computationally lightweight and training-free for deployment.

Limitations and Future Work

The primary failure mode occurs with "Dominant Concepts." If the undesired concept occupies the vast majority of pixels in the training set (e.g., a tight close-up of the unwanted object), the reconstruction loss may overwhelm the regularization. Future work may incorporate image-level or patch-level filtering to help the model focus exclusively on the relevant parts of the training images.

Summary updated

BibTeX
@misc{zeng2025coffee,
  author = {Ziyao Zeng and Jingcheng Ni and Ruyi Liu and Alex Wong},
  title = {{Coffee: Controllable Diffusion Fine-tuning}},
  year = {2025},
  eprint = {2511.14113},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.14113},
}
Figure