mlsanityData to 7 Oct 2026

In-Context Optimization for Retrieval-Augmented Generation: A Gradient-Descent Perspective

arXiv 2605.26356 ↗First posted 25 May 2026cs.CLcited by 0

On the map: Retrieval-augmented generation → Generation and context integration

Abstract (arXiv)

In-context learning has recently been linked to implicit gradient descent in linear self-attention models, suggesting that context can induce a forward-pass update. Retrieval-augmented generation (RAG) also relies on context, but retrieved documents are usually treated as static evidence rather than signals for adaptation. We study RAG as an in-context optimization process. First, we show that one linear self-attention layer can implement one gradient-descent step on a unified linearized RAG objective covering both projection-based and dot-product retrieval interfaces. This gives an exact regime where retrieval-augmented prediction and in-context optimization coincide. We use this result not as a literal model of LLM computation, but as a guide for adapting the interaction between queries and retrieved evidence. We then test the boundary of this correspondence: it remains stable under controlled linear extensions, but becomes feature-distribution dependent under nonlinear architectures. Finally, we turn this view into a lightweight method for frozen RAG LLMs. The method keeps the retriever and backbone fixed, and predicts a context-conditioned update to a generator-side evidence-use interface. Across seven QA benchmarks, two retrievers, and two frozen LLM backbones, this forward-only update improves a shared-interface baseline, transfers to held-out tasks, and approaches test-time gradient adaptation at much lower per-query cost.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Generation and context integration, one of 15 directions in Retrieval-augmented generation. Builds on 38 of its 45 references that are in the map. First posted on arXiv 25 May 2026.

Builds on

38 of 45 references.

Closest ancestors · 4

Same direction, newest first

  1. 2023In-Context Retrieval-Augmented Language Models31 Jan
  2. 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memories20 Dec
  3. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks22 May
  4. 2020REALM: Retrieval-Augmented Language Model Pre-Training10 Feb

Other references · 34

  1. 2024The Llama 3 Herd of Modelscited by 14,192
  2. 2024Qwen2.5 Technical Reportcited by 4,713
  3. 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
  4. 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
  5. 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
  6. 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,686
  7. 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,895
  8. 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,800
  9. 2021Improving language models by retrieving from trillions of tokenscited by 1,278
  10. 2020Constructing A Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Stepscited by 1,259
  11. 2022Text Embeddings by Weakly-Supervised Contrastive Pre-trainingcited by 1,216
  12. 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
22 more
  1. 2022Measuring and Narrowing the Compositionality Gap in Language Modelscited by 1,054
  2. 2021MuSiQue: Multihop Questions via Single-hop Question Compositioncited by 893
  3. 2022Transformers learn in-context by gradient descentcited by 714
  4. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  5. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  6. 2021Fast Model Editing at Scalecited by 491
  7. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  8. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  9. 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
  10. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
  11. 2024FlashRAG: A Modular Toolkit for Efficient Retrieval-Augmented Generation Researchcited by 165
  12. 2023Few-shot Fine-tuning vs. In-context Learning: A Fair Comparison and Evaluationcited by 134
  13. 2025A Survey of Graph Retrieval-Augmented Generation for Customized Large Language Modelscited by 85
  14. 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?cited by 60
  15. 2022HyperTuning: Toward Adapting Large Language Models without Back-propagationcited by 45
  16. 2024Online Adaptation of Language Models with a Memory of Amortized Contextscited by 35
  17. 2024Linear Transformers are Versatile In-Context Learnerscited by 28
  18. 2023Towards Understanding How Transformers Learn In-context Through a Representation Learning Lenscited by 15
  19. 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methodscited by 13
  20. 2024Benchmarking General-Purpose In-Context Learningcited by 6
  21. 2024RiTeK: A Dataset for Large Language Models Complex Reasoning over Textual Knowledge Graphs in Medicinecited by 6
  22. 2025HyperFlow: Gradient-Free Emulation of Few-Shot Fine-Tuningcited by 1

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025Retrieval-Augmented Generation as Noisy In-Context Learning: A Unified Theory and Risk Bounds
  2. 2025Dynamic Context Selection for Retrieval-Augmented Generation: Mitigating Distractors and Positional Bias
  3. 2025Retrieval-Augmented Generation: A Comprehensive Survey of Architectures, Enhancements, and Robustness Frontiers
  4. 2025Enhancing Retrieval-Augmented Generation: A Study of Best Practices
  5. 2024RQ-RAG: Learning to Refine Queries for Retrieval Augmented Generation
  6. 2025OpenRAG: Optimizing RAG End-to-End via In-Context Retrieval Learning
  7. 2025Enhancing Retrieval-Augmented Generation with Two-Stage Retrieval: FlashRank Reranking and Query Expansion
  8. 2024Inference Scaling for Long-Context Retrieval Augmented Generation