TL;DR
Cortex turns temporary in-context knowledge into permanent weight updates by having the model generate anticipated future queries, then distilling the context-conditioned answers into small Feed-Forward Network additions, so the knowledge survives after the context is removed while the rest of the model stays intact.
Why It Matters
You give an LLM a document, a new API spec, a persona instruction, or a corrected fact in its prompt, and it uses that information well. Then the context window rolls over, or the next user session starts fresh, and the model is back to not knowing. You can keep stuffing the context (expensive, lossy at scale) or hit Retrieval-Augmented Generation (works only if retrieval surfaces the right chunk at the right moment).
The alternative is to write that knowledge into the weights. But existing approaches each solve only a slice: Knowledge editing methods like ROME and MEMIT target single facts; Context distillation trains a context-free student to mimic a context-conditioned teacher but assumes you supply the query distribution; continual Supervised Fine-Tuning tends to catastrophically forget other capabilities. The authors call the unified version of this problem Memory Consolidation (MC): given a context C that provably helps on some queries, produce an updated model that keeps that gain without C and preserves everything else, after every update in a sequence.
How It Works
Cortex answers three questions. What to learn: the pre-update model generates its own prospective queries, meaning plausible future questions where C would matter, then answers them with C in context. Those (query, answer) pairs become the training set. No external teacher, no held-out eval leakage.
Where to write: only into feed-forward layers, which prior interpretability work identifies as key-value memory. Two variants: Synaptic adds LoRA-style low-rank updates to the existing gate/up/down projections; Structural adds brand-new nonlinear channels alongside the frozen originals (think: widening the FFN rather than nudging it). Both fold into standard FFN or Mixture of Experts layers at deployment, so inference uses the normal forward pass. For MoE models, Cortex uses one shared expansion branch that every token flows through, instead of per-expert branches that only see their routed tokens.
How to write: a frozen teacher sees [prefix, C, query, answer]; the student sees the same minus C and trains to match the teacher’s output distribution (truncated top-1024 KL) and its post-FFN hidden states (MSE). The hidden-state term gives the new FFN parameters an explicit target for compensating what attention loses when C is removed. For sequential updates, earlier adapters are frozen and only the current one trains; a query replay buffer stores past questions (not answers or contexts) and regenerates targets on the fly.
for C_t in context_stream:
queries = M_prev.generate(prompt="anticipate uses of", context=C_t)
answers = M_prev.generate(queries, context=C_t) # teacher-forced targets
replay = [(q, M_prev.generate(q)) for q in buffer] # regenerate, no old C
psi_t = new_ffn_params() # Synaptic or Structural
for (q, a) in answers + replay:
kl = KL(student(q; psi_t), teacher(q, C_t)) # top-1024 vocab
mse = post_ffn_hidden_mse(student, teacher)
step(psi_t, kl + mse)
M_t = merge(M_prev, psi_t) # folds into FFN/MoE
What They Found
The headline continual result: on a 14B model edited with 50 facts sequentially, Cortex-Structural reaches 88.9% consolidation rate (fraction of the context-induced gain recovered) and 99.8% retention rate (preserved baseline performance on unrelated queries), adding only 0.74M parameters per edit. The strongest baseline by final CR, ROME, gets 28.5%. Standard editors like FT-M, MEMIT, AlphaEdit, and WISE all show 86-91% of their responses degenerating into repetition or hitting length limits by edit 50; Cortex shows 0-0.8%.
Across a five-task testbed (ALFWorld, novel Python API learning, persona steering, RWKU knowledge suppression, factual editing) spanning 4B-120B dense and MoE models, at least one Cortex variant lies on the empirical consolidation-retention Pareto frontier in each of 15 task-model panels. On persona steering it recovers roughly 95-100% of the contextual effect with 99-100% fluency retention. On Qwen2.5 ALFWorld, consolidated experience actually beats contextual prompting (128-133% CR), though on GPT-OSS-20B tau2-bench the Synaptic variant underperforms vanilla on the target task, so the result is environment-dependent.
Ablations are informative. Training LoRA on Cortex’s own rehearsal data recovers much of the fact-level accuracy but loses portability (compositional use of the new fact) and retention through later edits, so the writing mechanism matters beyond the data. Restricting updates to FFNs beats also-adapting attention on both CR and RR. Removing query replay collapses old-edit accuracy from ~96% to 8-40% even though those adapters are frozen (frozen parameters do not mean frozen behavior, because upstream inputs shift). Shared MoE expansion beats per-expert expansion at matched parameter budgets, and the authors attribute this to more uniform training exposure since every token flows through the shared branch.
What’s Useful
•
If you are running continual factual edits on a model you control the weights for, Structural Cortex is worth benchmarking against MEMIT or AlphaEdit. The compact-updates finding (smallest k=1 beats larger widths under the same recipe) suggests starting small.
•
If you have been using Retrieval-Augmented Generation for stable, repeatedly-queried knowledge (API docs, personas, policy), consolidation into weights is an alternative worth testing when retrieval misses matter and the knowledge changes slowly. The paper does not establish that it beats RAG for frequently-updated or high-recall-sensitive retrieval.
•
For agent experience, the Qwen2.5 ALFWorld result where consolidated experience beats in-context prompting is interesting, but the τ2-Bench result shows it is not universal. Worth running on your own environment before committing.
•
The testbed and code will be released, so you can reproduce the CR/RR protocol on your own backbone. •
Prerequisite: this needs weight access, teacher-forced forward passes, and training infrastructure. It is not an API-only technique.
Caveats
All evaluations are text-only despite including multimodal backbones. The 50-edit continual sequence is modest; the authors flag large-batch and cross-task continual consolidation as future work. The τ2-Bench Synaptic result (-92% CR) shows that interactive environments can break the method in ways the aggregated frontier claim hides. CR and RR are only meaningful when the context gap is substantial and the retention baseline is positive, so the metrics do not translate directly to settings where the model already handles the query without context. Finally, the paper evaluates consolidation of knowledge that fits in a usable text context; experience that cannot be expressed that way is out of scope.