← Latest papers
💬 NLP

OCR-Memory: Optical Context Retrieval for Long-Horizon Agent Memory

The paper proposes OCR-Memory, a novel framework that overcomes text-context limitations in long-horizon LLM agents by encoding historical trajectories as images and retrieving verbatim text through a visual "locate-and-transcribe" mechanism, thereby significantly expanding effective memory capacity while minimizing hallucination.

Original authors: Jinze Li, Yang Zhang, Xin Yang, Jiayi Qu, Jinfeng Xu, Shuo Yang, Junhua Ding, Edith Cheuk-Han Ngai

Published 2026-04-30
📖 4 min read☕ Coffee break read

Original authors: Jinze Li, Yang Zhang, Xin Yang, Jiayi Qu, Jinfeng Xu, Shuo Yang, Junhua Ding, Edith Cheuk-Han Ngai

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a detective trying to solve a complex case that has been unfolding for months. You have a massive box of evidence: thousands of pages of notes, screenshots, and logs. But your brain (the AI agent) can only hold a few pages of information in its "active workspace" at one time.

If you try to read all those pages at once, your brain gets overwhelmed. If you try to summarize them into a short paragraph, you lose the tiny, crucial details needed to solve the case.

This is the problem OCR-Memory solves. It's a new way for AI agents to remember their past without getting overwhelmed or losing important details.

Here is how it works, using simple analogies:

1. The Problem: The "Filing Cabinet" vs. The "Brain"

Current AI agents are like detectives with a tiny desk. They can only keep a few documents on their desk (the "context window"). If a case gets long, they have to throw old papers away or summarize them.

  • Throwing away papers: They lose the exact words or specific errors that happened earlier.
  • Summarizing: They write a short note like "We clicked the red button." But what if the button was actually dark red and had a specific label? The summary loses that detail, and the agent might make a mistake later.

2. The Solution: Turning Text into a "Photo Album"

Instead of keeping the evidence as text, OCR-Memory turns the entire history of the agent's actions into images (like taking a photo of a whole page of notes).

  • High Density: A single image can hold a massive amount of text, but it takes up very little space in the AI's "brain" (token budget). It's like compressing a whole library into a single, tiny photograph.
  • Lossless: Because it's a picture of the original text, nothing is lost. The AI can "read" the photo later and see the exact words, not just a summary.

3. How It Finds Information: The "Index Card" System

You might ask, "If it's just a photo, how does the AI know what to look for without reading the whole thing?"

OCR-Memory uses a clever trick called "Locate-and-Transcribe."

  • The Visual Anchors: Before saving the photo, the system puts little red boxes with numbers on them (like [1], [2], [3]) next to different paragraphs, just like a teacher grading a paper.
  • The Search: When the AI needs to remember something, it doesn't try to write a new answer from scratch (which can lead to lies or "hallucinations"). Instead, it acts like a librarian scanning the photo. It points to the specific number, saying, "I need the text next to box #42."
  • The Retrieval: Once it points to the number, the system instantly pulls the exact, original text from a database. It's like saying, "Go to page 42, line 3," rather than trying to remember the sentence from memory. This guarantees the information is 100% accurate.

4. The "Fading Memory" Trick

Human memory works in a funny way: recent events are vivid and clear, while old events are fuzzy. OCR-Memory copies this to save space.

  • Recent History: The last few steps are saved as High-Definition (HD) photos. They are crisp and clear.
  • Old History: As time passes, older photos are automatically shrunk into low-resolution thumbnails. They look blurry, but you can still see the general shape and meaning.
  • The "Wake-Up" Call: If the AI suddenly needs to look at an old, blurry photo and realizes it's important, it instantly "zooms in" and restores it to HD quality from the original source. This keeps the memory system efficient but ready to be detailed when needed.

5. The Results: Better at Long Tasks

The researchers tested this on two big challenges:

  1. Web Navigation: Making an AI browse the internet and complete complex tasks.
  2. App World: Making an AI operate mobile apps.

In these tests, OCR-Memory was significantly better than previous methods. It could handle much longer tasks without getting confused, and it made fewer mistakes because it could always refer back to the exact original evidence, not a fuzzy summary.

Summary

Think of OCR-Memory as a super-efficient photo album for an AI.

  • It stores the past as pictures to save space.
  • It uses numbered tags to find specific info without guessing.
  • It blurs old memories to save room but can sharpen them instantly if needed.
  • It ensures the AI never has to "make up" facts, because it always retrieves the original, exact text.

This allows the AI to remember a very long history without running out of mental space, making it much better at solving complex, long-term problems.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →