cs.LGSep 27, 2026

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

Authors: Ruihan A. Li, Shangtong Zhang, Rohan Chandra

Organizations: University of Illinois Urbana-Champaign · University of Virginia

Abstract

In-context reinforcement learning (ICRL) enables large language model agents to adapt to new environments using their interaction history without updating model parameters. However, repeatedly conditioning on growing histories can lead to substantial token cost. We propose a bounded-history context-management framework that predicts the task-dependent downstream effect of removing historical interactions to guide history selection and determine a decision-dependent context budget. Formally, our framework uses the full rolling history as a reference. The predictor evaluates removal effects, defines a deletion ordering, and applies a shared selection criterion to determine how much history to retain at each decision. We evaluate the method in closed-loop SUMO driving under held-out in-distribution, unseen-domain, and unseen-route settings, and in ScienceWorld under a continual ICRL protocol. Relative to a baseline using the full context, our method reduces total token usage by 25.7%, 25.8%, and 23.2% across the three driving settings while maintaining comparable closed-loop driving performance. In ScienceWorld, it reduces total token usage by 52.1% compared to full context and uses 30.2% and 37.8% fewer tokens than the Recent and Similarity baselines, respectively, while maintaining performance.

Figures & tables

Appendix figures & tables4 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Do LLMs Learn from Rewards in Context? : Rethinking the role of reward in In-Context RL

    Oct 8, 2026Minchan Kwon, Seunghee Koh, Sunghyun Baek +2In-Context RLContextual RL

  2. Context Value Informed In-Context Reinforcement Learning

    Sep 27, 2025Wenhao Zhang, Shao Zhang, Xihuai Wang +2In-Context RLTest-Time RL