The code used to train and run inference with the ColVision models, e.g. ColPali, ColQwen2, and ColSmol.
The code used to train and run inference with the ColVision models, e.g. ColPali, ColQwen2, and ColSmol.
[Model card] [ViDoRe Leaderboard] [Demo] [Blog Post]
This repository contains the code used for training and running visual document retrievers introduced by the ColPali: Efficient Document Retrieval with Vision Language Models paper. It includes the original ColPali model, based on the ColBERT architecture and the PaliGemma model, along with later ColVision and bi-encoder retriever variants.
With ColPali, we propose to leverage VLMs to construct efficient multi-vector embeddings in the visual space for document retrieval. By feeding the ViT output patches from PaliGemma-3B to a linear projection, we create a multi-vector representation of documents. We train the model to maximize the similarity between these document embeddings and the query embeddings, following the ColBERT method.
Using ColPali removes the need for potentially complex and brittle layout recognition and OCR pipelines with a single model that can take into account both the textual and visual content (layout, charts, ...) of a document.
[!IMPORTANT]
colpali-engineis now deprecated. The repository and package remain available for research, reproducibility, and existing projects, but we recommend Sentence Transformers for new projects and production use.
Sentence Transformers v6 introduces first-class support for ColPali-style models through MultiVectorEncoder. It provides one ecosystem for embedding and retrieval models—including dense bi-encoders and multi-vector late-interaction models—across text, images, audio, and video, depending on the model.
The Sentence Transformers integration was developed with help from the ColPali and ViDoRe teams in bringing the model configurations to the Hugging Face Hub. See the v6 release, the multi-vector documentation, and the dedicated migration guide from colpali-engine.
Install Sentence Transformers with image support:
pip install -U "sentence-transformers[image]>=6.0.0"ColPali-family models now use the same concise API as other late-interaction models:
from sentence_transformers import MultiVectorEncoder
# You can also use models such as "vidore/colqwen2-v1.0" or "vidore/colpali-v1.3".
model = MultiVectorEncoder("vidore/colqwen2.5-v0.2")
queries = [
"What is the variable represented on the y-axis of the graph?",
"Which year has the highest total outlay?",
]
images = ["page_1.png", "page_2.png"] # Paths, URLs, or PIL images
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(images)
scores = model.similarity(query_embeddings, document_embeddings)colpali-engineSentence Transformers automatically recognizes Transformers-native *ForRetrieval checkpoints, including the -hf variants of the Vidore models. For example, vidore/colqwen2-v1.0-hf keeps its projection and normalization inside the model while its processor formats text queries and image documents.
The main API equivalents are:
colpali-engine |
Sentence Transformers v6 |
|---|---|
ColQwen2.from_pretrained(...) and ColQwen2Processor |
MultiVectorEncoder("vidore/colqwen2-v1.0") |
processor.process_queries(...) followed by model(**batch) |
model.encode_query(queries) |
processor.process_images(...) followed by model(**batch) |
model.encode_document(images) |
processor.score_multi_vector(query_embeddings, document_embeddings) |
model.similarity(query_embeddings, document_embeddings) |
mask_non_image_embeddings=True |
MultiVectorMask(keep_only_token_ids=[processor.tokenizer.convert_tokens_to_ids(processor.image_token)]) |
HierarchicalTokenPooler |
HierarchicalTokenPooling |
colpali_engine.interpretability |
sentence_transformers.multi_vector_encoder.interpretability |
In short, most inference migrations reduce to:
from sentence_transformers import MultiVectorEncoder
model = MultiVectorEncoder("vidore/colqwen2-v1.0")
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(images)
scores = model.similarity(query_embeddings, document_embeddings)For exact-parity notes, training guidance, and advanced configuration, refer to the full Sentence Transformers migration guide.
A huge thank you to every user, contributor, and researcher who supported the ColPali project, shared feedback, built integrations, trained models, and believed in visual document retrieval alongside us. We are deeply grateful to everyone who joined us on this journey, which is far from over and continues over at SentenceTransformers.
The original project documentation is preserved below for research and reproducibility.
| Model | Score on ViDoRe | License | Comments | Currently supported |
|---|---|---|---|---|
| vidore/colpali | 81.3 | Gemma | • Based on google/paligemma-3b-mix-448.• Checkpoint used in the ColPali paper. |
❌ |
| vidore/colpali-v1.1 | 81.5 | Gemma | • Based on google/paligemma-3b-mix-448.• Fix right padding for queries. |
✅ |
| vidore/colpali-v1.2 | 83.9 | Gemma | • Similar to vidore/colpali-v1.1. |
✅ |
| vidore/colpali-v1.3 | 84.8 | Gemma | • Similar to vidore/colpali-v1.2.• Trained with a larger effective batch size of 256 batch size for 3 epochs. |
✅ |
| vidore/colqwen2-v0.1 | 87.3 | Apache 2.0 | • Based on Qwen/Qwen2-VL-2B-Instruct.• Supports dynamic resolution. • Trained using 768 image patches per page and an effective batch size of 32. |
✅ |
| vidore/colqwen2-v1.0 | 89.3 | Apache 2.0 | • Similar to vidore/colqwen2-v0.1, but trained with more powerful GPUs and with a larger effective batch size (256). |
✅ |
| vidore/colqwen2.5-v0.1 | 88.8 | Apache 2.0 | • Based on Qwen/Qwen2.5-VL-3B-Instruct• Supports dynamic resolution. • Trained using 768 image patches per page and an effective batch size of 32. |
✅ |
| vidore/colqwen2.5-v0.2 | 89.4 | Apache 2.0 | • Similar to vidore/colqwen2.5-v0.1, but trained with slightly different hyper parameters |
✅ |
| TomoroAI/tomoro-colqwen3-embed-4b | 90.6 | Apache 2.0 | • Based on the Qwen3-VL backbone. • 320-dim ColBERT-style embeddings with dynamic resolution. • Trained for multi-vector document retrieval. |
✅ |
| athrael-soju/colqwen3.5-4.5B-v3 | 90.9 | Apache 2.0 | • Based on Qwen/Qwen3.5-4B (hybrid GatedDeltaNet + full-attention).• 320-dim ColBERT-style embeddings. • 4.5B params, LoRA-trained. |
✅ |
| vidore/colSmol-256M | 80.1 | Apache 2.0 | • Based on HuggingFaceTB/SmolVLM-256M-Instruct. |
✅ |
| vidore/colSmol-500M | 82.3 | Apache 2.0 | • Based on HuggingFaceTB/SmolVLM-500M-Instruct. |
✅ |
| Cognitive-Lab/ColNetraEmbed | 86.4 | Gemma | • Based on google/gemma-3-4b-it.• Multi-vector late interaction retrieval model. • Multilingual support across 22 languages. |
✅ |
| Cognitive-Lab/NetraEmbed | 81.0 | Gemma | • Based on google/gemma-3-4b-it.• Bi-encoder retrieval model. • Supports Matryoshka embeddings (768, 1536, 2560). • Multilingual support across 22 languages. |
✅ |
The codebase is compatible with Python >=3.10,<3.15 and recent PyTorch versions. To install the package, run:
pip install colpali-engine # from PyPI
pip install git+https://github.com/illuin-tech/colpali # from sourceMac users using MPS with the ColQwen models have reported errors with torch 2.6.0. These errors are fixed by downgrading to torch 2.5.1.
[!WARNING] For ColPali versions above v1.0, make sure to install the
colpali-enginepackage from source or with a version above v0.2.0.
The optional [lik] extra installs late-interaction-kernels, a fused Triton MaxSim kernel used automatically on CUDA Ampere+ / Apple Silicon for scoring and the ColBERT losses. It avoids materializing the [B, B, Lq, Ld] score tens
No open issues yet, or sync has not completed.