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 about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d6c9866f-dbd4-4532-b23b-1fb74f16947fCited by top-tier papers1
Ask how each one uses itBuilds on21
- 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
