Views
No views yet
pooling="colbert" or pooling="hierarchical_clustering". Weights are initialized from Qwen2.5-VL-3B-Instruct, finetuned on MSR-VTT for text-to-video retrieval with bidirectional attention.
| Method | Tokens | R@1 | R@10 | nDCG@10 |
|---|---|---|---|---|
| OmniEmbed-7B | 1 | 51.5 | 83.2 | 67.1 |
| Video-ColBERT | 26 | 51.5 | 85.5 | 67.7 |
| Baseline (Ours, uncompressed) | 1318 | 55.7 | 88.3 | 71.9 |
| SeqResize | 32 | 53.3 | 86.9 | 69.9 |
| MemTok | 32 | 54.2 | 86.4 | 69.9 |
| H-Pool (this checkpoint) | 32 | 54.1 | 87.3 | 70.4 |
| AGC | 32 | 56.9 | 87.0 | 71.5 |
| 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: 32 vectors per document |
| Scoring | ColBERT-style MaxSim (late interaction) |
| Normalization | L2-normalized embeddings |
| Query prefix | "Query: " |
| Passage prefix | "Passage: " |
| Precision | bfloat16 |
| Training video frames | 24 |
pooling="colbert", or H-Pool with pooling="hierarchical_clustering" and num_repr_vectors=32. 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_msrvtt"
10VIDEO_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 (32 vectors):
15model_args = ModelArguments(
16 model_name_or_path=MODEL_ID,
17 pooling="hierarchical_clustering",
18 normalize=True,
19 num_repr_vectors=32,
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 a video document ---
33passage_messages = [
34 {
35 "role": "user",
36 "content": [
37 {"type": "text", "text": "Passage: "},
38 {"type": "video", "video": VIDEO_PATH, "nframes": 24, "max_pixels": 84672, "min_pixels": 75264},
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, 32, 2048)
53
54# --- Encode a text query ---
55query_messages = [{"role": "user", "content": [{"type": "text", "text": "Query: a person is cooking"}]}]
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
63# --- ColBERT MaxSim scoring ---
64score = model.compute_similarity(query_embeddings, doc_embeddings, query_mask, doc_mask)
65print(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}