Token Pooling Recognition Learning Reduces Multi-Vector Search Storage by 75%

Hugging Face has proposed Token Pooling and Pooling-Aware Training to reduce the storage burden of multi-vector embedding models (such as ColBERT). By merging similar token vectors using Ward hierarchical clustering, the number of vectors per document is reduced to one-fourth, while training the encoder to maintain search performance even after pooling. While the standard model retained only 94.6% of NanoBEIR nDCG@10 during pooling, the Pooling-Aware Training model recovered to 97.8%. This is a practical solution to minimize search quality loss within the same storage budget.

Storage Bottleneck of Multi-Vector Embeddings

Single vector embedding models compress the entire document into a single vector, but multi-vector models like ColBERT retain contextual vectors for each token in the document. This allows different parts of the query to match different segments of the document, enhancing search expressiveness, but the number of vectors increases exponentially. In a corpus of millions of documents, hundreds of millions of vectors can arise, leading to storage costs that are difficult to manage.

The original text illustrates this burden with specific figures. In a 4-bit residual quantization (Fast-PLAID) environment, 200 vectors per document at 128 dimensions require 12.8 KB per document, which amounts to 12.8 GB for 1 million documents. Reducing the number of vectors per document to 50 brings it down to 3.2 GB, a 75% reduction. However, simply discarding vectors results in the loss of subtle distinguishing information necessary for search.

ConditionVectors per DocumentStorage per Document (4-bit Quantization)Total for 1 Million Documents
Uncompressed (Original)20012.8 KB12.8 GB
Pooling Applied (pool_factor=4)503.2 KB3.2 GB

Token Pooling: Vector Compression via Hierarchical Clustering

HierarchicalTokenPooling uses Ward hierarchical clustering to group similar token embeddings. Initially, each token vector is its own group, and the two groups that increase the sum of squared distances (variance) the least from the average within the group are merged iteratively. This method prefers compact groups where vectors are dense.

The merging process creates a hierarchy, allowing users to select a level that fits their budget to adjust the compression rate. Ultimately, the average vector of each group is calculated and renormalized for use in MaxSim score calculations.

There are three methods for controlling pooling budgets:

By default, the first token (usually `[CLS]` etc.) is protected from merging, and pooling is applied only to document embeddings, while query embeddings retain the original.

Pooling-Aware Training: Learning Representations that Withstand Compression

Applying pooling post hoc to standard multi-vector models can result in the loss of subtle distinctions important for search during the merging process. The original training objective did not consider compressed representations. To address this, Pooling-Aware Training was introduced.

The principle is similar to Matryoshka Embeddings. Just as Matryoshka applies search loss to multiple embedding dimension prefixes to make smaller dimensions useful, Pooling-Aware Training applies search loss to representations with reduced token vectors.

For each training batch, two losses are computed and weighted averaged:

$$ \mathcal{L} = \tfrac{1}{2}\mathcal{L}_{\mathrm{unpooled}} + \tfrac{1}{2}\mathcal{L}_{\mathrm{pooled}} $$

Since both losses update the same encoder, the model learns to batch token embeddings to maintain search performance before and after pooling.

  1. Generate Original Document Embedding
  2. Apply Pooling Compression
  3. Calculate Non-Pooling Loss
  4. Calculate Pooling Loss
  5. Weighted Sum Backpropagation
  6. Update Encoder

Ward clustering makes discrete merging decisions, so gradients do not flow. During training, a Straight-Through Estimator is used to pass the gradient of the pooled vector directly to the member tokens, while the cluster assignment itself is not differentiated.

Sentence Transformers Implementation Wrapper

Hugging Face has wrapped this in the `MultiVectorTokenPoolingLoss` class. Users can simply add the pooling module to existing pipelines like `ColBERTLoss`. Optionally, Kernel Acceleration can be activated to increase training speed.

Experimental Results: Trade-off Between Quality Retention and Storage Savings

The original text evaluated quality using the nDCG@10 metric of the NanoBEIR benchmark. Results were compared under the condition of `pool_factor=4` (one-fourth vector compression).

Standard Model94.6
Pooling-Aware Training Model97.8

Pooling-Aware Training recovered about 60% of the performance drop (5.4%p) due to compression (3.2%p improvement). It minimized search quality loss within the same storage budget (3.2 GB/1 million documents).

Adaptive Pooling and Practical Application Guide

Instead of a fixed `pool_factor`, using Adaptive Pooling allows for dynamic adjustment of the number of vectors based on document content diversity. By inputting representative document samples (`calibration_documents`) and specifying a target average number of vectors (e.g., 16), it automatically adjusts the `distance_threshold`. This threshold can be reused during indexing.

In practice, pooling can be combined with other compression techniques:

The original text emphasizes that "Pooling-Aware Training can be applied to any multi-vector model and can also be used as a post-correction for models trained without pooling."

"Pooling-aware training teaches the encoder to preserve the information that matters when its vectors are merged, helping you retrieve better from the same storage budget."

Implications for Developers and Remaining Challenges

This technique is a lever that directly reduces the operating costs of RAG systems. If vector DB storage costs and memory usage can be reduced to one-fourth while maintaining search quality at around 98%, the infrastructure budget savings for large-scale services would be significant. A wrapper that can be used immediately in the Sentence Transformers ecosystem lowers the barrier to adoption.

However, the original text only presented results from the small NanoBEIR benchmark. Generalization performance in the full BEIR or domain-specific large-scale corpora, heuristics for automatically determining the optimal `pool_factor` based on document length, domain, and language, and the clustering quality in non-English contexts like Korean require further validation.

Verified figures

Our take

Pooling-Aware Training is a significant advancement that directly tackles the storage cost barrier of multi-vector search at the algorithmic level. The approach of extending the idea of Matryoshka embeddings to the dimension of token counts is impressive, and its immediate compatibility with the Sentence Transformers ecosystem will be a great driving force for dissemination within the open-source community.

Open questions

Source

Back to catalog