Views
No views yet
pooling="colbert" or pooling="hierarchical_clustering". Weights are initialized from Qwen2.5-VL-3B-Instruct, finetuned on the ColPali train set for text-to-visual-document retrieval with bidirectional attention.
| Method | Tokens | nDCG@5 (Avg) | Bio | Econ | ESG-R | ESG-H |
|---|---|---|---|---|---|---|
| ColPali | – | 53.3 | 56.5 | 49.9 | 55.7 | 51.1 |
| ColQwenOmni | – | 56.5 | 56.5 | 53.2 | 54.2 | 62.2 |
| MetaEmbed | 64 | 58.8 | 58.7 | 55.5 | 57.4 | 63.7 |
| Baseline (Ours, uncompressed) | 1297 | 60.0 | 61.4 | 53.9 | 57.0 | 67.6 |
| SeqResize | 64 | 51.7 | 54.7 | 53.5 | 45.2 | 53.5 |
| MemTok | 64 | 54.3 | 56.8 | 53.0 | 46.4 | 61.4 |
| H-Pool (this checkpoint) | 64 | 56.4 | 59.6 | 52.1 | 53.4 | 60.6 |
| AGC | 64 | 56.7 | 59.0 | 54.5 | 55.8 | 57.3 |
| Initial weights | Qwen2.5-VL-3B-Instruct |
| Architecture | Qwen2.5-VL with bidirectional attention |
| Hidden dimension | 2048 |
| Pooling | colbert (full) or hierarchical_clustering (H-Pool) |
| Budget | H-Pool: 64 vectors per document |
| Scoring | ColBERT-style MaxSim (late interaction) |
| Normalization | L2-normalized embeddings |
| Query prefix | "Query: " |
| Passage prefix | "Passage: " |
| Precision | bfloat16 |
| Max image tokens | 1280 |
pooling="colbert", or H-Pool with pooling="hierarchical_clustering" and num_repr_vectors=64. Same checkpoint; only the pooling argument changes.1import torch
2from transformers import AutoProcessor
3from qwen_vl_utils import process_vision_info
4
5from src.arguments import ModelArguments
6from src.encoder.multivec_encoder import MultiVecEncoder
7from src.models.qwen2_5_vl_embed.qwen2_5_vl_embed import Qwen2_5ForEmbedding
8
9MODEL_ID = "hltcoe/ColBERT_qwen2.5-vl_colpali"
10IMAGE_PATH = "PLACEHOLDER"
11
12# Full (uncompressed) ColBERT:
13# model_args = ModelArguments(model_name_or_path=MODEL_ID, pooling="colbert", normalize=True, attn_implementation="flash_attention_2")
14# H-Pool (64 vectors):
15model_args = ModelArguments(
16 model_name_or_path=MODEL_ID,
17 pooling="hierarchical_clustering",
18 normalize=True,
19 num_repr_vectors=64,
20 attn_implementation="flash_attention_2",
21)
22
23processor = AutoProcessor.from_pretrained(MODEL_ID)
24model = MultiVecEncoder.load(
25 Qwen2_5ForEmbedding,
26 model_args,
27 attn_implementation=model_args.attn_implementation,
28 dtype=torch.bfloat16,
29)
30model = model.to("cuda").eval()
31
32# --- Encode an image document ---
33passage_messages = [
34 {
35 "role": "user",
36 "content": [
37 {"type": "text", "text": "Passage: "},
38 {"type": "image", "image": IMAGE_PATH, "max_pixels": 1003520, "min_pixels": 614656},
39 ],
40 }
41]
42text = processor.apply_chat_template(passage_messages, tokenize=False, add_generation_prompt=False)
43image_inputs, video_inputs = process_vision_info(passage_messages)
44passage_inputs = processor(
45 text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt",
46).to("cuda")
47
48with torch.amp.autocast(device_type="cuda", dtype=torch.bfloat16):
49 with torch.inference_mode():
50 doc_embeddings, doc_mask = model.encode(passage_inputs, is_query=False)
51 print(doc_embeddings.shape)
52 # colbert: (1, seq_len, 2048); hierarchical_clustering: (1, 64, 2048)
53
54# --- Encode a text query ---
55query_messages = [{"role": "user", "content": [{"type": "text", "text": "Query: What types of tissues are unable to regenerate spontaneously?"}]}]
56query_text = processor.apply_chat_template(query_messages, tokenize=False, add_generation_prompt=False)
57query_inputs = processor(text=[query_text], padding=True, return_tensors="pt").to("cuda")
58
59with torch.amp.autocast(device_type="cuda", dtype=torch.bfloat16):
60 with torch.inference_mode():
61 query_embeddings, query_mask = model.encode(query_inputs, is_query=True)
62 print(query_embeddings.shape)
63
64# --- ColBERT MaxSim scoring ---
65score = model.compute_similarity(query_embeddings, doc_embeddings, query_mask, doc_mask)
66print(f"Similarity score: {score.item():.4f}")1@misc{qin2026multivectorindexcompressionmodality,
2 title={Multi-Vector Index Compression in Any Modality},
3 author={Hanxiang Qin and Alexander Martin and Rohan Jha and Chunsheng Zuo and Reno Kriz and Benjamin Van Durme},
4 year={2026},
5 eprint={2602.21202},
6 archivePrefix={arXiv},
7 primaryClass={cs.IR},
8 url={https://arxiv.org/abs/2602.21202},
9}