Skip to content

FactEmbed: Factorized Latents for Composed Image Retrieval

THE ARGUMENT

FactEmbed's contribution is not a stronger retrieval head but a trainable intermediate step that forces the model to resolve the edit before building an embedding; whether it is worth deploying depends on whether your edits are local and whether storage is tight.

On this page

You have a batch of retrieval triples — a reference image, one sentence describing the edit, and the target image — and a vendor says it is enough to train a composed-image retriever as delivered. Do you sign? The default judgment is that with enough triples and a working contrastive loop, the model will pick up edits such as replacing a logo while keeping the rest of the shirt. This paper argues that the default misses a step: the model is never asked to work out which part of the scene changes and which part stays, before it is squeezed into a single representation for matching [1]. The authors insert a small set of learned scratchpads so the model imagines the edited target first, then builds the retrieval representation on top of that. It sounds like one extra step, but it changes what you should check when you accept the data.

The default: mapping the reference and the edit straight into one representation

Composed image retrieval (CIR) means finding the image that results from applying a written edit to a reference image: the user supplies a reference picture and a sentence such as replace the logo on the shirt with a moon, keep everything else, and the system returns the edited image from a gallery. The hard part is that the model must decide which visual factors the text changes and which it preserves. Recent work uses a multimodal large language model (MLLM, a model that reads images and text together) as the backbone, feeds in the reference plus the edit text, takes the final summary position ([EOS]) as a retrieval representation, and trains it with contrastive learning — pulling matched query-target pairs together and pushing unmatched ones apart. The paper calls this direct mapping and argues that it leaves the MLLM's compositional understanding underused: the model is never asked to resolve the edit before it is compressed into one representation [1].

ItemDirect mappingFactEmbed
SupervisionInstance-level contrastive loss onlyImagination reconstruction + factor-level contrast + instance-level contrast + spatial distillation
Intermediate stateNone; a global vector is produced directlyK factorized latents placed before [EOS]
Inference outputOne global vectorOne global vector plus K factor vectors per image
Fine-grained evidenceDiluted during poolingRecovered by reranking a short candidate list with factors

Step one: a set of latents imagines the target first

FactEmbed inserts K learnable latents into the input sequence, just before [EOS]. A latent here is a learned placeholder — an internal scratchpad, with each one responsible for a class of visual factors. During training, a target imagination objective is added: a lightweight decoder is attached at layer 14 of the 28-layer backbone, and this decoder, which is one self-attention layer plus a three-layer MLP, must reconstruct the target image's local features from those scratchpads. The important detail is the layout prior: ground-truth target features from a vision foundation model are average-pooled to h×h and expanded back to full resolution, then added to the latents as a coarse layout. Reconstruction error is therefore driven only by the residual that the coarse layout cannot explain, which forces the latents to carry local detail instead of copying the low-frequency layout of the whole image.

On the query side the target image is not visible, so the residual must be inferred from the reference image and the edit text; that inference is what the paper calls imagination. On the target side the same objective anchors the target latents to the same factor slots, so query and target factors are comparable. No external generative model and no second inference pass are involved: imagination happens inside the embedding model in a single forward pass.

Reconstruction is not enough: two contrastive levels and distillation

Reconstruction alone is insufficient: the query and the target may each decompose cleanly yet land in incompatible coordinates. The paper adds two things. First, a factor-level InfoNCE (a contrastive loss) is applied directly to the latents, with the matching score computed by Sinkhorn optimal transport — here optimal transport allows soft factor-to-factor correspondences rather than a hard one-to-one binding. An instance-level InfoNCE on the [EOS] global representation is kept, and the two losses are summed. Second, the spatial alpha masks produced by the decoder are distilled into the latent-to-patch attention at a deeper layer, so the decomposition does not stay in the auxiliary head but returns to the backbone layers actually read at retrieval time. Distillation is applied on the target side only, because query-side attention is defined over the reference image and does not share a spatial grid with the target masks.

  • Imagination loss: mean squared error against target features, averaged over query and target sides
  • Factor-level InfoNCE: batch contrast after optimal-transport matching of the K latents
  • Instance-level InfoNCE: batch contrast on the [EOS] global representation
  • Spatial distillation: target-side alpha masks pushed back into deeper attention

What inference costs: one forward pass, global recall, factor reranking

At inference, one forward pass produces two things at once: the [EOS] global representation and the mean-pooled latents. The former is a single vector and handles recall over the whole gallery; the latter is K vectors per image and is used only to rerank a short candidate list. The paper stresses that this reranking is negligible in cost, because it needs no extra encoding and no second forward pass. The price shows up in storage: the global scheme stores one vector per image, while the factor scheme stores K. The concrete value of K is given as a symbol in the method section, and the excerpt does not state a default number, so I do not fill one in.

What the experiments show, and what the excerpt does not report

The experimental section in the excerpt only states that the method outperforms prior CIR methods and general-purpose embedding models on CIR benchmarks, and that it is combined with MLLM data augmentation. Which benchmarks, how large each gain is, and how much each component contributes in ablation are not listed in the excerpt; Appendix C has a section on inference cost, but the excerpt gives no numbers there either. I will not estimate: without a table there are no numbers. For an acceptance reviewer, what can currently be confirmed is that the method chain is complete and the training objectives are internally consistent — imagination, factor contrast, instance contrast and distillation each have a clear place. What cannot be confirmed is whether the method still leads in your target domain.

  • Confirmed: the decoder is attached at layer 14 of 28, built from one self-attention layer and a three-layer MLP
  • Confirmed: training uses a factor-level and an instance-level InfoNCE, summed into one loss
  • Confirmed: the global vector and the factor vectors come from the same forward pass
  • Not confirmed: the concrete benchmark names, the size of the gains, the individual ablation contributions
  • Not confirmed: the actual inference-cost numbers in Appendix C

Boundary: where this method stops helping

Three situations need care. First, global edits: if the text asks for night or watercolor, the coarse layout prior already explains most of the difference, the residual is small, and the local evidence the factors can capture is limited. Second, storage sensitivity: at hundreds of millions of gallery images, K vectors per image is not a rounding error; a single global vector remains the workhorse and factor reranking fits only short candidate lists. Third, data quality: the method depends on precise reference-image, edit-text, target-image triples; if the edit description is vague or the target is not unique, the factors will not align and both contrastive levels will learn noise as signal. The paper's assumption is that an edit can be decomposed into visual factors; where that assumption fails, it is not more robust than direct mapping [1].

My conclusion: FactEmbed is worth tracking, but not worth copying unconditionally. First confirm that your edits are local, your triples are clean, and your storage budget can absorb K vectors per image; only then ask whether it can replace your single-vector retriever.

References

  1. Factorized MLLM Embeddings for Composed Image Retrieval

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…