Agentic Memory

Memory in an agent is one system across timescales, like memory in a brain: where it lives, how it moves, and how it gets written.

the memory stack

5

Fast, small and volatile at the top; slow, large and durable at the bottom. Memory moves between the stores along four flows.

flows

Written down the stack, read back up, consolidated into the weights, and forgotten out of every store. Pick a flow to follow it; pick a store for its facts.

Encode. Down the stack. The forward pass writes the KV cache and the recurrent state on its own; the agent decides what goes into external memory.

Retrieve. Up the stack, into the context. Notes come back by retrieval (RAG), the weights by generating what the model knows, a cached prefix by reuse.

Consolidate. Into the weights. Experience is replayed as synthetic data and trained in, as sleep moves memories from hippocampus to neocortex. A larger or longer-context teacher can distil in too.my focus

Forget. Out of every store: truncation, eviction, overwrite, curation and decay, and in the weights interference or deliberate unlearning (SHRED).

Select a store: its facts open below the stack.

how memory gets written

3

Every write to memory, fast or slow, is set by three independent knobs.

objective

what the update optimises

  • next-token likelihoodpredict the data
  • preferenceRLHF, DPO
  • distillation(my focus)self or teacher
  • forgetting term(my focus)unlearning

data

what it learns from, in what order

  • IIDshuffled, revisitable: the standard assumption
  • streaming(my focus)once, in order, drifting: where forgetting bites

update

how the change is computed

  • backpropgradient descent on the weights
  • backprop-free(my focus)in-context learning, memory writes, fast weights, consolidation without gradients through the whole model
filled: my focus

The knobs are independent; mine are set to streaming data, distillation and forgetting objectives, and backprop-free consolidation.

trade-offs

6
Trade-offs across the five memory stores, marked low, medium or high.
trait01Context window02KV cache03Recurrent state04External memory05Parametric memory
capacitylow: fixed windowmedium: grows per tokenlow: constanthigh: unboundedmedium: fixed, large
write costlow: appendlow: a side effectlow: every stepmedium: a decisionhigh: gradient descent
read costhigh: every tokenmedium: dense or sparselow: constantmedium: a retrieval steplow: free
persistencelow: one calllow: a sessionmedium: the streamhigh: across sessionshigh: permanent
editabilityhigh: edit the textmedium: evict or selectlow: opaquehigh: edit the notelow: unlearning
interferencelow: lowlow: lowhigh: overwritelow: lowhigh: catastrophic

01 Context window02 KV cache03 Recurrent state04 External memory05 Parametric memory

open problems

4
  1. 01Generalise, not memoriseparametricWhat goes into the weights should transfer, not only be recalled.
  2. 02Learn from a stream without forgettingstreamingExperience arrives once, in order; the weights must keep what they had.
  3. 03A state store stronger than the context windowrecurrent stateFixed in size, carried across the whole stream, and worth reading.
  4. 04Consolidation without backpropconsolidateWrite what matters into memory as the stream passes, not in the next offline run.

The full list is on Research.

Zizhao Huloading加载中