Provable Transformer Context Compression for In-Context Reinforcement Learning

Yajie Zhao, Yingjun Mo, Zhiyong Wang, Bo Tang, Chao Xu +1 more
10/14/2026
cs.LGcs.AI
transformer-attentionrl

No confident code implementation found for this paper.

Abstract

Transformers can perform in-context reinforcement learning without parameter updates. However, existing theoretical constructions often require context sizes that grow with the number of sampled transitions, leading to increasing memory costs in large-scale problems.

Show full abstract

This raises a fundamental scalability question: how much context is intrinsically necessary to carry out such learning? We answer this question for fixed-policy TD evaluation. We show that, with a shared linear decoder, the minimum context dimension required to exactly reproduce the first $L$ TD iterates is the Krylov dimension induced by the sampled transitions. When the available context dimension $m$ falls below this threshold, exact reproduction is no longer possible. In this regime, we characterize the optimal approximation error and show that it decays as $Θ(γ^m\max\{1,1/(m(1-γ))\})$ where $γ$ is the discounting factor. Moving from representation complexity to actual memory cost, we characterize the optimal retained memory for exact continuous representations as $Θ(nk_L)$ and show experimentally that on a sampled task whose exact rank is full but whose numerical rank is small, a context accurate to $10^{-2}$ is $88.7\%$ smaller than the sparse sufficient statistics of TD. Finally, we establish the learnability of the shared executor through pretraining by proving global convergence of an auxiliary objective over effective attention parameters under suitable task diversity. Experiments across diverse TD evaluation problems validate parameter recovery and the predicted context--accuracy tradeoff.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhao2026provable,
  title  = {Provable Transformer Context Compression for In-Context Reinforcement Learning},
  author = {Yajie Zhao and Yingjun Mo and Zhiyong Wang and Bo Tang and Chao Xu and Fang Kong},
  year   = {2026},
  eprint = {2610.20004},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.20004v1}
}

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/2610.20004.svg)](https://codeofpaper.com/paper/2610.20004)

Discussion