CompoDiff: Versatile Composed Image Retrieval With Latent Diffusion

Geonmo Gu, Sanghyuk Chun, Wonjae Kim, HeeJae Jun, Yoohoon Kang, Sangdoo Yun

Abstract

We propose a novel diffusion-based model, CompoDiff, for solving zero-shot Composed Image Retrieval (ZS-CIR) with latent diffusion. This paper also introduces a new synthetic dataset, named SynthTriplets18M, with 18.8 million reference images, conditions, and corresponding target image triplets. CompoDiff and SynthTriplets18M tackle the shortages of the previous CIR approaches, such as poor generalizability due to the small dataset scale and the limited types of conditions. CompoDiff not only achieves a new state-of-the-art on four ZS-CIR benchmarks, including FashionIQ, CIRR, CIRCO, and GeneCIS, but also enables a more versatile and controllable CIR by accepting various conditions, such as negative text, and image mask conditions.

Introduction: The Challenge of Composed Image Retrieval

Composed Image Retrieval (CIR) is the task of searching for an image using a combination of a reference image and a text instruction (e.g., "this dress, but in blue and shorter"). Historically, this field has faced two major hurdles:

  1. Rigid Architectures: Most existing models use simple "fusion modules" to combine image and text features. These modules are often "black boxes" that offer no control over the relative importance of the image versus the text and cannot handle complex conditions like negative constraints ("without the hat") or spatial masks ("change only this area").
  2. Data Scarcity: Training CIR models requires triplets: a reference image, a modification text, and a target image. Manually collecting these is incredibly expensive. Existing datasets like FashionIQ or CIRR are relatively small (around 30k triplets), leading to models that generalize poorly to real-world, open-domain searches.

Methods: CompoDiff

The authors introduce CompoDiff, which treats retrieval as a conditional image editing task performed within the CLIP latent space.

CompoDiff performs Composed Image Retrieval by combining an input image with text instructions to retrieve relevant target images.

Latent Diffusion and Transformer Denoiser

Unlike standard diffusion models that generate pixels, CompoDiff predicts the embedding of the target image. This allows the output to be used directly for high-speed similarity searches in existing image databases. Instead of the standard U-Net, CompoDiff uses a Transformer architecture. This is more efficient for processing latent vectors and allows for flexible cross-attention with multiple conditions.

Versatile Conditioning

By using Classifier-Free Guidance (CFG), the model can handle positive text, negative text, and image masks simultaneously. Crucially, users can adjust "weights" at inference time to decide if the search should stay closer to the original image or follow the text instruction more strictly. Spatial masks allow users to specify exactly which parts of the reference image should be modified or preserved during the search.

Spatial masks can be used as a condition to focus the retrieval or modification on specific areas of the image.

Two-Stage Training

The model is first pre-trained on standard image-text pairs (LAION-2B) to learn general visual concepts, then fine-tuned on the massive synthetic triplet dataset, SynthTriplets18M.

Datasets: SynthTriplets18M

The paper’s second major contribution is SynthTriplets18M, a synthetic dataset over 500 times larger than previous CIR benchmarks.

  • Scale: 18.8 million triplets.
  • Generation: The authors used LLMs (OPT-6.7B) to generate diverse modification instructions and Stable Diffusion (with Prompt-to-Prompt) to create the corresponding target images.
  • Evaluation Benchmarks: The model was tested in a "zero-shot" setting (no training on the target domain) on FashionIQ, CIRR, CIRCO, and GeneCIS.

Key Insights and Ideas

  • Retrieval as "Recall," not "Precision": The authors argue that while image editing models aim for a single perfect pixel-match, CIR models need to find a "generalized concept" to retrieve many potential matches from a database. This justifies using a specialized latent diffusion model rather than a standard generative one.
  • The Power of Synthetic Data: The results show that CIR performance is currently limited more by data volume than by architecture. Training a simple fusion model on SynthTriplets18M often outperforms complex SOTA models trained on small human datasets.
  • Inference-Time Control: Because it’s a diffusion model, CompoDiff allows for a "serendipity control." By tweaking the guidance scale, a search engine could offer results that are either very literal or more "creative" and diverse.

Key Results

  • State-of-the-Art (SOTA): CompoDiff set new records for zero-shot CIR. On the CIRCO benchmark, it achieved a 15.33 mAP@5, significantly outperforming the previous best of ~11.
  • Generalizability: Even when trained only on synthetic data, CompoDiff beats models specifically trained on the target datasets (like FashionIQ), proving that the massive scale of SynthTriplets18M overcomes the "domain gap" of synthetic images.
  • Efficiency: While diffusion is often slow, the authors show that CompoDiff reaches near-peak performance in just 5 to 10 denoising steps, making it viable for real-time applications.

Limitations and Future Work

  • Inference Speed: Although 10 steps is fast for diffusion, it is still slower than "one-shot" encoder models. The authors suggest that future work could involve distilling CompoDiff into a faster consistency model.
  • Latent Space Constraints: The model is bound by the quality of the CLIP latent space. If CLIP cannot represent a specific concept well, CompoDiff will struggle to retrieve it.
  • Synthetic Bias: While massive, the dataset relies on the "imagination" of Stable Diffusion and LLMs, which may carry their own biases or fail to represent certain niche real-world textures or physics.

Summary updated

BibTeX
@inproceedings{gu2024compodiff,
  author = {Geonmo Gu and Sanghyuk Chun and Wonjae Kim and HeeJae Jun and Yoohoon Kang and Sangdoo Yun},
  title = {{CompoDiff: Versatile Composed Image Retrieval With Latent Diffusion}},
  booktitle = {SynData4CV @ CVPR},
  year = {2024},
  url = {https://openreview.net/forum?id=gYE6LBojgM},
}
Figure