TL;DR
Most AI agents suffer from a bizarre form of amnesia: they either stuff past experiences into a rapidly shrinking text prompt, or rely on compressed "latent" memories that are frozen in stone the moment deployment begins. TIMA (Test-Time Internalization for Agentic Memory) gives LLM agents a living, breathing muscle memory—allowing them to distill complex problem-solving patterns into compact, continuous tokens on the fly while keeping the main LLM completely frozen.
What Problem Does This Paper Address?
Imagine trying to learn guitar, but instead of building muscle memory, you have to read a massive diary of every finger placement you’ve ever tried before playing a single chord. That’s how standard textual memory (like RAG) works for LLM agents—it hogs the context window and struggles to capture abstract, procedural "how-to" knowledge.
An alternative is latent memory, which compresses experience into continuous vectors ("soft tokens") in the model's hidden space. However, existing latent memory modules are typically trained offline and frozen at test time. They can't adapt to new experiences during live deployment. Meanwhile, Test-Time Learning (TTL) allows models to update weights on the fly, but existing TTL methods are built for uniform text streams, not messy agentic loops where thoughts, actions, and environment observations interleave. The authors ask: How can an agent continuously refine compact, reusable procedural memory from its own live actions?
Methods
TIMA bridges latent memory and test-time learning without ever touching the weights of the heavy backbone LLM (e.g., Qwen-7B or Llama-3B). Instead, it introduces three coupled components:
- The Memory-Augmented Loop: In a standard Think $\rightarrow$ Act $\rightarrow$ Observe loop, TIMA injects $K$ continuous "memory tokens" (default $K=8$) right into the context at every turn to guide the agent's next thought and action.
- The Internalizer (with Online TTL): This is a lightweight sidecar model (a 1.5B model with LoRA adapters) that reads the task query and recent history to generate those $K$ memory tokens. What's new here is how it learns at test time: after each turn, TIMA updates the Internalizer's parameters by minimizing the negative log-likelihood of the agent's composite action (reasoning + tool call). Intuitively, good memory makes good reasoning more predictable. To prevent the agent from learning its own bad habits, entropy-aware filtering discards high-uncertainty (noisy) turns, updating only on confident steps using momentum and weight decay.
- The Internalizer Bank: To carry knowledge across tasks without lumping everything into one muddled module, TIMA maintains a bank of specialized Internalizers indexed by query embeddings. New tasks retrieve the closest matching Internalizer, update it during execution, and save it back. To avoid a cold start, the bank is seeded with 20 domain-clustered anchor entries that are copied before specialization so foundational priors aren't overwritten.
Datasets
No new benchmarks were introduced. The authors evaluated TIMA across eight existing benchmarks spanning four distinct task families:
- Mathematical Reasoning: GSM8K, MATH
- Code Generation: KodCode, BigCodeBench
- Multi-Hop QA: HotpotQA, 2WikiMultihopQA
- Multi-Turn Interactive Environments: ALFWorld (household tasks), WebShop (online shopping)
To warm-start the Internalizer Bank, 300 successful trajectories per benchmark (strictly disjoint from test sets) were drawn from official training splits for static tasks and from AgentBank for interactive tasks.
Key Insights and Ideas
- Confidence is the antidote to catastrophic forgetting: Updating a model on its own live outputs sounds like a recipe for a death spiral. The authors show that without filtering, accuracy on HotpotQA plunges from 44.7% to 36.9% over subsequent update blocks. Simply ignoring high-entropy (uncertain) turns stabilizes memory, holding accuracy steady (45.6% $\rightarrow$ 43.7%).
- Agentic TTL needs action-grounded objectives: Standard test-time learners like Titans (which updates memory based on token-level "surprise") actually perform near or below vanilla baselines here. Optimizing specifically to predict the agent's reasoning-and-action trajectory is what unlocks procedural learning.
- Emergent specialization without hard caps: The Internalizer Bank doesn't explode in size over long task streams. It grows sub-linearly and naturally plateaus—routing new tasks to existing specialists and refining them in place, with t-SNE plots revealing clean, interpretable sub-clusters inside the memory space.
- Tiny footprints carry massive weight: Going from $K=0$ to just $K=4$ continuous memory tokens boosts HotpotQA accuracy on Qwen by 24.1 percentage points, proving procedural patterns can be remarkably compact.
Key Results
Across both Qwen2.5-7B-Instruct and Llama3.2-3B-Instruct, TIMA consistently beats vanilla prompting, textual memory (RAG, A-Mem), RL-augmented search (Search-R1), and latent-memory baselines (MemGen, Titans).
- Reasoning Benchmarks: On Qwen2.5-7B, TIMA takes first place on all six static benchmarks, averaging 61.25% accuracy (a +12.81% jump over Vanilla, +4.47% max gain over MemGen, and up to +15.96% over Titans). Turning off test-time updates (
TIMA w/o ttl) drops average accuracy by ~4.3%, proving live adaptation—not just bank retrieval—drives the win. - Interactive Agents: On ALFWorld, TIMA hits 78.1% overall success, crushing textual memory A-Mem by 26.3 percentage points (a ~50.8% relative leap) and beating offline latent-memory MemGen (76.3%), with the biggest gains on complex multi-step tasks like clean (+7.7%) and pick2 (+6.4%). On WebShop, it leads with a 58.7% success rate.
Limitations and Future Work
Not discussed in the paper. (Note: The provided text concludes after Section 6 without a dedicated Limitations or Future Work section, deferring extended ablations and hyperparameters to the appendices.)
Summary updated