TL;DR
The paper introduces document optimization, a method that uses reinforcement learning to train language models to rewrite documents so they better align with a target retriever's embedding space. By shifting the computational burden entirely offline, this approach allows smaller, cheaper retrievers to match or outperform models that are orders of magnitude larger—all without adding a single millisecond to query-time latency.
What Problem Does This Paper Address?
In information retrieval, "document expansion" is a classic technique where documents are augmented with extra words (like potential query terms) before indexing to prevent vocabulary mismatch. While this worked well for traditional lexical search engines like BM25, naively applying it to modern neural retrievers often backfires, introducing noise that degrades retrieval quality.
Furthermore, improving modern retrieval systems typically requires fine-tuning the retriever's embedding weights. This is impossible when dealing with closed-source, commercial "black-box" APIs (such as OpenAI's embedding models). The authors tackle this dilemma by asking: Can we optimize the documents themselves to fit the retriever, rather than changing the retriever to fit the documents?
Methods
The authors recast document expansion as a reinforcement learning problem. Instead of using static heuristics, they employ an instruction-tuned Language Model (LM) or Vision-Language Model (VLM) as a policy ($\pi$) to generate document transformations.
The core mechanics of their approach include:
- Counterfactual Retrieval Reward: To evaluate a rewritten document, the system simulates a "what-if" scenario: it replaces the original document with the rewrite in the search index while keeping all other documents fixed. It then measures the change in ranking ($\Delta$nDCG@k) across a set of positive and negative queries. This directly optimizes the evaluation metric and penalizes rewrites that cause false positives.
- Group Relative Policy Optimization (GRPO): The policy samples a group of candidate rewrites for a document, computes their relative rewards, and updates its weights based on which candidates performed best. This elegant approach avoids the need for a separate, complex critic model.
- Black-Box & White-Box Flexibility: Because the reward signal only requires the final retrieval ranks, it works perfectly on black-box APIs. If the retriever's weights are accessible (white-box), the authors also introduce a Joint Adaptation strategy that alternates between optimizing the documents and fine-tuning the retriever.
Datasets
The method was evaluated across two distinct domains:
- Code Retrieval: Evaluated using four programming benchmarks from the Massive Text Embedding Benchmark (MTEB): HumanEvalRetrieval, MBPPRetrieval, DS1000Retrieval, and FreshStackRetrieval.
- Visual Document Retrieval (VDR): Evaluated using the Vidore2 benchmark, which involves retrieving visually rich documents (PDF pages containing charts, tables, and images) using text queries. Specific subsets used include biomedical_lectures_v2, economics_reports_v2, esg_reports_v2, and esg_reports_human_labeled_v2.
Key Insights and Ideas
- Optimization is Not Just Expansion: An optimized document isn't just longer; the model learns to compress, restructure, or rephrase information. Analysis showed that RL-optimized documents were significantly more compact and high-signal than naive, zero-shot expansions.
- Flipping the Efficiency Curve: Document optimization allows a smaller, 6.5× cheaper model (like OpenAI's
text-embedding-3-small) to beat its larger sibling (text-embedding-3-large). - Massive Gains for Lexical Search: The most dramatic improvements occurred with BM25 on code retrieval. By translating raw code snippets into structured, comment-heavy textual summaries, the lexical retriever's performance more than doubled.
Key Results
- Black-Box Improvements: Applying document optimization to OpenAI's
text-embedding-3-smallboosted its nDCG@5 on code from 58.7 to 66.8, and on VDR from 53.3 to 57.6—surpassing the unoptimizedtext-embedding-3-largemodel (66.3 on code, 57.0 on VDR). - BM25 Resurgence: On code retrieval, BM25 performance skyrocketed from a baseline of 15.6 to 46.6 nDCG@5.
- Joint Adaptation Wins: For open-weights models, combining document optimization with retriever fine-tuning yielded the highest scores. For instance, Jina-ColBERT-V2 improved from 55.8 to 63.3 on VDR and from 48.6 to 61.8 on code retrieval.
Limitations and Future Work
- Supervision Dependency: The training process relies on having access to a set of annotated positive queries for the documents. While the authors successfully experimented with weak supervision (using model-generated or mined queries), performance is still bounded by query quality.
- Training Compute: Generating multiple candidate rewrites and performing counterfactual indexing during training is computationally intensive. However, the authors note this cost is amortized because it happens entirely offline prior to production deployment.
- Future Directions: The authors suggest expanding this framework to other multimodal domains and exploring more sophisticated schedules for joint retriever-policy adaptation.
Summary updated