Abstract
Query-by-Document (QBD) retrieval, where both queries and documents are exceptionally long, presents significant challenges for standard Transformer-based models due to token limits and quadratic computational costs. We present Proportional Relevance Score (RPRS), a re-ranking method that leverages sentence-level bi-encoders and a scoring logic derived from the BM25 algorithm. RPRS effectively "harvests" relevance from entire documents, achieving state-of-the-art results on legal and patent datasets while operating orders of magnitude faster than traditional cross-encoders.
Introduction
In specialized domains such as law and patent research, a "query" is often an entire document—for instance, finding legal cases similar to a 10,000-word brief. This task, known as Query-by-Document (QBD) retrieval, is poorly served by standard Transformer models like BERT for two primary reasons:
- The 512-Token Limit: Standard BERT models truncate long documents, losing vital context.
- Computational Complexity: The $O(L^2)$ scaling of self-attention makes processing massive documents memory-intensive and slow.
While long-context Transformers exist, they frequently struggle in QBD tasks due to a lack of domain-specific large-scale training data. The authors propose RPRS as a "length-aware" and efficient alternative for real-world production environments.
Methodology
The core of the proposed approach is the Proportional Relevance Score (RPRS). The method avoids direct processing of long sequences by breaking documents into sentence-level units.
The RPRS Pipeline
The process involves three main stages:
- Sentence Embedding: Both the query and candidate documents are split into sentences. A bi-encoder architecture, specifically Sentence-BERT (SBERT), is used to transform each sentence into a vector representation.
- Proportional Scoring: The model calculates the proportion of sentences in a candidate document that are "most similar" to sentences in the query. The final score is derived from the product of Query Proportion (QP) and Document Proportion (DP).
- BM25-Inspired Enhancement (RPRS w/freq): To handle repetitive content and varying document lengths, the authors incorporate "term saturation" ($k1$) and "length normalization" ($b$) logic from the classic BM25 algorithm, applying these principles to sentence similarities rather than raw terms.
By utilizing a bi-encoder, document sentences can be pre-embedded and indexed. At query time, the complexity is reduced to $O(N)$, where $N$ is the number of sentences, making it significantly faster than cross-encoders.
Experimental Setup
The authors evaluated RPRS across five diverse long-form datasets:
- COLIEE 2021 & Caselaw: Legal case retrieval datasets with average document lengths exceeding 5,000 words.
- CLEF-IP 2011: Technical patent prior art retrieval.
- WWG & WWA: Wikipedia-based datasets focused on Video Games and Wine.
Results and Discussion
Performance and Efficiency
RPRS achieves state-of-the-art (SOTA) performance on the COLIEE 2021 task with an F1 score of 0.2336, outperforming the previous best model, MTFT-BERT (0.2205). Crucially, RPRS is approximately 46,800 times faster than a standard BERT cross-encoder by avoiding quadratic joint self-attention costs.
Key Insights
- Granularity Matters: Sentences serve as an ideal unit of analysis, balancing semantic meaning with granularity better than fixed-length token chunks.
- Length as an Advantage: Unlike truncated BERT models, RPRS performance improves as document length increases, as it can aggregate evidence from the entire text.
- Neural-Lexical Hybrid: The success of RPRS suggests that the mathematical foundations of 1990s-era lexical retrieval (BM25) remain highly relevant when applied to modern neural embeddings.
Conclusion
RPRS provides a robust and efficient solution for long-form QBD retrieval. While currently a re-ranker dependent on a first-stage retriever like BM25, future work aims to adapt RPRS into a standalone first-stage retriever. The method's ability to generalize across domains (e.g., from legal to patent data) without further optimization highlights its potential for broad industrial application.
Summary updated