TL;DR
Most search systems for PDFs first turn each page into text (parsing, OCR, chunking, captions) and then search that text. ColPali skips the text step: a vision-language model reads the page image and produces about a thousand small vectors, one per image patch, and a late-interaction score matches a query against them. On the authors' new ViDoRe benchmark it reaches an average nDCG@5 of 81.3, against 65.5 to 67.0 for the strongest text pipelines in their table.
Builds on: Vision-Language Model, Bi-Encoder, Late Interaction · Leads to: later visual retrievers such as ColQwen2, which the paper itself tests as a stronger backbone
Why it mattered
Retrieval-augmented generation depends on finding the right page before a model can answer from it. ColPali showed that a single vision-language model, trained on query-page pairs, can replace a multi-stage PDF ingestion pipeline and still win on accuracy. Its public release (models, training data, code and the ViDoRe leaderboard) turned "retrieve by page image" from an idea into something other groups could benchmark and fine-tune. The paper's own follow-up tests (Section 6) include a Qwen2-VL backbone that scores 86.6 on the same benchmark average, which the authors read as a sign that better vision-language models make better visual retrievers.
History
Before 2020, document retrieval mostly meant text search over OCR output or parsed PDFs. Dense text retrieval grew around bi-encoders such as Dense Passage Retrieval (2020), and late interaction arrived with ColBERT in 2020, which kept one vector per token so that scoring could be fine-grained while the index was still built ahead of time. Vision-language models followed a separate path: contrastive models such as CLIP (2021) and SigLIP (2023) aligned images with text, but were not trained for matching a query to a long, text-heavy page.
ColPali (2024) joined these two lines. Its authors took PaliGemma, a vision-language model in which image patches feed a language model, and trained it with ColBERT's late-interaction loss on query-page pairs. They also released ViDoRe, a benchmark for page-level retrieval across ten datasets, because they found that existing benchmarks measured text passages or natural images, not document pages. The benchmark and the released models made the comparison easy to repeat, and the storage costs the method creates can be cut with compression methods that the paper cites.
The problem
A search system for documents is judged on three things, which the paper names R1 (retrieval quality), R2 (query latency) and R3 (indexing throughput, that is how many pages can be embedded per unit of time). Before this paper, the standard pipeline for a PDF was:
- extract words with a PDF parser or OCR;
- detect layout (titles, tables, figures, headers);
- cut the text into chunks with some sense of meaning;
- optionally write a caption for each figure or table so that a text model can see it.
The authors measured where the quality came from. Changing the text embedding model made little difference; changing what the ingestion pipeline kept made a large one. On the same chunks, a plain BM25 ranker and a strong dense text encoder (BGE-M3) were close: with OCR, their average nDCG@5 was 65.5 and 66.1. The bottleneck was that figures, tables and layouts were thrown away or turned into lossy text before any model saw them. Indexing was also slow: the authors report about 7.22 seconds per page for the Unstructured pipeline in their setting, most of it spent on layout detection, OCR and captioning.
The question is then: can a model read the page image directly and be good enough at retrieval that the pipeline is unnecessary?
How it works
The walkthrough below follows one query and one page through the system, using the paper's architecture.
- Offline, index a page. Take a page as an image. The image is cut into a fixed grid of patches. In PaliGemma's vision encoder this gives 1024 patches.
- Run the vision-language model over the image tokens and a short text prompt. The patch embeddings enter a language model (Gemma 2B inside PaliGemma 3B) together with a fixed prompt, "Describe the image", which the paper adds as six text tokens. The model produces one output vector per token, so about 1030 vectors for the page.
- Project each vector down. A linear layer maps every output vector to 128 dimensions, the size used in the ColBERT paper. The page is now a matrix with about 1030 rows and 128 columns, and it is stored once in the index.
- Online, embed the query. The query text goes through the same language model and projection. Each query token gets its own 128-dimensional vector. The paper also appends five special query-augmentation tokens.
- Score the page with late interaction. For each query vector, find the page vector it matches best (largest dot product). Add those best matches up over all query vectors. That sum is the score of the page.
- Rank. Do step 5 for every page in the corpus and sort. The top pages go to the user, or to a language model that writes the answer.
flowchart LR A[Page image] --> B[Patches through<br/>PaliGemma 3B] B --> C[About 1030 vectors<br/>projected to 128-d] C --> D[(Index)] Q[Query tokens] --> E[Same model<br/>and projection] E --> F[Late interaction:<br/>best page match per query token, summed] D --> F F --> G[Ranked pages]
The key design choice is step 2: the image tokens and the text tokens are read by one model, so the query is compared with image content that already carries the model's language understanding. The rest is the late-interaction scoring from Late Interaction, which keeps the page vectors separate so they can be indexed ahead of time.
The math
The paper writes the query as and the page as , where and are the numbers of vectors and is the projected dimension. Each row is one token (query) or one patch (page).
Step 5 in symbols: the late-interaction score
Read it from the inside out. is the dot product of query vector with page vector , a single number that is large when the two point the same way. The over keeps the best page vector for query vector . The sum over adds one such best match per query vector. The paper uses a dot product here, not the normalised Cosine Similarity.
Training in symbols: the contrastive loss
Training uses a batch of query-page pairs , where is the correct page for . Write for the score of the correct page and for the best-scoring wrong page in the batch. The loss is the Cross-Entropy Loss of picking the correct page, with the wrong pages in the batch as competitors. The paper rewrites it with the Softmax denominator in a numerically stable form:
The function is the softplus function. It is near 0 when is well above and grows roughly linearly when the wrong page wins. Because is built from maxima and sums of dot products, gradients flow through it, so the whole model is trained end to end.
Worked examples
Query has two token vectors, and . Page A has three patch vectors , , .
- For against page A: dot products are , , . The best is .
- For against page A: dot products are , , . The best is .
- Add the two best matches: .
- Page B has vectors and . For the best dot product is . For it is . So .
- Page A scores higher, , so it ranks first.
Interpretation: each query token only needs one good patch on the page. Page A has a patch that matches the first query token strongly and a different one that matches the second, so it wins even though page B has patches that are moderately similar to both.
Take one query in a batch, with a correct page scoring and the best wrong page in the batch scoring .
- Compute the gap .
- Compute .
- Compute .
- This is the loss for this query. A query whose wrong page scored instead would have gap and loss , so the loss rises sharply when a wrong page competes closely.
- Check with the softmax form: , and . The two forms agree.
Interpretation: training pushes the correct page's best-match sum above the strongest wrong page in the batch, and the loss saturates towards 0 once the margin is large.
The paper reports 257.5 KB per page for ColPali stored in float16. Reproduce it from the parts.
- A page gives 1024 image-patch vectors, plus the six text tokens, so vectors.
- Each vector has numbers.
- Each number takes 2 bytes in float16, so one page is bytes.
- Divide by 1024 to express it in KiB: . This matches the paper's 257.5 KB if "KB" means 1024 bytes.
- For comparison, the paper reports 8.60 KB per page for BGE-M3. ColPali uses about 30 times as much space per page.
- The paper's token pooling (mean-pooling groups of patches, with a pool factor of 3) cuts the vector count by 66.7% and keeps 97.8% of performance on average, which brings the index down to roughly a third of the size.
Interpretation: the larger index is the real cost of the method. The paper argues the cost is acceptable because centroid clustering or binary quantisation can cut storage by about two orders of magnitude with minimal performance loss, citing Santhanam et al.
Try it: A corpus has 1 million pages, each stored at the paper's exact size of bytes with no pooling. Roughly how much disk space does the index need, in gigabytes (1 GB = bytes), and about how much after the pool-factor-3 reduction that the paper describes? Answer: bytes, so about 264 GB. With the 66.7% cut in vectors the index keeps about one third of that, roughly 88 GB.
Common mistakes and tradeoffs
It is tempting to think ColPali is just "a better OCR". In fact it never produces text: the model reads pixels and the score is computed between query tokens and image patches. The paper's interpretability figure shows that the query token for "hour" gives high similarity to both the words "hourly" and "hours" in the page image, and to the chart's x-axis, which the authors read as OCR-like behaviour without an OCR step.
It is tempting to think a single vector per page is enough. For documents it is not: a page holds many separate pieces of information (a table, a headline, a figure), and one pooled vector averages them away. The ColBERT-style multi-vector store keeps them apart, which is where most of the gain over bi-encoders comes from. The paper's single-vector BiPali model scores 58.8 on average, against 81.3 for ColPali.
It is tempting to think ColPali is cheap. At query time it is not much slower than a text encoder (about 30 ms against about 22 ms for BGE-M3 in the paper's setting, for a single query), and it is much faster to index, since a page needs one forward pass instead of a parsing pipeline. But it costs about 30 times more storage per page, and it needs a GPU-sized model to embed pages.
When to use it: a corpus of visually rich pages (scanned forms, slides, reports, tables and figures) where the ingestion pipeline is the slow or lossy part, and where you can afford a larger index. When not to use it: plain-text corpora where a BM25 or text bi-encoder already works, or settings with very tight storage. Alternatives the paper tests are the captioned or OCR pipelines (strong but slow to index), contrastive single-vector models such as SigLIP (fast but weak here), and cross-encoders, which score a query with each page jointly and are too slow to run over a whole corpus.
Results
The main table of the paper (Table 2) reports nDCG@5 on ten ViDoRe datasets. The academic datasets are ArxivQ, DocQ, InfoQ, TabF and TATQ; the practical ones are Shift, AI, Energy, Government and Healthcare. The averages below are the paper's own.
| System | Average nDCG@5 |
|---|---|
| Unstructured text-only + BM25 | not reported as an average in the paper |
| Unstructured + OCR + BM25 | 65.5 |
| Unstructured + OCR + BGE-M3 | 66.1 |
| Unstructured + Captioning + BGE-M3 | 67.0 |
| SigLIP (vanilla, single vector) | 51.4 |
| BiPali (single vector, PaliGemma) | 58.8 |
| ColPali (late interaction) | 81.3 |
What they mean:
- Multi-vector scoring is the step that matters most. The single-vector BiPali model, which uses the same backbone, reaches 58.8. ColPali reaches 81.3.
- The gap is largest on the visually hard sets. On ArxivQ, ColPali scores 79.1 against 40.1, the best text-pipeline score there (BM25 with captioning). On InfoQ it scores 81.8 against 71.9, the best text-pipeline score there (BGE-M3 with captioning). Both comparisons are read from Table 2.
- Query latency: Section 3 says every system evaluated answers queries in at most 22 ms on an NVIDIA L4. Section 5.2 puts BGE-M3's query encoding at about 22 ms and ColPali's at about 30 ms (batch size 1, averaged over 1000 queries). The two statements do not quite agree, so read ColPali's query cost as roughly 20 to 30 ms.
- Indexing is much faster: the paper's Table 5 gives 7.22 s per page for Unstructured with captioning, 0.39 s for ColPali and 0.12 s for vanilla SigLIP.
- Ablations (Section 6): halving the patches to 512 costs 24.8 nDCG@5 points; a larger backbone (ColQwen2 on Qwen2-VL, 768 patches) scores 86.6, which is 5.3 above ColPali; training only on the external DocMatix dataset costs 2.2 points.
Limits: the benchmark's practical queries are generated by Claude-3 Sonnet, with every one checked by human annotators, and the practical tasks have 100 queries over 1000 pages per topic, so small differences between systems are not reliable. The storage cost is large in the paper's own numbers. The paper evaluates page-level retrieval only, not answer generation.
Reading guide
- Abstract and Section 1 (Introduction): the case for skipping the ingestion pipeline. Needs Retrieval-Augmented Generation for the setting.
- Section 2 (Problem formulation and related work): R1, R2, R3 and the offline/online split. Needs Bi-Encoder, Cross-Encoder and BM25; the ColBERT paragraph needs Late Interaction.
- Section 2.2 and Appendix E: how vision-language models are built, and what SigLIP and PaliGemma are. Needs Vision-Language Model, Vision Transformer (ViT), Contrastive Learning and Sigmoid Loss for Language Image Pre-Training.
- Section 3 (ViDoRe): the benchmark design. Needs Precision and Recall for the Recall@K metric, and nDCG (ranked-retrieval gain), which the paper uses as its main score.
- Section 4 (Architecture and loss): the late-interaction formula and the softplus form of the loss. Needs Cosine Similarity (the paper uses a dot product here) and Cross-Entropy Loss with Softmax.
- Section 4.2 (Training) and Appendix B.2: LoRA adapters (see Low-Rank Adaptation (LoRA)) and the learning-rate settings.
- Section 5 (Results) and Section 5.2 (Latency, memory): the tables and the pooling experiment, which uses Max Pooling-style reduction over patches; the paper's pooling is a mean over groups, so read it as a relative of that idea.
- Section 6 (Ablations): the trade-offs between patches, backbone size and training data.
Recap
- Text-based document search loses visual information during parsing, OCR and captioning, and that loss, not the text embedding model, limits quality.
- ColPali embeds each page image directly with a vision-language model into about 1030 vectors of size 128.
- Query tokens are scored against page vectors with late interaction: for each query vector take the best dot product over the page's vectors, then sum.
- Training uses an in-batch contrastive loss on that score, so the whole system is end to end.
- On ViDoRe the authors report an average nDCG@5 of 81.3, versus 65.5 to 67.0 for the best text pipelines in their table, at much lower indexing latency and higher storage cost.
Read next: the Late Interaction lesson for the scoring rule in general, and Retrieval-Augmented Generation for the setting where this retrieval step feeds a language model.
Check yourself
QuestionRecall: what does the late-interaction score sum over, and what does it take the maximum over?Show answer
QuestionA query has 3 token vectors. For a page, their best dot products with the page's vectors are 0.7, 0.4 and 0.9. What is the late-interaction score?Show answer
QuestionWhy does ColPali keep one vector per patch instead of pooling a whole page into one vector, and what does that cost?Show answer
QuestionA team's pipeline spends most of its indexing time on OCR and layout detection. Based on the paper, what would switching to ColPali change, and what would it not fix?Show answer
QuestionIn the training loss, the correct page scores 1.0 and the best wrong page in the batch scores 1.0. Compute the loss for that query.Show answer
Sources
- Faysse et al., ColPali: Efficient Document Retrieval with Vision Language Models, arXiv:2407.01449 — https://arxiv.org/abs/2407.01449
- Khattab and Zaharia, ColBERT, arXiv:2004.12832 — https://arxiv.org/abs/2004.12832
- Beyer et al., PaliGemma, arXiv:2407.07726 — https://arxiv.org/abs/2407.07726