Between one vector and full attention
A bi-encoder, the Embeddings tab's model, squeezes a whole paragraph into one vector before it has seen the question, so everything the question might ask about has to fit in 384 numbers. A cross-encoder, the Reranker tab's model, reads question and paragraph together and loses nothing, but must run once per pair at query time. Late interaction sits between them: encode question and paragraph separately, as a bi-encoder does, but keep a vector for every token, and let the two sets of vectors interact only at the end with a cheap operation. Paragraph vectors can still be computed once, ahead of time.
ColBERT (Khattab and Zaharia, 2020) introduced the idea; this tab records ColBERTv2, a BERT-base encoder (12 blocks, 109 M parameters) followed by a linear map from 768 to 128 dimensions and normalisation to length 1, on the Embeddings tab's 2,067 SQuAD paragraphs and 300 questions.
A vector per token
The A vector per token panel shows both inputs. A question becomes exactly 32 tokens: [CLS], a [Q] marker, the question's word pieces, [SEP], and then [MASK] tokens up to 32. Nothing attends to the [MASK]s, but each still reads the question and gets a vector of its own, which takes part in the score like any other. The ColBERT paper calls this query augmentation: the masks learn to act as soft extra query terms, a learned form of query expansion.
A paragraph gets a [D] marker, is cut at 180 tokens, and keeps a vector for every token except punctuation. Over the corpus that is 261,365 vectors, 126.4 per paragraph; 616 paragraphs were cut at the limit.
MaxSim
With question vectors and paragraph vectors , each question token keeps only its best match in the paragraph, and the score sums those maxima:
The MaxSim panel draws the whole grid of cosines with each row's maximum outlined and the maxima as bars. The sum rewards a paragraph that matches every question term somewhere, not one that matches on average, which is closer to how lexical retrieval counts terms than to a single cosine. A token's best match depends on its context: "bank" in a question about rivers and "bank" in a paragraph about loans get different vectors. Selecting a question token shades the paragraph by its cosine with every paragraph token.
A single vector's cosine is one dot product; MaxSim costs of them, about 4,000 for an average paragraph here, still far cheaper than running BERT on the pair.
What the token vectors buy
Scoring every question against every paragraph exhaustively, 620,100 MaxSims, ColBERTv2 puts the relevant paragraph first for 0.827 of the 300 questions against bge-small's 0.673, with nDCG@10 0.891 against 0.810 and MRR@10 0.873 against 0.766. Recall@10 is the same, 0.947: late interaction mostly moves the right paragraph from near the top to the top. ColBERTv2 is also the larger model, 109 M parameters against 33 M, so not all of the difference is due to late interaction.
The price is storage. The Stored for the corpus (float32, uncompressed) bars compare 261,365 vectors of 128 numbers, 127.6 MiB, with bge-small's 2,067 vectors of 384, 3.0 MiB: about 42 times as much.
Compression and indexing
ColBERTv2 attacks that cost with residual compression: the token vectors are clustered, and each is stored as the identifier of its nearest centroid plus its residual from that centroid quantised to one or two bits per dimension. Its paper reports a 6 to 10 times smaller index than the original ColBERT's, and better quality, from denoised supervision: training with hard negatives and with scores distilled from a cross-encoder.
This tab scores the corpus exhaustively. ColBERTv2's own engine, PLAID, avoids that: it first scores paragraphs by the centroids of their tokens alone, prunes most of them, and decompresses and scores only the survivors with full MaxSim, which its paper reports cuts search latency by up to 7 times on a GPU and 45 times on a CPU against plain ColBERTv2.
Where it came from
After BERT, the best rankers were cross-encoders that read each query with each document, far too slow to search a large collection. ColBERT (2020) kept BERT's token-level matching but moved the document side offline, and could search a whole collection with a vector index instead of only reranking another retriever's list. ColBERTv2 (2022) made the index small and PLAID (2022) made it fast. The Reranker tab shows the full-interaction model ColBERT approximates, and the HNSW and IVF-PQ tabs the vector indexes such systems are built on.
Papers
- ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT Introduces late interaction: a vector per token, scored by the sum of each query token's maximum similarity, and query augmentation with [MASK] tokens.
- ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction The model recorded here: residual compression of the token vectors and denoised supervision.
- PLAID: An Efficient Engine for Late Interaction Retrieval ColBERTv2's search engine: centroid interaction and pruning before full MaxSim.
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding The encoder that gives every token its contextual vector.
- C-Pack: Packed Resources For General Chinese Embeddings The BGE models; bge-small-en-v1.5 is the single-vector model ColBERT is compared with.