Beyond RAG: Task-Aware KV Cache Compression for Comprehensive Knowledge Reasoning

Giulio Corallo, Orion Weller, Fabio Petroni, Paolo Papotti
3/6/2025
cs.CLcs.AIcs.IR

No confident code implementation found for this paper.

Abstract

Incorporating external knowledge in large language models (LLMs) enhances their utility across diverse applications, but existing methods have trade-offs. Retrieval-Augmented Generation (RAG) fetches evidence via similarity search, but key information may fall outside top ranked results. Long-context models can process multiple documents but are computationally expensive and limited by context window size. Inspired by students condensing study material for open-book exams, we propose task-aware key-value (KV) cache compression, which compresses external knowledge in a zero- or few-shot setup. This enables LLMs to reason efficiently over a compacted representation of all relevant information. Experiments show our approach outperforms both RAG and task-agnostic compression methods. On LongBench v2, it improves accuracy by up to 7 absolute points over RAG with a 30x compression rate, while reducing inference latency from 0.43s to 0.16s. A synthetic dataset highlights that RAG performs well when sparse evidence suffices, whereas task-aware compression is superior for broad knowledge tasks.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{corallo2025beyond,
  title  = {Beyond RAG: Task-Aware KV Cache Compression for Comprehensive Knowledge Reasoning},
  author = {Giulio Corallo and Orion Weller and Fabio Petroni and Paolo Papotti},
  year   = {2025},
  eprint = {2503.04973},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2503.04973v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2503.04973.svg)](https://codeofpaper.com/paper/2503.04973)

Discussion