Scalable In-Context Q-Learning

Jinmei Liu, Fuhong Liu, Zhenhong Sun, Jianye Hao, Huaxiong Li +4 more
6/2/2025
9 citations
cs.AIcs.LG
rl

Official code: NJU-RL/SICQL (13 stars, Python, last commit 2025-06-02).

Abstract

Recent advancements in language models have demonstrated remarkable in-context learning abilities, prompting the exploration of in-context reinforcement learning (ICRL) to extend the promise to decision domains. Due to involving more complex dynamics and temporal correlations, existing ICRL approaches may face challenges in learning from suboptimal trajectories and achieving precise in-context inference.

Show full abstract

In the paper, we propose \textbf{S}calable \textbf{I}n-\textbf{C}ontext \textbf{Q}-\textbf{L}earning (\textbf{S-ICQL}), an innovative framework that harnesses dynamic programming and world modeling to steer ICRL toward efficient reward maximization and task generalization, while retaining the scalability and stability of supervised pretraining. We design a prompt-based multi-head transformer architecture that simultaneously predicts optimal policies and in-context value functions using separate heads. We pretrain a generalized world model to capture task-relevant information, enabling the construction of a compact prompt that facilitates fast and precise in-context inference. During training, we perform iterative policy improvement by fitting a state value function to an upper-expectile of the Q-function, and distill the in-context value functions into policy extraction using advantage-weighted regression. Extensive experiments across a range of discrete and continuous environments show consistent performance gains over various types of baselines, especially when learning from suboptimal data. Our code is available at \textcolor{magenta}{\href{https://github.com/NJU-RL/SICQL}{https://github.com/NJU-RL/SICQL}}.

View on arXivView PDF

Code Implementations(1)

NJU-RL/SICQLOfficial100%

Official codebase for SICQL: Scalable In-Context Reinforcement Learning

130Python, ShellJun 2, 20251 years ago

Similar Papers

Cite this paper

@article{liu2025scalable,
  title  = {Scalable In-Context Q-Learning},
  author = {Jinmei Liu and Fuhong Liu and Zhenhong Sun and Jianye Hao and Huaxiong Li and Bo Wang and Daoyi Dong and Chunlin Chen and Zhi Wang},
  year   = {2025},
  eprint = {2506.01299},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.01299v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.01299.svg)](https://codeofpaper.com/paper/2506.01299)

Discussion