Topic 5 of 5 · 5 min read
Measuring recall in multimodal search
Goal: Compute recall at k for two multimodal retrieval pipelines on a labeled query set and pick the better one for the product.
To know whether a multimodal search works, label a set of queries with the images or pages that should come back, then measure how often they do. The standard number is recall at k: the share of queries where a correct item appears in the top k results.
Check yourself · 1 of 3
What does recall at 5 measure?
Why it matters
Without a labeled set, you compare pipelines by trying a few queries and trusting your impression, which favours the examples you happened to pick. A labeled set turns "feels better" into a number you can repeat after every change, and it shows which kinds of queries fail.
How to do it
- Build the set. Collect 100 or more real queries. For each, record the id of every correct image or page. Include hard cases on purpose: small text, near-duplicate images, abstract descriptions.
- Label carefully. Have someone search the library by hand. A query can have several correct items.
- Run each pipeline. For each query, take the top k results (often 5 and 10).
- Compute recall at k. If a query has one correct item, recall at k is 1 when it is in the top k, else 0. Average over queries. With several correct items, use the share found.
- Bucket the failures. Tag each miss: small text, counting, near-duplicate, wrong language, rare object. Count per bucket.
- Compare. Pick the pipeline that wins where your product needs it, not only the highest average.
Before and after
Before: a team switches to a new embedding model because three demo queries looked better.
After: on 120 labeled queries, the old pipeline scores recall at 10 of 0.71 and the new one 0.74. The buckets show the new model improved style queries but dropped on queries with printed codes, which are 40 percent of real traffic. The team keeps the old model and adds OCR keyword search.
What goes wrong
- Labels written by the person who built the pipeline, who unconsciously writes queries it can answer.
- A test set with no hard cases, so every pipeline scores high.
- Reporting one average that hides a bucket the product depends on.
- Labeling only one correct item when near-duplicates also qualify, which punishes correct results.
- Tuning on the test set until it stops predicting real use.
Examples
Comparing two pipelines on 100 queries
| Pipeline | Recall at 5 | Recall at 10 | Misses on printed codes |
|---|---|---|---|
| Image embeddings only | 0.62 | 0.74 | 21 |
| Embeddings plus OCR keyword | 0.71 | 0.83 | 6 |
If 30 of the 100 queries contain printed codes, the second pipeline is the clear choice even before looking at the average.
Key points
- Recall at k is the share of labeled queries where a correct item appears in the top k results.
- Build the query set from real searches and include hard cases such as small text and near-duplicates.
- Record every acceptable answer per query, or correct near-duplicates will count as misses.
- Tag each miss with a failure bucket, so a pipeline can be judged on the query types the product needs.
- Compare pipelines on the same labeled set, and keep a held-out part that you never tune on.
Common mistakes
- Testing with queries written by the team that built the pipeline.
- Labeling a single correct image when several near-duplicates would be equally right.
- Reading only the average and missing a failure bucket that matters to users.
- Tuning the pipeline on the evaluation queries and then reporting the same score.
Check yourself · 2 of 3
Why include small-text and near-duplicate queries in the test set on purpose?
Check yourself · 3 of 3
Pipeline X has recall at 10 of 0.80 and Pipeline Y has 0.78. Y wins on the query type that makes up half your traffic. What should you do?
Practice items, not counted towards your mastery.
Start here
- ColPali: Efficient Document Retrieval with Vision Language Models (opens in a new tab)PaperFree
Introduces retrieval over page screenshots and the ViDoRe benchmark, with the case against parse-then-chunk pipelines.
- Learning Transferable Visual Models From Natural Language Supervision (CLIP paper) (opens in a new tab)PaperFree
The paper behind shared image and text vector spaces, including its stated weak spots such as counting and fine detail.
- ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT (opens in a new tab)PaperFree
Defines late interaction: one vector per token and a max-similarity score, the idea ColPali applies to image patches.
More for this topic
- ViDoRe benchmark and evaluation code (illuin-tech) (opens in a new tab)ToolFree
A working example of a labeled query-to-page benchmark and the metrics used to compare visual document retrievers.