Back to paper library
CVPR 2022Retail visionPaper notes

EI-CLIP

Canada Goose Is Not a Goose

Original paper

EI-CLIP: Entity-aware Interventional Contrastive Learning for E-commerce Cross-modal Retrieval

Paper authors

Haoyu Ma · Handong Zhao · Zhe Lin …

Show all 9 authors

Haoyu Ma · Handong Zhao · Zhe Lin · Ajinkya Kale · Zhangyang Wang · Tong Yu · Jiuxiang Gu · Sunav Choudhary · Xiaohui Xie

Publication
CVPR 2022Conference
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@inproceedings{retailproducteiclip2022,
  title = {{EI-CLIP: Entity-aware Interventional Contrastive Learning for E-commerce Cross-modal Retrieval}},
  author = {Haoyu Ma and Handong Zhao and Zhe Lin and Ajinkya Kale and Zhangyang Wang and Tong Yu and Jiuxiang Gu and Sunav Choudhary and Xiaohui Xie},
  year = {2022},
  booktitle = {CVPR},
  url = {https://doi.org/10.1109/CVPR52688.2022.01752},
  doi = {10.1109/CVPR52688.2022.01752}
}
On this page

In CLIP's world, Diesel is fuel and Canada Goose is a bird.

That isn't wrong. Most of what CLIP learned from 400 million image-text pairs on the web looks just like that. In fashion e-commerce, though, Diesel is an Italian denim brand, Canada Goose is a Canadian company that sells down parkas, Golden Goose is a brand known for its sneakers, Top refers to a garment worn on the upper body, and relaxed describes a loose cut.

The usual way to use CLIP for text-to-image search in e-commerce is to fine-tune it on product data. But there is only so much fine-tuning data, and the common sense rooted deep in the model may not get corrected.

This paper comes from UC Irvine, Adobe Research and the University of Texas at Austin; the first author did the work during an internship at Adobe. The authors put the problem into a causal-inference framework, and it ends up as a fairly simple method.

Problem Definition

Original Figure 1: the left column is the general domain, the right column e-commerce. The first row is Diesel: the general-domain image is a diesel pump at a gas station, with the related words diesel, fuel, gasoline, car; the e-commerce image is a Diesel T-shirt with tags for brand diesel, composition 100% cotton, category T-shirt, relaxed fit, washing instructions and so on. The second row is Canada Goose: the general-domain image is a Canada goose flying over a lake, with the related words goose, wing, water, bird; the e-commerce image is a Canada Goose down parka with tags for brand, shell and lining materials, category jacket and so on.
Original Figure 1, Ma et al., from PDF page 1, scholarly quotation.

Product text in e-commerce usually has two parts. One is the description, a passage written for people to read; the other is a set of structured tags such as brand, category, season and material composition. The authors call these tags entities.

The fashion retrieval models of the time, FashionBERT and Kaleido-BERT, both put their effort into the image side, using finer patch features to capture clothing details, while the language side still used plain BERT. The authors point out two problems on the language side.

The first is semantic bias. In general text, "golden goose" is a gold-colored goose, and BPE splits it into two tokens, golden and goose; it even shares goose with Canada Goose. During fine-tuning, these tokens have a hard time learning that "this is a brand".

The second is that entities are not equally useful. The authors first ran a small experiment: fine-tune CLIP on Fashion-Gen, with the description concatenated with different tags as the text input. Only the brand helped. Adding season or composition was nearly useless or even made things worse, and concatenating every tag did worse than adding the brand alone.

Solution

Describing the Problem with Causal Inference

The authors place the text XX, the image YY and the entity semantics zz in a causal graph. z=g(a,b)z = g(a, b) means that entity aa takes meaning bb; golden goose, for example, can take the meaning "animal" or the meaning "brand".

CLIP learns P(Y∣X)P(Y \mid X), which expands to:

P(Y∣X)=∑zP(Y∣X,z) P(z∣X)P(Y \mid X) = \sum_z P(Y \mid X, z)\, P(z \mid X)

The trouble is P(z∣X)P(z \mid X). Given the sentence "a T-shirt of golden goose", the common sense CLIP picked up in pretraining makes the meaning "golden goose is an animal" highly probable, so the search results lean toward images with geese or something golden in them.

The standard way causal inference handles a confounder like this is backdoor adjustment, which cuts the dependence between zz and XX and uses the prior of zz in the training data instead:

P(Y∣do(X))=∑zP(Y∣X,z) P(z)P(Y \mid do(X)) = \sum_z P(Y \mid X, z)\, P(z)

In fashion data, golden goose is far more likely to be labeled a brand than an animal, so the common-sense bias gets pushed down.

Turning It into Entity Embeddings

At this point the authors make a key simplification. The tags in e-commerce data already say exactly what each entity is. Golden goose sits in the brand field, so its only meaning is "brand", and every general-domain meaning has probability zero.

The sum over zz therefore reduces to a single term, and that term doesn't have to come from CLIP's text encoder. The authors learn an embedding vector for each entity from scratch, treating the whole entity as one unit instead of splitting it into subwords:

EiT=EiD+EiAEiD=hT(Di),EiA=hA(Ai)\begin{aligned} E^T_i &= E^D_i + E^A_i \\ E^D_i &= h^T(D_i), \quad E^A_i = h^A(A_i) \end{aligned}

DiD_i is the product description and AiA_i its entity tags. hAh^A is simple, one embedding layer plus one MLP layer, and its 512-dimensional output is added to CLIP's text feature. The description still goes through CLIP's text encoder, while each entity is looked up in a table.

In plain terms, the brand golden goose gets its own vector in the model. That vector is learned only from fashion data and is completely untouched by "a gold-colored goose".

Gates to Pick the Entities

Original Figure 3: (a) the CLIP approach concatenates the description with brand Diesel, season SS2014, category Jacket and composition 90% cotton into one text, feeds it to the text encoder, and does contrastive learning against the image feature. (b) the EI-CLIP approach still feeds the description to the text encoder; each entity group (brand, season, …, category) has its own entity encoder, whose output is weighted by its own gate (Gate 1 to Gate K), and together these form the confounding entity selector; the weighted entity feature passes through the entity-aware module, is added to the description feature, and is then contrasted with the image feature.
Original Figure 3, Ma et al., from PDF page 4, scholarly quotation.

The second problem is which entities are useful. Brand, category, season and composition each get an entity encoder hkAh^A_k, and each group is followed by a gate, one MLP layer plus a sigmoid, that outputs a weight wkw_k between 0 and 1:

E^iA=∑kwk⋅hkA(aik)\hat{E}^A_i = \sum_k w_k \cdot h^A_k(a^k_i)

The gate sets the weight from the entity's own embedding, so the model learns for itself which kinds of tag deserve attention. After training, the season group's weight is only about 0.05, almost switched off, which matches the earlier small experiment.

Training computes three contrastive losses at once: image against "description plus entities", image against "description only", and image against "entities only". The authors say this lets the entity encoder learn separately from the pretrained text encoder, so the common-sense bias doesn't seep back into the entity embeddings.

Discussion

The main dataset is Fashion-Gen: over 67,000 fashion items, each with one description and one to six photos from different angles, plus four tag groups (brand, subcategory, season, composition). There are 570 brands and more than 16,000 composition combinations.

Evaluation comes in two forms. One follows the FashionBERT convention: draw 100 negatives from the same subcategory and rank them together with the correct answer. The other searches the whole catalog, which the authors consider closer to real search.

Searching the Whole Catalog

SettingImage→text R@1Text→image R@1SumR
Pretrained CLIP, no fine-tuning9.410.7141
Fine-tuned, description only22.524.5273
Fine-tuned, description + all tags as a string23.325.7285
EI-CLIP, gate weights fixed and equal25.228.2296
EI-CLIP25.728.4302

Source: Table 1 of the paper. SumR is the sum of R@1, R@5 and R@10 in both directions.

Without fine-tuning, CLIP's R@1 is only about 10%; the gap between e-commerce and the general domain is large. Fine-tuning more than doubles it.

Concatenating the tags into the text helps, but not by much: SumR goes from 273 to 285. Giving each entity its own embedding jumps to 296, and adding the gates reaches 302. The abstract's "10.3% and 10.5% relative improvements" are exactly these two pairs, R@1 from 23.3 to 25.7 and from 25.7 to 28.4.

Mostly the Brand

Tags addedHowSumR
None273
Brand onlyString293
Category onlyString276
Season onlyString272
Composition onlyString269
All tagsString285
Brand onlyEntity embedding294
All tagsEI-CLIP302

Source: Table 4 of the paper, excerpt.

The per-entity ablation makes the picture very clear. Concatenating just the brand as a string already gives a SumR of 293, higher than the 285 from concatenating every tag. Concatenating season or composition actually makes results worse, which shows that throwing in all the metadata indiscriminately does harm.

Switching the brand from a string to an entity embedding adds only 1 point (293 to 294). That sits awkwardly with the authors' first motivation: on this dataset at least, learning Diesel as a separate vector and letting CLIP read the word "Diesel" make little difference. EI-CLIP's last 8 points (294 to 302) come from using several entity groups together and letting the gates set their weights.

Against FashionBERT

In the "100 negatives from the same subcategory" setting, the authors re-ran FashionBERT; with tags it reaches a SumR of 359.8. Fine-tuning CLIP directly with tags gives 384.7, and EI-CLIP gives 390.1.

In this comparison, the biggest gap comes from CLIP itself. Simply switching to fine-tuned CLIP puts it well above FashionBERT; EI-CLIP adds only 5.4 on top of that. The authors also admit this setting is easier: there are only 101 candidates, all from the same subcategory, so the category tag is of no use at all.

The other e-commerce dataset was compiled by the authors from Amazon reviews: just over 20,000 image-text pairs, with brand as the only tag. EI-CLIP reaches a SumR of 280 against CLIP's 267. The gain is mostly in image-to-text; text-to-image R@1 only moves from 23.5 to 23.7.

Conclusion

EI-CLIP describes, in the language of causal inference, a problem every e-commerce engineer knows well. A pretrained model has preconceptions about certain words, and in product data those words mean something else. The backdoor-adjustment derivation ends up as two very practical designs, a dedicated embedding vector for each entity value and a gate for each tag group.

The clearest message in the experiments is actually the per-entity ablation table. More tags are not always better: the brand delivers almost all of the gain, while season and composition hurt. What the gates contribute is switching those useless tags off automatically.

The causal framework sounds heavy, but in practice you can start with the lightest step. Add the brand name to the product text first and see how far that gets you; how much to listen to the other tags can be left to the gates. The paper released no code, but fortunately neither design is hard to implement yourself.