Entity-Graph Enhanced Cross-Modal Pretraining for Instance-level Product Retrieval
- Publication
- IEEE Transactions on Pattern Analysis and Machine Intelligence 2023Journal
- First submitted to arXiv
- arXiv:2206.08842
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{retailproductentitygraph2022,
title = {{Entity-Graph Enhanced Cross-Modal Pretraining for Instance-level Product Retrieval}},
author = {Xiao Dong and Xunlin Zhan and Yunchao Wei and Xiaoyong Wei and Yaowei Wang and Minlong Lu and Xiaochun Cao and Xiaodan Liang},
year = {2022},
eprint = {2206.08842},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2206.08842}
}
Product titles in e-commerce are a peculiar kind of text.
Take "Lancôme Small Black Bottle Christmas Skin Care Set Essence Eye Cream Small Black Bottle Eye Twin Pack Sunscreen Primer". A title like this isn't a sentence written for people to read. It's a string of keywords: the seller crams in every word that might get searched, from product names and promotional phrases to words like "set" and "twin pack" that describe the bundle.
Product1M is the dataset built around this kind of text. Its task is to take a photo of a multi-product set plus its title and find every single item in the set. This paper is the same team's extension. They want the model, when it reads a title, to know which words are the real "nouns" pointing at products and which are just noise.
Problem Definition
The authors give an example. An SK-II four-piece set has a title naming fairy water, facial cream, cleanser and clear lotion, plus "four-piece set". Ideally the model should attend to the names of the four products and ignore descriptions like "four-piece set". A model trained directly with image-text contrastive learning, though, may end up attending to wrongly cut fragments such as "SK-II", "Cream Cleaner" and "Lotion Four-piece".
Natural language processing has a family of methods called knowledge injection, which pour entity information from a knowledge graph into a language model so that it knows which words are meaningful concepts. These methods need an annotated knowledge graph, though, and building one for each new domain is expensive.
The authors' compromise is to skip building a separate knowledge graph. They extract noun entities straight from the titles and build a graph from the relations among those entities.
Besides Product1M's original multi-product retrieval, this paper adds a new task called identical-product retrieval. It takes 819 products and over 200,000 records from Product1M. The query is a photo of one product, and the model has to find, in the gallery, photos of the same product from other angles and against other backgrounds. This is the case you hit most often when comparing prices, where the same product looks a little different from seller to seller. For every query-answer pair in the test set, at least 5 crowd annotators checked whether the two are the same product.
Solution

The model is called EGE-CMP (Entity-Graph Enhanced Cross-Modal Pretraining). Its skeleton follows CAPTURE from Product1M, a hybrid-stream Transformer that first encodes each modality separately, then crosses them, and finally fuses them. The difference is a third modality, entities.
Extracting Entities from Titles

The entities come from a very direct source. An off-the-shelf named entity recognition (NER) tool pulls the noun phrases out of each title; from the Lancôme title above, it extracts words such as facial skin care, Small Black Bottle, Sunscreen and Skin Care Set. All the distinct entities in the dataset make up an entity dictionary.
Like text and images, the entities get their own encoder and then do cross-attention with the title. At retrieval time, the outputs of the text–visual and entity–text co-Transformers are concatenated into a 1024-dimensional feature.
Three Kinds of Pretraining Tasks
There are three masking tasks. MLM masks 15% of the title's tokens and predicts them back; MRP masks 15% of the image regions and regresses the original region features; MEM masks about 15% of the entities and predicts them back from the joint features.
There are two contrastive pairs. One is image against title, where a product's image and its title form a positive pair. The other is entity against title, which teaches the text encoder which spans of the title correspond to each entity.
Entity Graph
The third part is the entity graph named in the paper's title.
The authors maintain an entity queue, initially filled with every entity in the dictionary. To update the queue, all the entities are fed through the co-Transformer to get embeddings, which then go to a graph clustering network called AdaGAE. It learns the relations among the entities and yields a graph embedding for each one. Similarity between graph embeddings decides which entities serve as negatives for which during training.
Two ranking losses are defined on this graph. The node ranking loss asks each entity to sit closer to semantically similar entities and away from the selected negatives:
The margin is set to 0. The subgraph ranking loss has the same form, except that it compares subgraph features aggregated from each entity's nearest neighbors, so that a group of similar entities, taken as a whole, is also pushed apart from an unrelated group.
Scale and Inference
The layer counts match CAPTURE. The single-modal, cross and co-Transformers have 4 layers each, 12 in total, with a hidden size of 768. The text side is initialized from BERT, with titles capped at 36 tokens. The image side uses a Faster R-CNN trained on Visual Genome and keeps 10 to 36 sufficiently confident regions per image.
At inference, queries and gallery items take the same path. Region features and entities are extracted, everything runs through the whole model, and the outputs of the two co-Transformers are concatenated into a 1024-dimensional feature, which is ranked by cosine similarity against every gallery entry. Multi-product and identical-product retrieval use the same model and the same feature; only the gallery and the evaluation differ.
Discussion
Multi-Product Retrieval
| Method | mAP@10 | mAP@100 | mAR@100 | Prec@100 |
|---|---|---|---|---|
| Image only | 47.46 | 37.06 | 14.63 | 29.20 |
| Text only | 68.85 | 60.56 | 16.44 | 54.86 |
| CLIP* | 76.03 | 73.66 | 24.59 | 70.03 |
| UNITER | 79.00 | 75.73 | 25.22 | 73.99 |
| CAPTURE | 81.49 | 78.81 | 26.46 | 75.00 |
| EGE-CMP | 86.91 | 80.57 | 25.68 | 73.72 |
Source: Table 2 of the paper, excerpt.
On mAP@10, EGE-CMP beats its predecessor CAPTURE by 5.4 points, and the biggest gap is in the ordering of the top few results. Further right in the table the gap narrows, and on mAR@100 and Prec@100 EGE-CMP even falls below CAPTURE. Entities help the model push the most relevant items to the very top, but the total number it finds within the top 100 doesn't grow.
There's one more thing to watch in this table. Same task, same data: in the earlier Product1M paper, mAP@10 was 79.36 for CAPTURE, 74.69 for UNITER and 70.25 for CLIP*. In this paper's table the same three methods score 81.49, 79.00 and 76.03, all 2 to 6 points higher, and the paper doesn't explain what changed in the evaluation setup. When comparing these numbers across the two papers, it's best to compare only relative gaps within the same table.
Also, someone reported on the predecessor's GitHub that ViT-B/16 plus BERT, with only a contrastive loss and whole images as input without region crops, already reaches 87.7 mAP@10. EGE-CMP's 86.91 still hasn't beaten that simple two-tower baseline.
Identical-Product Retrieval
| Method | mAP@10 | mAP@100 | Prec@10 | Prec@100 |
|---|---|---|---|---|
| Image only | 52.90 | 41.51 | 52.90 | 33.75 |
| Text only | 70.21 | 63.88 | 70.21 | 60.54 |
| CLIP* | 81.80 | 81.11 | 81.80 | 57.98 |
| CAPTURE | 82.03 | 82.04 | 82.03 | 59.03 |
| EGE-CMP | 84.66 | 84.79 | 84.66 | 62.00 |
Source: Table 3 of the paper, excerpt.
The gallery for identical-product retrieval is much smaller, just over 10,000 entries, and every method scores higher than on multi-product retrieval. Among the multimodal pretraining models, mAP@10 differs by only about two points (79.90 to 82.03); EGE-CMP is still the highest, 2.6 above CAPTURE.
In both tasks, text alone beats image alone by a wide margin, around 20 points. In a field like cosmetics, where the bottles and jars all look alike, the title carries more information than the picture.
Ablation: Which Part Does the Work
| Setting | mAP | Prec |
|---|---|---|
| Image-text masking + contrastive | 81.49 | 77.27 |
| + Entity masking (MEM) | 85.71 | 81.80 |
| + Node ranking loss | 85.76 | 81.91 |
| + Subgraph ranking loss | 86.91 | 82.59 |
Source: Table 4 of the paper, image + text version.
The first row equals CAPTURE's score. Adding entity masking lifts mAP by 4.22 in one go, most of the total improvement. Adding the node ranking loss next gives only 0.05 more, and the subgraph ranking loss adds another 1.15.
In other words, the "entity graph" in the paper's title contributes about 1.2 points; most of the improvement comes from the pretraining task of masking a whole entity and predicting it back. This matches what the same team saw in M5Product, where masking whole entities in spec sheets worked better than masking token by token. In the text-only and image-only versions too, the entity-masking step brings the biggest gain.
Conclusion
The problem EGE-CMP tackles is a very practical one. E-commerce titles are messy strings of keywords, and the model needs to know which spans are the nouns that actually point at products. The authors' approach doesn't rely on an external knowledge graph. They use NER to pull entities straight out of the titles, treat them as a third modality, and build a graph over those entities.
The ablation splits the credit very clearly. The most effective part is entity masking, which teaches the model to read "Small Black Bottle" as one unit; the entity graph and the two ranking losses together add only a little over one point.
For e-commerce titles, the cheapest first step is to extract noun phrases with NER and mask each one as a whole during pretraining; graph clustering and ranking losses can wait.
One more small thing. The papers in this series don't report consistent baselines on the same dataset, so when comparing their numbers, it's best to check the tables against each other yourself before citing them.