AgentOCR: Reimagining Agent History via Optical Self-Compression

Lang Feng, Fuchao Yang, Feng Chen, Xin Cheng, Haiyang Xu +3 more
1/8/2026
27 citations
cs.LGcs.AI
rl

Official code: langfengQ/AgentOCR (50 stars, Python, Apache-2.0, last commit 2026-03-01).

Abstract

Recent advances in large language models (LLMs) enable agentic systems trained with reinforcement learning (RL) over multi-turn interaction trajectories, but practical deployment is bottlenecked by rapidly growing textual histories that inflate token budgets and memory usage. We introduce AgentOCR, a framework that exploits the superior information density of visual tokens by representing the accumulated observation-action history as a compact rendered image.

Show full abstract

To make multi-turn rollouts scalable, AgentOCR proposes segment optical caching. By decomposing history into hashable segments and maintaining a visual cache, this mechanism eliminates redundant re-rendering. Beyond fixed rendering, AgentOCR introduces agentic self-compression, where the agent actively emits a compression rate and is trained with compression-aware reward to adaptively balance task success and token efficiency. We conduct extensive experiments on challenging agentic benchmarks, ALFWorld and search-based QA. Remarkably, results demonstrate that AgentOCR preserves over 95\% of text-based agent performance while substantially reducing token consumption (>50\%), yielding consistent token and memory efficiency. Our further analysis validates a 20x rendering speedup from segment optical caching and the effective strategic balancing of self-compression.

View on arXivView PDF

Code Implementations(1)

langfengQ/AgentOCROfficial100%
Apache-2.0

[ACL'26 Oral] AgentOCR is a token-efficient framework that compresses multi-turn agent history by rendering it into images and adopting RL-driven self-compression

502Python, Jupyter NotebookOct 29, 20259 months agoApache-2.0

Similar Papers

Cite this paper

@article{feng2026agentocr,
  title  = {AgentOCR: Reimagining Agent History via Optical Self-Compression},
  author = {Lang Feng and Fuchao Yang and Feng Chen and Xin Cheng and Haiyang Xu and Zhenglin Wan and Ming Yan and Bo An},
  year   = {2026},
  eprint = {2601.04786},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.04786v1}
}

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

Discussion