Memory in the Loop: In-Process Retrieval as ExtendedWorking Memory for Language Agents
Summary
The "Memory in the Loop" (MiL) research introduces an in-process retrieval mechanism designed to function as extended working memory for language agents, directly addressing the high latency of traditional external memory stores. While conventional systems query memory once per turn with latencies of tens to hundreds of milliseconds, MiL integrates memory directly into the agent's observe-reason-act loop, allowing per-step read/write operations. This in-process store achieves approximately 100us response times, a three-order-of-magnitude improvement over networked solutions. Experiments with four GPT-5-class models under a bounded window demonstrate recall improving from 0/5 to 3.6-4.8/5. The study also identifies embedding as the new dominant per-step bottleneck (~200-400ms over the network), proposing that pairing the in-process store with a small local embedder can reduce the complete operation to a measured ~40us. The research causally links increased memory latency to a rise in redundant agent actions.
Key takeaway
For NLP Engineers designing language agents that require persistent, dynamic memory, prioritize implementing in-process memory solutions. This approach drastically reduces retrieval latency from hundreds of milliseconds to microseconds, improving agent recall and reducing redundant actions. You should also consider pairing in-process memory with a small local embedder to further optimize per-step costs, ensuring efficient, real-time agent operation.
Key insights
In-process memory, answering in microseconds, transforms external stores into extended working memory for language agents.
Principles
- Memory latency directly impacts agent efficiency.
- In-process stores enable true extended working memory.
- Bottlenecks shift from retrieval to embedding.
Method
Integrate an in-process memory store, read and written on every agent step, to achieve sub-millisecond retrieval latency.
In practice
- Implement in-process memory for LLM agents.
- Optimize embedding for per-step operations.
- Evaluate agent redundancy against memory latency.
Topics
- Language Agents
- In-Process Memory
- LLM Performance
- Retrieval-Augmented Generation
- Latency Optimization
- Working Memory
Best for: Research Scientist, AI Architect, AI Engineer, AI Scientist, NLP Engineer, Machine Learning Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.