RAGBoost: Efficient Retrieval-Augmented Generation with Accuracy-Preserving Context Reuse

Yinsicheng Jiang, Yeqi Huang, Liang Cheng, Cheng Deng, Xuan Sun, Luo MaiarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) increasingly rely on massive contexts for Retrieval-Augmented Generation (RAG) and agentic workflows, leading to significant prefill latency bottlenecks. We present ContextPilot, a system designed to accelerate long-context inference by up to 3x through strategic reordering and deduplication of retrieved documents to maximize KV-cache reuse. By introducing "context annotations"—minimal textual cues—ContextPilot preserves model reasoning quality even when input sequences are shuffled for efficiency.

1. Introduction

As LLMs scale to handle contexts exceeding 100,000 tokens, the "Time-to-First-Token" (TTFT) becomes a critical user experience hurdle. This latency is primarily driven by the prefill stage, where the model must process the entire prompt to generate a Key-Value (KV) cache. Existing caching solutions, such as RadixCache, require exact prefix matches; any change in document order or minor prompt variations results in a cache miss. While approximate matching can improve reuse, it often degrades reasoning performance. ContextPilot addresses this trade-off, providing aggressive cache reuse without sacrificing accuracy.

2. System Architecture

ContextPilot operates on a "context-reuse" framework consisting of three primary components: indexing, strategic reordering, and context annotations.

Overview of the ContextPilot system architecture, showing the flow from multiple sessions through the search module to the inference engine with prefix caching.

2.1 Context Indexing and Reordering

The system maintains a tree-based index of "Context Blocks" (CBs). A specialized distance function measures overlap and positional similarity between document sets, identifying reusable chunks across different users or turns. When a query is received, ContextPilot reorders retrieved documents to place cached blocks at the start of the prompt, effectively converting potential misses into prefix hits.

2.2 Context Annotations

To mitigate the "lost-in-the-middle" effect and other reasoning degradations caused by shuffling document order, ContextPilot appends "context annotations." These are short instructions that explicitly inform the model of the original relevance priority (e.g., "[1] > [2] > [3]"). This allows the model to reconstruct the intended logical flow internally during the attention process.

Comparison between an original prompt and a reordered prompt using ContextPilot's annotations to guide the model's reasoning.

3. Evaluation

ContextPilot was evaluated across diverse long-context workloads, including RAG benchmarks (MultihopRAG, NarrativeQA) and agentic memory tasks (LoCoMo). Tests were conducted on large-scale architectures such as DeepSeek-R1 (671B) and Llama 3.3-70B.

3.1 Performance and Accuracy

  • Throughput: ContextPilot achieves 1.5x to 3x speedups over state-of-the-art systems like RadixCache. On DeepSeek-R1, it increased the cache hit ratio from 5% to 60%.
  • Reasoning Quality: On complex tasks like MultihopRAG, the system improved F1 scores by up to 4%. The annotations act as a "correction fluid," helping the model focus its attention maps more effectively than standard ordered prompts.
  • Efficiency: The indexing overhead is minimal, adding only ~0.2ms per request.

4. Discussion and Future Work

Modern LLMs are increasingly "order-resilient," creating a performance window for cache-efficient shuffling. ContextPilot leverages this by using annotations not just to recover accuracy, but to enhance it. However, the system's effectiveness depends on the model's instruction-following capabilities; smaller models may see diminished returns. Future research will explore extending this framework to multi-agent orchestration and serverless "cold-start" environments.

5. Conclusion

ContextPilot demonstrates that the trade-off between inference speed and reasoning fidelity in long-context RAG is not inevitable. By combining intelligent prefix caching with explicit instructional guidance, the system enables high-throughput, high-accuracy LLM applications at scale.

Jiang, Y., Huang, Y., et al. (2026). CONTEXTPILOT: Fast Long-Context Inference via Context Reuse. MLSys 2026.

Summary updated

BibTeX
@misc{jiang2025ragboost,
  author = {Yinsicheng Jiang and Yeqi Huang and Liang Cheng and Cheng Deng and Xuan Sun and Luo Mai},
  title = {{RAGBoost: Efficient Retrieval-Augmented Generation with Accuracy-Preserving Context Reuse}},
  year = {2025},
  eprint = {2511.03475},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.03475},
}
Figure