NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ConTra: A Training Framework for Effective Contextual Retrieval via Prefix Generation

Jiajun Hou, Jingbang ChenarXiv 2026

TL;DR

When we slice massive documents into searchable chunks, passages often lose the vital context that identifies them—like a financial table severed from the header naming the company. ConTra (Context That Travels) uses reinforcement learning to train tiny, fast language models to write ultra-concise, ~16-token plain-text prefixes for each chunk during indexing. Because this context lives as readable text rather than hidden vector math, it guides both initial vector search and downstream reranking, beating giant models and specialized encoders at a fraction of the indexing cost.

What Problem Does This Paper Address?

Modern search and Retrieval-Augmented Generation (RAG) pipelines rely on a two-stage dance: a fast vector search grabs a shortlist of candidate chunks, and a smart "reranker" reads the text of those candidates alongside the query to perfect the final order.

However, splitting long documents into chunks creates contextual orphans. Imagine searching for a company’s 2023 operating income: if the chunking boundary separates the financial table from the page heading, neither the vector search nor the reranker knows which company or year the numbers belong to.

Existing fixes split into two camps, each with a catch:

  1. Contextual encoders (like Late Chunking or PPLX) bake surrounding document context directly into the chunk’s vector representation. This helps vector search find the chunk, but the reranker still only reads the raw, orphaned text, remaining blind to the context!
  2. Prompted text prefixes (pioneered by Anthropic) ask an LLM to write a short situating summary prepended to each chunk. Both stages can read this prefix, but prompting large LLMs for millions of chunks is painfully slow and expensive, while smaller prompted models write rambling, generic filler.
Figure 1: A textual prefix carries document context through embedding retrieval and reranking. Contextual encoders enrich chunk vectors, while the reranker receives only the original chunk text.

Methods

The authors introduce ConTra, a reinforcement learning (RL) post-training framework (using DAPO on Qwen3.5 backbones at 0.8B, 2B, and 4B scales) that teaches small language models to write crisp, high-utility prefixes offline during index construction.

While concatenating a prefix to a chunk before embedding and reranking is standard, ConTra's four-part RL reward function is novel. During training, candidate prefixes are scored online using frozen models:

  • Embedding Utility: Rewards prefixes that pull the chunk’s vector closer to a context-disambiguated query vector than the raw chunk alone.
  • Reranking Utility: Uses a frozen cross-encoder reranker's logit difference as a fine-grained tie-breaker, teaching the generator to extract exact entities and relations rather than broad summaries.
  • Factual Grounding: A frozen 4B LLM judge checks whether the prefix is supported by the source document, penalizing query-echoing hallucinations.
  • Length Control: Leaves prefixes up to 16 tokens unpenalized, then applies a linear penalty. This prevents neighboring chunks from repeating identical document-wide background and competing with one another.

Datasets

  • ConTEB: An 8-task benchmark testing retrieval where document-level context is essential. ConTra filters 100,000 ConTEB training pairs down to 5,760 high-signal instances for RL training, and evaluates on its test split.
  • RealContextBench (Newly Introduced): Existing benchmarks assume surrounding text is always helpful. Real-world corpora, however, mix self-contained passages with context-dependent ones, plus noisy neighbors. RealContextBench combines five realistic application collections (Natural Questions, TechQA, FairytaleQA, QMSum meetings, and FinanceBench) with three controlled NanoBEIR distraction setups (isolated chunks, random surrounding passages, and LLM-generated topically similar distractors) to test precision and noise resistance.

Key Insights and Ideas

  • High recall means nothing if the reranker is flying blind: PPLX-4B pulls 93.9% of gold chunks into the top-15 shortlist on ConTEB, yet its final reranked score drops from 0.8210 to 0.7310 because the text reranker can't see the latent vector context. Giving the reranker readable prefixes unlocks complementary gains across both stages.
  • Brevity prevents "sibling rivalry": Without length penalties, 4B models balloon from ~18-token prefixes to ~239-token summaries. Repeating general document background across every chunk blurs distinctions between neighboring passages, tanking final retrieval accuracy (0.8465 down to 0.7084) while slowing down indexing.
  • Self-reinforcing distillation: Even when a passage has no surrounding context, ConTra boosts rankings by distilling and foregrounding the chunk’s own core definitions right at the start of the text.
  • Explicit prefixes resist noisy neighbors: Contextual encoders absorb distracting adjacent text directly into chunk vectors. Keeping the original chunk verbatim and prepending selective text anchors the representation against off-topic and topically similar interference.

Key Results

  • Punching way above its weight: On ConTEB, ConTra-2B achieves 0.8525 reranked nDCG@10—beating the prompted 9B baseline (0.8279) and reranked flagship contextual encoders PPLX-4B (0.7310) and Voyage-context-4 (0.7300) by over 12 points.
Table 2: ConTEB nDCG@10 for embedding retrieval (Emb.) and reranking (Rer.). Overall reports the macro-average across the eight tasks. Qwen3.5 rows denote untrained models using Anthropic’s prompt. Green bold and underlining indicate the best and second-best scores, respectively.
  • Zero-shot domain transfer: Trained only on ConTEB, ConTra-2B achieves the highest overall reranked nDCG@10 (0.6692) on RealContextBench, shining on FinanceBench (0.525 vs. 0.469 for Voyage-4).
  • Major speedups & tiny storage: On an H100 GPU, ConTra-2B indexes short documents 7.74× as fast as the 9B prompted baseline and 2.15× as fast as PPLX-4B (and 4.82× / 1.40× as fast on long documents). RL brevity cuts indexing time by up to 52.3% at the same 2B scale, while storing prefixes adds <1% disk overhead.
  • Reduced hallucinations: The factual reward cuts prefix hallucination rates from 16.0% down to 4.5% in manual audits.

Limitations and Future Work

  • Capacity ceilings on ultra-Tiny models: RL post-training cannot overcome fundamental parameter limits. On ConTEB’s Insurance task—which requires linking tables to country headings far away in long documents—ConTra-0.8B scores just 0.160 (vs. 1.000 for 2B and 4B), lacking the capacity to parse long-range structure.
  • Windowing limits cache reuse on long docs: Automatic KV-cache prefix reuse hits 81.9% on short documents, but drops to 24.9% when long documents must be sliced across multiple shifting context windows.
  • Clean-corpus recall trade-offs: On clean narrative or meeting corpora (like QMSum and FairytaleQA), pairing PPLX-4B's dense candidate retrieval with ConTra's prefixes for reranking beats standalone ConTra—albeit at higher indexing compute cost.

Summary updated

BibTeX
@misc{hou2026contra,
  author = {Jiajun Hou and Jingbang Chen},
  title = {{ConTra: A Training Framework for Effective Contextual Retrieval via Prefix Generation}},
  year = {2026},
  eprint = {2611.34366},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.34366},
}
Figure