Supervised Pretraining Can Learn In-Context Reinforcement Learning

Large transformer models trained on diverse datasets have shown a remarkable ability to learn in-context, achieving high few-shot performance on tasks they were not explicitly trained to solve. In this paper, we study the in-context learning capabilities of transformers in decision-making problems, i.e., reinforcement learning (RL) for bandits and Markov decision processes. To do so, we introduce and study Decision-Pretrained Transformer (DPT), a supervised pretraining method where the transformer predicts an optimal action given a query state and an in-context dataset of interactions, across a diverse set of tasks. This procedure, while simple, produces a model with several surprising capabilities. We find that the pretrained transformer can be used to solve a range of RL problems in-context, exhibiting both exploration online and conservatism offline, despite not being explicitly trained to do so. The model also generalizes beyond the pretraining distribution to new tasks and automatically adapts its decision-making strategies to unknown structure. Theoretically, we show DPT can be viewed as an efficient implementation of Bayesian posterior sampling, a provably sample-efficient RL algorithm. We further leverage this connection to provide guarantees on the regret of the in-context algorithm yielded by DPT, and prove that it can learn faster than algorithms used to generate the pretraining data. These results suggest a promising yet simple path towards instilling strong in-context decision-making abilities in transformers.

Paper

Similar papers

Peer review

Reviewer qnXx6/10 · confidence 3/52023-07-03

Summary

This paper introduces a new pretraining objective for decision-making tasks. Leveraging the in-context learning capabilities of transformers, the authors propose to pretrain a model that predicts the optimal action given the current state and a set of history interactions as context. Empirically, the pretrained model is capable of learning various algorithms implicitly and can transfer to unseen tasks. Theoretically, the pretraining objective can be viewed as training the model to perform posterior sampling. **After rebuttal**: The rebuttal addressed my concerns sufficiently. The new experimental results highlight the importance of both in-context datasets and optimal actions. I have increased my score to 6.

Strengths

1. This work proposes a new pretraining framework for decision-making tasks. It is one of the pioneering efforts in the problem of in-context decision-making. 2. The paper is generally sound and presents adequate empirical results. The connection to posterior sampling is also interesting. 3. The paper is well-written.

Weaknesses

1. My main concern is about the requirement of optimal actions at pretraining. This assumption appears to be overly strong and I doubt its scalability to large-scale pretraining and more complex tasks. 2. I find it unclear whether the pretrained model benefits more from in-context datasets or optimal actions. It is suggested to conduct an ablation study on the context size, which appears to be missing from the appendix. I am curious about the performance when the context size is set to 0. 3. The modification of history-dependent pretraining in Section 6 needs further clarification. The importance of this modification is unclear to me. 4. The authors should provide a more comprehensive comparison between their proposed pretraining objective and previous research, such as retrieval-augmented RL [1]. [1] Goyal A, Friesen A, Banino A, et al. Retrieval-augmented reinforcement learning[C]//International Conference on Machine Learning. PMLR, 2022: 7740-7765.

Questions

1. In Appendix A.5, you mention that the in-context datasets for Miniworld do not include images as observations. Does this imply that in-context datasets are not important as expected for the final performance? 2. Can you please explain the difference between DPT(PPO, PPO) and AD, and why DPT(PPO, PPO) is superior to AD? 3. How are the datasets constructed for Dark Room (Three Tasks)?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

The authors acknowledge certain limitations of the proposed method.

Reviewer R3a78/10 · confidence 3/52023-07-05

Summary

This paper proposes an in-context learning based algorithm for meta-learning decision-making algorithms, combined with a novel analysis which shows that unlike prior works, the proposed algorithm is guaranteed to work. Moreover, the authors also show empirically and theoretically that their algorithm is able to improve upon its training demonstrations.

Strengths

1. The paper conducts a novel theoretical analysis on the ability to generalize well when meta-learning with the in-context learning paradigm applied to decision-making problems. 2. The latent representation learning results in linear bandits which enable the improvement over the training demonstrations is a novel motivation for in-context learning based decision-making algorithms. 3. The paper is clearly written and accessible to readers with varying backgrounds.

Weaknesses

The formulation of a consistent learned model assumes the meta-learning algorithm is perfect. Can you relax this assumption to provide the fine-grained pre-training sample complexity?

Questions

Could you please explain why in Figure 2, UCB is outperformed by Thompson Sampling even though you stated that UCB is an optimal online multi-armed bandit algorithm?

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

Since the analysis for MDP assumes that the training demonstrations are generated with an optimal policy, the claim that the proposed method can theoretically improve upon the training demonstrations should explicitly specify that the improvement is only for the bandit and contextual bandit cases, not the more general MDP case.

Reviewer pHmJ7/10 · confidence 4/52023-07-07

Summary

This paper studies in-context learning for sequential decision-making problems. It proposes an approach, Decision Pretrained Transformer (DPT), which takes as input a (state, context) pair and produces an action. It is pretrained on a large number of tasks drawn from some task distribution and evaluated on held-out tasks. This approach can be applied in both offline settings (in which case the context is a given set of trajectories from the task at hand) and online settings (in which case the context is the agent’s experience on the current task so far). The approach is evaluated in two settings: toy bandits (including linear contextual bandits) and simple MDPs. In the online bandit setting, it is shown to learn behaviors which efficiently balance exploration and exploitation, similarly to hand-coded bandit algorithms like UCB/LinUCB. This hold both in the stateless bandit setting and the linear contextual bandit setting. In the offline setting, it also matches Thompson sampling. The second setting the algorithm is evaluated on is simple MDPs, namely a small partially observed grid world and MiniWorld (a pixel-based version of Minigrid). Here again, DPT is able to perform well both online and offline, even if the dataset quality is poor. Finally, the paper shows that under certain assumptions, DPT can be shown to perform posterior sampling, which is consistent with the empirical results in the bandit settings. Overall, this is pretty good paper. The idea, though simple, has not to my knowledge been explored before. The experiments are well-designed, illustrate the claims well and the writing is clear. The main downside is that the tasks feel pretty toy - the bandit examples are just Gaussians and the MDPs are grid worlds (possibly dressed up with pixels, as in MiniWorld). However, as a first proof of concept I think this still meets the bar for acceptance at NeurIPS.

Strengths

- The problem is definitely interesting, since large-scale, diverse datasets are often available for pretraining and zero-shot adaptation to new tasks is often desirable - The writing is very clear, and the experiments are well presented - The experiments are well-designed to show the properties of the proposed approach

Weaknesses

- The experiments are on toy environments - There is no mention of open sourcing the code. I think this is important since the setting is new and future work should be able to compare to this approach on the same tasks.

Questions

- How does the computational cost of the proposed method compare to that of the baselines? Due to the need to perform attention over the context each step, this might be expensive. Please add a short discussion of this. - Will the code to reproduce experiments be open-sourced?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

Yes.

Reviewer CX5S6/10 · confidence 3/52023-07-09

Summary

This work leverages transformers to solve decision making problems in a few-shot manner. In particular, they train transformers to predict optimal actions from a task given a query state and a few-shot dataset of state, action, reward transitions. The approach is tested in both multi-armed-bandit problems and POMDPs, showing superior performance than other RL and Meta-RL approaches. It also provides theoretical analysis of the proposed policy, providing regret bounds and guarantees of performance when different algorithms are used to generate the pre-training data.

Strengths

Method: The work conducts a thorough study of the effectiveness of transformer for in-context learning in decision making problems. While the domains chosen are quite simple, there are some valuable learnings (especially if they transfer to more complex domains), such as: - The value of sampling actions from the transformer's likelihood in multi-armed bandits - The effect of using expert datasets for in-context learning - Better generalization than competing baselines, when tested on new tasks The work also includes examples of POMDPS with higher dimensional observations (25x25 pixels) showing the proposed pretraining paradigm achieves better performance than competing baselines. Valuable analysis of the performance of in-context learning when having access to PPO-trained policies, bringing the setting closer to AD. I particularly value how authors evaluate the effect of different sources for the context states and actions. I am wondering whether PPO, PPO is directly comparable to AD though since in their case they provide in-context actions and trajectories for different stages of training. By chosing simple domains, the work can thoroughly explore the behavior of in-context learning for different properties of the training data, particularly in the multi-armed bandit section. To my knowledge, this is the first work to build connections of in-context learning in decision making problems and posterior sampling, which allows to: 1. Provide an upper bound on the regret of the proposed transformer-based policy. 2. Show that if the pretraining in-context dataset comes from policies that were only trained on the data and task present in the dataset, the final policy will be the same. Clarity: Generally clear writing and background. The experiments are simple but informative, and the work is easily reproducible. More notation and clarity should be given in the theory section, such as stating what is H, and providing more intuition in the propositions.

Weaknesses

Novelty: while this paper conducts a reasonable study on the advantages of in-context learning in decision making problems, this is a feature that has been recently studied in more complex domains and tasks (see related works next). My main concern in this work is that there is not much novelty or learnings compared to those works, and that despite making a reasonable study of the capabilities of transformers for few-shot decision making problems, they are studied in very simple scenarios. Related work: Several works have studied in context-learning for decision making problems, in more complex scenarios [1, 2]. These works should be cited. I am also not clear on what novelty this work provides with respect to the aforementioned papers. I would like a clarification on this as well. [1] https://arxiv.org/pdf/2206.13499.pdf [2] https://arxiv.org/abs/2301.07608 Baselines: While RL2 is a fair baseline, I think authors should look at other meta-RL algorithms, or tune the existing baselines to be more comparable. I understand that PPO is used as a reference, but it should at least be finetuned with the few-shot examples given - it is hard to compare methods when some are actually seeing less data. AD is designed to learn to do RL and therefore works best when having a curriculum of trajectories, which is not the case here.

Questions

It is not intuitive to me that a model trained with expert data (DPT-Exp) behaves poorly when the % of expert data is high (Figure 3.a) since that is what is seen during training, I would expect it to b heave the best. Could authors elaborate on why this is the case? The setting in lines 312-317 makes a lot of sense. Why not using that in all the experiments, if as claimed "the original pretraining method can be seen as a simpler approximation 316 of this modified method"? I don't understand assumption 1.1, if we are following that assumption, why not directly using P_{pre} as out policy? Some intuition would be helpful. Proposition 6.3 is very unitnuitive to me, if I understand it correctly. Is it stating that a pretraining dataset coming from PPO and one coming from a random policy would perform the same? I don't see anything in the proposition that implies otherwise, but this doesnt match in the empirical experiments.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

2 fair

Contribution

1 poor

Limitations

Yes

Reviewer CX5S2023-08-15

Thanks for the thorough rebuttal. Authors have addressed all my concerns, and clarified misunderstandings. I am thus changing my rating.

Reviewer qnXx2023-08-16

Thank you for your comprehensive response to my concerns. Given the convincing experimental results highlighting the importance of both in-context datasets and optimal actions, I am inclined to increase my score to 6.

Reviewer R3a72023-08-20

Thanks for the thorough rebuttal. Authors have addressed all my concerns and clarified misunderstandings. I am thus willing to increase my rating.

Program Chairsdecision2023-09-21

Decision

Accept (spotlight)

© 2026 NYSGPT2525 LLC