potentialpaper

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

Mingchen Li, Jiatan Huang, Chuxu Zhang, Liang Zhao, hong yu

NeurIPS 2026

Edit this page

Or clone it with git

Run in a terminal:

Needs Git LFS. To push, use an API key from your profile as the password.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

Abstract. 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.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

edit · history

DateVersionSubmitted toPDFEvidence
2 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)reviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 3 reviews · OpenReview

Updated 25 Nov 2026, 03:47 UTC.

Program Chairs · DecisionOpenReview ↗
Decision
Accept (poster)
Read decision
Meta-review

summary

This paper studies RAG as an in-context optimization process, proves a gradient descent correspondence in a linearized setting, and proposes RAG-GD to predict context-conditioned LoRA updates for frozen RAG models. The idea is interesting, and the evaluation across seven QA benchmarks, two retrievers, and two backbones is reasonably broad.

reviews summary

The reviews are divided, with scores of 4, 2, and 4. Reviewers appreciate the theory-guided framing and the lower cost compared with test-time SGD, but question whether the practical method is truly derived from the theory or is mainly a generic context-conditioned LoRA predictor. They also note that the gain over the strongest few-shot adapter is small, the results lack variance estimates, the backbones and baselines are not fully current, and the end-to-end efficiency and robustness to noisy retrieval are not sufficiently demonstrated.

need clarifications

  1. isolate the benefit of gradient matching from simply training a context-conditioned LoRA predictor, and explain why one support example already captures most of the gain.
  2. clarify whether the small gain over the base adapter with few-shot examples is practically meaningful, including any available evidence on stronger backbones and the sensitivity to support-example selection.
  3. provide uncertainty estimates or multi-seed results for the main comparisons, especially where the reported improvement is below one point.
  4. report end-to-end latency or compute comparisons with standard RAG and equal-compute baselines, including the forward passes needed to encode support examples, and clarify robustness to irrelevant or conflicting retrieval results.
  5. explain the omission of recent adaptation baselines such as HyperFlow and MAC, and either provide the closest fair comparison or narrow the novelty and superiority claims.

The paper will only be considered if AC and Reviewer YGnV agree that these concerns have been resolved. Otherwise, AC would lean reject.

Final justification

Fortunately, all reviewers agree with accept after the impressive rebuttal of authors. ALL concerns are addressed, AC changes the decision to ACCEPT.

Area Chair VxGb · Meta-reviewOpenReview ↗
Read meta-review
Meta-review

summary

This paper studies RAG as an in-context optimization process, proves a gradient descent correspondence in a linearized setting, and proposes RAG-GD to predict context-conditioned LoRA updates for frozen RAG models. The idea is interesting, and the evaluation across seven QA benchmarks, two retrievers, and two backbones is reasonably broad.

reviews summary

The reviews are divided, with scores of 4, 2, and 4. Reviewers appreciate the theory-guided framing and the lower cost compared with test-time SGD, but question whether the practical method is truly derived from the theory or is mainly a generic context-conditioned LoRA predictor. They also note that the gain over the strongest few-shot adapter is small, the results lack variance estimates, the backbones and baselines are not fully current, and the end-to-end efficiency and robustness to noisy retrieval are not sufficiently demonstrated.

need clarifications

  1. isolate the benefit of gradient matching from simply training a context-conditioned LoRA predictor, and explain why one support example already captures most of the gain.
  2. clarify whether the small gain over the base adapter with few-shot examples is practically meaningful, including any available evidence on stronger backbones and the sensitivity to support-example selection.
  3. provide uncertainty estimates or multi-seed results for the main comparisons, especially where the reported improvement is below one point.
  4. report end-to-end latency or compute comparisons with standard RAG and equal-compute baselines, including the forward passes needed to encode support examples, and clarify robustness to irrelevant or conflicting retrieval results.
  5. explain the omission of recent adaptation baselines such as HyperFlow and MAC, and either provide the closest fair comparison or narrow the novelty and superiority claims.

The paper will only be considered if AC and Reviewer YGnV agree that these concerns have been resolved. Otherwise, AC would lean reject.

Final justification

Fortunately, all reviewers agree with accept after the impressive rebuttal of authors. ALL concerns are addressed, AC changes the decision to ACCEPT.

1 comment
Authors · CommentOpenReview ↗

We sincerely thank the AC and all reviewers for their thoughtful feedback. Their comments helped us improve both the empirical evidence and the presentation of the paper. We are also grateful that Reviewers YGnV and Cicj found our rebuttal helpful, acknowledged the clarifications, and updated their ratings upward.

Our work studies RAG through an in-context optimization lens. We first establish an exact correspondence between linear self-attention and one gradient-descent step on a unified linearized RAG objective, and then characterize where this correspondence holds and breaks beyond the linear regime. Guided by this analysis, we instantiate the idea in real RAG LLMs through RAG-GD, which amortizes the gradient update to the generator-side evidence-use interface without test-time backpropagation. In the rebuttal, we added several experiments and clarifications to address the five main points raised in the meta-review.

  1. Gradient matching and K=1K=1 saturation. In response to Reviewers 1rT4, YGnV, and Cicj, we added a matched task-loss predictor with the same architecture, support context, and training budget. Gradient matching performs better in all four backbone and retriever settings and explains about 65% of the total gain over the Base adapter. We also clarified that the saturation concerns one gradient step, not one support example. TT-SGD shows the same pattern, suggesting that it comes from the underlying gradient dynamics.
  2. Practical meaning of the gain over Base adapter with few-shot prompting. In response to Reviewer YGnV, we evaluated Qwen3-14B. RAG-GD outperforms Base adapter with few-shot prompting on all five tested benchmarks, by 1.45 EM and 1.13 F1 on average. We also repeated NQ with five support draws. RAG-GD maintains a 1.46 EM gain with a 95% confidence interval of [+0.83,+1.91].
  3. Uncertainty estimates for small improvements. In response to Reviewers 1rT4 and Cicj, we repeated the main comparisons under five support draws and added paired bootstrap confidence intervals. RAG-GD wins under every draw for both backbones. The confidence intervals also exclude zero for the smaller gains over HyperTuning and Base adapter with few-shot prompting.
  4. End-to-end cost and retrieval robustness. In response to Reviewers 1rT4 and Cicj, we included the cost of encoding all three demonstrations. This one-time adaptation takes 108 ms and amortizes to 0.03 ms per query on NQ. Per-query generation is only about 10 ms slower than the Base adapter. We also added a summarize-then-answer baseline and retrieval-corruption experiments. RAG-GD remains best under irrelevant retrieval noise. We will limit this claim to irrelevant evidence, since explicitly conflicting evidence was not tested.
  5. HyperFlow, MAC, and the scope of comparison. In response to Reviewer Cicj, we implemented a matched open-loop HyperFlow baseline. RAG-GD improves over it by 1.36 EM and wins on four of five benchmarks. We also clarified that MAC uses persistent document-level memory and query-specific updates, while RAG-GD produces a reusable task-level update from labeled demonstrations. We will explain this difference and avoid claiming direct superiority over MAC.

We appreciate the AC and reviewers for identifying places where the original submission was not sufficiently clear. In the revised paper, we will incorporate these new results and explanations into the main text. We will more carefully describe RAG-GD as a theory-motivated amortized adaptation method, clarify the scope of the theoretical result, and expand the discussions of baselines, statistical stability, robustness, implementation, and deployment cost.

Reviewer CicjOpenReview ↗
Rating
5/6
Confidence
4/5
Quality
3/4
Clarity
4/4
Significance
3/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This study connects the theoretical framework of In-Context Learning (ICL) as implicit gradient descent with the Retrieval-Augmented Generation (RAG). First, the authors mathematically show that a single linear self-attention layer can execute a gradient descent step on a linearized RAG objective for retrieval, then and inspired by this theoretical framing, the authors expand their findings to LLMs. The paper presents RAG-GD: a forward-only adaptation technique that trains and employs a lite-weight predictor network to predict (w/o training) LoRA weight updates for the query, key, and value matrices of a frozen LLM using a few examples. The authors compare RAG-GD with several baselines and show its superiority.

Strengths and weaknesses

Strengths

  • Novelty and Theoretical Rigor: The overall proposal is highly novel and can open up opportunities for further improvement. The mathematical proof adds rigor to the paper and the extension to LLMs is reasonable.

  • Stating Limitations: The researchers are transparent regarding the constraints of their linear theory. They present a diagnostic stress test showing that the correspondence between the theoretical predictor and the trained transformer significantly weakens when dealing with skewed or heavy-tailed feature distributions.

  • Context Length Efficiency: RAG-GD cleverly mitigates the limitations of context length and its associated quadratic cost that is present in traditional RAG, although such limitation might still be present itself elsewhere.

Weaknesses

  • Thin Margins w/o Statistical Variance: The empirical results rely on a single run per configuration due to understandable compute constraints. However, RAG-GD outperforms HyperTuning by only ~0.85% on average (EM). The gain on the held-out PopQA benchmark over the Base adapter is only +1.07 EM. Without error bars or multiple seeds, it is difficult to confidently establish statistical significance.

  • Incomplete Modern Baselines: The authors frame RAG-GD as superior to existing context building methods, but the primary comparison is against Prompt Tuning and HyperTuning, which are quite outdated. The related work section identifies more recent adaptation methods (such as HyperFlow and MAC), but the paper fails to compare RAG-GD against them. One would expect the more recent variants of HyperTuning do better and possibly surpass RAG-GD.

  • Theoretical Leap: Lemma 1 mathematically guarantees the gradient descent equivalence strictly under a squared error loss function. However, the LLM-scale implementation shifts to using cross-entropy loss for token generation. The authors acknowledge this is not a "theorem-preserving lift", but it reduces the LLM methodology to a heuristic inspired by the theory, and not a direct application of it.

Questions
  • Statistical Significance: Can you provide error bars, confidence intervals, or results from multiple seeds for at least cases where the margin is thin?

  • Additional Baselines: Why were methods like HyperFlow or MAC excluded from the experimental setup, and how does RAG-GD's performance compare to them?

  • Robustness to Noisy Retrieval: In traditional RAG, we expect the model to reasonably ignore irrelevant documents, while experiencing some degradation in performance. How does RAG-GD do in the presence of noise? It is possible that updating the weights with irrelevant documents harm the performance more than it would in traditional RAG. An experiment on noisy data can reveal this. If this is the case, can training the MLP on irrelevant retrieved doc mitigate this by teaching it to output zero gradient in such cases?

  • Mathematical Equivalence: Because the projection is linear, if I understand correctly, averaging the MLP outputs and then projecting them should result in the exact same output as projecting each MLP output into LoRA weights individually and then averaging the weights. Is this correct and the observed behaviour in practice?

  • Efficiency-1: The authors argue that RAG-GD is highly efficient because it avoids test-time backpropagation. However, computing the input for the predictor network requires a full LLM forward pass for every support example to extract the EOS hidden state. This will introduce significant latency, potentially making it slower than standard RAG (which requires only a single forward pass over the query and concatenated context). Could the authors provide a wall-clock latency comparison and FLOP count between standard RAG and RAG-GD during inference to justify the efficiency claims?

  • Efficiency-2: Given that extracting the EOS hidden states requires running the LLM over the retrieved documents anyway, a natural and highly practical baseline would be to simply prompt the LLM to summarize or extract the relevant evidence from the documents during these initial forward passes, and then feed those concise summaries into the final generation prompt. Did the authors compare RAG-GD against such a baseline? I expect such a baseline to do better than traditional RAG and am interested to see its performance against RAG-GD.

  • Efficiency-3: It is possible that a standard test time scaling method such as Best of N surpasses RAG-GD, with an equal compute power. Has authors tried any such approach as a baseline?

Limitations

yes

Final justification

I thank the authors for addressing my concerns and answering my questions. I raise my rating to accept.

Formatting concerns

Citation: In Section 5 (lines 237–239) and Section 5.3 (line 262), the authors introduce several major benchmark datasets (NQ, TriviaQA, HotpotQA, 2WikiMultiHopQA, MuSiQue, PopQA, Bamboogle) without inline citations. While these are cited in the appendix, readers expect to find the citations at the very first mention in the main text.

2 comments
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for the thoughtful feedback. We address the concerns on statistical significance, modern baselines, noisy retrieval, mathematical equivalence, and inference-time efficiency below.


For W1 and Q1: Error bars, confidence intervals, and stability of the thin-margin results

We repeated the evaluation under five independent support draws, with all support-conditioned methods receiving the same draw each time. Macro-average EM across seven benchmarks, E5 retrieval:

Backbone Comparator Comparator EM RAG-GD (K=5K=5) Δ\DeltaEM 95% CI Draw wins
Qwen-2.5-7B Base adapter 34.16 36.77±0.1236.77 \pm 0.12 +2.61 [+2.29,+2.91][+2.29,+2.91] 5/5
Qwen-2.5-7B HyperTuning 35.88±0.1635.88 \pm 0.16 36.77±0.1236.77 \pm 0.12 +0.89 [+0.51,+1.26][+0.51,+1.26] 5/5
Qwen-2.5-7B Base adapter + few-shot 36.21±0.1136.21 \pm 0.11 36.77±0.1236.77 \pm 0.12 +0.56 [+0.23,+0.87][+0.23,+0.87] 5/5
Llama-3.1-8B Base adapter 38.86 40.53±0.1740.53 \pm 0.17 +1.67 [+1.28,+2.09][+1.28,+2.09] 5/5
Llama-3.1-8B Base adapter + few-shot 39.89±0.1439.89 \pm 0.14 40.53±0.1740.53 \pm 0.17 +0.64 [+0.28,+0.98][+0.28,+0.98] 5/5

RAG-GD outperforms every comparator under all five draws, and all confidence intervals exclude zero. In particular, the thin margin over HyperTuning remains positive at +0.89 EM, with a 95% CI of [+0.51,+1.26][+0.51,+1.26].

On the reviewer-highlighted PopQA comparison, RAG-GD improves over the fixed Base adapter from 47.05 to 48.12 EM, a gain of +1.07. A paired bootstrap over the 14,267 test questions gives a 95% CI of [+0.45,+1.69][+0.45,+1.69].


For W2 and Q2: Comparison with modern adaptation baselines

Our original experiments focused on methods that could be directly evaluated under the same task-level few-shot RAG protocol. HyperFlow was originally developed for few-shot vision adaptation with trajectory-conditioned parameter flows, while MAC targets online document adaptation through a persistent memory bank. Neither is a direct drop-in baseline for our setting. We agree, however, that HyperFlow provides a relevant comparison because it also amortizes an optimization trajectory.

Our open-loop HyperFlow variant shares the backbone, Base adapter, support encoder, Q/K/V LoRA interface, support sets, and training budget with RAG-GD. RAG-GD predicts the endpoint of a KK-step autograd trajectory, whereas HyperFlow learns step-conditioned drifts and integrates them with Euler updates. The drift is conditioned on the support representation and step index rather than the full evolving parameter state.

Method NQ TriviaQA HotpotQA PopQA Bamboogle Avg.
Base adapter 41.77 63.31 33.78 47.05 18.40 40.86
HyperFlow 39.87 62.51 36.16 48.03 24.80 42.27
RAG-GD (K=5K=5) 42.91 65.98 35.54 48.12 25.60 43.63

HyperFlow improves over the Base adapter by +1.41 EM. RAG-GD further improves over HyperFlow by +1.36 EM and wins on four of five benchmarks.

MAC instead stores document-conditioned modulations in a persistent memory bank and generates query-specific updates. RAG-GD produces one task-level update from three labeled demonstrations and reuses it across queries. A matched comparison would therefore require changing MAC’s supervision and memory protocol. We will add the HyperFlow results and clarify this distinction in the revision.


For W3: Scope of the linear theory and its connection to the cross-entropy LLM setting

We agree that the practical method is a theory-motivated amortized adaptation method, not a direct application of Lemma 1. The linear result provides an exact answer to a design question: where the update should act and what the predictor should approximate to avoid test-time backpropagation. At LLM scale, Eq. 8 independently defines the target as the actual KK-step autograd update of the frozen nonlinear model under answer-token cross-entropy. It does not assume that the linear equivalence continues to hold.

We also directly test whether this gradient-derived target matters. Holding the predictor architecture, parameter count, Base adapter, support context, retrieval cache, training budget, and inference procedure fixed, gradient matching outperforms downstream task-loss supervision in all four backbone–retriever settings. The task-loss predictor improves over the Base adapter by 0.70 EM on average, while gradient matching adds a further 1.28 EM, accounting for about 65% of the aggregate improvement. The additional gain from the gradient target ranges from +0.79 to +2.00 EM.


For Q3: Robustness to noisy retrieval and irrelevant evidence

We test whether adaptation makes the generator more sensitive to noisy query-time retrieval. For each query, we replace rr of the top-5 documents with the top-1 retrieved document of another query from the same benchmark. Corruption is seeded per query, so all methods receive identical corrupted contexts. We report average EM across seven benchmarks using Qwen-2.5-7B with E5 retrieval.

Method r=0r=0 r=1r=1 r=3r=3 r=5r=5
Vanilla RAG 32.61 30.57 (93.7%) 26.40 (81.0%) 19.12 (58.6%)
Base adapter 34.16 32.01 (93.7%) 27.52 (80.6%) 21.07 (61.7%)
RAG-GD (K=5K=5) 36.71 34.09 (92.9%) 30.38 (82.8%) 23.88 (65.1%)

RAG-GD achieves the highest EM at every corruption level. Its retention is comparable to Vanilla RAG under mild corruption and higher under severe corruption. At r=5r=5, it retains 65.1% of its clean performance, compared with 58.6% for Vanilla RAG. Thus, a clean support-derived update does not increase sensitivity to irrelevant query-time context.

This experiment keeps the support demonstrations clean and does not test harmful updates from noisy support evidence. As future work, we will investigate training the predictor on corrupted supports to suppress updates when the evidence is uninformative.


For Q4: Whether pooling before projection is equivalent to averaging per-example LoRA updates

The proposed equivalence would hold only if the entire map from each demonstration representation hih_i to the full update ΔW\Delta W were linear. Our computation is nonlinear at two points. We first pool the EOS states and apply the post-pooling predictor once:

hˉ(C)=1N∑ihi,(Uℓ,π,Vℓ,π)=fϕ(hˉ(C)),ΔWℓ,π=Uℓ,πVℓ,π⊤.\bar h(C)=\frac{1}{N}\sum_i h_i,\qquad (U_{\ell,\pi},V_{\ell,\pi})=f_\phi(\bar h(C)), \qquad \Delta W_{\ell,\pi}=U_{\ell,\pi}V_{\ell,\pi}^{\top}.

This is not equivalent to predicting an update for each demonstration and averaging afterward. The predictor fϕf_\phi contains a nonlinear MLP, and the LoRA reconstruction is bilinear:

fϕ(1N∑ihi)≠1N∑ifϕ(hi),f_\phi\left(\frac{1}{N}\sum_i h_i\right) \neq \frac{1}{N}\sum_i f_\phi(h_i),
1N∑iUiVi⊤≠(1N∑iUi)(1N∑iVi)⊤.\frac{1}{N}\sum_i U_iV_i^\top \neq \left(\frac{1}{N}\sum_i U_i\right) \left(\frac{1}{N}\sum_i V_i\right)^\top.

Thus, the two procedures differ analytically and are not expected to coincide in practice. Our implementation uses the pool-then-predict procedure. We will clarify the pooling position and computation order in Section 5.2.


For Q5, Q6 and Q7: End-to-end inference efficiency and compute-matched baselines

Latency and compute. The support encoding cost is incurred once per task, not once per query. RAG-GD encodes N=3N=3 demonstrations, predicts one task-level update, and reuses it for all test queries. On NQ with Qwen-2.5-7B, E5 retrieval, and an A100, this one-time adaptation takes 108 ms. Amortized over 3,610 queries, the overhead is 0.03 ms per query. Per-query generation takes 317 ms, compared with 307 ms for the Base adapter and 294 ms for Vanilla RAG. Thus, RAG-GD adds only 3.3% latency over the Base adapter, with nearly unchanged peak memory (5.53 vs. 5.50 GB).

Under the same protocol, TT-SGD requires 18.6 GB to produce the task-level update, compared with 5.53 GB for RAG-GD. In compute terms, RAG-GD adds three support prefills and one small predictor pass once per task, with no backward pass. Its amortized additional LLM compute is therefore 3Fsupport/M3F_{\mathrm{support}}/M per query for a task with MM test queries. We will add the wall-clock, memory, and token-normalized FLOP analysis to the revision.

Summarize-then-answer. Because support documents address different questions, their summaries cannot replace evidence for a new query. We therefore evaluate the reviewer-suggested practical query-specific version: summarize each query’s retrieved documents, then answer from the summary. This requires an additional autoregressive stage beyond RAG-GD’s non-generative support encoding.

Method NQ HotpotQA NQ latency/query
Vanilla RAG 39.16 32.45 0.29 s
Summarize-then-answer 33.89 31.30 1.57 s
RAG-GD (K=5K=5) 42.91 35.54 0.32 s

In these two extractive QA benchmarks, summarization does not improve accuracy and substantially increases latency, likely because compression can remove answer-bearing details. We will include this baseline and its prompt in the revision.

Best-of-NN. Due to the limited rebuttal window, we could not complete a reliable Best-of-NN evaluation. RAG-GD adds a one-time 108 ms adaptation cost and about 10 ms per query, whereas each additional Best-of-NN sample requires another full generation and answer selection. A strict compute match therefore leaves little budget for N>1N>1. We do not claim superiority over unrestricted test-time scaling, and the two approaches are complementary.


We thank the reviewer again for the detailed feedback. In the revised paper, we will incorporate the additional experiments and clarifications above to strengthen the empirical evidence, sharpen the efficiency claims, and more clearly define the scope of the theory-guided LLM method.

Authors · CommentOpenReview ↗

Thank you for updating your score. We sincerely appreciate your constructive feedback and will incorporate the promised clarifications into the revised manuscript.

Reviewer YGnVOpenReview ↗
Rating
4/6
Confidence
3/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
2/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This paper studies how to more efficiently do test-time gradient adaptation in in-context learning when the few shot examples come with RAG-ed contexts. It first shows in a theoretic proof that "one linear self-attention layer can implement one gradient-descent step" in a simplified linearized RAG setting and studies how well it holds when switching to more complex settings. It then proposes a method to do in-context learning with RAG in real LLM setting: training a lightweight model that predicts the LoRA matrices on QKV using only few shot examples with RAG that try to match the LoRA matrices learned by doing a few back-propagation. This way, it avoids doing more expensive back-propagation during inference time.

Strengths and weaknesses

Strengths:

  1. This paper has both a theoretical section and experiment section. More importantly, the paper has a section of testing the boundary on how well the theory holds when the setting becomes more complex (closer to real world use case) and when it starts to break
  2. By training a lightweight predictor to emit a LoRA update in a single forward pass, the method achieves performance that approaches expensive test-time gradient adaptation (TT-SGD) but at a fraction of the per-query inference cost.

Weaknesses:

  1. Old & relatively weak base model: this paper is based on two base models Qwen 2.5-7B and Llama 3.1-8B. Both are very old models (more than 1.5 years old) and relatively on the small side. Have the authors tried using latest and more powerful base models? The reason is that with a stronger base model with better post training, the "Base adapter + few shot" (or even "Vanilla RAG + few shot") method may become a lot better by simply feeding all the few shot examples with their RAG-ed contexts into the llm. Especially in table 3 in the appendix, it actually shows that the proposed method in this paper is only marginally better than "Base adapter + few shot" (36.71 vs 36.22). So the conclusion is likely to flip when switching to better base models. Also, it should be clearly stated in the main paper instead of in appendix what the actual gain over "Base adapter + few shot" is.
  2. Weak connection between theory and experiment: the theory (lemma 1) is too simplified to represent real world use case. It doesn't even represent real RAG, only a linearized version of RAG. Also, section 4.3 actually shows that this simplified version doesn't hold so well in more complex cases and real LLM use cases are definitely even more complex than those cases in section 4.3.
  3. Less robust metrics used: this paper only uses Exact Match and token-overlap F1 as metrics which are both based on simple matching. Are those robust to slight rewriting and rephrasing, e.g. "USA" vs "United States of America"? Have the authors considered more robust metrics, e.g. LLM-as-judge?
  4. (In)sensitivity to "k": the data in this paper shows that k=1 already captures most of the gain and further increasing k to 5 doesn't do much. It may be a good thing from the training cost perspective but it might also indicate this proposed method isn't really learning the backpropogation dynamics and maybe just learns some simple conditioner for this task.
  5. Sensitivity of few shot examples: this paper selects 3 few shot examples during inference time. How are those 3 selected? How sensitive it is?
Questions

(Same as weakness:)

  1. Old & relatively weak base model: could the authors add experiments using latest and stronger base models?
  2. Less robust metrics used: have the authors considered adding more robust metrics, e.g. LLM-as-judge?
  3. Sensitivity of few shot examples: this paper selects 3 few shot examples during inference time. How are those 3 selected? How sensitive it is?
Limitations

Yes

Final justification

The rebuttal from the author addressed most of my concerns, mainly whether the metric gains hold for a stronger base model, and whether the insensitivity to k means just a context conditioner. The new evidence in the rebuttal resolves those two key questions and hence I will raise my final score to 4.

Formatting concerns

N/A

3 comments
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for recognizing the value of our boundary analysis and forward-only adaptation framework, and for the constructive suggestions to evaluate a newer and stronger backbone, strengthen the theory–experiment connection, add semantic evaluation metrics, analyze sensitivity to KK, and clarify the selection and stability of the support demonstrations.


For W1 and Q1: Backbone recency, stronger-model validation, and few-shot baselines

We tested the key comparison on Qwen3-14B using E5 retrieval and the same protocol. We evaluate five of the seven benchmarks and report EM/F1.

Method NQ TriviaQA HotpotQA PopQA Bamboogle Avg.
Vanilla RAG 39.03/51.81 63.59/71.48 37.81/49.14 39.79/51.98 23.20/31.05 40.68/51.09
Vanilla RAG + few-shot 41.31/52.60 65.41/72.18 38.10/49.48 42.51/53.41 22.40/32.21 41.95/51.98
Base adapter 44.30/54.84 64.92/73.53 41.09/53.50 49.38/57.16 28.80/44.17 45.70/56.64
Base adapter + few-shot 44.62/55.35 65.11/73.51 40.58/52.80 50.39/57.77 29.60/44.61 46.06/56.81
RAG-GD (K=5K=5) 45.24/55.62 66.42/74.94 42.11/54.66 51.80/57.83 32.00/46.65 47.51/57.94

The conclusion does not flip on the newer backbone. Our Method RAG-GD outperforms Base adapter + few-shot on all five benchmarks, by +1.45 EM and +1.13 F1 on average. The corresponding EM margin on Qwen2.5-7B is +0.57 over the same five benchmarks, so the advantage increases on Qwen3-14B.

The stronger backbone does use demonstrations more effectively in Vanilla RAG, where the few-shot gain changes from -0.44 to +1.27 EM. However, the marginal gain of few-shot prompting on top of the Base adapter decreases from +2.20 to +0.36 EM. Thus, stronger post-training improves direct prompting but does not eliminate the benefit of RAG-GD.


For W2: Scope of the linear theory and its connection to the LLM-scale method

We agree that Lemma 1 holds only in a linearized setting and is not a model of real RAG systems. It may help to state the role it actually plays in the design. Our goal is to avoid test-time backpropagation in RAG. Since ICL adapts through forward computation alone, we asked whether a forward update could replace test-time gradient steps, and Lemma 1 answers this exactly in the linearized setting: one linear self-attention layer provably implements one gradient-descent step on the unified RAG objective. This equivalence relies on linearity and does not transfer to real systems, but it yields two design decisions we carry forward: the support-induced update acts on the query–evidence interaction, which tells us where to adapt; and that update is a gradient-descent step, which tells us what the predictor should be trained to produce. Section 4.3 then maps where the exact correspondence stops holding. This boundary is precisely why the LLM-scale method does not assume the equivalence: Eq. 8 computes the actual K-step update by autograd under answer-token cross-entropy, a target that is well defined on the real nonlinear model, and the predictor is trained to match it.

Whether this gradient-derived target adds value beyond a learned context-conditioned predictor is testable. We ran a matched ablation in which the task-loss predictor shares the context encoder, update heads, LoRA rank, base adapter, retrieval cache, support examples, training budget, and inference procedure with RAG-GD. The only difference is the supervision signal.

Backbone Retriever Base adapter Task-loss predictor RAG-GD Predictor gain Gradient-target gain
Qwen-2.5-7B E5 34.16 34.71 36.71 +0.55 +2.00
Qwen-2.5-7B BM25 29.71 31.03 32.43 +1.32 +1.40
Llama-3.1-8B E5 38.86 39.61 40.54 +0.75 +0.93
Llama-3.1-8B BM25 35.86 36.04 36.83 +0.18 +0.79

Gradient matching outperforms the matched task-loss predictor in all four backbone–retriever configurations. Across the four settings, it accounts for about 65% of the aggregate improvement over the Base adapter. The TT-SGD comparison provides complementary evidence that RAG-GD captures the performance effect of the non-amortized autograd update.

We will revise the framing from “theory-to-practice” to “theory-motivated design” and present Lemma 1 as analytical motivation for the method’s adaptation site and supervision target.


For W3 and Q2: Semantic robustness of the evaluation metrics

We agree that EM can miss semantically correct answers with aliases, inflections, or paraphrases. We therefore added a reference-based LLM-judge evaluation using Qwen2.5-32B-Instruct with deterministic decoding. Given the question, gold answer, and prediction, the judge determines whether the prediction is semantically equivalent to the reference. Results are macro-averaged across the same seven benchmarks with E5 retrieval.

Method EM F1 LLM-judge accuracy
Vanilla RAG 32.61 40.60 41.25
Base adapter 34.16 42.54 43.88
Base adapter + few-shot 36.22 44.75 45.38
HyperTuning 35.85 44.21 44.91
RAG-GD (K=5K=5) 36.71 45.11 46.04

The judge recovers about nine additional points of semantically correct answers for all methods, confirming that EM is conservative. The ranking remains unchanged, and RAG-GD performs best under EM, F1, and judge accuracy.

Representative EM false negatives include “International Whaling Commission” for “The International Whaling Commission or IWC,” “documentaries” for “documentary,” and “health points” for “hit points or health points.” These errors mainly reflect aliases, inflections, and reference formatting.


For W4: KK-sensitivity and whether RAG-GD tracks gradient dynamics

We agree that K=1K=1 captures most of the gain. To test whether this reflects a limitation of the predictor or the update itself, we compared RAG-GD with TT-SGD (actual KK-step gradient descent on the support context at test time) under the same support context, learning rate, and configuration. Results are average EM across seven benchmarks using Qwen-2.5-7B with E5 retrieval.

Method K=1K=1 K=5K=5 K=10K=10
TT-SGD 36.12 36.54 36.58
RAG-GD 36.35 36.71 36.68

TT-SGD shows the same saturation pattern as RAG-GD. From K=1K=1 to K=5K=5, TT-SGD gains +0.42 EM and RAG-GD gains +0.36. From K=5K=5 to K=10K=10, the changes are only +0.04 and -0.03. The saturation is therefore already present in the real test-time update, rather than being introduced by amortization.

The target geometry supports this interpretation. The cosine similarities between ΔWGD1\Delta W_{\mathrm{GD}}^1, ΔWGD5\Delta W_{\mathrm{GD}}^5, and ΔWGD10\Delta W_{\mathrm{GD}}^{10} are 0.887, 0.779, and 0.961, respectively. Although the update norm grows by 3.24×3.24\times at K=5K=5 and 5.05×5.05\times at K=10K=10 relative to K=1K=1, later steps largely continue along a similar direction and provide little additional downstream gain. This is consistent with a locally stable cumulative update direction around the shared base adapter.

The matched ablation in W2 further rules out the simple-conditioner explanation: with the same predictor architecture and parameter count, gradient matching outperforms task-loss supervision in all four settings. Together, the results show that RAG-GD mirrors the KK-sensitivity of TT-SGD and gains specifically from the gradient-derived target. We will clarify that KK denotes target update depth rather than a tuned hyperparameter.


For W5: Selection and sensitivity of the few-shot demonstrations

The three demonstrations are sampled uniformly without replacement from the task support pool, with no ranking, weighting, or query-dependent selection. One support set is sampled per task and reused for all test queries. The support size is fixed at N=3N=3 throughout.

To measure sensitivity to the sampled demonstrations, we repeated the NQ evaluation with five independent support draws. Both methods use the same draw in each repetition. Results use Qwen-2.5-7B with E5 retrieval:

Method EM F1
Base adapter + few-shot 41.39±0.1741.39 \pm 0.17 51.29±0.1951.29 \pm 0.19
RAG-GD (K=5K=5) 42.85±0.0942.85 \pm 0.09 52.65±0.0852.65 \pm 0.08

Standard deviations are computed across the five draws. Both methods are stable under support resampling, while RAG-GD maintains a consistent advantage. The paired EM difference is +1.46, with a 95% bootstrap confidence interval of [+0.83,+1.91][+0.83,+1.91] over test queries.


We thank the reviewer again for the constructive feedback. In the revised paper, we will incorporate the new Qwen3-14B results, LLM-judge evaluation, KK-sensitivity diagnostics, and support-resampling analysis, while more clearly positioning the linear result as a design motivation rather than a literal model of LLM computation.

Reviewer YGnV · CommentOpenReview ↗

Thank you for the response. Most of my concerns have been addressed by the new evidence and I have raised my score to 4.

Authors · CommentOpenReview ↗

Thank you for your follow-up and for reconsidering the score. We appreciate your constructive feedback and will incorporate the promised clarifications in the revision.

Reviewer 1rT4OpenReview ↗
Rating
4/6
Confidence
3/5
Quality
3/4
Clarity
2/4
Significance
3/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This work addresses the central challenge of adapting how a frozen RAG model uses retrieved evidence without test-time backpropagation. The paper first proves that linear self-attention can implement one gradient-descent step on a linearized RAG objective, then uses that view to motivate RAG-GD: a predictor that emits a context-conditioned LoRA update to a generator-side evidence-use interface. The claims of the paper are that this improves over base RAG/adapters across seven QA datasets, two retrievers, and two frozen LLMs, approaching test-time SGD at lower deployment cost.

Strengths and weaknesses

The paper connects theory and practice in an interesting way. It clarifies that it does not claim that LLMs literally perform gradient descent; instead, it uses the linear result as a design guide. The experimental setup is broad: NQ, TriviaQA, PopQA, HotpotQA, 2WikiMultiHopQA, MuSiQue, and Bamboogle, with BM25/E5 and Qwen/Llama backbones. The deployment story is attractive: the update is predicted in one forward pass and avoids backward passes through the LLM.

The bridge between the linear theory and real LLM RAG is a bit loose. The practical method is closer to amortized test-time adaptation / hypernetwork-predicted LoRA than a direct implementation of the theorem. Additional context-conditioned baselines are only run on Qwen due to compute constraints, which weakens the comparative picture. The gains over the base adapter are consistent but not very large, so statistical significance and per-task failure cases should be clearer.

Questions
  • How much of the gain comes from the gradient-matching target versus simply adding a learned context-conditioned LoRA predictor?
  • Does RAG-GD remain robust when retrieved documents contain distractors or conflicting evidence?
Limitations

None

Formatting concerns

None

1 comment
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for recognizing the paper’s theory-guided design, broad experimental coverage, and efficient forward-only deployment, and for the constructive suggestions to clarify the theory-to-practice connection, isolate the contribution of gradient matching, extend the context-conditioned baselines, and strengthen the robustness and statistical analyses.


For W1: Connection between the linear analysis and the practical method

We agree that the practical method is amortized test-time adaptation through a context-conditioned LoRA predictor, not a direct implementation of Lemma 1. What the linear analysis contributes is two design decisions. It tells us where to adapt: the update induced by support examples acts on the query–evidence interaction, so we adapt the generator-side evidence-use interface. And it tells us what to predict: in the linear setting that update is a gradient-descent step, so we train the predictor to match the K-step gradient update rather than a downstream task loss.

The second decision is testable, and the matched ablation in our response to Q1 tests it. With the predictor architecture, parameter count, support context, training budget, and inference procedure all fixed, changing only the supervision signal from task loss to gradient matching improves EM in all four backbone–retriever settings. The predictor architecture alone does not explain the gain; the gradient-derived target does.


For W2: Context-conditioned baselines on Llama

We have now run the full set of context-conditioned baselines on Llama-3.1-8B, using E5 retrieval and the same protocol as the Qwen experiments.

Method NQ TriviaQA PopQA HotpotQA 2Wiki MuSiQue Bamboogle Avg.
Vanilla RAG + few-shot 41.98 65.77 47.75 35.80 25.15 7.32 26.40 35.74
Prompt tuning 41.90 64.60 49.91 34.59 32.49 11.22 26.40 37.30
HyperTuning 43.21 62.09 50.33 36.80 33.18 12.02 29.60 38.18
Base adapter + few-shot 44.03 65.82 52.69 38.78 34.06 12.09 32.00 39.92
RAG-GD (K=5K=5) 45.68 67.66 52.31 39.01 33.94 13.20 32.00 40.54

The ordering matches the Qwen results. RAG-GD outperforms HyperTuning on all seven benchmarks by +2.36 EM on average, and exceeds the strongest baseline, Base adapter + few-shot, by +0.62 EM. The corresponding margin on Qwen is +0.49, showing a consistent effect across both backbones. We will add these results to the revision.


For W3: Statistical stability and per-task consistency

We repeated RAG-GD under five independent draws of the support demonstrations. The Base adapter does not use support examples and uses deterministic decoding, so its predictions are fixed across draws. Results report average EM across seven benchmarks with E5 retrieval.

Backbone Base adapter RAG-GD (K=5K=5) Δ\DeltaEM 95% CI Draw wins
Qwen-2.5-7B 34.16 36.77±0.1236.77 \pm 0.12 +2.61 [+2.29,+2.91][+2.29,+2.91] 5/5
Llama-3.1-8B 38.86 40.53±0.1740.53 \pm 0.17 +1.67 [+1.28,+2.09][+1.28,+2.09] 5/5

Standard deviations are computed across support draws. The confidence intervals are obtained by paired bootstrap resampling over test queries, comparing the fixed Base adapter predictions with RAG-GD performance averaged across the five support draws. RAG-GD outperforms the Base adapter under every draw for both backbones.

The improvement is also consistent across tasks. Across the 28 benchmark–backbone–retriever cells in Table 2, RAG-GD improves EM in 27 cells and F1 in 26. The only EM regression is on Bamboogle with Llama/BM25, where the difference corresponds to two of the 125 test questions.


For Q1: Contribution of the gradient-matching target

We ran a controlled supervision-signal ablation using the same context encoder, update heads, LoRA rank, base adapter, retrieval cache, support examples, training budget, and inference procedure as RAG-GD. The only difference is the objective: downstream answer loss versus matching the autograd-defined KK-step LoRA update.

We decompose the total improvement over the static Base adapter as:

RAG-GD−Base=(Task-loss predictor−Base)+(RAG-GD−Task-loss predictor).\text{RAG-GD} - \text{Base}=(\text{Task-loss predictor} - \text{Base})+(\text{RAG-GD} - \text{Task-loss predictor}).

Backbone Retriever Base adapter Task-loss predictor RAG-GD Predictor gain Gradient-target gain
Qwen-2.5-7B E5 34.16 34.71 36.71 +0.55 +2.00
Qwen-2.5-7B BM25 29.71 31.03 32.43 +1.32 +1.40
Llama-3.1-8B E5 38.86 39.61 40.54 +0.75 +0.93
Llama-3.1-8B BM25 35.86 36.04 36.83 +0.18 +0.79

Across the four settings, the total improvement over the Base adapter is +1.98 EM on average. Of this, +0.70 comes from adding the predictor and +1.28 comes from gradient matching. Thus, approximately 65% of the aggregate gain is attributable to the gradient-derived target. Gradient matching also outperforms the matched task-loss predictor in all four settings.


For Q2: Robustness to retrieval corruption

We directly evaluate robustness to retrieval distractors. For each test query, we replace rr of the top-5 retrieved documents with the top-1 retrieved document of another query from the same benchmark. Replacement keeps the document count and context budget fixed. Corrupted positions are sampled uniformly and seeded per query, so all methods receive identical corrupted contexts. The support demonstrations remain clean.

Results are average EM across seven benchmarks using Qwen-2.5-7B with E5 retrieval. Parentheses report retention relative to clean performance.

Method r=0r=0 r=1r=1 r=3r=3 r=5r=5
Vanilla RAG 32.61 30.57 (93.7%) 26.40 (81.0%) 19.12 (58.6%)
Base adapter 34.16 32.01 (93.7%) 27.52 (80.6%) 21.07 (61.7%)
RAG-GD (K=5K=5) 36.71 34.09 (92.9%) 30.38 (82.8%) 23.88 (65.1%)

RAG-GD achieves the highest EM at every corruption level. Under mild corruption, its retention is comparable to the baselines. Under heavier corruption, it retains a larger fraction of its clean performance. When all five documents are replaced, RAG-GD retains 65.1% of its clean EM, compared with 61.7% for the Base adapter and 58.6% for Vanilla RAG. It exceeds the Base adapter by 2.81 EM, or 13.3% relative.

These results show that RAG-GD preserves its advantage under irrelevant retrieval distractors and does not become more sensitive to noisy query-time context after adaptation. This experiment does not isolate passages that explicitly support an incorrect answer, which represent a distinct and harder conflicting-evidence setting. We will clarify this scope and avoid claiming robustness to explicit conflicts without a dedicated evaluation.


We thank the reviewer again for the constructive feedback. In the revised paper, we will incorporate the new controlled ablations, second-backbone comparisons, confidence intervals, and retrieval-corruption results, while more clearly framing RAG-GD as a theory-motivated amortized adaptation method.

Comments on the paper

1 comment
Area Chair VxGb · CommentOpenReview ↗

As rebuttal is coming to an end, plz reply author's rebuttals

Thanks,

AC

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Missing a submission?

Loading the discussion…