cs.AIOct 16, 2026

Agentic In-Context Learning: What Algorithms Can Transformers Learn in Closed-Loop Interaction?

Authors: Shiguang Wu, Yaqing Wang, Quanming Yao

Organizations: Tsinghua University · Beijing Institute of Mathematical Sciences and Applications

Abstract

The learning algorithm view of in-context learning (ICL) studies how fixed-parameter Transformers learn from supplied examples. Language model agents extend this setting through interaction: their actions determine what evidence enters context next. We call this regime Agentic In-Context Learning (Agentic ICL). Existing studies largely depend on externally supplied contexts or reward-bearing interaction histories, while work on general tool-using agents lacks a learning algorithm view. We represent an interactive learner by its state, update, and decision rule, covering active learning, bandits, and online reinforcement learning (RL). For expressivity, we construct causal Transformers that approximate these algorithms over a finite horizon, and bound the resulting loss in return. For training, we characterize when optimizing process rewards preserves behavior that maximizes the final outcome. Distillation experiments show that Transformers can learn to execute three representative recursions. We then train models from outcome or process rewards without oracle action or state targets, as in RL post-training. Different rewards yield distinct decision policies. Improving the alignment of process supervision with outcome-optimal action preferences shifts learned decisions accordingly. Such behavioral differences persist in a pretrained language model across textual paraphrases.

Figures & tables

Appendix figures & tables24 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Transformers Provably Implement In-Context Reinforcement Learning with Policy Improvement

    May 7, 2026Haodong Liang, Lifeng LaiReinforcement LearningTransformer-Based RL

  2. Implicit Statistical Inference in Transformers: Approximating Likelihood-Ratio Tests In-Context

    Mar 11, 2026Faris Chaudhry, Siddhant GadkariLikelihood Ratio TestingIn-Context Learning

  3. Beyond Linear Attention: Softmax Transformers Implement In-Context Reinforcement Learning

    May 8, 2026Zixuan Xie, Xinyu Liu, Claire Chen +3Reinforcement LearningTransformer-Based RL