AttnComp: Attention-Guided Adaptive Context Compression for RAG

Lvzhou Luo, Yixuan Cao, Ping Luo · ICT, Chinese Academy of Sciences / UCAS · arXiv, September 2025
arXiv:2509.17486 Llama-3.1-8B-InstructTop-P document selection
Visuals marked Reported use numbers quoted in the episode (approximate where the episode said "about"). Visuals marked Illustrative are conceptual schematics, not paper data.

RAG pipeline with a compressor in the middle

A retriever fetches 100 chunks (~100 words each). AttnComp decides how many survive, including zero.

Fixed budget vs adaptive keep Illustrative

Two of 100 chunks matter. A fixed top-5 budget can miss the bridge document; an adaptive rule keeps what the attention needs.

Bridge document: independent vs joint scoring Illustrative

"Where was the eldest brother of this person born?" The bridge document names the brother but never mentions the subject.

Attention as a shared budget Illustrative

Each query token spreads 1.0 across earlier tokens (rows sum to 1). Column averages become scores, so documents compete.

Hover a cell.

Top-P selection, nucleus-sampling style

Start the running total at the instruction's score. Add documents high to low until p is reached, or a score falls below 0.01.

0.95

The compressor, step by step

Mostly borrowed: 13 frozen layers plus one cross-attention layer. About half a percent of parameters is trained.

Where the training labels come from

The untrained compressor labels its own data, then a reader check filters it.

8,000 HotpotQA questions × 100 docs2,000 all-irrelevant8 epochslr 2e-4reshuffled each epoch~4 h on 4× RTX 4090

Results Reported

E5-base-v2 retrieves top 100 chunks from the Dec 2018 Wikipedia dump; Llama-3.1-8B-Instruct reads for every method. Single run, no significance tests.

Signals behind the design Reported

The authors' observations; the episode cautions they are motivation, not verified mechanisms.

Qwen reader check: accuracy vs F1 (direction only)

Only HotpotQA improves in accuracy; F1 rises on all five. The paper does not explain the divergence.

Open questions the episode flags

no leave-HotpotQA-out runno head-choice ablationno label vs gold-fact agreementconfidence: no calibration error / AUROCnon-Wikipedia / long-form corporaseed varianceonly 8B dense modelsinstruction-score → internal-knowledge story untested

References

  1. AttnComp — Luo, Cao, Luo, 2025 (arXiv:2509.17486)
  2. RECOMP — Xu, Shi, Choi, 2023
  3. LLMLingua / LongLLMLingua — Jiang et al., 2023
  4. Lost in the Middle — Liu et al., 2023
  5. Robust to Irrelevant Context — Yoran et al., 2024
  6. Reader to Retriever — Izacard, Grave, 2020
  7. Retrieval Head — Wu et al., 2024
  8. Attention is not Explanation — Jain, Wallace, 2019
  9. H2O — Zhang et al., 2023
  10. Neural Text Degeneration — Holtzman et al., 2019
  11. Adaptive-RAG — Jeong et al., 2024
  12. Self-RAG — Asai et al., 2023
  13. Attention Sinks — Xiao et al., 2023
  14. EXIT — Hwang et al., 2024
  15. Provence — Chirkova et al., 2025
  16. SnapKV — Li et al., 2024
  17. Llama 3 / Mistral 7B / Qwen2 — 2023–2024