Behavior-agnostic Task Inference for Robust Offline In-context Reinforcement Learning
Long Ma, Fangwei Zhong, Yizhou Wang
Abstract
The ability to adapt to new environments with noisy dynamics and unseen objectives is crucial for AI agents. In-context reinforcement learning (ICRL) has emerged as a paradigm to build adaptive policies, employing a context trajectory of the test-time interactions to infer the true task and the corresponding optimal policy efficiently without gradient updates. However, ICRL policies heavily rely on context trajectories, making them vulnerable to distribution shifts from training to testing and degrading performance, particularly in offline settings where the training data is static. In this paper, we highlight that most existing offline ICRL methods are trained for approximate Bayesian inference based on the training distribution, rendering them vulnerable to distribution shifts at test time and resulting in poor generalization. To address this, we introduce Behavior-agnostic Task Inference (BATI) for ICRL, a model-based maximum-likelihood solution to infer the task representation robustly. In contrast to previous methods that rely on a learned encoder as the approximate posterior, BATI focuses purely on dynamics, thus insulating itself against the behavior of the context collection policy. Experiments on MuJoCo environments demonstrate that BATI effectively interprets outof-distribution contexts and outperforms other methods, even in the presence of significant environmental noise.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Behavior-Invariant Task Representation Learning with Transformer-based World Models for Offline Meta-Reinforcement Learning cites VariBAD: A Very Good Method for Bayes-Adaptive Deep RL via Meta-Learning
- Supervised Pretraining Can Learn In-Context Reinforcement Learning cites VariBAD: A Very Good Method for Bayes-Adaptive Deep RL via Meta-Learning
- Supervised Pretraining Can Learn In-Context Reinforcement Learning cites Language Models are Few-Shot Learners
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Language Models are Few-Shot Learners
Cited by top-tier papers1
Builds on22
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Offline Reinforcement Learning with Implicit Q-LearningIlya Kostrikov, Ashvin Nair, Sergey LevineICLR 2022 · 1,402 citations
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations
- VariBAD: A Very Good Method for Bayes-Adaptive Deep RL via Meta-LearningLuisa M. Zintgraf, Kyriacos Shiarlis, Maximilian Igl, Sebastian Schulze et al.ICLR 2020 · 315 citations
- Supervised Pretraining Can Learn In-Context Reinforcement LearningJonathan Lee, Annie Xie, Aldo Pacchiano, Yash Chandak et al.NeurIPS 2023 · 170 citations
Related papers
- Entropy Regularized Task Representation Learning for Offline Meta-Reinforcement LearningMohammadreza Nakhaeinezhadfard, Aidan Scannell, Joni PajarinenAAAI 2025
- Recovering from Out-of-sample States via Inverse Dynamics in Offline Reinforcement LearningKe Jiang, Jia-Yu Yao, Xiaoyang TanNeurIPS 2023 · 12 citations
- In-Context Compositional Q-Learning for Offline Reinforcement LearningQiushui Xu, Yuhao Huang, Yushu Jiang, Wenliang Zheng et al.ICLR 2026
- Debiased Offline Representation Learning for Fast Online Adaptation in Non-stationary DynamicsXinyu Zhang, Wenjie Qiu, Yi-Chen Li, Lei Yuan et al.ICML 2024 · 3 citations
- Meta-Reinforcement Learning Robust to Distributional Shift Via Performing Lifelong In-Context LearningTengye Xu, Zihao Li, Qinyuan RenICML 2024 · 6 citations
