Engram: Multi-Stage Memory for Agentic Tuning of Heterogeneous Models

Huanran Li, Nhat X. T. Le, Kevin De Angeli, Yao Xuan, Alireza Vahdatpour, Djordje GligorijevicarXiv 2026

TL;DR

Imagine an expert AI engineer who forgets every lesson they’ve ever learned the moment they start a new project. Engram fixes this "agentic amnesia" by giving LLM-based tuning agents a multi-stage memory system. By intelligently retrieving and judging past experiments, Engram allows agents to tune complex neural networks 47% faster than starting from scratch.

What Problem Does This Paper Address?

Tuning a deep neural network is often a dark art. Engineers spend weeks tweaking learning rates, layer widths, and optimizer settings based on "vibes" and hard-won experience. Recently, Large Language Model (LLM) agents have stepped in to automate this, reasoning over code and logs to suggest better configurations.

The catch? These agents usually have no "cross-session" memory. If an agent learns a brilliant trick for a click-prediction model on Monday, it has completely forgotten it by Tuesday when it starts tuning a slightly different model.

Reusing past lessons is surprisingly hard because models are heterogeneous. A learning rate that works for a small model might cause a massive one to diverge. A trick that requires a huge compute budget is useless if you're tuning for a mobile device. The authors identify that we don't just need a database of past results; we need a system that understands the rationale behind those results and can judge if they apply to the current "patient" on the operating table.

Methods

Engram introduces a sophisticated, multi-stage memory architecture that mimics how a human expert recalls information. It splits data into two buckets: Memory (raw logs of every trial ever run) and Knowledge (distilled, validated lessons).

The system operates in three distinct "online" stages and one "offline" stage:

  1. Initial Guidance (IG): At the very start of a session, the agent gets a "cheat sheet" of validated lessons from the Knowledge base that match the current model's architecture and budget.
  2. Session Retrieval (SR): Before generating a new batch of hypotheses, the agent looks back at entire past tuning sessions. It doesn't just look for "similar" models; it looks for sessions that were successful for the same reasons the current session is showing promise.
  3. Trial Candidate Review (TCR): This is the final "sanity check." Before a trial is actually executed (which is expensive!), an agent compares the specific proposed change against similar individual trials in the past to see if it's likely to fail or exceed the compute budget.
  4. Offline Consolidation: Between tuning sessions, an offline agent acts like a librarian. It reviews new trials, identifies successful patterns, validates them against other models, and promotes them to the "Knowledge" base.
Figure 2: Online Agent: multi-stage retrieval and curation of evidence for the tuning agent. Insets are schematic.

Datasets

The researchers evaluated Engram on two massive, production-scale advertising models at Meta.

  • Model 1: A model with a "rich" history (227 past sessions to learn from).
  • Model 2: A model with a "poor" history (only 299 sessions from "distant" models that were quite different in purpose).

They measured success using Normalized Entropy (NE)—a standard metric for log loss in ad ranking—and kept a strict eye on inference FLOPs to ensure the tuned models weren't just getting better by becoming impossibly slow.

Key Insights and Ideas

  • Rationale is King: Simply knowing that "Learning Rate = 0.1 worked" isn't enough. Engram stores the reasoning the agent used. If the reason was "the model is small and can handle high volatility," a later agent can decide if that logic still holds for a larger model.
  • The "Agreement" Metric: In Session Retrieval, Engram uses a clever scoring system. It ranks past sessions higher if they showed gains on the same parameters that are currently working for the agent. It’s like saying, "Oh, you're looking at embedding sizes? Here's a guy who found a goldmine there last month."
  • Curation over Volume: More data isn't always better. The paper shows that "No curation" (just dumping all past data on the agent) actually performs worse. The LLM acts as a filter, protecting the tuning agent from "misapplied evidence" that could lead it down a rabbit hole.

Key Results

The results are a compelling argument for giving AI a diary:

  • 47% Faster Tuning: On both models, Engram reached the same performance level in 17 trials that a "from-scratch" agent took 32 trials to achieve.
  • Better Final Performance: Not only did it get there faster, but it often found better configurations overall.
  • Robustness to "Distant" History: Even on Model 2, where the history came from very different types of models, Engram's ability to judge applicability allowed it to outperform the control.
Figure 1: Tuning an ads model: best normalized log loss on unseen data (mean and range over five sessions). With history, the agent needs 47% fewer trials to match its 32-trial result from scratch.

Limitations and Future Work

While the results are impressive, the authors note a few areas for growth:

  • Scope of Evaluation: The study focused on two specific (albeit large) ads models. How well this transfers to vastly different domains like Computer Vision or LLM pre-training remains to be seen.
  • Sample Size: Each "arm" of the experiment was run five times. While statistically significant for this field, larger-scale testing would further solidify the findings.
  • The Consolidation Loop: The "self-improving" nature of the memory (where it gets smarter over months of use) is a long-term promise that needs more longitudinal data to fully prove out.

In short, Engram suggests that the future of AI agents isn't just about bigger models or more compute—it's about making sure they don't have to learn the same lesson twice.

Summary updated

Abstract

Large language model (LLM) agents can now tune neural networks, yet without cross-session memory they spend costly trials rediscovering known lessons. Reuse is difficult because production models differ in architecture, training setup and inference budget. We present Engram, a memory system that links past trial outcomes with the hypotheses and rationale behind them and assesses whether this evidence applies to the current model. An online agent curates evidence at the decision points where it is needed: Initial Guidance supplies validated lessons at the start, Session Retrieval supplies related past sessions before each batch of hypotheses is generated, and Trial Candidate Review checks each trial candidate against matching past trials. Between sessions, an offline agent distills validated lessons, making the memory self-improving. On two ads models, Engram reaches the 32-trial result of a no-memory control with 47% fewer trials and also ends with a better model on average.
BibTeX
@misc{li2026engram,
  author = {Huanran Li and Nhat X. T. Le and Kevin De Angeli and Yao Xuan and Alireza Vahdatpour and Djordje Gligorijevic},
  title = {{Engram: Multi-Stage Memory for Agentic Tuning of Heterogeneous Models}},
  year = {2026},
  eprint = {2611.28356},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.28356},
}
Figure