Research
MemoryAthena: Adaptive Routing over Latent and Generated Memories
MemoryAthena: Adaptive Routing over Latent and Generated Memories Overview Research area: Natural Language Processing, specifically memory-augmented language models, retrieval-augmented generation, an

- arXiv
- 2609.25853
- Published
- 2026-09-22
- Authors
- Mingyuan Li, Guangsheng Yu, Juyuan Zhang, Xu Wang, Zhibo Man, Haonan Zhang, Shaoxiong Ji
AI summary
MemoryAthena: Adaptive Routing over Latent and Generated MemoriesOverview
Research area: Natural Language Processing, specifically memory-augmented language models, retrieval-augmented generation, and conditional routing.
Technical level: Intermediate — the paper assumes familiarity with learned/retrieval memory (Engram, kNN-LM, MLP Memory), residual injection into frozen backbones, and mixture-of-experts style routing.
Scope: The paper proposes a three-pathway memory interface (direct retrieval, retrieval-conditioned generation, and context-conditioned generation) and a lightweight E-anchored router that decides when, which, and how strongly a generated memory should modify a direct memory retrieval, evaluated on five QA benchmarks and six NLP classification tasks.
What This Paper Is About
Most memory-augmented language models pass a stored item to the model unchanged, and prior work shows a memory system can be split into addressing, storage, and reading so that memory learned with one backbone can be reused by another through an adapted reader. This paper asks whether a useful memory representation must always be retrieved from storage, or whether it can instead be generated — either conditioned on retrieved memory cues or conditioned on the model's own causal hidden states. The goal is to build a system that keeps direct retrieval as a stable reference and selectively lets a generated representation intervene only when it is predicted to help.
Key Contributions
-
From memory retrieval to memory generation. Building on a decomposition of external memory into addressing, storage, and reading, the authors introduce a three-path memory interface spanning direct Engram retrieval (E), generation from retrieved Engram cues (GE), and generation from causal backbone states (GH), and use it to test whether the representation a language model consumes must be explicitly stored.
-
Routing under heterogeneous memory utility. The paper frames generated memory as a conditional intervention problem rather than a replacement problem. MemoryAthena keeps E as an explicit anchor and learns when, which, and how strongly a generated representation should intervene, using bounded interpolation with exact fallback to the direct pathway.
-
Counterfactual advantage distillation without downstream supervision. Routing targets are constructed from future-token likelihood differences among frozen memory pathways and distilled into a lightweight causal head, separating the learning of how to construct memory representations from learning when to use them.
Main Findings
-
Question answering improves over the same-checkpoint direct pathway. MemoryAthena raises the five-task QA average from 37.65 (E only) to 39.28, improving all five QA metrics relative to E: NQ from 28.28 to 33.02 (+4.74), WebQA from 33.35 to 34.60 (+1.25), TriviaQA from 69.34 to 70.68 (+1.34), TruthfulQA from 31.25 to 31.74 (+0.49), and HotpotQA from 26.04 to 26.34 (+0.30).
-
General NLP improves as well. The six-task average increases from 76.73 (E only) to 79.13. Improvements over E are 3.90 points on SST2, 3.70 on MR, 1.70 on CR, 1.50 on RT, and 3.71 on AGN. Yahoo is the exception: with the more conservative setting τ = 1, the router reaches 57.43 against 57.51 for E, while the other five tasks use the default admission threshold τ = 0.
-
Generated memory is not uniformly better than retrieval. GE improves WebQA from 33.35 to 35.24 but is weaker than E on TriviaQA and HotpotQA, and GH is weaker than E on all five QA summary metrics (GH-only average 33.21 versus E-only 37.65).
-
E-anchored routing beats symmetric alternatives. Ordinary hard routing averages 35.83 and ordinary soft fusion falls to 28.62. The stronger subset-hard control reaches 37.74, still below MemoryAthena at 39.28. Subset soft fusion reaches 29.48.
-
Learning to route is critical. A random-router control averages 31.67, a decrease of 7.61 points from 39.28, with TriviaQA F1 falling from 70.68 to 49.18. Making E, GE, and GH available is insufficient without a learned selective policy.
-
Pretrained memory initialization is not required. Training the memory system from scratch reaches 40.16, slightly above the pretrained-memory configuration at 39.28.
-
The learned interface matters more than parameter count. Removing the gate reduces the five-task average from 39.28 to 33.35, and replacing the interface with a parameter-matched FFN reduces it to 24.92. An affine-stitch alternative reaches 37.81, and permuted Engram keys reach 38.58.
-
Memory-side system size. The complete memory-side system contains approximately 201M parameters, excluding the frozen backbone.
-
Routing behavior is task-dependent. GH provides the majority of the memory contribution: 74.15% on NQ, 76.08% on WebQA, and 76.77% on TruthfulQA, while GE contributes 3.83–6.23%. GH also dominates SST2 (77.99%), MR (75.50%), AGN (89.03%), and Yahoo (71.86%). CR is the counterexample, with GE at 44.60% versus GH at 34.04% and E at 21.36%; RT retains a larger direct-memory component (28.42%). Mean interpolation strength ranges from 0.716 to 0.893.
-
A gold-label oracle gap remains. The three-source oracle improves over the best E-containing two-source oracle by 2.32 points on NQ, 3.37 on WebQA, 1.79 on TriviaQA, 0.73 on TruthfulQA, and 2.35 on HotpotQA. The three-source oracle exceeds MemoryAthena by 5.31 points on NQ, 9.07 on WebQA, 5.94 on TriviaQA, 3.04 on TruthfulQA, and 7.74 on HotpotQA.
-
Cross-backbone transfer remains usable. After transferring the memory interface from Mistral to Llama, the system averages 37.87 and stays competitive with the same-checkpoint Mistral E pathway, with WebQA at 36.40.
-
Not reported. The paper does not report uncertainty estimates or functional coding scores, and states these are not inferred.
Methodology in Plain English
The system keeps a frozen language model and attaches memory to it, rather than training a new model. Three "pathways" produce a residual that is added to the backbone's hidden states:
- E reads the retrieved Engram memory entry directly, exactly as conventional memory interfaces do.
- GE uses retrieved Engram cues as conditions for generating a small latent representation instead of reading the stored entry literally.
- GH generates that latent representation from the backbone's own causal hidden states, without consulting the external memory table at all.
Training happens in three stages. First, the addressable memory table is learned while the source backbone is frozen. Second, the memory and the target backbone are frozen and the generators and target-side readers are adapted so all three pathways can produce usable residuals. Third, everything is frozen and only a small routing head is trained.
To train the router without downstream task labels, the authors run each pathway alone under teacher forcing and measure its token-level advantage over E: the log-likelihood difference for the observed next token. These differences are aggregated over several future horizons to form smoother targets. The routing head then predicts, from current-state features only, how much each generated pathway is expected to improve over E, plus a confidence score.
At inference time, a generated pathway is admitted only if its predicted advantage exceeds a threshold τ and its confidence exceeds a threshold ρ. The best admitted candidate modifies the direct residual through bounded interpolation: r = e + α(g − e), with α between 0 and 1 and maximum scale a_max = 1 and temperature T_α = 0.15. If nothing is admitted, α becomes 0 and the direct E pathway is recovered exactly.
The primary backbone is Mistral-7B-v0.3, with memory injected at layers 2 and 10 through a four-branch reader; Llama-2-7B supplies the imported source memory and serves as the target backbone in the cross-backbone transfer row. Memory dimension is 512. Each generator produces four latents from a three-position causal window with width 256, two layers, and four attention heads, and source-adaptation rank is 16. The QA router uses Wikipedia-2021 text; the general NLP pipeline uses an equal-token mixture of WikiText-103, Amazon Polarity review text, CC-News, and IMDB text. QA evaluation covers Natural Questions (3,609 examples), WebQuestions (2,032), TriviaQA (17,944), TruthfulQA (817), and HotpotQA (7,405). The six NLP tasks contain 872, 2,000, 2,000, 1,066, 7,600, and 60,000 examples respectively.
Why This Matters
Impact on research. The paper reframes memory-augmented language modeling from "retrieve and inject" to "generate and selectively correct." It shows that generated memory is conditionally useful rather than uniformly superior, and that the central difficulty is utility estimation and admission, not representation construction. It also provides a label-free distillation scheme for training such decisions, and quantifies how much complementarity remains unexploited through oracle headroom.
Real-world applications:
- Enterprise question answering over internal knowledge bases, where a stable direct retrieval path can be retained while generated memory handles inputs where stored entries are a poor match.
- Domain-adapted assistants for legal, medical, or technical corpora, where memory learned with one model can be transferred to another backbone through an adapted reader.
- Long-horizon dialogue and document assistants, where context-conditioned generation (GH) can supply a representation when the memory table is unhelpful.
- Sentiment and topic classification pipelines on the six evaluated NLP tasks, where the method improved SST2, MR, CR, RT, and AGN over the direct pathway of the same checkpoint.
Industry relevance. The routing head is lightweight and trained while the backbone, memory, generators, and readers are all frozen, so a deployed frozen model can be augmented without retraining it. The memory-side system is approximately 201M parameters excluding the backbone. The paper also notes that GH requires a clean backbone computation in the current implementation, and freezing its parameters does not remove that inference cost — a practical consideration for latency-sensitive deployments.
Future Directions
-
Close the oracle gap. The gold-label three-source oracle exceeds the deployed router by 3.04 to 9.07 points across QA tasks, indicating that complementary information is already available but not fully exploited.
-
More automated routing objectives. The authors call for objectives that jointly discover useful memory candidates, calibrate their utility, and approach oracle-level selection without downstream labels.
-
Reduce dependence on manual hyperparameters. The system still relies on memory pathways, routing features, training objectives, and admission hyperparameters (τ, ρ, a_max, T_α); the paper states it does not yet provide a fully automatic mechanism for discovering which memory representation to construct and use for a given input.
-
Address inference cost. GH requires a separate clean backbone pass in the current implementation, and this cost persists even with frozen parameters — an open question for practical deployment.
Target Audience
Researchers and engineers working on memory-augmented language models, retrieval-augmented generation, and conditional computation or routing. It is most useful to readers already comfortable with frozen-backbone adaptation, residual injection, and mixture-of-experts style gating, and to practitioners who need to decide whether adding memory generation to an existing retrieval pipeline is worth the added inference cost.
Authors’ abstract
Learned-memory methods store information in an explicit table and consume it through a separate reader, allowing addressing, storage, and reading to be modified independently. We study whether useful memory can also be generated rather than only retrieved. MemoryAthena uses three pathways: direct Engram retrieval (E), generation from retrieved Engram cues (GE), and generation from causal backbone states without consulting the memory table (GH). Generated memory is conditionally useful: it can complement E in one context but interfere with it in another. MemoryAthena therefore treats E as an anchor and learns when a generated representation should intervene. With the backbone, memory, generators, and readers frozen, a lightweight causal routing head is trained from counterfactual future-token likelihood advantages of GE and GH relative to E. At inference time, an admitted candidate modifies the E residual through bounded interpolation, while rejection recovers the direct pathway exactly. On question answering, MemoryAthena raises the five-task average from 37.65 to 39.28 over the direct pathway of the same checkpoint, while the six-task general-NLP average increases from 76.73 to 79.13. The complete memory-side system contains approximately 201M parameters, excluding the frozen backbone. Further analyses show complementary strengths among E, GE, and GH across tasks and inputs. These results support generated memory as a selective correction to direct retrieval and highlight routing when, which, and how strongly to intervene as the central challenge.