REFRAG: An Efficient Decoding Framework for RAG
REFRAG is a collaboration between Meta Superintelligence Labs, the National University of Singapore, and Rice University (lead author: NUS PhD student Lin Xiaoqiang and colleagues).
Paper: https://arxiv.org/abs/2509.01092
The Long-Context Challenge in RAG
- Time cost: attention complexity grows quadratically with sequence length, causing very high time-to-first-token (TTFT).
- Space cost: the KV cache grows linearly with sequence length, limiting batch size and throughput.
- Information sparsity: among dozens of retrieved documents, only a few fragments are truly relevant to the query; the rest contribute almost nothing to generation yet still participate in all attention computation.
- Accuracy on 16 RAG tasks is comparable to or higher than a full-context LLaMA model.
- Average perplexity (PPL) reduction of 9.3% versus the CEPE baseline on Book and Arxiv datasets.
- Enterprise knowledge-base Q&A with large-scale retrieval
- Multi-turn dialogue without truncating history
- Long-document summarization (books, reports)
- Agent applications with complex reasoning and tool use
Block-Diagonal Attention Sparsity
Retrieved passages in RAG tend to be semantically weakly related to each other, producing a block-diagonal sparsity pattern: tokens within one passage are strongly correlated, while tokens across passages are only weakly related. Feeding all raw tokens to the LLM is therefore unnecessary and inefficient.
Core Design: Compress–Sense–Expand
1. Compress: a lightweight encoder (e.g., RoBERTa) compresses text chunks into single embedding vectors, drastically reducing sequence length. 2. Sense: an MLP projection layer maps encoder embeddings into the main LLM's token embedding space, aligning the two models. 3. Expand: a reinforcement learning policy intelligently selects which information chunks to decompress, ensuring key details (exact numbers, dates) are not lost to compression.
Results
| Metric | Result | |---|---| | TTFT speedup (k=32) | 30.85x | | Context length extension | 16x | | Throughput improvement | 6.78x | | KV cache reduction | ~k-fold |