--- license: other language: - en task_categories: - text-retrieval tags: - colbert - colbertv2 - multi-vector - late-interaction - msmarco - embeddings size_categories: - n>1T --- # MS MARCO v2 — ColBERTv2 fp32 Multi-Vector Embeddings (uncompressed) Per-token multi-vector embeddings for the full **MS MARCO v2 passage** corpus (~138.4M passages) plus the **dev / dev2** queries, produced with the official **ColBERTv2** checkpoint (`colbert-ir/colbertv2.0`). - **Precision:** fp32 (NO residual quantization, NO pooling) - **Dim:** 128 per token - **Corpus token vectors:** ~9.41B (avg ~68 tokens/passage) - **Total corpus size:** ~4.82 TB > These embeddings are uncompressed on purpose (research on multi-vector > indexing). If you only need a usable index, the official ColBERT 2-bit PLAID > index is ~10x smaller. ## Layout ``` corpus/ # passage embeddings (official ColBERT packed layout) .pt # fp32 tensor [sum(doclens_in_chunk), 128] doclens..json # token count per passage in this chunk .metadata.json # {passage_offset, num_passages, num_embeddings} plan.json # global plan (num_chunks=1384, chunk_size=100000, ...) queries/ # query embeddings (official ColBERT query mode) queries_dev.pt # fp32 tensor [3903, 32, 128] (fixed length) queries_dev.qids.json # query ids aligned with dim 0 queries_dev2.pt # fp32 tensor [4281, 32, 128] queries_dev2.qids.json scripts/ # reproduction + loaders encode_msmarco_v2.py # corpus encoder (8-GPU, resumable) encode_queries_v2.py # query encoder verify_embeddings.py # integrity report + passage reconstruction prepare_corpus.py # download/flatten mteb/msmarco-v2 corpus ``` Passage chunks use **packed, variable-length** storage (no padding). Each `.pt` holds all token vectors of up to 100,000 passages concatenated; `doclens..json` lets you slice them back per passage. Global passage index: `global_pid = chunk_id * 100000 + local_idx`. ## Loading ### A passage's multi-vector matrix ```python import torch, json, numpy as np from huggingface_hub import hf_hub_download repo = "yaooooo233/msmarco-v2-colbertv2-fp32" chunk_id, local_idx = 0, 5 pt = hf_hub_download(repo, f"corpus/{chunk_id}.pt", repo_type="dataset") dl = hf_hub_download(repo, f"corpus/doclens.{chunk_id}.json", repo_type="dataset") D = torch.load(pt) # [T, 128] fp32 lens = json.load(open(dl)) off = np.concatenate([[0], np.cumsum(lens)]) P = D[off[local_idx]:off[local_idx+1]] # [tokens, 128] ``` ### Query matrices ```python qpt = hf_hub_download(repo, "queries/queries_dev.pt", repo_type="dataset") qids = hf_hub_download(repo, "queries/queries_dev.qids.json", repo_type="dataset") Q = torch.load(qpt) # [3903, 32, 128] fp32 ids = json.load(open(qids)) # query ids aligned with Q[i] ``` ### ColBERT MaxSim score (query i vs passage P) ```python # Q[i]: [32,128], P: [tokens,128] (both L2-normalized) score = (Q[i] @ P.T).max(dim=1).values.sum().item() ``` ## Reproduction Corpus and queries can be regenerated from `mteb/msmarco-v2` with the scripts in `scripts/` using the official `colbert-ir/colbertv2.0` checkpoint. Full corpus encoding takes ~11h on 4–8× A100. ## Citation Built on MS MARCO (Nguyen et al., 2016), ColBERTv2 (Santhanam et al., 2022), and the MTEB `mteb/msmarco-v2` distribution. Please cite those works.