English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

REFRAG: Rethinking RAG-Based Decoding — Research Report on Block-Level Context Compression

Forum topic · ✨步子哥 · 2025-11-27

Summary

REFRAG is a research framework from Meta (arXiv:2509.01092) that rethinks decoding in retrieval-augmented generation (RAG) systems by compressing retrieved passages into chunk-level embeddings. A lightweight encoder (e.g., RoBERTa-Large) splits retrieved text into k-token blocks and produces compressed embeddings, which a projection layer aligns with a LLaMA-style decoder. This reduces input length from s to s/k, cutting KV-cache memory by k times. A reinforcement-learning policy (optimized with GRPO, rewarded by negative log perplexity) selectively keeps ~10% of critical blocks uncompressed, preserving accuracy. Training uses curriculum learning with reconstruction tasks followed by progressive fine-tuning. Experiments show REFRAG16 achieves a 16.5x and REFRAG32 a 30.85x speedup in time-to-first-token (TTFT), with 16x context extension (16,384 tokens) at perplexity lower than full-context LLaMA-32K. On RAG benchmarks, it improves accuracy by 1.22-1.93% at equal latency, outperforms baselines on multi-turn dialogue (TopiOCQA) and long-document summarization, and surpasses CEPE and LLMLingua. Code is open-sourced.

REFRAG: Rethinking RAG-Based Decoding — Research Report

This report analyzes the REFRAG paper (arXiv:2509.01092v2, updated October 2025), which introduces efficient decoding for retrieval-augmented generation (RAG) via block-level context compression and reinforcement-learning-based selective expansion.

1. Background and Core Problem

  • Long-context bottleneck in RAG: Retrieved passages typically occupy 90%+ of the input, causing:
  • Latency spikes: Time-to-first-token (TTFT) grows quadratically with context length: TTFT ∝ (24d² + 4ds)lbs / f.
  • Memory pressure: KV cache grows linearly: KV Cache ∝ 4dlb(s+o).
  • Computational redundancy: Retrieved passages have low inter-passage semantic similarity (due to dedup/diversity operations), yielding a block-diagonal sparse attention structure; standard self-attention wastes computation.
  • Limitations of existing methods:
  • General long-context optimizations (StreamingLLM, CEPE) are not designed for RAG sparsity and cannot dynamically compress text at arbitrary positions.
  • Prompt compression (LLMLingua) relies on heuristics, breaks autoregressive generation, and does not support multi-turn dialogue.
  • 2. Core Technique

    Architecture

  • Dual-model design:
  • A lightweight encoder (e.g., RoBERTa-Large) chunks retrieved text into blocks of k tokens and produces compressed embeddings c_i = M_enc(C_i).
  • A projection layer aligns encoder and decoder spaces: e^cnk_i = φ(c_i).
  • A decoder (e.g., LLaMA) receives the question tokens plus block embeddings and generates the answer.
  • Key advantages: input length compressed from s to s/k (k× KV-cache reduction); "compress anywhere" support enables multi-turn dialogue.
  • Selective Compression via RL

  • A policy network decides which blocks to compress:
  • State: block embedding sequence {c_i}.
  • Action: indices l = {l_j} of blocks kept as raw tokens.
  • Reward: negative log perplexity (r = -log PPL), optimized with GRPO for variance reduction.
  • Keeping only ~10% of critical blocks (p=0.1) approaches full-context performance.
  • Training

  • Curriculum learning:
  • 1. Reconstruction task: freeze the decoder; train the encoder to reconstruct original tokens from chunk embeddings (x_{1:k} → c_1 → x_{1:k}). 2. Progressive CPT: expand from single-chunk to multi-chunk reconstruction.
  • Fine-tuning: mix compressed/uncompressed block inputs to adapt to downstream tasks.
  • 3. Experimental Results

    | Model | Compression | Perplexity ↓ | TTFT Speedup | |---|---|---|---| | LLaMA-Full | 1× | 1.069 | 1× | | CEPE (SOTA) | – | 1.107 | 8.2× | | REFRAG16 | 16× | 1.062 | 16.5× | | REFRAG32 | 32× | 1.103 | 30.85× |

  • Context extension: supports 16× longer contexts (16,384 tokens) with perplexity still below LLaMA-32K.
  • RAG tasks: at equal latency, REFRAG16 (8 passages) beats LLaMA (1 passage) by 1.22% with a strong retriever and 1.93% with a weak retriever; at equal accuracy, TTFT speeds up 5.26× (10-passage setting).
  • Multi-turn dialogue (TopiOCQA): over 6 turns, REFRAG8 reaches 25.37% accuracy vs. 19.52% for LLaMA-FT, since compression avoids history truncation.
  • Long-document summarization (same token budget): ArXiv Rouge-L of 22.66 vs. 18.28 for LLaMA; PubMed improves 23.07 → 23.20.
  • 4. Advantages vs. Prior Work

    | Dimension | REFRAG | Limitations of alternatives | |---|---|---| | Compression flexibility | Chunk compression at any position | CEPE supports prefix-only compression | | Efficiency | TTFT 30.85×, throughput 6.78× | CEPE only 8.2× | | Accuracy retention | RL-based dynamic block selection | LLMLingua relies on heuristics | | Context extension | 16× context without accuracy drop | LLaMA-32K needs full computation, degrades |

    5. Use Cases and Limitations

    Suitable for: high-throughput RAG systems (search engines, customer support), multi-turn knowledge dialogue, and long-document analysis (scientific/legal summarization).

    Limitations:

  • Performance degrades notably at compression factors k > 64.
  • The lightweight encoder (RoBERTa) is limited on complex tasks.
  • Experiments are restricted to English datasets.
  • 6. Conclusion

    REFRAG combines block-level compression with RL-based selective expansion to enable efficient RAG decoding: 30.85× TTFT speedup, 16× memory reduction, 6.78× throughput gain, and 16× context extension — outperforming LLaMA, CEPE, and LLMLingua across RAG, dialogue, and summarization tasks, with strong industrial value for low-latency knowledge-intensive applications.

  • Code: https://github.com/facebookresearch/refrag
  • Paper: arXiv:2509.01092v2 (updated October 2025)

Tags

#rag#refrag#llm-inference#context-compression#kv-cache#reinforcement-learning#long-context#meta-ai

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176415021