TL;DR
PEEK introduces a "context map"—a small, fixed-budget prompt cache that stores reusable "orientation knowledge" about a large, recurring external context (like a document corpus or code repository). By automatically distilling structural insights from an agent's execution trajectories, PEEK significantly boosts task accuracy while drastically reducing iterations and API costs compared to state-of-the-art prompt-learning frameworks.
What Problem Does This Paper Address?
When Large Language Model (LLM) agents are deployed in production, they are often tasked with repeatedly querying the same massive external context—such as a 50k-entry user feedback database or a massive codebase—to answer changing user requests.
Current context-management strategies fall short in this scenario:
- Shared chats quickly become bloated and noisy.
- RAG and context compaction provide only passive access to raw or condensed data.
- Prompt-learning frameworks (like ACE) focus on task-level strategies rather than understanding the context itself.
The authors identify a missing quadrant in the agent state-space: actively maintaining a bounded, semantic artifact that captures orientation knowledge—how the context is organized, what it contains, and what schemas or constants remain useful across multiple distinct queries.
Methods
PEEK implements an agent-level semantic cache called a context map that sits directly within the system prompt. Instead of relying on manual pre-population, PEEK automatically builds and maintains this map across queries using a programmable cache policy driven by three decoupled modules:
- The Distiller: Analyzes the agent's execution trajectory (reasoning steps, tool calls, and observations) to diagnose where it spent its time (orientation vs. task-specific work), tags existing map items (helpful, harmful, neutral, or stale), and extracts new transferable cache candidates.
- The Cartographer: Translates the Distiller's findings into structured edits (
ADD,DELETE,REPLACE) using stable item IDs to keep updates localized and clean. - The Evictor: Enforces a strict token budget (defaulting to 1,024 tokens) using priority-based eviction. It protects high-level context understanding and roadmaps while evicting parsing schemas or intermediate results first if the budget is exceeded.
Datasets
The system was evaluated on two categories of long-context tasks that stress repeated context interaction:
- OOLONG: A long-context reasoning and information aggregation benchmark. The authors focused on the three hardest splits:
trec_coarse,agnews, andyahoo. - CL-bench: A challenging context-learning benchmark covering domain-specific knowledge, complex procedures, and laws.
The authors also attempted to retrofit standard QA datasets like BrowseComp-Plus, FanOutQA, and QuALITY, but detailed why they failed (either due to disjoint, manufactured contexts or contexts being too short to create cache pressure), highlighting the need for native benchmarks in this sub-field.
Key Insights and Ideas
- Orientation vs. Task Strategy: Just as a human data analyst keeps a lightweight cheat sheet of a database's schema and quirks, LLM agents benefit far more from caching context-specific "orientation knowledge" than generic task-level rules.
- Decoupling Diagnosis from Editing: Collapsing the Distiller and Cartographer into a single monolithic LLM call degrades performance by 7.7% on average. Separating the analysis of what was learned from the planning of how to edit the map prevents non-contextual facts from leaking into the cache.
- Presence Over Precise Size: Ablation studies showed that having a context map matters far more than its exact size; even a highly constrained budget of 512 tokens yielded massive improvements over base models.
Key Results
PEEK consistently outperformed strong baselines (including RAG, MemAgent, and ACE) across all benchmarks:
- On OOLONG: PEEK improved accuracy by 6.3% to 34.0% over baselines, while using 93–145 fewer iterations and incurring 1.7–5.8× lower cost than the state-of-the-art framework ACE.
- On CL-bench: PEEK improved the solving rate by 6.0–14.0% and rubric accuracy by 7.8–12.1%, at a 1.4× lower cost than ACE.
- Strong Generalization: These performance gains held true when swapping the base model (from GPT-5-mini to GPT-5.5 or Qwen3-Coder-Next-FP8) and the agent architecture (from RLM to OpenAI Codex), proving PEEK is not tied to a specific model family.
Limitations and Future Work
- Dependency on Reusable Knowledge: PEEK’s utility depends entirely on the nature of the context; if an agent's interaction with a document reveals no reusable structural insights, the cache provides little value.
- Agent-Specific Utility: Because different agent architectures interact with contexts differently, a map optimized by one agent might vary in usefulness if handed off to another.
- Future Directions: The authors suggest exploring adaptive cache sizing, training a specialized model for the Distiller module, maintaining multi-cache collections for parallel agents, and designing new benchmarks specifically tailored for repeated queries over a single massive context.
Summary updated