Sam Babichenko

Reading notes / Vector search

Late interaction retrieval

Khattab and Zaharia, 2020; Santhanam et al., 2022

Scoring
q,q, dda query, a passage
qiq_iquery token vectors, i=1,…,∣q∣i=1,\dots,|q|; ∣q∣=32|q|=32 with [MASK] padding
djd_jpassage token vectors, j=1,…,∣d∣j=1,\dots,|d|, punctuation dropped
DDdimension of the token vectors, 128
S(q,d)S(q,d)MaxSim score ∑imax⁡jqi⊤dj\sum_i\max_jq_i^\top d_j
Compression and pruning
C\mathcal Ck-means centroids of the token vectors
dˉj\bar d_jcentroid nearest to djd_j
rj,r_j, r~j\tilde r_jresidual dj−dˉjd_j-\bar d_j, and its bb-bit quantization
bbbits per residual coordinate, 1 or 2
S~(q,d)\tilde S(q,d)centroid-only score ∑imax⁡jqi⊤dˉj\sum_i\max_jq_i^\top\bar d_j
tcs,t_{\rm cs}, nprobe,n_{\rm probe}, ndocsn_{\rm docs}the engine's pruning threshold, centroids probed per query vector, passages kept after pruning
The papers write
Eq,E_q, EdE_dColBERT's bags of query and passage vectors; it writes Sq,dS_{q,d} for S(q,d)S(q,d)
Qi,Q_i, Dj,D_j, N,N, MMColBERTv2's qi, dj, ∣q∣, ∣d∣q_i,\ d_j,\ |q|,\ |d|
Ct,C_t, vvColBERTv2's nearest centroid dˉj\bar d_j and vector djd_j
SD~S_{\tilde D}the engine paper's S~(q,d)\tilde S(q,d)
k,k, n,n, γ\gammain Weller et al.'s bound: the size of a top-kk set, the number of passages, and half the score margin; they write dd for DD

Context. A search system has to pull a few relevant passages out of millions. In 2020 the most accurate neural rankers were rankers that feed the query and one passage through a transformer together, as one input, and read a relevance score off the output; every query-passage pair needs its own forward pass. A BERT cross-encoder reads a query and one passage together and outputs a relevance score, so every query-passage pair needs a fresh forward pass. On a passage-ranking benchmark of about 8.8 million web passages and real Bing queries, most of them with one passage labeled relevant (Nguyen et al., 2016), re-ranking the 1,000 passages returned by the classical ranking function: a passage scores by the query words it contains, each weighted by how rare the word is in the collection, with diminishing credit for repeats (Robertson et al., 1995) took a BERT-base cross-encoder about 11 seconds on a V100 GPU. A also called a dense retriever or bi-encoder: one vector per passage, computed offline, and one per query; the score is their dot product, so search is a nearest-neighbor lookup encodes each passage once offline into one vector and scores it by a dot product with the query vector. Scoring is cheap, but it packs the entire passage into a single vector before the query is known.

Khattab and Zaharia (2020) keep offline precomputation while matching queries against passages token by token. Their model, ColBERT, encodes the query and the passage separately and keeps one vector per token on each side. To score a passage, ColBERT lets each query vector pick its closest passage vector and sums those maxima. Every passage vector is computed offline, so query time pays only for encoding the query plus dot products and maxima. Keeping one vector per passage token shifts the bottleneck to index size. ColBERTv2 (Santhanam et al., 2022a) shrinks that index six- to tenfold with almost no quality loss. It stores each vector as its nearest cluster centroid id plus a residual quantized to 1 or 2 bits per coordinate, and trains with cross-encoder distillation. A companion search engine (Santhanam et al., 2022b) then cuts query latency by scoring candidates from centroid ids alone and decompressing residuals only for the top survivors.

Late interaction and MaxSim. Let qq be a query and dd a passage. A shared a bidirectional transformer encoder pretrained by predicting masked words (Devlin et al., 2019); BERT-base has 12 layers and about 110 million parameters encoder takes a query or passage marker token and emits one vector per token. A linear layer projects each vector to dimension the dimension of the token vectors, D=128D=128 in ColBERT and ColBERTv2 (128) and normalizes it to unit length, so dot products equal cosine similarities. Write the query's token vectors, unit length in RD\mathbb R^D; ∣q∣=32|q|=32, real tokens plus [MASK] padding for the query vectors and the passage's token vectors, unit length in RD\mathbb R^D, one per non-punctuation token for the passage vectors. ColBERT drops punctuation from passages. It pads queries with BERT's [MASK] token to ∣q∣=32|q|=32 positions and keeps those extra outputs, a step the authors call padding the query with [MASK] tokens to a fixed length and keeping their output vectors, meant as a learned, soft expansion and reweighting of the query's terms. The for each query vector, the largest dot product with any passage vector; ColBERT's score is the sum of these maxima over the query vectors score sums each query vector's best match over the passage:S(q,d)=∑i=1∣q∣max⁡1≤j≤∣d∣qi⊤dj.S(q,d)=\sum_{i=1}^{|q|}\max_{1\le j\le|d|}q_i^\top d_j.ColBERT trains on MS MARCO triples of a query, a labeled relevant passage, and a BM25 negative, using pairwise softmax cross-entropy. Quality is measured mainly by mean reciprocal rank at 10: the average over queries of 1/(rank of the first relevant passage), counted as 0 when none is in the top 10; reported as a percentage on the MS MARCO development set.

Laid out as a grid with one row per query vector and one column per passage vector, MaxSim is the sum of the row maxima. Both sides come from a contextual encoder, so dot products track words in context instead of raw string overlap. Scoring the query "when did the titanic sink" with the released ColBERTv2 checkpoint (computed here) shows the contrast. One passage reads, "The ocean liner went down in the North Atlantic on 15 April 1912, a few hours after it struck an iceberg." On it, the query's "when" matches the "on" before the date at 0.93, and "sink" matches "down" at 0.61. A second passage reads, "The Titanic museum in Belfast explains when the ship was built and why so many people still visit the city." There the same word "when" reaches only 0.13, and "sink" reaches only 0.26. The first passage shares only "the" with the query yet scores 22.6. The second shares "titanic", "when", and "the" yet scores 14.0. The 24 [MASK] rows supply 16.2 of the first passage's score, seven of them by matching "down".

Query-time cost and full-collection retrieval. Scoring one passage takes ∣q∣ ∣d∣|q|\,|d| dot products of length DD. MS MARCO averages about 68 vectors per passage (from the engine paper's index statistics), giving (computed here)FLOPs per passage=2 ∣q∣ ∣d∣ D≈2⋅32⋅68⋅128≈5.6×105.\begin{aligned}\text{FLOPs per passage}&=2\,|q|\,|d|\,D\\&\approx2\cdot32\cdot68\cdot128\\&\approx5.6\times10^{5}.\end{aligned}A BERT-base cross-encoder spends about 9.7×10109.7\times10^{10} FLOPs on a single query-passage pair, based on ColBERT's count of 97 trillion FLOPs to re-rank 1,000 passages. ColBERT needs 7 billion FLOPs in total for those 1,000 passages. MaxSim takes only 0.56 billion of that total, while the single query encoding over 32 tokens makes up most of the cost. Because ColBERT encodes the query once regardless of candidate count, its FLOPs advantage over BERT widens from about 180 times at 10 passages to 13,900 times at 1,000. The sum-of-maxima form also supports end-to-end retrieval over the full collection. Each query vector fetches its nearest passage vectors from an approximate ColBERT uses faiss, a library for approximate nearest-neighbor search (Johnson et al., 2017), with vectors grouped into 2,000 k-means cells, 10 cells searched per query vector, and each vector compressed to 16 bytes, and ColBERT scores only the passages owning those vectors with S(q,d)S(q,d).

ColBERT results and ablations. On BM25's top 1,000 MS MARCO passages, BERT-base ColBERT reaches 34.9 MRR@10 on the development set, against 36.0 for a BERT-base cross-encoder trained by the authors with the same loss. Latency on one V100 GPU drops from 10,700 ms per query to 61 ms. ColBERT's 61 ms covers the full query (gathering stored vectors, GPU transfer, query encoding, and scoring), while the cross-encoder's figure counts only GPU scoring. Using squared Euclidean distance instead of the dot product, ColBERT reaches 36.0 MRR@10 in end-to-end search over all 8.8 million passages, against 34.8 for the same model re-ranking BM25's top 1,000. The end-to-end run draws its candidates from the nearest-neighbor index. Its the fraction of a query's labeled relevant passages that appear in the top 50, averaged over queries of 82.9% beats the official BM25 ranking's 81.4% recall@1000. In a 5-layer ablation trained for 200,000 steps (numbers read off the paper's bar chart), ColBERT scores about 32 MRR@10. Replacing the per-token maximum with an average drops it to about 26, matching a 4,096-dimensional [CLS] single-vector model, because weak token matches dilute strong ones. Dropping [MASK] query augmentation in the same ablation costs about 2 points.

ColBERTv2: shrinking the index with residual compression. Late interaction's main cost is storage. At 128 coordinates in 16 bits (256 bytes per vector), ColBERT's MS MARCO index takes 154 GiB. ColBERTv2 runs k-means on a sample of passage vectors to learn centroids the cluster centroids, found by k-means [[emeans]] on the vectors of a sample of passages; their number grows with the square root of the number of vectors in the collection. It then stores each djd_j as its nearest centroid the centroid in C\mathcal C nearest to djd_j, stored as a 4-byte id plus a quantized residual the residual rj=dj−dˉjr_j=d_j-\bar d_j with each coordinate replaced by one of 2b2^b fixed values, stored as a bb-bit index at bits per coordinate of the residual, 1 or 2; ColBERTv2's experiments use b=2b=2 unless stated bits per coordinate:rj=dj−dˉj,dj≈dˉj+r~j,bytes per vector=4+bD/8.\begin{aligned}r_j&=d_j-\bar d_j,\\d_j&\approx\bar d_j+\tilde r_j,\\\text{bytes per vector}&=4+bD/8.\end{aligned}Storage drops from 256 bytes per vector to 20 bytes at b=1b=1 and 36 bytes at b=2b=2. The MS MARCO index shrinks to 16 GiB and 25 GiB respectively, including 4.5 GiB for the centroid-to-vector lists. At 25 GiB it roughly matches a single-vector index of one 768-dimensional 32-bit vector per passage. Coarse residuals work because contextual vectors cluster tightly by token and sense. When ColBERT's nearly 600 million MS MARCO vectors are clustered into 2182^{18} centroids, 90% of clusters hold at most 16 distinct tokens, compared with under 50% for random vectors with the same token counts. That leaves the residual to encode only small contextual shifts. On a ColBERT model scoring 36.2 MRR@10 on MS MARCO, 2-bit residuals preserve 36.2 and 1-bit residuals reach 35.5, beating 34.8 for an earlier centroid-free 1-bit binarization.

ColBERTv2: denoised supervision raises quality in and out of domain. MS MARCO labels only one or a few relevant passages per query, so BM25 negatives can pull in unlabeled relevant passages. ColBERTv2 instead retrieves top passages with a triple-trained ColBERT model and scores them with a 22-million-parameter the public ms-marco-MiniLM-L-6-v2 checkpoint: a 6-layer MiniLM, a transformer compressed from a larger one by distillation (Wang et al., 2020), trained as an MS MARCO re-ranker with distillation, as the ColBERTv2 paper states. Each training example pairs a query with 64 passages, one highly ranked or labeled positive and the rest lower-ranked. Training combines a KL-divergence loss matching the cross-encoder's softmax distribution with cross-entropy over the passages of the other queries in the same batch on the same GPU, used as extra negatives for each query. KL divergence avoids forcing a bounded sum of cosines onto the cross-encoder's raw score scale. A second pass of retrieval and scoring refreshes the negatives with the new model. With this supervision and 2-bit residuals, ColBERTv2 reaches 39.7 MRR@10 on the MS MARCO development set, ahead of ColBERT at 36.0 and a single-vector retriever trained jointly with a cross-encoder by listwise distillation (Ren et al., 2021); it also reads passage titles at 38.8, the strongest single-vector model in the table. Out of domain, ColBERTv2 scores highest on 22 of 28 tests across a suite of retrieval datasets from other domains used without training on them, scored by nDCG@10 (Thakur et al., 2021), Wikipedia open-domain QA, and LoTTE. LoTTE tests StackExchange answers on long-tail topics with natural search and forum queries.

The centroid engine scores candidates before decompressing residuals. In ColBERTv2's original search, most query time on MS MARCO goes to gathering compressed vectors for 10,000 to 40,000 candidate passages and decompressing their residuals. Santhanam et al. (2022b) filter candidates with centroids first. Dropping the residual givesqi⊤dj≈qi⊤dˉj+qi⊤r~j≈qi⊤dˉj,\begin{aligned}q_i^\top d_j&\approx q_i^\top\bar d_j+q_i^\top\tilde r_j\\&\approx q_i^\top\bar d_j,\end{aligned}so every needed similarity sits inside one ∣q∣×∣C∣|q|\times|\mathcal C| query-by-centroid matrix computed once per query. A passage's MaxSim with every passage vector replaced by its nearest centroid, S~(q,d)=∑imax⁡jqi⊤dˉj\tilde S(q,d)=\sum_i\max_jq_i^\top\bar d_j; each term is a lookup in the query-by-centroid score matrix score,S~(q,d)=∑i=1∣q∣max⁡1≤j≤∣d∣qi⊤dˉj,\tilde S(q,d)=\sum_{i=1}^{|q|}\max_{1\le j\le|d|}q_i^\top\bar d_j,then reduces to lookups by centroid id, with no residual reads. Only a small tail of centroids scores high for any query. leaving out of S~\tilde S every passage vector whose centroid cc has max⁡iqi⊤c\max_iq_i^\top c below a threshold tcst_{\rm cs} therefore skips every passage vector whose centroid falls below a threshold the centroid-score threshold for pruning: 0.5, 0.45 or 0.4 in the engine's three settings against every query vector. Search runs in four stages. First, the engine gathers passages that hold a vector in the the number of nearest centroids looked up per query vector to collect candidate passages: 1, 2 or 4 in the engine's three settings nearest centroids per query vector. Next, pruned centroid interaction keeps the top the number of passages kept after centroid interaction with pruning: 256, 1,024 or 4,096 in the engine's three settings candidates, and unpruned centroid interaction cuts that set to a quarter. Only those survivors have their residuals decompressed to score with S(q,d)S(q,d).

Engine speed and recall. Under centroid-only scoring on MS MARCO and LoTTE, the top 10k10k passages contain about 98% or more of ColBERTv2's full-search top kk for kk of 10, 100, and 1,000. That floor is read off the paper's figure, while its text says 99+%. On MS MARCO's 8.8 million passages at the most conservative setting (k=1,000k=1{,}000), the engine reaches 39.8 MRR@10 against 39.7 for ColBERTv2's own search. Latency drops from 4,569 ms to 101 ms per query on eight CPU threads (45 times faster), and from 260 ms to 38 ms on a GPU. A cheaper setting of ColBERTv2's own search in the same table also reaches 39.7 MRR@10, at 922 ms on CPU and 53 ms on GPU. Its recall@1000 is lower, 96.6 against 97.5 for the engine. In a 500-query ablation, the two centroid stages deliver an 8.6-times CPU speedup, and custom kernels multiply that by another 4.9 times. Custom kernels without centroid interaction give only 3 times. On the 138 million passages of MS MARCO v2, a query takes 96 ms on a GPU at k=100k=100.

Adoption and follow-up work. Outside the authors' group, late interaction has become standard retrieval infrastructure. Qdrant scores multivectors with a max_sim comparator, Weaviate added multi-vector embeddings in version 1.29, and Vespa has shipped a native ColBERT embedder with MaxSim ranking expressions since February 2024. On the modeling side, Sentence Transformers added a MultiVectorEncoder type in version 6.0 (Hugging Face blog, August 2026), alongside PyLate (Chaffin and Sourty, 2025), which builds on Sentence Transformers. ColPali (Faysse et al., 2025) applies the same MaxSim scoring to image-patch vectors of document pages. Two later papers share authors with the ColBERT line. WARP (Scheerer et al., 2025) serves models trained with a training objective (Lee et al., 2023) that makes a model's retrieved token vectors suffice for scoring, so passages need not be gathered in full; similarities of passage tokens not retrieved are filled in by an estimate, scoring passages from retrieved token vectors alone plus an estimate for the rest. Running a different model single-threaded on CPU, WARP answers a query in 171 ms against 476 ms for ColBERTv2 with the centroid engine. Jacob et al. (2025) challenge the assumption that cross-encoders bound retriever accuracy. When cross-encoders re-rank deeper into a strong dense retriever's results, recall rises and then falls, often below the retriever alone, because cross-encoders give high scores to some unrelated passages.

Why many vectors beat one: a disputed bound. Weller et al. (2026) offer a geometric account of single-vector limits. Suppose unit query and passage vectors in dimension DD can return every kk-subset of nn passages as the top kk with score margin 2γ2\gamma. They prove (nk)≤(1+1/γ)D\binom nk\le(1+1/\gamma)^D. Their a retrieval task of 50,000 short documents listing what a person likes and 1,000 queries of the form "who likes X?", each with two relevant documents, chosen so that the queries cover nearly every pair of 46 documents benchmark is built to demand many distinct top-2 sets. There the best single-vector model in their table, at 4,096 dimensions, reaches 18.9% recall@100, against 54.8% for multi-vector a ColBERT-style late-interaction model on a ModernBERT backbone, trained by Chaffin with PyLate and 93.6% for BM25. In a preprint, Archish S et al. (2026) note that without a margin, 2k+12k+1 dimensions suffice for any fixed query-passage set, a bound Weller et al. also give in an appendix. They argue that domain shift and relevance mismatch explain most of the drop, whereas Weller et al. had found that training on LIMIT's own training split barely helps. In Archish S et al.'s experiments, fine-tuning on LIMIT-style data recovers much of the score, but it costs single-vector Qwen3-Embedding-0.6B 57% of its MS MARCO recall@10, against 5% for GTE-ModernColBERT. The single- and multi-vector heads of jina-embeddings-v4 show the same split. Both groups find multi-vector models ahead while disagreeing on the cause.

Evidence and limits. Within each paper, the core comparisons are controlled. ColBERT is matched against a BERT cross-encoder trained with the same loss, and compressed vectors against uncompressed vectors from the same model. The centroid engine is measured against ColBERTv2's own search on identical indices and hardware. Component ablations and 28 out-of-domain benchmarks back those numbers. The weakest link is the comparison against single-vector models. ColBERT's ablation puts both architectures under the same simple BM25-negative training, yet in ColBERTv2's main table the distilled single-vector RocketQAv2 sits within 0.9 MRR@10 of ColBERTv2. No experiment trains both architectures with the same distillation recipe to separate architecture from supervision. Most baseline scores in ColBERTv2 are copied from prior papers. The engine paper's latencies for BM25 and SPLADEv2 come from another paper on different hardware, shown only for orientation. Every benchmark is in English with MS MARCO training.

Technical notes. The centroid engine's latencies omit query encoding, a BERT-base pass over 32 tokens, whereas ColBERT's 61 ms includes it. The authors argue that quantization or distillation can make query encoding negligible. Candidate generation inspects only passages holding a vector near the probed centroids, so any relevant passage whose matching vectors sit elsewhere is never scored. The centroid-only top-10k10k recall above is measured against ColBERTv2's own search, which shares that limit, rather than against exhaustive scoring.

Terms

Late interaction
Encode query and passage separately, one vector per token; compare them only at the end with a cheap sum of maxima, so the passage side is precomputed.
MaxSim score
S(q,d)=∑imax⁡jqi⊤djS(q,d)=\sum_i\max_jq_i^\top d_j: each query vector takes its best-matching passage vector; the score sums these row maxima.
Cross-encoder
Reads query and passage together; accurate, but one forward pass per pair at query time (10,700 ms to re-rank 1,000 MS MARCO passages).
Single-vector retriever
One vector per passage, dot-product score; cheapest, but the passage is summarized before the query is known.
Query augmentation
Pad the query with [MASK] to 32 positions and keep those vectors; removing it costs about 2 MRR@10 points.
MaxSim cost
2∣q∣∣d∣D≈5.6×1052|q||d|D\approx5.6\times10^5 FLOPs per MS MARCO passage, against about 101110^{11} for a BERT-base cross-encoder pass.
Residual compression
dj≈dˉj+r~jd_j\approx\bar d_j+\tilde r_j: centroid id (4 bytes) plus bb-bit residual per coordinate; 20 or 36 bytes against 256; 154 GiB to 16 or 25 GiB.
Denoised supervision
Hard negatives from ColBERT itself, scored by a 22M-parameter MiniLM cross-encoder; KL loss over 64 passages per query.
Centroid interaction
S~(q,d)=∑imax⁡jqi⊤dˉj\tilde S(q,d)=\sum_i\max_jq_i^\top\bar d_j: MaxSim with centroids, by lookup into one query-by-centroid matrix, no decompression.
Centroid pruning
Skip passage vectors whose centroid scores below tcst_{\rm cs} against every query vector.
Headline
ColBERT re-ranking: MRR@10 34.9 against 36.0 for BERT-base, 61 ms against 10,700 ms; engine: 39.8 at 101 ms on 8 CPU threads against 39.7 at 4,569 ms.

Sources

Connected notes

  • With effects θi\theta_i spread around a common mean, the posterior mean pulls each raw estimate toward that mean, and Lindley's version of James-Stein estimates both the mean and the amount of pulling from the spread of the estimates themselves. It beats the raw estimates in total squared error for every configuration of the θi\theta_i once there are four or more, and in Efron's batting example it cuts the total prediction error to 0.28 of that of the raw batting averages.

  • By the note's rough estimate the difference between two average pass@1 scores, over about 120 problems with 16 samples each, has a standard deviation of at most about 0.016 before any training-seed variation, so gaps of 0.01 to 0.02 between eviction methods are not resolved.

  • A speedrun record must show that its mean validation loss over several runs is at most 3.28 at one-sided p<0.01p\lt0.01, with the token streams fixed, and changes that only touch systems performance are exempt from the test, since they compute the same updates up to rounding.

  • On d8, removing pre-norm gives a loss that is not finite at the default learning rate, but at its own best rate the variant trains to 3.0766, only 0.01 behind removing RoPE, and moves from last to third of the six variants. The instructors note that their own one-rate exploration missed this.

Threads