Composite Re-Ranking for Efficient Document Search with BERT

Yingrui Yang, Yifan Qiao, Jinjin Shao, Mayuresh Anand, Xifeng Yan, Tao Yang

Abstract

Transformer-based models like BERT have significantly improved document ranking relevance but are often too computationally expensive for real-time production use on standard CPUs. We introduce BECR (BERT-based Composite Re-Ranking), a lightweight framework that achieves state-of-the-art relevance while maintaining high efficiency. BECR employs a query decomposition strategy and pre-computes token embeddings, allowing it to bypass expensive transformer operations during online inference. By integrating deep semantic signals with traditional lexical features and utilizing aggressive compression techniques like Locality-Sensitive Hashing (LSH), BECR reduces inference latency and storage overhead significantly, making neural re-ranking feasible on CPU-only clusters.

Introduction

The advent of Transformer models has revolutionized the field of Information Retrieval (IR). However, the high computational cost of these models remains a major barrier to their widespread adoption in large-scale search engines. In a typical two-stage ranking pipeline, a fast initial retriever (e.g., BM25) identifies candidate documents, which are then re-ranked by a more complex model. While BERT-based re-rankers provide superior accuracy, their reliance on GPUs for online inference makes them prohibitively expensive for many production systems. BECR addresses this challenge by providing a "CPU-friendly" alternative that preserves the ranking power of BERT.

Methods

The BECR framework is built upon three core innovations designed to optimize both speed and storage.

  1. Query Decomposition and Embedding Composition: To avoid running a full transformer pass at query time, BECR decomposes user queries into uni-grams and "skip-n-grams" (word pairs within a certain proximity). It then constructs a query representation by aggregating pre-computed embeddings for these components. This approach effectively moves the heavy lifting of transformer computation to an offline indexing phase.
  2. Composite Scoring: BECR utilizes a multi-faceted scoring function to determine document relevance: $$S = S_{deep} + S_{lexi} + S_{other}$$ Where $S_{deep}$ represents the neural semantic matching score derived from BERT embeddings, $S_{lexi}$ captures traditional lexical matching (e.g., BM25), and $S_{other}$ incorporates document-level features like PageRank.

  3. Aggressive Compression: To manage the vast amount of data generated by pre-computing embeddings, BECR employs Locality-Sensitive Hashing (LSH). This technique compresses 768-dimensional floating-point vectors into 256-bit binary signatures. Furthermore, the authors demonstrated that the BERT model could be pruned from 13 layers to just 5 with negligible impact on ranking quality.

The BECR framework overview, illustrating (a) training, (b) indexing, and (c) online inference stages.

Evaluation and Results

The performance of BECR was evaluated on several benchmark datasets, including Robust04, ClueWeb09-Cat-B, and MS MARCO.

Speed and Efficiency: On standard CPU hardware, BECR demonstrated remarkable speed. For a typical 5-token query, the model re-ranked 150 documents in just 40.7ms. This represents a 4x to 9x speedup over ColBERT, a leading efficient BERT baseline. Unlike many other neural rankers, BECR is fast enough for real-time use without requiring GPU acceleration.

Storage Optimization: The combination of LSH and layer pruning resulted in dramatic storage savings. For a collection of 50 million documents, the storage requirement for embeddings was reduced from an impractical 1,711 TB to a manageable 7.0 TB—a reduction to 0.4% of the original size.

Comparison of storage requirements between original and compressed embedding spaces.

Relevance: Despite its efficiency, BECR does not compromise on quality. On the ClueWeb09 dataset, it outperformed the CEDR-KNRM baseline by 20% in terms of NDCG@5, proving that lightweight models can achieve competitive results.

Discussion and Limitations

A key insight from this work is that contextual information can be effectively "stitched" together from pre-computed n-gram embeddings, approximating the output of a live transformer. The inclusion of lexical features serves as a robust safety net, compensating for any precision loss during embedding approximation.

However, some challenges remain. The reliance on pre-computed embeddings shifts the bottleneck from computation to disk I/O, which may become a factor under heavy concurrent loads. Additionally, the current weighting scheme for query composition is heuristic and could potentially be improved through machine learning optimization. Finally, the model's zero-shot performance showed a slight decline, indicating some sensitivity to the training domain.

Summary updated

BibTeX
@inproceedings{yang2022composite,
  author = {Yingrui Yang and Yifan Qiao and Jinjin Shao and Mayuresh Anand and Xifeng Yan and Tao Yang},
  title = {{Composite Re-Ranking for Efficient Document Search with BERT}},
  booktitle = {WSDM},
  year = {2022},
  doi = {10.1145/3488560.3498495},
}
Figure