cs.LGSep 27, 2025

Context Value Informed In-Context Reinforcement Learning

Authors: Wenhao Zhang, Shao Zhang, Xihuai Wang, Yang Li, Ying Wen

Organizations: Shanghai Jiao Tong University

Abstract

In-context reinforcement learning (ICRL) has emerged as an effective paradigm for test time adaptation to unseen tasks without parameter updates. However, existing ICRL methods can exhibit brittle and unstable adaptions, and the mechanisms underlying such adaptions remain poorly understood. We provide a policy-gradient view of ICRL and argue that relying on trajectory-level return feedback can lead to high-variance updates when test time rollout is limited. Motivated by the actor--critic principle, we propose Context Value Informed ICRL (CV-ICRL), which equips the in-context policy with an explicit context value: the expected discounted return conditioned on the current state and accumulated interaction context. CV-ICRL trains a value head and writes its prediction back into the context as a value token, enabling TD-style return targets for lower-variance policy updates. Experiments on the Dark Room, Minigrid, and Procgen testbeds show that CV-ICRL substantially improves the stability of test time adaptation and achieves higher returns across tasks and environments. Code and data are available at https://github.com/Bluixe/CV-ICRL .

Figures & tables

Appendix figures & tables15 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. TR-ICRL: Test-Time Rethinking for In-Context Reinforcement Learning

    Apr 1, 2026Wenxuan Jiang, Yuxin Zuo, Zijian Zhang +8In-Context RLRL for Language Model Reasoning

  2. In-Context Reinforcement Learning under Non-Stationarity: A Survey

    Jul 1, 2026A Run, Ziluo DingNon-Stationary RLIn-Context RL

  3. Downstream-Aware Context Selection for Online In-Context Reinforcement Learning

    Sep 27, 2026Ruihan A. Li, Shangtong Zhang, Rohan ChandraIn-Context RLIn-Context Learning