Back to paper library
Paper notesarXiv 2024ICLR 2025

ColPali

What You See Is What You Search

Original paper

ColPali: Efficient Document Retrieval with Vision Language Models

Paper authors

Manuel Faysse · Hugues Sibille · Tony Wu …

Show all 7 authors

Manuel Faysse · Hugues Sibille · Tony Wu · Bilel Omrani · Gautier Viaud · Céline Hudelot · Pierre Colombo

Publication
ICLR 2025Conference
First submitted to arXiv
arXiv:2407.01449
Cite this paper · BibTeX

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

@misc{documentunderstandingcolpali2024,
  title = {{ColPali: Efficient Document Retrieval with Vision Language Models}},
  author = {Manuel Faysse and Hugues Sibille and Tony Wu and Bilel Omrani and Gautier Viaud and Céline Hudelot and Pierre Colombo},
  year = {2024},
  eprint = {2407.01449},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.01449}
}
On this page

When you hook a batch of PDFs into a RAG system, what really eats up time is usually not choosing an embedding model but the long chain of preprocessing in front of it.

The PDF first goes to a parser or OCR to extract the text, then through layout detection to separate paragraphs, headings, tables, and figures; next you decide how to chunk it so that each chunk is roughly complete in meaning. If a page has charts, you also need a vision-language model to write a text description of them, because text embedding models can't read images. Only after all that is it embedding's turn.

This pipeline is long, and every stage can go wrong. A table gets torn apart, a chart is reduced to its caption, a paragraph spanning columns gets stitched together wrong, and no retriever downstream, however strong, can recover from it.

This paper comes from Illuin Technology, a French company that builds AI systems for businesses, with collaborators from CentraleSupélec, Equall.ai, and ETH Zürich. Their proposal is bold: skip text extraction altogether, treat each page as an image, and retrieve with the images directly.

Defining the Problem

What Makes Good Document Retrieval

The authors first set the task as page-level retrieval: given a question, the system must rank the correct page from the corpus near the top.

In industrial settings, a retrieval system works in two phases. Offline, all pages are built into an index; online, the user's question is matched against the index. From this, the authors list three requirements:

  • R1: retrieval must be accurate, measured with standard metrics such as nDCG@5.
  • R2: online queries must be fast, measured by average latency.
  • R3: offline indexing throughput must be high, measured by the time spent per page.

Three Ways to Match

Text retrieval has roughly three ways of matching, and ColPali borrows the third.

  • Bi-encoder: documents and questions are each encoded into a single vector, and online only one cosine is computed. Fast, but a whole page's information is squeezed into one vector.
  • Cross-encoder: the question and the document are concatenated and fed into the model together, so every word on each side can attend to the other. Accurate, but for every new question, the model must be rerun on every document in the corpus.
  • Late interaction: the compromise proposed by Khattab and Zaharia's ColBERT. Each document token keeps its own vector, computed offline in advance; online, each question token is also encoded into a vector, and the vectors from the two sides are compared. The document side can still be precomputed, while the matching keeps word-to-word detail.

ViDoRe

Retrieval benchmarks of the time evaluated either text passages (such as MTEB) or image-text matching on natural images. None evaluated “using a question to find a document page, where the pages have tables, charts, and infographics.” So the authors built their own, ViDoRe (Visual Document Retrieval Benchmark).

ViDoRe has two groups of tasks:

  • Academic tasks: existing document QA datasets repurposed as retrieval tasks, with the question as the query and the page the question came from as the correct answer. These include DocVQA (scanned documents), InfoVQA (infographics), TAT-DQA (financial reports), arXivQA (figures from papers), and TabFQuAD, a French table dataset released by the authors.
  • Practical tasks: four English topics, energy, government, healthcare, and AI, plus a French topic on environmental reports, Shift. The authors crawled public PDFs, 1,000 pages per topic, had Claude-3 Sonnet look at the pages and write questions, and then had 4 volunteer annotators filter them by hand down to 100 questions per topic.

How Existing Systems Score

The authors ran common industry approaches on ViDoRe. The base pipeline is the open-source tool Unstructured at its highest-quality setting, with layout detection, Tesseract OCR, table reconstruction, and chunking by heading. On top of that, they added two ways of handling visual elements:

  • +OCR: tables, charts, and images are also run through OCR, each as its own chunk.
  • +Captioning: visual elements are handed to Claude-3 Sonnet, which writes a detailed description.

The chunks are encoded with BM25 or BGE-M3, and a page's score is the highest score among its chunks. They also tested the contrastive image-text models Jina-CLIP, Nomic, and SigLIP, matching against page images directly.

Average nDCG@5 on ViDoRe (compiled from Table 2 of the paper):

SystemAverage
Unstructured + OCR, BM2565.5
Unstructured + OCR, BGE-M366.1
Unstructured + Captioning, BM2565.1
Unstructured + Captioning, BGE-M367.0
SigLIP51.4
Jina-CLIP17.7

Two things can be read from this table. First, swapping BM25 for the neural BGE-M3 adds only 0.6 to 1.9 points on average. A better embedding model doesn't help much; the bottleneck is further upstream, where the information on the page never gets extracted in the first place.

Second, the contrastive models that look at the image directly fall far behind. SigLIP still manages 51.4, but the other two score only in the teens. The image side of these models wasn't optimized for reading text.

So the question becomes: can you build a model that looks at the image and can also read the text on the page?

Solving the Problem

Architecture

Original Figure 1: the top half is the standard retrieval pipeline. Offline, pages go through OCR, layout detection, captioning, and chunking in turn, and a text embedding model encodes them into N'd vectors, at 7.22 seconds per page and 0.66 nDCG@5 on ViDoRe; online, the question is encoded into one vector and scored with MaxSim, at 22 ms per query. The bottom half is ColPali: offline, the page image goes into a vision encoder, a projection layer, and an LLM, which output one vector per patch, Nd in all, at 0.39 seconds per page and 0.81 nDCG@5; online, each token of the question “What are ViTs?” is encoded into a vector through the LLM and projection layer, each does MaxSim against the document vectors, and the results are summed, at 30 ms per query.
Original Figure 1, Faysse et al., from PDF page 2, CC0 1.0.

The top half is the long pipeline just described, and the bottom half is ColPali. On the offline side, the whole page image goes straight into a vision-language model, which outputs one vector per image patch; on the online side, each question token also gets its own vector, and the two sides are matched with MaxSim and summed into a score.

ColPali's backbone is Google's PaliGemma-3B. It projects the patch embeddings output by the SigLIP-So400m/14 image encoder into the vector space of the Gemma-2B language model, so image tokens and text tokens are processed in the same language model. The authors add a projection layer after the language model's output that compresses each token's vector to 128 dimensions, the dimension ColBERT uses.

Why pass the image patches through the language model instead of using SigLIP's output directly? Because after the language model, the image tokens' representations are pulled into the same space as the text tokens, which is what gives “hour” in the question and the patch of the page printed with hours a chance to land close together in one space.

How Many Vectors a Page Becomes

Let's walk one document page through it.

ColPali uses the 448-resolution PaliGemma. The page is resized to 448×448448 \times 448 and cut into 14×1414 \times 14-pixel patches, 32×32=102432 \times 32 = 1024 of them. The model also appends a fixed text prompt after the image, “Describe the image,” which is 6 tokens. These 1030 tokens pass through Gemma-2B together, each outputting a vector that is then projected to 128 dimensions.

So in the index, one document page is a 1030×1281030 \times 128 matrix Ed\mathbf{E}_d.

The question side works the same way. Take “Which hour of the day had the highest overall electricity generation in 2019?”: it is split into a dozen or so tokens, followed by 5 special <unused0> tokens. This trick comes from ColBERT; the extra tokens act like a learnable buffer that lets the model decide for itself which aspects of the query to reinforce. After encoding, it is an Nq×128N_q \times 128 matrix Eq\mathbf{E}_q.

How Late Interaction Is Computed

With both matrices in hand, the score is computed like this:

LI(q,d)=∑i=1Nqmax⁡j∈[1,Nd]⟨Eq(i),Ed(j)⟩\mathrm{LI}(q, d) = \sum_{i=1}^{N_q} \max_{j \in [1, N_d]} \left\langle \mathbf{E}_q^{(i)}, \mathbf{E}_d^{(j)} \right\rangle

For each question token, find the document vector with the largest inner product; add up the maxima found for every token, and that is the page's score.

Work through a scaled-down example by hand. Suppose the question has only 3 tokens and the document only 4 patches, with these pairwise inner products:

p1p2p3p4Max
hour0.10.80.20.00.8
highest0.30.10.60.20.6
20190.70.00.10.30.7

Illustrative numbers made up for this note.

This page's score is 0.8+0.6+0.7=2.10.8 + 0.6 + 0.7 = 2.1. Each query token gets to find “the patch most like itself” on the page, different tokens can match different positions, and the page never has to be squeezed into a single vector first. The real computation is an Nq×1030N_q \times 1030 inner-product matrix, taking the maximum of each row and summing.

Each row of this table, drawn back onto the page, is a heatmap:

Original Figure 3 (right half): a stacked bar chart titled “2019 Average Hourly Generation by Fuel Type,” with hours 1 to 24 on the horizontal axis and average hourly generation (MW) on the vertical axis. Overlaid is the similarity heatmap for the query token “hour,” brighter around Hourly in the title and Hours on the x-axis at the bottom. Below is the query “Which hour of the day had the highest overall eletricity generation in 2019?” with hour underlined.
Original Figure 3 (right half), Faysse et al., from PDF page 9, CC0 1.0.

These are the inner products of the token “hour” with the 1024 patches. Hourly in the title and Hours on the x-axis both light up, so the model really did read these words from the pixels; it also picked up that the x-axis represents hours. In the appendix, the authors also observe that a few blank patches score high, and they speculate that the model uses these patches to hold global information about the whole page, much like register tokens in a ViT.

Training

Late interaction is fully differentiable, so it can be trained directly with contrastive learning. A batch holds bb (question, correct page) pairs, and the positive score is sk+=LI(qk,dk)s_k^+ = \mathrm{LI}(q_k, d_k). The negatives aren't all averaged; only the highest-scoring wrong page in the batch is used:

sk−=max⁡l≠kLI(qk,dl)L=1b∑k=1blog⁡(1+e sk−−sk+)\begin{aligned} s_k^- &= \max_{l \ne k} \mathrm{LI}(q_k, d_l) \\ \mathcal{L} &= \frac{1}{b} \sum_{k=1}^{b} \log\left(1 + e^{\,s_k^- - s_k^+}\right) \end{aligned}

The correct page's score has to beat the hardest wrong page, and the bigger the margin, the smaller the loss.

The training data has 118,695 question-page pairs:

  • 72,788 pairs (about 61%) from the training sets of DocVQA, InfoVQA, TAT-DQA, and arXivQA.
  • 45,940 pairs (about 39%) from PDF pages the authors crawled from 3,885 domains, with questions written by Claude-3 Sonnet.

All of it is in English, deliberately: the authors wanted to see whether the model could handle French zero-shot. They also checked that no PDF appears in both the training set and ViDoRe.

Training runs for just 1 epoch. LoRA (r=α=32r = \alpha = 32) is applied only to the language model's transformer layers, while the final projection layer is trained from scratch; 8 GPUs, total batch size 32.

Discussion

Three Steps, Taken Apart

ColPali didn't get there in one step. Starting from SigLIP, the authors changed one thing at a time, and average nDCG@5 moved like this:

  1. BiSigLIP: fine-tune SigLIP's text side on this document retrieval data, 51.4 → 58.6. The specialized training data alone is worth 7 points, and the paper-figures task (ArxivQA) jumps by 15.3.
  2. BiPali: switch to PaliGemma, with image patches passed through the language model and averaged into one vector, 58.6 → 58.8. English tasks even dip slightly, while French ones soar: Shift from 26.5 to 43.7, TabFQuAD from 62.7 to 76.9. The training data contains no French at all; the authors credit Gemma's own multilingual ability.
  3. ColPali: the same model, now keeping one vector per token for late interaction, 58.8 → 81.3.

The biggest jump is the third step. As long as the whole page is still squeezed into one vector, a stronger model adds only 0.2 points; keep multiple vectors, and it gains 22.5 points in one go.

Against the strongest text pipeline (Unstructured + Captioning + BGE-M3, 67.0), ColPali is 14.3 points higher. Task by task (nDCG@5, compiled from Table 2 of the paper):

TaskBest text pipelineColPali
ArxivQA (paper figures)35.779.1
DocVQA32.954.4
InfoVQA71.981.8
TabFQuAD (French tables)69.183.9
TAT-DQA (financial reports)43.865.8
Shift (French)73.173.2
AI88.896.2
Energy83.391.0
Government80.492.7
Healthcare91.394.4

ArxivQA, heavy on figures, shows the largest gap, 43 points. Even on the text-heavy practical tasks, ColPali is higher on every one; only on Shift, the most text-dense, are the two nearly tied.

The authors also record a failed attempt. Using SigLIP directly for late interaction (ColSigLIP) averages just 2.5. SigLIP's pretraining computes its loss only on a single pooled vector, so the vectors of individual patches were never required to mean anything. This also shows that ColPali's multiple vectors work because PaliGemma sends every patch through the language model.

Speed: Fast Offline

Original Figure 2: three horizontal bars showing offline indexing time per page. PDF Parser takes 7.22 seconds in all, made up of layout detection (about 0.8 seconds), OCR (about 2.7 seconds), and captioning (about 3.7 seconds); SigLIP takes 0.12 seconds; ColPali takes 0.39 seconds, all of it page encoding.
Original Figure 2, Faysse et al., from PDF page 5, CC0 1.0.

On a single NVIDIA L4, the text pipeline takes 7.22 seconds per page: 0.81 seconds of layout detection, 2.67 of OCR, and 3.71 of captioning, with the actual embedding taking only 0.03 seconds. ColPali takes 0.39 seconds per page, all of it spent in the model's forward pass. For 10,000 pages, the former takes about 20 hours and the latter about 1 hour.

Online queries, on the other hand, are slightly slower with ColPali. BGE-M3 encodes a 15-token question in about 22 ms, ColPali's language model in about 30 ms; late interaction itself adds about 1 ms per 1,000 pages. Once the corpus reaches a million pages, you need a dedicated multi-vector retrieval engine such as PLAID.

The Price: Big Storage

The price of speed is storage. With 1030 vectors per page, 128 dimensions each, stored in float16, that comes to:

1030×128×2 bytes=263,680 bytes≈257.5 KB\begin{aligned} & 1030 \times 128 \times 2\ \text{bytes} \\ &= 263{,}680\ \text{bytes} \approx 257.5\ \text{KB} \end{aligned}

The same page takes only 8.6 KB with BGE-M3 and about 1.6 KB as a BM25 sparse vector. ColPali is 30 times BGE-M3; a million pages come to about 264 GB.

The authors suggest two ways to compress. One is binarization, storing only the sign of each dimension, which cuts storage 16-fold; an engineer at Vespa tested it on GitHub, and DocVQA nDCG@5 fell from 54.4 at full precision to 52.4. The other is token pooling, merging similar patch vectors:

Original Figure 3 (left half): the horizontal axis is the pool factor from 1 to 7, and the vertical axis is nDCG@5 as a percentage of the unpooled score. Most datasets' curves stay between 96% and 100%, and the black dashed average declines gently from 100% to about 96%; the blue line for Shift drops to about 96% at factor 3 and about 86% at factor 5.
Original Figure 3 (left half), Faysse et al., from PDF page 9, CC0 1.0.

A pool factor of 3 means every 3 vectors are merged into 1, cutting the vector count by 66.7% while keeping 97.8% of nDCG@5 on average. Many patches are blank page background, and merging them away costs little. The exception is Shift, the most text-dense dataset: with little blank space and text in every patch, the more you merge, the faster it drops.

Ablations

Each of several ablations answers one question (average nDCG@5, compiled from Table 7 in the paper's appendix):

  1. Resolution: lowering the input from 448 to 224 sharply cuts the number of patches, and the average drops by 24.8 points. Text in documents is small; resolution is not the place to save.
  2. A larger language model: Idefics2-8B, which compresses the image into 64 tokens with a perceiver and pairs it with Mistral-7B, averages 76.6. That's 20.1 above the 224 version but still 4.7 below ColPali with its 1024 patches, and training and inference are about twice as slow.
  3. A better VLM: training Qwen2-VL 2B with the same data and method, capped at 768 patches, gives ColQwen2, averaging 86.6, another 5.3 above ColPali.
  4. Query augmentation tokens: removing the 5 <unused0> tokens leaves English tasks about the same, but French Shift drops 9.8 and TabFQuAD 6.5.
  5. Hardest negative only: switching to the ordinary in-batch contrastive loss lowers the average by 1.6.
  6. Unfreezing the image encoder: training SigLIP as well actually loses 0.7.
  7. Different training data: training only on DocMatix synthetic data, entirely unrelated to ViDoRe, loses just 2.2 and still beats the best baseline by more than 12 points.
  8. A little domain data: adding 1,552 French table QA examples raises TabFQuAD by 2.6 points and Recall@1 by 5, with no other task getting worse.

The last two matter most for engineering. ColPali is trained end to end, so to strengthen it on a certain kind of document, you just add data and retrain; to improve tables in a text pipeline, you have to change one of the OCR, chunking, or captioning stages.

Two Pitfalls on GitHub

Right after the model was released, quite a few people reported in issue #17 that the ColPali they set up themselves gave results that looked random, while the official Hugging Face demo worked fine. After nearly three weeks of digging, there turned out to be two causes. The projection layer was randomly initialized, and since only the LoRA adapter had been released, it came out different on every load; the adapter's dropout also wasn't turned off. The authors re-released a fixed base model and a v1.1 adapter, with a reminder to call model.eval() again after loading the adapter.

The other is issue #124. Someone reproducing BiPali got an average of only 34, against the paper's 58.8. The authors helped dig for a week and finally found that the user had launched with torchrun, so each GPU saw only its own 4 samples; the authors launched with python, giving a batch of 32 pooled across 8 GPUs. This loss picks the hardest negative from the batch, so going from 32 to 4 means far fewer negatives, and the result was off by nearly 25 points.

The authors responded quickly to both, and both make sense in hindsight. But if you're putting ColPali to use, you need to get both right from the start.

Conclusion

ColPali removes document retrieval's entire preprocessing stage, letting a vision-language model look at the page directly, keeping one vector per patch, and matching with ColBERT's late interaction. On ViDoRe it beats the strongest text pipeline by 14.3 points and cuts offline indexing from 7.22 to 0.39 seconds per page; the ablations also show that what really makes the score jump is multiple vectors, not a bigger model.

The costs are spelled out clearly. At 257.5 KB per page, it's 30 times a text embedding; halve the resolution and the score collapses; and online queries are a bit slower than with text embeddings. Binarization, token pooling, and dedicated multi-vector engines can all ease these, but they won't go away on their own.

So the next time someone proposes converting the PDFs to plain text first and throwing it into a vector database, flip through those documents first. If the pages are full of tables and charts, the problem may not be the embedding but the preprocessing that throws the images away.