potentialpaper

One for All: A Non-Linear Transformer can enable Cross-Domain Generalization for In-Context Reinforcement Learning

Bowen He, Juncheng Dong, Lin Lin, Xiang Cheng

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.

TL;DR. We study non-linear transformers for in-context reinforcement learning and show that a single model can achieve strong generalization when viewed through a kernel-based perspective.

Abstract. A central challenge in reinforcement learning (RL) is to learn models that generalize beyond the tasks on which they are trained, a goal traditionally pursued through multi-task and meta RL. Recently, transformer architectures have emerged as a promising approach, enabling adaptation to new tasks via in-context learning without explicit parameter updates. From a functional perspective, a transformer can be viewed as a functional operator that maps a context to a task-specific function. It is thus fundamental to understand and design this operator to support stronger generalization in RL. In this work, we address this resulting question of generalization from a kernel-based perspective by establishing a connection between non-linear transformers and kernel-based temporal difference learning. By interpreting the transformer as performing regression in a Reproducing Kernel Hilbert Space (RKHS), we show that value functions from different domains can be represented using a shared set of weights, provided they lie within the same RKHS. Experiments on multiple MetaWorld domains support this interpretation, demonstrating convergence of the temporal-difference objective.

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
3 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)reviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 4 reviews · OpenReview

Updated 25 Nov 2026, 03:46 UTC.

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

Summary: The paper investigates in-context RL capabilities of non-linear transformers. The paper shows that there exists a transformer model with fixed weights capable of performing kernel TD updates with a non-linear kernel in-context. This yields accurate approximations of value function within the corresponding RKHS. The paper supports this claim with experimental results on Meta World environments.


Strengths: The paper provides a novel perspective on in-context reinforcement learning. The reviewers highlighted the elegance of the theoretical framework and the insights behind the results (Reviewers 86Ym, Mr2p, qfjb), as well as the thoughtfulness of the experimental design (Reviewers 86Ym, fWjb). Furthermore, reviewers acknowledged empirical support for the developed theory (Reviewers 86Ym, MR2p, qfjb).


Weaknesses: The reviewers have expressed several concerns about the current version of the paper, out of which the following appear most important. As noted by all the reviewers, the paper focuses on policy evaluation, providing little insight into policy improvement; the authors are encouraged to more clearly discuss (and ideally demonstrate through additional experiments) the practical importance of the results. The main theorem focuses on proving the existence of a model with weights that enable TD learning, rather than showing how to train a transformer with such weights (as noted by Reviewers qfjb, fWjb). The authors are encouraged to more clearly acknowledge this limitation and provide a discussion on possible extensions of the current results that would address it. As per the comments made by Reviewers MR2p and qfjb, additional baselines, in particular, those based on kernel TD, appear important for understanding the empirical performance of the approach. The authors are encouraged to expand the empirical analysis accordingly. The authors are also encouraged to address other comments and questions, including those indicating potential discrepancy between the transformer architecture considered and those typically used in real-world applications (Reviewer fWjb).

Final justification

The authors have provided a thoughtful rebuttal, which includes additional experimental results that address some of the main concerns and questions about the experiments raised by the reviewers (e.g., regarding the value prediction error and the comparison to the classic TD kernel baseline). The authors have also provided a discussion about extending the results to the control setting, which more clearly acknowledges the corresponding limitation of their work (i.e., the paper's focus on policy evaluation). In addition, they have provided further comments on the nature of their main theoretical result, explaining more clearly the value of their existence result and the challenges associated with considering end-to-end training. Overall, this is a borderline paper: the reviewers appear generally positive about the work while recognizing its limitations. The authors are encouraged to revise the manuscript to incorporate the new results and discussion points from the rebuttal.

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

Summary: The paper investigates in-context RL capabilities of non-linear transformers. The paper shows that there exists a transformer model with fixed weights capable of performing kernel TD updates with a non-linear kernel in-context. This yields accurate approximations of value function within the corresponding RKHS. The paper supports this claim with experimental results on Meta World environments.


Strengths: The paper provides a novel perspective on in-context reinforcement learning. The reviewers highlighted the elegance of the theoretical framework and the insights behind the results (Reviewers 86Ym, Mr2p, qfjb), as well as the thoughtfulness of the experimental design (Reviewers 86Ym, fWjb). Furthermore, reviewers acknowledged empirical support for the developed theory (Reviewers 86Ym, MR2p, qfjb).


Weaknesses: The reviewers have expressed several concerns about the current version of the paper, out of which the following appear most important. As noted by all the reviewers, the paper focuses on policy evaluation, providing little insight into policy improvement; the authors are encouraged to more clearly discuss (and ideally demonstrate through additional experiments) the practical importance of the results. The main theorem focuses on proving the existence of a model with weights that enable TD learning, rather than showing how to train a transformer with such weights (as noted by Reviewers qfjb, fWjb). The authors are encouraged to more clearly acknowledge this limitation and provide a discussion on possible extensions of the current results that would address it. As per the comments made by Reviewers MR2p and qfjb, additional baselines, in particular, those based on kernel TD, appear important for understanding the empirical performance of the approach. The authors are encouraged to expand the empirical analysis accordingly. The authors are also encouraged to address other comments and questions, including those indicating potential discrepancy between the transformer architecture considered and those typically used in real-world applications (Reviewer fWjb).

Final justification

The authors have provided a thoughtful rebuttal, which includes additional experimental results that address some of the main concerns and questions about the experiments raised by the reviewers (e.g., regarding the value prediction error and the comparison to the classic TD kernel baseline). The authors have also provided a discussion about extending the results to the control setting, which more clearly acknowledges the corresponding limitation of their work (i.e., the paper's focus on policy evaluation). In addition, they have provided further comments on the nature of their main theoretical result, explaining more clearly the value of their existence result and the challenges associated with considering end-to-end training. Overall, this is a borderline paper: the reviewers appear generally positive about the work while recognizing its limitations. The authors are encouraged to revise the manuscript to incorporate the new results and discussion points from the rebuttal.

1 comment
Authors · CommentOpenReview ↗

Thanks

Dear AC and reviewers.

We would like to briefly summarize the outcome of the discussion period. As of this message, all four reviewers remain positive on the paper: Reviewers 86Ym and fWjb have confirmed that their concerns are resolved and will maintain their scores, and Reviewer qfjb has raised their score following our responses. We have also provided detailed responses to Reviewer Mr2p addressing each of the points raised.

We would like to note that the reviews we received are among the highest quality we have encountered. The comments were precise and constructive, and engaging with them has substantially improved our work: they prompted us to clarify the positioning of our contribution, to add further clarifications and experiments, and to state more explicitly the open problems and difficulties that remain for future work.

We are grateful to the reviewers and the AC for the care they have taken with this submission. The experience has been encouraging and has motivated us to further strengthen our research going forward.

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

This article investigates why nonlinear Transformers can achieve cross-domain generalization from the perspective of Reproducing Kernel Hilbert Space (RKHS). The theoretical results in the paper primarily focus on policy evaluation, proving the existence of a set of parameters that can successfully implement TD updates in-context. These theoretical findings were also validated in Meta-World and a synthetic environment. Overall, this work makes a timely contribution by extending the in-context learning capabilities of Transformers from linear to nonlinear cases in theory.

Strengths and weaknesses

Strengths

  1. The perspective of using Reproducing Kernel Hilbert Space (RKHS) to study the in-context learning behavior of Transformers is novel and well-motivated.
  2. The theoretical results in the paper align closely with the experimental findings. In addition to testing on the relatively realistic Meta-World benchmark across various noise levels through extensive experiments on both in-domain and cross-domain generalization, they also utilized a synthetic environment to visualize the landscape of the value function obtained by the Transformer through in-context learning.
  3. The authors provided a comprehensive experimental setup and detailed parameter settings required to reproduce their results.

Weaknesses

  1. The paper primarily focuses on policy evaluation. It does not provide relevant results for policy improvement.
  2. There is a discrepancy between the Transformer architecture considered in this paper and the one used in real-world applications. For instance, regarding the non-linear activation functions: while the Softmax function is standard in practice, this paper considers an exponential activation without normalization. A Softmax function with normalization clearly does not satisfy the Reproducing Kernel Hilbert Space (RKHS) assumptions used here.
  3. Regarding the main theoretical results, specifically Theorem 3.1: the authors only prove that there exists a set of Transformer parameters capable of implementing the corresponding TD iteration to represent the TD value. However, it remains unclear how such parameters could actually be obtained through training.
Questions
  1. In Theorem 3.1, the author states that the last row contains the TD values for every state. However, it seems to me that the last row should only contain the TD values (specifically the TD residuals) for the states along the trajectory. This phrasing seems a bit imprecise. Can the authors further discuss this point?

  2. Regarding the state value function for the current query state, it involves values from the padding states. How are these padding state values selected? Since the evaluation and TD updates only follow a single trajectory, would the padding state values differ across different trajectories? If so, does that imply the constant bias in the value function estimate would also vary between trajectories?

  3. In Section 5.2, how exactly is the TD error in the figures calculated? Is it a direct average of the last row of the generated output matrix (the ZlZ_l matrix)? If that is the case, a decrease in this average only means that the values in the last row are shrinking; it doesn't prove that the actual policy evaluation is becoming more accurate.

  4. Regarding the MetaWorld experiments: for a given domain's training environment, are you randomly sampling from all 50 tasks, or are you selecting a single task from those 50 and adding high-level noise to it for training?

Limitations

yes

Final justification

The rebuttal addressed most of my concerns. In my opinion, this paper is well motivated and self-contained, and it makes a meaningful contribution by extending theoretical results on in-context learning from linear to nonlinear settings.

Formatting concerns

no

5 comments
Authors · CommentOpenReview ↗

Rebuttal-1

We thank the reviewer for the questions raised and for their positive assessment of our work's contribution. We address each concern below.

Answer to W1. Extension to the control setting.

We kindly refer the reviewer to our response to Reviewer 86YM, specifically section Q2, for a discussion of the current state of the literature and potential extensions to the control setting.

Answer to W2. Change to softmax activation.

We kindly refer the reviewer to our response to Reviewer Mr2p, specifically Section Q1, for a discussion of using softmax as the activation function, relevant literature, and potential directions for future work.

Answer to Q1. The last row of the matrix.

Thank you for pointing this out. We agree that the phrase "the last row contains the TD values for every state" is imprecise.

More precisely, for each context column i∈0,…,n−1i \in \\{0,\ldots,n-1\\}, the last-row entry is the TD residual associated with the corresponding trajectory transitions,

bℓ(i)=r(i)+γvℓ(i+1)−vℓ(i).b_{\ell}^{(i)} = r^{(i)} + \gamma v_{\ell}^{(i+1)} - v_{\ell}^{(i)}.

Thus, these entries contain the TD residuals for the transitions included in the context trajectory, rather than value estimates for every state in the state space. The final column has a different interpretation: it contains

−vℓ(n)+γvℓ(pad),-v_{\ell}^{(n)} + \gamma v_{\ell}^{(\mathrm{pad})},

whose negative gives the query-state value estimate up to the state-independent padding offset discussed in the limitations section.

The construction can evaluate an arbitrary query state by placing that state in the query column, but it does not simultaneously store value estimates for all states. We will revise the wording in the theorem and the surrounding discussion to make this distinction explicit.

Answer to Q2. The padding values for the query state.

We clarify that the padding state is not selected separately for each trajectory. Following the standard convention in in-context learning, s(pad)s^{(\mathrm{pad})} is chosen as a fixed vector shared across all inputs; a natural choice is the all-zero vector.

With s(pad)=0s^{(\mathrm{pad})} = 0, the exponential-kernel evaluation involving the query state becomes

κ(s(n),s(pad))=exp⁡((s(n))⊤0δ)=1.\kappa\left(s^{(n)}, s^{(\mathrm{pad})}\right) = \exp\left(\frac{(s^{(n)})^\top 0}{\delta}\right) = 1.

Therefore, the padding-related kernel value is independent of the query state. Consequently, for a fixed context trajectory, the padding term introduces a constant offset.

Answer to Q3. The TD error.

Specifically, the states and value estimates in the context are not used to compute the reported TD errors. Instead, we use independent query transitions, consisting of query states, their associated rewards, and immediate next states, compute the TD error for each transition, and report the average. In other words, the context transitions are used only to fit the value function within the RKHS, while the TD errors are evaluated on a separate set of query transitions. The same protocol applies to Appendix D as well.

Answer to Q4. Training protocol.

For each domain, we fix the noise level to high and train the model sequentially across different task IDs. At inference time, however, the model is evaluated on sampled task IDs under all noise levels, as shown in Figure 2, while Appendix D reports the corresponding curves across domains.

Reviewer fWjb · CommentOpenReview ↗

Thanks for the clarification. I agree that choosing s(pad)=0s^{(pad)}=0 makes κ(s,s(pad))=1\kappa(s,s^{(pad)})=1, so the padding contribution is independent of the query state conditional on a fixed context. However, my question concerns variation of v(pad)v^{(pad)} across contexts. Since,

vk+1(pad)=vk(pad)+αk∑jbk(j),v^{(pad)}_{k+1}=v^{(pad)}_k+\alpha_k\sum_jb^{(j)}_k,

the padding-state estimate depends on the TD residuals of the sampled context trajectory. For example, v1(pad)=α0∑jr(j)v_1^{(pad)}=\alpha_0\sum_jr^{(j)}. Thus, trajectories with different realized rewards would generally induce different padding-state values and hence different offsets. Is this calculation correct? If so, is the intended claim only that the offset is constant across query states within a fixed context, rather than constant across different context trajectories?

Authors · CommentOpenReview ↗

Response-1.1

We thank the reviewer for this highly precise observation. Your calculation and understanding are entirely correct. To clarify our intended claim: the offset is a constant independent of the query state, strictly conditioned on a fixed context trajectory.

As you accurately pointed out, while the 0\mathbf{0} vector cancels out the inner products associated with the context states, the reward and residual terms remain because the kernel function does not evaluate to zero in general. Consequently, the offset will indeed vary across different sampled context trajectories based on their realized rewards.

This variation does not violate the implemented mechanism. Because in-context learning typically involves evaluating various query states against a single, fixed context trajectory, this context-dependent offset acts merely as a uniform shift for all queries within that specific context. As discussed in the paper, this has minimal influence on the overall evaluation and is consistent with our experimental setup.

We sincerely appreciate you highlighting this nuance! We will ensure this distinction is explicitly clarified in the revised manuscript, taking advantage of the additional space permitted.

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

The paper is really about in-context policy evaluation for reinforcement learning, though it gets there by a pretty specific route. The authors treat nonlinear transformer attention as something that induces an RKHS kernel, and then use that viewpoint to build a multi-head transformer whose forward pass carries out kernelized TD updates. Neat idea, actually. Their main theorem makes the construction explicit: with fixed transformer weights, every layer performs one TD-style update using the transitions in the context, while the context states themselves play the role of kernel centers. To back up the theory, the paper tests the setup on MetaWorld policy-evaluation tasks and on a synthetic RKHS Markov reward process.

Strengths and weaknesses

Strengths

  • A concrete and interpretable construction. The paper proposed that a nonlinear transformer with carefully chosen fixed weights can implement kernel TD updates inside its forward pass. This is a useful existence result because it shows that a transformer architecture can, in principle, implement a non-linear policy-evaluation algorithm in context. The construction also provides an interpretable view of what each layer does: each layer corresponds to a single TD-style update, and the context states serve as kernel centers for estimating the value of the query state. This provides a principled way to understand one possible mechanism by which transformer-style architectures could perform in-context policy evaluation.

  • Empirical results provide some support for the proposed mechanism. The MetaWorld experiments show that the constructed nonlinear transformer can reduce TD error across several domains, and the comparison with the linear transformer helps illustrate why a nonlinear function class is important for these tasks. The synthetic experiment is also useful because it provides a controlled setting where the value function lies in an RKHS and the model’s approximation can be visually compared with the ground-truth value landscape. These results do not fully establish broad practical value, but they do provide evidence that the theoretical construction behaves as expected in both controlled and more realistic environments.

Weaknesses

  • The scope is narrower than the headline framing suggests. The paper is about policy evaluation rather than full reinforcement learning or control. Although the authors acknowledge this early, the title and high-level framing around cross-domain in-context RL are broader than what is actually demonstrated. The results show value estimation through TD-style updates, but they do not demonstrate policy improvement, control performance, or end-to-end in-context RL adaptation. Therefore, the contribution would be more accurately described as cross-domain in-context policy evaluation. Policy evaluation is certainly an important subroutine in RL, but the current results are still a step away from showing that the method enables full in-context reinforcement learning across domains.

  • The mechanism is hand-designed rather than learned. A central limitation is that the paper does not really explain how trained in-context models perform policy evaluation. Instead, it constructs a specific transformer whose fixed weights are chosen to reproduce kernel TD updates. This distinction is important: the paper shows that a transformer can be initialized or designed to implement a known algorithm, but it does not show that a generic transformer trained end-to-end naturally learns this mechanism. As a result, the contribution is better understood as an existence proof for a hand-designed transformer computation, rather than a mechanistic explanation of how policy-evaluation algorithms emerge in trained in-context RL models.

  • The practical and empirical value is not fully established. A direct kernel TD baseline is missing. Since the construction is explicitly a kernel TD in transformer form, the most important baseline is not only a linear transformer but also standard kernel TD with the same kernel, context length, temperature, and step-size schedule. Without that comparison, it is hard to assess whether the transformer formulation adds practical value beyond re-expressing an existing algorithm.

Questions
  • How does the method compare numerically to standard kernel TD with the same kernel and context transitions?
  • What changes are needed to extend the analysis from policy evaluation to control or action-value estimation?
Limitations

A major limitation is that the paper only shows that a transformer with carefully hand-constructed fixed weights can implement kernelized TD updates for policy evaluation. This is different from showing that a normally trained in-context learning model discovers or uses such a mechanism. Therefore, while the construction is theoretically interesting, it provides limited evidence about the mechanisms underlying current learned in-context RL models.

Moreover, the empirical evaluation does not demonstrate usefulness on practical downstream RL tasks. The method is evaluated mainly through TD-error convergence and value-function approximation, but it does not show improvement in control, policy learning, or decision-making performance. As a result, the practical significance of expressing kernel TD in transformer form remains unclear.

Final justification

The paper offers a concrete and interpretable existence proof that a nonlinear transformer can implement kernel TD policy evaluation in context, with experiments that broadly support the proposed mechanism. However, its contribution is narrower than the framing suggests: it addresses policy evaluation rather than full in-context RL, relies on hand-designed weights rather than learned mechanisms, and lacks a direct kernel TD baseline to demonstrate practical advantages.

Formatting concerns

No

4 comments
Authors · CommentOpenReview ↗

Rebuttal-1

We thank the reviewer for recognizing the contribution of our work and for raising insightful questions that we believe are well worth addressing. We share our perspectives below.

Answer to W1. The title should be restricted.

We thank the reviewer for raising this point, as it provides a valuable opportunity to discuss the current status of this research direction and our broader perspective.

The research status of In-Context RL. While in-context RL holds promise for developing cross-domain policies, there is currently a lack of principled work achieving this goal in the full control setting. To our knowledge, [1] is the only work demonstrating the early potential of a transformer model applied across diverse environments like MuJoCo's Pendulum and Ant. Furthermore, theoretical efforts explaining how transformers might achieve this have largely remained anchored in the supervised learning paradigm. Researchers predominantly approach the problem from a Bayesian perspective, positing that the transformer locates a policy conditioned on observed environmental transitions. Although Algorithm Distillation [2] empirically shows that transformers can learn a source RL algorithm, existing theory yields only an imitation guarantee [3].

Our ultimate goal is to demonstrate that transformers can intrinsically implement a complete RL algorithm capable of handling arbitrary tasks. From this perspective, leaping directly into the full control setting is currently infeasible given the state of the established literature. Consequently, we restricted our focus to the policy evaluation setting, establishing a rigorous foundation and leaving full control as the natural next step.

The motivation behind the broad framing. Our line of work operates on the hypothesis that if we can rigorously demonstrate a transformer's ability to achieve policy evaluation across domains, we are effectively one step away from wiring in an additional component to achieve full control. It is highly conceivable that policy improvement can be realized once the heavy lifting of the main policy evaluation process has been successfully handled by the transformer architecture. We chose the title "One for All" to reflect this underlying vision: that transformer models could potentially hold a complete RL algorithm within a single architecture to solve tasks from disparate MRPs and MDPs.

Nevertheless, we agree with the reviewer that this visionary framing may set expectations beyond the current empirical scope of the paper, and we are fully committed to making the necessary textual adjustments

We hope this additional context clarifies the rationale behind our title and overall research trajectory, and we sincerely appreciate the reviewer's engagement with these ideas.

Answer to W2. Construction rather than end-to-end training.

Building upon our previous response, our research strategy is to first rigorously demonstrate that a transformer can in principle achieve cross-domain generalization (establishing its expressivity), before attempting to empirically discover how to train a transformer end-to-end for this purpose (addressing optimization).

We deliberately leave the challenge of end-to-end training for future work for several key reasons. First, how to effectively pretrain a transformer for cross-domain policy evaluation is itself an open question that has never been explicitly explored in the literature. As discussed, the prevailing training protocol relies on supervised learning, and there is currently no commonly recognized framework that effectively incorporates a TD component into this process. Second, realizing this in a trained model may require coupling the evaluation mechanism directly with a policy improvement process—which, as noted earlier, currently lacks a principled solution. We therefore chose to take this necessary first step before jumping directly into empirical training exploration.

Nevertheless, establishing this theoretical existence proof is a non-trivial prerequisite. We believe our current contribution stands on its own by providing a concrete mechanistic baseline that confirms the architecture's fundamental capabilities before introducing the complexities of training dynamics.

[1] Kirsch, L., Harrison, J., Freeman, C. D., Sohl-Dickstein, J., & Schmidhuber, J. Towards General-Purpose In-Context Learning Agents. NeurIPS 2023 Workshop on Foundation Models for Decision Making, 2023.

[2] Laskin, M., Wang, L., Oh, J., Parisotto, E., Spencer, S., Steigerwald, R., Strouse, D., Hansen, S., Filos, A., Brooks, E., Gazeau, M., Sahni, H., Singh, S., & Mnih, V. In-context Reinforcement Learning with Algorithm Distillation. ICLR, 2023.

[3] Lin, L., Bai, Y., & Mei, S. Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining. ICLR, 2024.

Authors · CommentOpenReview ↗

Rebuttal-2

Answer to W3. Comparison to classic TD kernel baseline.

We thank the reviewer for suggesting a direct comparison with classical kernel TD. We conduct this comparison in the synthetic environment with an arbitrary parameter setting, where the ground-truth value function is available for every state. To ensure a controlled comparison, all methods use the same kernel, context transitions, temperature, initialization, and number of update steps.

We compare three variants. Classic-Const applies classical kernel TD with a single fixed step size selected by grid search. ADAPT-Value uses the transformer-equivalent computation with layer-wise step sizes optimized directly against the ground-truth value function; we therefore treat it as an oracle diagnostic rather than a practical learning procedure. ADAPT-TD instead learns the layer-wise step sizes using the TD objective employed by our method.

The results provide two main observations. First, ADAPT-Value closely tracks Classic-Const over the 30 updates and reaches a final RMSE of 0.4159, compared with 0.4169 for Classic-Const. This agreement provides an empirical sanity check for our theoretical construction: under a matched value-estimation criterion, the transformer-equivalent computation closely reproduces the behavior of classical kernel TD.

Second, ADAPT-TD ultimately achieves a lower final RMSE. Although its errors are substantially larger during the first few layers and its trajectory is less monotonic, it achieves lower errors at many later layers and reaches an RMSE of 0.3655 at layer 30. This represents an approximately 12.3% reduction relative to the 0.4169 RMSE of Classic-Const. In this controlled environment, the result suggests that learning layer-wise update coefficients through the TD objective can produce a more effective finite-depth update schedule than using a single constant step size.

ll Classic-Const ADAPT-Value ADAPT-TD
1 1.3679 1.3467 5.4754
2 1.5381 1.5407 3.1401
5 0.9965 0.9937 1.1424
10 0.7282 0.7262 0.7043
15 0.5901 0.5883 0.5240
20 0.5068 0.5054 0.4267
25 0.4530 0.4518 0.4037
30 0.4169 0.4159 0.3655

We emphasize that this experiment does not establish that transformers universally outperform classical kernel TD, since the current baseline uses a single constant step size rather than a separately tuned adaptive or decaying schedule. Instead, it shows that our transformer construction can recover the behavior of classical kernel TD while providing additional flexibility through learnable layer-wise updates.

More broadly, the goal of in-context learning is to develop a unified model that can adapt across diverse tasks through its forward pass without test-time weight updates. Our result provides an explicit architectural realization of kernel TD within a transformer and shows how the same fixed computation can be reused for policy evaluation across different domains under the shared-RKHS condition. Thus, the value of the construction is not that it replaces kernel TD with a fundamentally different algorithm, but that it identifies a concrete mechanism by which a transformer can execute policy-evaluation updates in context. We view this as a foundation for developing more capable cross-domain in-context RL models.

Answer to Q1. Extenstion to the full control setting.

We kindly invite the reviewer to read our brief discussion with Reviewer 86YM under section Q2. We acknowledge that we do not have a principled solution for this extension just yet, but we hope that discussion provides a view of our current perspective and theoretical intuitions.

We believe the questions raised have helped us further clarify our positioning and the current status of the broader research, and we sincerely thank the reviewer for the opportunity to address them. We would be grateful if the reviewer would reconsider their assessment in light of the information provided above

Reviewer qfjb · CommentOpenReview ↗

Thank you for your detailed clarifications. My concerns have been resolved and I have raised my score.

Authors · CommentOpenReview ↗

Thanks

We sincerely thank the reviewer for the engagement throughout the discussion and for raising the score. This has been among the highest quality review processes we have experienced, and the comments have meaningfully improved how we position and present this work.

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

This work shows that a specially designed transformer can imitate kernel TD learning in its forward pass. The idea is interesting. The paper proves that a specially built nonlinear transformer can imitate kernel TD learning inside its forward pass. It is only about policy evaluation, not full RL control.

Concerns are mainly from the generalization since the exeprimental environments are relatively constrained.

Strengths and weaknesses

Strengths

  • The kernel idea makes sense. It helps move beyond simple linear value functions.
  • The theory is neat: each transformer layer acts like one TD update.
  • The paper gives a clear reason why nonlinear attention may help with value estimation.
  • The experiments on MetaWorld show TD loss going down on several domains.

Weakness

The main concern is that the experiments mainly report TD error, not real RL performance or policy improvement. Besides, I believe a direct baseline against normal kernel TD is missing. Since the transformer is basically doing kernel TD, this comparison is important.

Questions
  • Would the method still work with normal softmax attention?

  • The discussion of the constant offset seems questionable. The paper says the offset cancels in TD errors because it appears in both V(st) and V(st+1), however, for discounted TD it is not directly cancelled because of \gamma, right?

Limitations

yes

Final justification

The authors provided further discussion accordingly, which is valuable for improving the readability of the paper, but I would keep the score unchanged.

Formatting concerns

no major issue

2 comments
Authors · CommentOpenReview ↗

Rebuttal-1

We thank the reviewer for their careful reading of our work and for the constructive questions they raised. We respond to points below.

Answer to W1. The lack of value prediction error.

We kindly invite the reviewer to see our response to Reviewer 86YM under Q1/W1. We will add a table on initial-state-value error to the appendix to present these results, and will also vary the synthetic environment's parameters to further demonstrate that the value prediction error converges to a very small value, since the synthetic environment allows us to compute ground-truth state values exactly.

Answer to Q1. Does changing to softmax activation change the work?

Empirically, using softmax yields metrics similar to those of the exponential kernel. We ran experiments with the softmax activation and report the final TD error below, which is considerably close to that of the exponential kernel:

  • button-press-v3: 0.0037
  • pick-place-v3: 0.00025
  • pick-place-wall-v3: 0.00317
  • plate-slide-v3: 0.00931
  • shelf-place-v3: 0.00921

The only change to the architecture is removing the 1n\frac{1}{n} normalization factor at each layer, since softmax already provides a denominator that serves as normalization; adding the factor on top would compress the values into an extremely small range.

Essentially, softmax can be viewed as a normalized exponential kernel, which is not clean to analyze from the RKHS perspective. That said, we believe it could be studied further through the lens of Nadaraya–Watson kernel regression, which is beyond the scope of this work and which we leave to future analysis. We also refer the reader to [1] for a discussion of this point.

Answer to Q2. The discussion about the constant offset.

Thank you for pointing this out. The reviewer is correct that our original statement was imprecise. Let the value decoded from the query column be

V^ℓ(s)=vℓ(s)−γvℓ(spad)=vℓ(s)+cℓ,\widehat{V}_{\ell}(s) = v_{\ell}(s) - \gamma v_{\ell}(s^{\mathrm{pad}}) = v_{\ell}(s) + c_{\ell},

where cℓ=−γvℓ(spad)c_{\ell} = -\gamma v_{\ell}(s^{\mathrm{pad}}) is independent of the query state for a fixed context. The discounted TD error computed from this decoded value is

δ^t=rt+γV^ℓ(st+1)−V^ℓ(st)=rt+γ(vℓ(st+1)+cℓ)−(vℓ(st)+cℓ)=δt+(γ−1)cℓ\begin{aligned} \widehat{\delta}_t &= r_t + \gamma \widehat{V}_{\ell}(s_{t+1}) - \widehat{V}_{\ell}(s_t) \\\\ &= r_t + \gamma\left(v_{\ell}(s_{t+1}) + c_{\ell}\right) - \left(v_{\ell}(s_t) + c_{\ell}\right) \\\\ &= \delta_t + (\gamma - 1)c_{\ell} \end{aligned}

Therefore, the constant offset does not cancel exactly in the discounted TD error unless γ=1\gamma = 1 or vℓ(spad)=0v_{\ell}(s^{\mathrm{pad}}) = 0. We will correct Section 5 and make it precise that there exists an independent small constant in the TD error.

This correction does not affect the main construction in Theorem 4.1. In the context columns, the last row directly stores the TD residuals

bℓ(i)=r(i)+γvℓ(i+1)−vℓ(i),b_{\ell}^{(i)} = r^{(i)} + \gamma v_{\ell}^{(i+1)} - v_{\ell}^{(i)},

and the two attention heads exactly implement the residual update in Eq. (7). The offset arises only when decoding the value of the query state from the query column, and it appears as an independent constant in the TD error itself. Since it is also independent of the query state, relative value comparisons are preserved.

Moreover, the absolute value can be in principle recovered through a simple calibration. For example, evaluating the padding state gives

V^ℓ(spad)=(1−γ)vℓ(spad).\widehat{V}_{\ell}(s^{\mathrm{pad}}) = (1 - \gamma)v_{\ell}(s^{\mathrm{pad}}).

Therefore, for γ<1\gamma < 1,

vℓ(s)=V^ℓ(s)+γ1−γV^ℓ(spad).v_{\ell}(s) = \widehat{V}_{\ell}(s) + \frac{\gamma}{1 - \gamma}\widehat{V}_{\ell}(s^{\mathrm{pad}}).

We believe this calibration could be implemented using an additional padding-query token or an auxiliary readout. We keep the current architecture as the cleanest one and will add this clarification and revise the discussion of the limitation accordingly.

[1] Cheng, X., Chen, Y., & Sra, S. (2024). Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context. Proceedings of the 41st International Conference on Machine Learning (ICML 2024). arXiv:2312.06528.

Authors · CommentOpenReview ↗

Thanks

We thank the reviewer for the careful reading and constructive questions. We have found this review process valuable, and the feedback we received is among the highest quality we have experienced; it has helped us strengthen both the presentation and the empirical support of the paper. We remain happy to address any further questions during the discussion period.

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

This paper establishes a theoretical connection between non-linear transformers and kernel-based temporal-difference learning for in-context reinforcement learning. The core contribution is an explicit weight construction showing that a multi-layer transformer with exponential attention activation can implement iterative kernel TD updates in its forward pass, where each layer performs one step of the kernelized semi-gradient TD update in a Reproducing Kernel Hilbert Space. The key insight is that if value functions from different domains lie within the same RKHS induced by the attention kernel, a single set of transformer weights can perform policy evaluation across those domains without retraining. The authors validate the theory on five MetaWorld domains and a synthetic 2D environment, demonstrating that TD loss converges across domains using fixed transformer weights with only learnable scaling coefficients.

Strengths and weaknesses

Strengths:

  1. The kernel-based interpretation connecting non-linear attention to RKHS regression is elegant and provides a principled explanation for cross-domain generalization in in-context RL. The insight that tasks sharing an RKHS can be handled by a single set of transformer weights is theoretically meaningful and clearly distinguished from the linear transformer construction.
  2. This paper demonstrates its limitations clearly. Section 4 provides a thoughtful discussion of the constant bias and fixed kernel parameters issues, explaining both why they arise and why they may be acceptable in certain settings.
  3. The experimental design is thoughtful and well aligned with the theory: the synthetic environment uses a ground-truth value function that provably lies in the target RKHS, enabling a direct test of the paper's main claim rather than only an indirect convergence check. The resulting visualization in Figure 3 provides clear and intuitive evidence that the transformer recovers the correct value landscape up to the predicted constant offset, making the empirical result particularly informative.

Weaknesses:

  1. The experiments mainly show TD loss convergence, but provide less direct evidence about whether the learned value estimates are accurate or useful for downstream reinforcement learning. Since TD loss is an optimization objective rather than a direct measure of value-function quality, it is difficult for me to tell from the current results whether the model actually predicts returns well in the MetaWorld tasks. Additional value prediction results would make the empirical support more convincing.
  2. The paper focuses on policy evaluation rather than the full reinforcement learning pipeline. This is reasonable for a theoretical paper, but the practical implications would be clearer if the authors more explicitly discussed how the proposed construction might connect to policy improvement or decision-making in future work.
  3. There is a slight error in the legend for Figure 2.
Questions
  1. The training only updates scaling coefficients. What happens if the full transformer weights are trained end-to-end? Does the learned solution still resemble the theoretical kernel TD construction, or does the model find a different mechanism entirely?
  2. For the MetaWorld experiments, could the authors report the actual value prediction error in addition to the TD loss? TD loss convergence does not guarantee accurate value estimates, especially given the constant bias.
  3. The kernel temperature must be set per domain or per domain group. How sensitive is performance to this choice? Could the authors include an ablation showing TD convergence as a function of temperature mismatch?
Limitations

yes

Final justification

The authors’ rebuttal addresses my main concerns by providing additional value-prediction results on MetaWorld and further evidence regarding end-to-end transformer training. One limitation remains: the paper does not include a sensitivity analysis of the kernel temperature. Overall, this limitation does not undermine the paper’s main theoretical contribution, and I therefore maintain my positive Borderline Accept assessment.

Formatting concerns

No.

4 comments
Authors · CommentOpenReview ↗

Rebuttal-1

Answer to Q1/W1. Value Prediction Error.

The tasks and environments from metaworld are closer to practical settings, making it inherently difficult to obtain ground-truth state values for all possible states--there is no closed-form way to compute them. However, it is feasible to estimate the initial state value, since in Meta-World the task ID determines a fixed initial state.

Therefore, we conducted additional experiments to evaluate the error between the estimated initial state value and the predictions produced by the transformer model. Specifically, we approximate the initial state value via Monte Carlo rollouts and measure the discrepancy using the square root of the mean squared error (RMSE), in order to maintain consistency in value scale.

Since the rebuttal does not permit additional links, we describe the decrease in the initial state value as follows:

  • button-press-v3: 3.5 -> 1.1
  • pick-place-v3: 25.2 -> 4.1
  • pick-place-wall-v3: 28.4 -> 4.3
  • plate-slide-v3: 29.3 -> 5.1
  • shelf-place-v3: 15.7 -> 3.8

We would expect that these results would generalize.

On the other hand, it is feasible to provide the state-value estimation error over all states for the synthetic environment described in Section 5.4, with further details in Appendix G. We note that the average state-value error is reduced to 0.00034 in this setting, after accounting for the bias. Appendix G provides further illustrations, varying the number of in-context transitions and the number of layers. We believe this result would extend to other synthetic environments or configurations.

Answer to Q2. Discussion about extending to the control setting.

A large body of the current literature interprets in-context reinforcement learning in the control setting through a Bayesian lens, showing that a transformer pretrained on optimal-action labels implements posterior sampling over the unknown task [1]. Algorithm Distillation instead learns from the learning histories of a source RL algorithm [2]; while it empirically improves upon that algorithm, existing theory yields only an imitation guarantee [3].

Both lines treat the in-context algorithm as something inherited from the pretraining distribution — an oracle policy or a source algorithm. We take a different view: rather than amortizing an external algorithm, we ask whether the transformer's forward pass realizes the policy evaluation and policy improvement operators of generalized policy iteration directly, which would account for its ability to act competently across tasks without task-specific supervision. In this work we restrict attention to policy evaluation, the operator on which the improvement step depends, and defer the full iteration loop to future work.

Since no established framework yet characterizes how the improvement operator arises, we set out the conjectures we consider promising. Policy improvement is operated on top of policy evaluation: given an evaluated policy, the improvement step reduces to a one-step lookahead, which is well within the reach of a single attention block. The difficulty is therefore not the operator itself but the alternation it induces — each improvement changes the policy whose value must next be estimated. We conjecture that this alternation may be realized in more than one way: implicitly, with successive layers of a single transformer carrying successive rounds of evaluation and improvement, or explicitly, by composing two modules wired into the alternation manually, as in the standard actor–critic practice of maintaining separate policy and value networks. We regard the latter as the more promising route and take it as the direction for our future work.

We hope the preceding discussion clarifies the current status of this research direction. We would like to provide further clarifications below.

[1] Lee, J. N., Xie, A., Pacchiano, A., Chandak, Y., Finn, C., Nachum, O., & Brunskill, E. (2023). Supervised Pretraining Can Learn In-Context Reinforcement Learning. NeurIPS 2023. arXiv:2306.14892.

[2] Laskin, M., Wang, L., Oh, J., Parisotto, E., Spencer, S., Steigerwald, R., Strouse, D., Hansen, S., Filos, A., Brooks, E., Gazeau, M., Sahni, H., Singh, S., & Mnih, V. (2023). In-context Reinforcement Learning with Algorithm Distillation. ICLR 2023. arXiv:2210.14215.

[3] Lin, L., Bai, Y., & Mei, S. (2024). Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining. ICLR 2024. arXiv:2310.08566.

Authors · CommentOpenReview ↗

Rebuttal-2

Answer to Q3. What is gonna happen if we train a regular transformer end-to-end.

To further investigate the feasibility of this step, we conducted experiments training standard transformers end-to-end using the same training procedure described in the paper. We use a GPT-2 style model with 4 layers, 4 attention heads, and embedding dimension 128, together with an input embedding module for the state–reward transitions. To quantify the training trend, we define R\mathcal{R} as the ratio of the final TD error to the initial TD error, so that R<1\mathcal{R} < 1 indicates a decrease.

Domain R\mathcal{R}
plate-slide 0.035
button-press 0.189
pick-place-wall 0.686
shelf-place 0.868
pick-place 1.195

The learning dynamics are highly inconsistent: the TD error decreases substantially on two domains, remains largely stagnant on two others, and increases on pick-place. Since the models do not reliably converge even on the single domain they are trained on, it is unlikely that end-to-end training would yield models that generalize across multiple domains. We observed the same pattern when increasing depth from 4 to 30, so the inconsistency does not appear to stem from insufficient capacity.

These results support our position that training a generic non-linear model to natively capture the dynamic-programming structure of TD updates is neither immediate nor trivial. Developing a reliable, principled end-to-end training protocol for this purpose is a distinct open problem, which reinforces our position to leave it to future work.

Reviewer 86Ym · CommentOpenReview ↗

Response to the authors

Thank you for your detailed clarifications. My concerns have been resolved and I will keep my positive score.

Authors · CommentOpenReview ↗

Thanks

We thank the reviewer for the thoughtful engagement and for maintaining a positive assessment of our work. We have genuinely appreciated this review process — the comments we received were among the highest quality we have experienced, and they have helped us improve the paper considerably.

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

Missing a submission?

Loading the discussion…