Retrieval for Extremely Long Queries and Documents with RPRS: A Highly Efficient and Effective Transformer-based Re-Ranker

Arian Askari, Suzan Verberne, Amin Abolghasemi, Wessel Kraaij, Gabriella Pasi · DOI

TL;DR

The researchers introduce RPRS (Proportional Relevance Score), a novel re-ranking method designed for "Query-by-Document" (QBD) tasks where both the query and the target documents are extremely long. By leveraging sentence-level embeddings and a scoring logic inspired by the classic BM25 algorithm, RPRS achieves state-of-the-art results across legal, patent, and Wikipedia datasets while remaining significantly more efficient than standard Transformer-based rankers.

What Problem Does This Paper Address?

In many specialized fields like law or patent research, a "query" isn't just a few keywords; it’s an entire document (e.g., "find cases similar to this 10,000-word legal brief"). This is known as Query-by-Document (QBD) retrieval.

Standard Transformer models like BERT face two major hurdles here:

  1. The 512-Token Limit: BERT can only "see" about one or two pages of text at a time. Truncating a 5,000-word document loses vital information.
  2. Computational Complexity: The self-attention mechanism in Transformers scales quadratically ($O(L^2)$) with sequence length. Processing massive documents directly is slow and memory-intensive.

While "Long-context" Transformers exist, they often struggle in QBD tasks due to a lack of large-scale training data. The authors sought a method that is both "length-aware" and efficient enough for real-world production.

Methods

The core of the paper is the Proportional Relevance Score (RPRS). Instead of feeding a whole document into a model, the authors break the process down:

  1. Sentence Embedding: They split both the query and candidate documents into sentences and use Sentence-BERT (SBERT)—a bi-encoder architecture—to turn each sentence into a vector.
  2. Proportional Scoring: They calculate how many sentences in a candidate document are "most similar" to sentences in the query. The final score is a product of Query Proportion (QP) and Document Proportion (DP).
  3. The "BM25" Twist: The authors propose an enhanced version called RPRS w/freq. They borrow the "term saturation" ($k1$) and "length normalization" ($b$) logic from the classic BM25 algorithm and apply it to sentence similarities. This prevents a single repetitive sentence from unfairly boosting a document's rank and accounts for varying document lengths.

Because it uses a bi-encoder, document sentences can be pre-embedded and indexed. At query time, the complexity is only $O(N)$ (where $N$ is the number of sentences), making it orders of magnitude faster than cross-encoders.

Datasets

The authors evaluated RPRS on five diverse, long-form datasets:

  • COLIEE 2021: Legal case retrieval (average document length > 5k words).
  • Caselaw: Another legal dataset used to test how well parameters tuned on COLIEE generalize.
  • CLEF-IP 2011: Patent prior art retrieval (extremely technical and long).
  • WWG & WWA: Wikipedia-based datasets focused on Video Games and Wine articles, respectively.

Key Insights and Ideas

  • Sentences are the "Goldilocks" Unit: The authors found that sentences provide a better balance of semantic meaning and granularity than fixed-length token chunks (like 128 or 256 tokens).
  • More is Better: Unlike standard BERT models, which see no benefit (or even a penalty) from longer documents due to truncation, RPRS actually improves as document length increases. It effectively "harvests" evidence from the entire text.
  • Neural-Lexical Hybrid Logic: The most surprising "aha" moment is that the mathematical foundations of 1990s-era lexical retrieval (BM25) are still incredibly relevant for 2020s-era neural embeddings. Applying saturation and normalization to vector similarities is a powerful way to handle the "noise" in long documents.

Key Results

  • State-of-the-Art Performance: On the COLIEE 2021 legal task, RPRS w/freq achieved an F1 score of 0.2336, significantly outperforming the previous best model, MTFT-BERT (0.2205).
  • Domain Generalization: Parameters tuned on legal data worked remarkably well on patent data without further optimization, suggesting RPRS is robust across different technical domains.
  • Efficiency: RPRS is roughly 46,800 times faster than a standard BERT cross-encoder because it avoids the quadratic cost of joint self-attention over long sequences.

Limitations and Future Work

  • Two-Stage Dependency: RPRS is currently a re-ranker. It relies on an initial "first-stage" retriever (like BM25) to provide a pool of candidate documents. If the relevant document isn't in that initial pool, RPRS can't find it.
  • Parameter Tuning: While it only has three parameters ($n, k1, b$), they still require some labeled data to optimize. The authors suggest future work could involve "adaptive" versions that compute these parameters dynamically.
  • First-Stage Potential: The authors aim to modify RPRS so it can eventually function as a first-stage retriever, potentially replacing BM25 entirely for long-form search.

Summary updated

BibTeX
@article{askari2024retrieval,
  author = {Arian Askari and Suzan Verberne and Amin Abolghasemi and Wessel Kraaij and Gabriella Pasi},
  title = {{Retrieval for Extremely Long Queries and Documents with RPRS: A Highly Efficient and Effective Transformer-based Re-Ranker}},
  journal = {ACM Trans. Information Systems},
  year = {2024},
  doi = {10.1145/3631938},
}
Figure