Query Embedding Pruning for Dense Retrieval

Nicola Tonellotto, Craig MacdonaldarXiv 2021 · DOI

TL;DR

This paper introduces a dynamic pruning strategy for multi-representation dense retrieval models like ColBERT. By selecting only the most "important" query term embeddings (based on their rarity in the collection) for the initial search, the authors reduced the number of documents requiring expensive re-ranking by 70%, achieving a 2.65x end-to-end speedup with no significant loss in search effectiveness.

What Problem Does This Paper Address?

Dense retrieval has revolutionized search by using neural models (like BERT) to represent queries and documents as high-dimensional vectors (embeddings). While early models used a single vector per document, state-of-the-art "multi-representation" models like ColBERT create an embedding for every single token in a query or document.

This approach is highly effective because it allows for "late interaction"—calculating fine-grained similarity between every query term and every document term. However, it creates a massive efficiency bottleneck. A single query might generate 32 embeddings, each of which triggers an approximate nearest neighbor (ANN) search. This "fan-out" results in thousands of candidate documents that must be stored in memory and exactly scored by a heavy-duty reranker. The authors set out to prune these query embeddings to make the system faster without making it "dumber."

Methods

The authors propose a strategy inspired by classical Information Retrieval (IR) called TAAT (Term-At-A-Time) pruning.

In traditional search, rare words (like "axolotl") are more useful for finding relevant documents than common words (like "the"). The authors apply this logic to dense embeddings. Their method, Query Embedding Pruning, works as follows:

  1. Ranking Embeddings: They rank the query's embeddings based on Inverse Collection Frequency (ICF). Essentially, they look at the token corresponding to each embedding and prioritize the ones that appear least frequently in the entire document collection.
  2. Pruning: Instead of using all 32 embeddings for the initial ANN search stage, they only use the top $p$ most important ones (e.g., the 3 rarest terms).
  3. Architecture: As shown in the architecture diagram below, the pruned set of embeddings is used to identify a candidate set of documents. Crucially, once these candidates are found, the system "restores" the pruned embeddings to perform the final, exact re-ranking.
Figure 1: Dense retrieval architecture.

Datasets

The researchers evaluated their approach using:

  • MSMARCO Passage Ranking: A massive, industry-standard dataset for web search.
  • TREC 2019 Deep Learning Track: A subset of MSMARCO with high-quality, manual relevance labels.
  • PyTerrier: The experiments were implemented using this open-source IR experimentation platform.

The document index used was substantial, weighing in at 176 GB for the embeddings and 16 GB for the FAISS ANN index.

Key Insights and Ideas

  • The Plateau Effect: The authors discovered that search effectiveness (measured by nDCG@10 and MAP) plateaus very quickly. As seen in Figure 2, after the first 6–8 embeddings, adding more query embeddings provides diminishing returns for ranking quality, even though it continues to pull in more documents.
Figure 2: TREC 2019 deep learning track effectiveness for various numbers of query embeddings (𝑘′ = 1000).
  • Discriminative Power: Not all embeddings are created equal. Embeddings for rare tokens are far more "discriminative"—they are better at pinpointing relevant documents than embeddings for common tokens or special BERT tokens like [MASK] or [CLS].
  • ICF is a Strong Proxy: Using Inverse Collection Frequency to rank embeddings is significantly more effective than simply taking the first few terms of a query. By focusing on rare terms, the system finds the "needle in the haystack" much faster.

Key Results

The results demonstrate a clear win for efficiency:

  • Massive Pruning is Possible: Reducing the number of query embeddings from 32 down to just 3 resulted in no statistically significant difference in effectiveness (nDCG@10 and MAP).
  • Reduced Workload: This pruning reduced the number of documents retrieved in the first stage by 70% (from ~7,000 down to ~2,000).
  • Real-world Speedup: The end-to-end response time dropped from 461.4ms to 173.7ms, representing a 2.65x speedup.

Figures 5 and 6 (below) illustrate how the ICF-based pruning (blue line) reaches peak effectiveness much faster and with fewer retrieved documents than the baseline "First" strategy (red line).

MAP vs. Number of documents retrieved on TREC 2019.
MRR@10 vs. Number of documents retrieved on MSMARCO Dev.

Limitations and Future Work

While highly effective, the paper notes a few areas for further exploration:

  • Static Pruning: The authors suggest that "static pruning"—removing unimportant document embeddings at indexing time—could provide even further gains.
  • Selective Pruning: Rather than using a fixed number of embeddings (like $p=3$) for every query, a system could dynamically decide how many embeddings to use based on the query's complexity.
  • Special Tokens: The study found that BERT's special tokens (like [CLS]) contribute very little to ColBERT's initial retrieval stage, suggesting they might be candidates for permanent exclusion from the ANN phase.

Summary updated

BibTeX
@misc{tonellotto2021query,
  author = {Nicola Tonellotto and Craig Macdonald},
  title = {{Query Embedding Pruning for Dense Retrieval}},
  year = {2021},
  eprint = {2108.10341},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.10341},
}
Figure