← Latest papers
🤖 AI

PEEK: Context Map as an Orientation Cache for Long-Context LLM Agents

PEEK is a system that enhances long-context LLM agents by caching reusable orientation knowledge about recurring external contexts in a small, persistent "context map," which significantly improves reasoning accuracy and efficiency while reducing computational costs compared to existing baselines.

Original authors: Zhuohan Gu, Qizheng Zhang, Omar Khattab, Samuel Madden

Published 2026-05-20
📖 4 min read☕ Coffee break read

Original authors: Zhuohan Gu, Qizheng Zhang, Omar Khattab, Samuel Madden

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 hired to solve a series of different cases, but every single case involves investigating the same massive, 50,000-page filing cabinet in a basement.

In the past, when AI agents (smart computer programs) tried to solve these problems, they had two main ways of handling that filing cabinet:

  1. The "Memory Lane" Approach: They kept the entire conversation history of every previous case in their head. But after a few cases, their brain got so full of old chatter that they couldn't focus on the new clues. It was like trying to find a specific needle in a haystack that was also filled with every conversation you've ever had.
  2. The "Search Engine" Approach: Every time they got a new question, they ran to the filing cabinet, searched for a few relevant pages, and brought them back. This was fast, but they kept forgetting how the cabinet was organized. They had to re-learn the layout every single time.

The Problem:
The paper argues that for repeated work on the same large context, the AI is missing a crucial tool: Orientation Knowledge.

Think of it like a human analyst who has worked in that basement for a month. They don't need to re-read the whole cabinet every time. They have a mental map: "Oh, the sports stats are in the red binders on the left, the financial data is in the blue ones on the right, and there's a weird rule about how dates are written that I learned on day one."

The paper calls this missing tool a Context Map.

Enter PEEK: The "Peek" into the Cabinet

The authors created a system called PEEK (which stands for Context Map as an Orientation Cache).

Think of PEEK as a sticky note that lives permanently on the AI's desk (inside its prompt). This sticky note is small and has a strict size limit, so it can't hold the whole filing cabinet. Instead, it holds a summary map of the cabinet.

Here is how PEEK works, using a creative analogy of a Library Intern:

1. The Distiller (The "Sniffer")

After the AI solves a problem, the Distiller looks at the AI's messy work log. It asks: "What did the agent actually learn about the library's layout?"

  • It ignores the specific answer to the question (e.g., "The answer is 42").
  • It focuses on the orientation (e.g., "The sports section is always in the back," or "The dates are written in a weird format").
  • It filters out the noise and keeps only the reusable "map" knowledge.

2. The Cartographer (The "Map Maker")

The Cartographer takes those notes and turns them into a clean, structured update for the sticky note.

  • If the AI learned that "Sports" is in the red binders, the Cartographer writes that down clearly.
  • If the AI realized a specific rule about dates, it adds that to a "Constants" section.
  • It makes sure the map doesn't get cluttered with facts that only apply to one specific question.

3. The Evictor (The "Janitor")

The sticky note has a limited size (a token budget). If the AI learns something new, the Evictor has to decide what to throw away to make room.

  • It uses a priority system. It keeps the most important "map" info (like the layout of the building) and throws away less important details (like a specific date format that was only useful for one question).
  • This ensures the note stays small, fast, and always relevant.

Why is this a big deal?

The paper tested PEEK on two types of difficult tasks:

  1. Reasoning: Finding clues scattered across the massive document and putting them together.
  2. Learning: Figuring out the rules of the document and applying them to new questions.

The Results:

  • Smarter: PEEK solved problems much more accurately than the old methods (improving scores by 6% to 34%).
  • Faster: Because the AI didn't have to re-learn the layout of the filing cabinet every time, it needed far fewer attempts (iterations) to get the right answer.
  • Cheaper: Fewer attempts meant the system cost significantly less money to run (up to 5.8 times cheaper than the previous best method).

The Bottom Line

The paper claims that for AI agents working repeatedly on the same large dataset, the secret isn't just "remembering more" or "searching faster." It's about keeping a small, curated map of the world right in front of them.

PEEK gives the AI a "peek" into the context that stays with it, allowing it to navigate the massive external world efficiently, just like a seasoned librarian who knows exactly where every book is without having to re-read the catalog every day.

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 →