Introduction
In neural text retrieval, dual-encoders (e.g., BERT-based models) are favored for their efficiency. They represent queries and documents as independent vectors, enabling fast similarity searches. However, traditional training via contrastive learning on simple triplets—comprising a query, a positive document, and a single negative—has significant drawbacks:
- Context Blindness: It ignores the "ranking context," the relative relevance of a document among many candidates.
- Objective Mismatch: Contrastive losses like InfoNCE are proxies that do not directly optimize for list-wise metrics such as nDCG.
While Learning-to-Rank (L2R) methods address these issues, they are often too computationally expensive for the retrieval stage. CODER (COntextual Document Embedding Reranking) bridges this gap by training query encoders to score documents within a large ranking context efficiently.
Methods
CODER introduces a fine-tuning framework that enhances dual-encoders without the need to re-index document collections.
The framework's key components include:
- Asymmetric Fine-tuning: Document embeddings remain fixed (precomputed by a base model like TAS-B or RepBERT), while only the query encoder is fine-tuned. This ensures no re-indexing overhead.
- Joint Scoring: During training, the model jointly scores $N=1000$ candidate documents per query. These candidates are "hard negatives" retrieved by a first-stage method.
- List-wise Loss: CODER employs a ListNet loss (KL-divergence) to compare the predicted score distribution against the ground-truth relevance distribution for all 1,000 candidates simultaneously.
- Efficient Inference: At runtime, CODER acts as a second-stage reranker with a negligible ~5.5ms overhead or as a standalone single-stage retriever with zero added latency.
Key Insights
- Optimal Context Size: Performance scales with the number of negatives, plateauing near the embedding space dimensionality (e.g., 768). Scoring 1,000 documents provides a superior view of the loss landscape compared to small batches.
- Hard Negatives Matter: Using query-specific "hard" negatives is critical for establishing a meaningful ranking context. Adding random negatives to a large set of retrieved ones provides no additional benefit.
- List-wise Optimization for Multi-label Data: The benefits are most pronounced on datasets like TripClick, where queries have multiple relevant documents at varying levels of importance. List-wise losses excel at distinguishing between "good" and "excellent" matches.
Key Results
CODER achieves state-of-the-art results across several benchmarks while maintaining high efficiency.
- MS MARCO: Applying CODER to a RepBERT base improved MRR@10 from 0.304 to 0.327.
- TripClick: CODER established a new SOTA on the TripClick HEAD dataset, outperforming complex cross-encoder ensembles.
- Efficiency: Fine-tuning is rapid, taking 3.5–4.5 hours on a single NVIDIA TITAN RTX. Inference latency is minimal, adding only ~5.5ms per query.
Discussion and Limitations
While CODER significantly improves retrieval performance, it has some constraints:
- Fixed Document Embeddings: Improvements are limited to "steering" the query vector; the underlying document representations are not updated.
- Diminishing Returns: Gains are less pronounced when applied to already highly-optimized models like CoCondenser.
- Future Potential: Future work could explore more complex parametric scoring functions to further boost performance, potentially at the cost of some efficiency.
Summary updated