Distilling Memory and Procedural Skills
Should an agent acquire procedural knowledge through distillation into its parameters, retrieval from external memory, or both? A bounded E4 extension where retrieval and distilled weights tie on static accuracy, stale knowledge defeats both, and deletion plus read-through wins.
Chapter 26 ended with a student that reproduces training rollouts and fails new situations. The diagnosis offered, as a hypothesis, was that the policy memorised training states without extracting the rule that would generalise; the floor result was consistent with that reading without isolating it. This chapter asks a related question: whether the facts an agent answers from have to live in its weights at all, and tests whether that knowledge has to live in the weights at all:
Should an agent acquire procedural knowledge through distillation into its parameters, retrieval from external memory, or a combination of both?
The measured answer is that the carrier matters more than the score. Retrieval from a store and distillation into weights tie exactly on overall success (0.667 on all three seeds; both are perfect on the fresh queries) — and fail the same stale queries identically (0.000). Deletion plus a read-through workflow succeeds everywhere (1.000). Same knowledge, different carriers, different fates when the world changes. The experiment exists to make that sentence checkable rather than rhetorical.
What lives where
Three carriers, three update and deletion properties. Parametric knowledge is a fact baked into weights by gradient descent: cheap to query (one forward pass), expensive to change (retraining), and undeletable in any targeted sense — there is no operation that removes “entity 5, attribute 2 is 7” from a weight matrix without affecting everything else the matrix holds.
External memory is a fact kept in a store outside the weights: cheap to query (one lookup), cheap to change (overwrite the entry), and deletable key by key with an audit trail. Procedural knowledge is knowing how rather than knowing that: the lookup–read–answer sequence, which lives in the policy in all our arms and is the only thing the memory-less arm even attempts to hold.
The chapter’s central distinction is between knowing that and knowing how, crossed with where each lives. Our memory-less policy (arm A) must carry both the procedure and all 64 facts in 10,400 parameters, and carries neither to the test set. Our retrieval arm (B) carries the procedure nowhere — it answers from the store in one lookup — and the facts in 64 entries. Our distilled arm (C) carries 64 facts in 1,200 weights and no procedure at all. Our combined arm (D) carries the facts in a pruned store and the procedure in a verified workflow. Four designs, one environment, and the failures sort them.
| Carrier | Query cost | Change cost | Deletion | Lives in |
|---|---|---|---|---|
| Parametric (weights) | one forward pass | retraining | none targeted | arm A, arm C |
| External memory (store) | one lookup | overwrite entry | key + audit trail | arm B |
| Procedure (workflow) | three tool steps | rewrite workflow | version the workflow | arm D |
Table 1. The three carriers compared on the properties the experiment measures: query cost, change cost, and deletion. Which carrier wins depends on the task; the results below decide for this one.
Retrieval-conditioned action selection
A retrieval-conditioned policy chooses actions given both the observation and what the store returns. Write the store lookup as \(m(o)\) — the stored value for the query in \(o\), or empty on miss. The retrieval-conditioned policy used here is deliberately the simplest possible (and the chapter labels the formalism below as a book hypothesis, not an established result):
What the formalism buys even in this minimal form is a language for the failure analysis: every error in arms B and D is attributable either to retrieval (wrong or stale \(m(o)\)) or to action (wrong use of a right \(m(o)\)), never to a mixture the measurements cannot separate. In our results the action side never fails — the rule is deterministic — so all B failures are retrieval failures (staleness), and D’s perfect score means its misses were all handled by the fallback.
Walk the rule through query (5, 2) as changed: the store holds the v1 value 7; the environment now says 15. Arm B computes \(m(o) = 7\), answers 7, fails — retrieval error, action correct. Arm D computes \(m(o) = \emptyset\) (entry deleted), runs the fallback: LOOKUP(5), READ(5,2) observing 15, ANSWER(15) — succeeds, at the price of two counted tool steps (LOOKUP and READ) after the failed store lookup.
Arm C has no \(m(o)\) at all; it fails with no intermediate state to inspect (its exact output is not logged; the memorised v1 value, 7, is the expected one). Three carriers, three observable traces, one truth (15): the formalism turns “the memory failed” into an assignment of blame per arm, which is the precondition for fixing any of them.
Figure 1. Answers against truth 15 on query (5, 2): B retrieves the outdated v1 fact 7, C recalls the memorised 7, D observes 15 via read-through. Chapter 27 walkthrough values.
A simple memory objective falls out of the same framing, also as hypothesis: minimise expected task loss over the joint of retrieval and action,
The numbers instantiate the decomposition per arm. Arm B: coverage term 0/12 (the snapshot covers every test key), freshness term 4/12 (the four changed queries), use term 0/8 (every fresh retrieval answered correctly). Arm D: coverage term 4/12 — but every miss is handled, so the loss needs a fourth term the hypothesis as stated omits: fallback failure, 0/4 here. The omission is instructive.
A memory objective that stops at retrieval precision treats a miss as a loss; a system with read-through treats it as a cost (extra steps). D’s 1.67 operations per query against B’s 1.00 is that cost made visible. The chapter keeps the three-term form as the book hypothesis and records the fallback term as the extension a production memory objective would need — stated as design reasoning, not as a measured result, because the fallback here is one fixed workflow rather than a policy whose failures could be estimated.
Working memory versus persistent knowledge
The observation vector already contains a working memory: the last tool result, the current entity, the steps used. It persists for the episode and vanishes after. The store is persistent knowledge: it survives across episodes and must be maintained across KB updates. Conflating them is the standard design error — treating a fact needed next episode as something to hold in activations, or treating a transient tool result as something to write to the store. The experiment keeps them physically separate (observation fields vs store entries) so the measurements cannot conflate them either.
Concretely, on query (5, 2): the working trace is \(o_0\) (query
5/2, nothing done) → LOOKUP(5) → \(o_1\) (entity 5 current) →
READ(5,2) → \(o_2\) (value 15 observed) → ANSWER(15). Every field in
\(o_0, o_1, o_2\) is recomputed from the live state and discarded at
episode end. The store entry ((5,2), 7), meanwhile, sits unchanged
from snapshot to test, consulted in one step by arm B and never
updated.
When the KB changes, the working trace is unaffected — D’s
read-through rebuilds it from the current environment — while the
store entry silently becomes wrong. Episodic state goes stale by
ending; persistent state goes stale by surviving. Only the second
kind needs a retention policy, and only the second kind got one
(retain-kb-v1, study-end).
Demonstration-based procedural learning is what arm A attempts: 120 state-action pairs teaching lookup–read–answer. Chapter 26 found it reproduces training states without generalising, and arm A here reproduces that floor on a fresh split (0.000 on all twelve test queries and all twelve validation queries, against 2,000 updates on the same 120-pair recipe). The reproduction matters: it confirms the D-FP-12B finding is not a split artefact, since seeds, splits, and test composition all differ.
The memory arms do not attempt procedural learning at all — B has no procedure beyond the one-line rule, C has no procedure beyond direct answering, D’s procedure is the pinned workflow. The procedural question the chapter can therefore answer is narrow but real: when the facts live outside the weights, how much procedure does the agent still need? Answer from the measurements: one lookup (B), one forward pass (C), or one lookup plus a three-step fallback (D). Everything else the memory-less policy struggled to learn disappears once retrieval works.
Example A — a stored fact
Query (3, 1). The store holds ((3,1), 6) with provenance
kb-snapshot-v1: \(3\cdot5+1\cdot7 = 22\), and \(22\bmod 16 = 6\).
The stored value is 6, the environment
still says 6 (unchanged combo), arm B looks it up and answers 6:
one lookup, correct. Arm C, distilled on all 64 v1 facts including
this one, answers 6 from weights: one forward pass, correct. Arm A
rolls out its memorised policy, reads the wrong attribute, answers
wrong. The three carriers agree on nothing except the answer key —
and B and C get it right for entirely different reasons (retrieval
vs retention) that the stale queries will separate.
Example B — the ordered procedure
D’s read-through on a missed query is the chapter’s procedural task: LOOKUP the query entity, READ the query pair, ANSWER the observed value — the Chapter 26 teacher sequence, executed as a pinned workflow rather than a learned policy. On the four changed queries, D misses the store (entries deleted), runs the three steps against the current environment, observes the v2 values (8, 15, 4, 10), and answers each correctly.
Cost: one failed store lookup plus two counted tool steps (LOOKUP and READ; the final answer is not counted) each, mean 1.67 operations per test query against B’s 1.00. The workflow is slower and always right; the store is faster and stale on a third of the test. That exchange rate — 0.67 extra operations per query for the four points of stale accuracy — is the chapter’s quantified trade-off, valid for this task and stated as such.
Example C — the stale failure
Query (0, 0). KB v1 says 0; the update makes it 8. Arm B looks up (0, 0), retrieves 0, answers 0: wrong. The retrieval was perfect (the store contains exactly what was snapshot) and the answer is wrong anyway, because the world moved. Arm C also fails from weights (its exact output is not logged; the memorised 0 is the expected one): same failure, different carrier, no recourse — there is no key to delete in a weight matrix.
The pair of failures is the chapter’s cleanest evidence that staleness is a property of the update protocol, not of either carrier: both held the old truth faithfully, and faithfulness to an outdated snapshot is failure. The same four queries (with v1/v2 pairs 0→8, 7→15, 12→4, 2→10) defeat B and C on every seed while D answers all four by reading the current environment.
Example D — the deletion that propagates
A deletion request arrives for the four stale facts. Arm D retires
the four store entries; the audit reads 60 live, 4 retired, each
with its source trail (retired (0, 0) (source=kb-snapshot-v1) and
siblings). Every subsequent lookup of a deleted key misses — asserted
in the runner before evaluation proceeds, so propagation is verified,
not assumed. The four misses become four read-throughs, all
correct. Contrast arm C: the same request has no operation to
perform.
One could retrain C on corrected facts (2,000 more updates, unmeasured here), filter its outputs (Chapter 19’s machinery, no deletion semantics), or accept the stale answers. None of those is deletion. The chapter’s decision rule follows directly: if the retention policy requires targeted erasure — and under the GDPR’s right to erasure (L-021) it sometimes does — the knowledge must live in a deletable carrier. Weights are the wrong intervention where deletion is a requirement, regardless of their accuracy while fresh.
Memory provenance, retention, and the law
Every store entry carries its key, value, source (kb-snapshot-v1),
purpose (retain-kb-v1), retention window (study-end), and seed.
The audit distinguishes live from retired and the fingerprint pins
the live set per seed. This is KD-041 (data provenance) applied to
memory rather than training data: the same chain-of-custody
questions — where did this fact come from, what may it be used for,
when must it go — with a shorter fuse, because memory is queried at
decision time rather than absorbed at training time.
The legal context is background, not advice. The GDPR’s lawfulness, minimisation, and erasure duties (Articles 5, 6, and 17) are the reason retention windows and deletion propagation exist as engineering requirements (L-021); the AI Act’s documentation and downstream-information duties point the same way for deployed systems. Nothing here is personal data — the KB is modular arithmetic — so no lawful basis was needed and none is claimed. The record exists because the next memory will not be synthetic: a store holding user facts inherits consent, minimisation, and erasure obligations that no retrieval metric measures. Chapters 38 and 39 own that analysis; this chapter supplies the mechanism (retire the key, prove the miss) they will audit.
The frozen E4 extension
Per seed (70, 71, 72): the store holds all 64 v1 facts; four fixed combos change value; test is those four plus eight random unchanged; validation is twelve unchanged; training uses forty remaining combos. Arm A trains the Chapter 26 tool recipe (2,000 updates, no store). Arm B retrieves deterministically (0 updates). Arm C distils all 64 stored facts into direct-answer weights (2,000 updates). Arm D deletes the four stale entries and reads through on miss. Identical values on all three seeds:
| Arm | Success | Fresh (8) | Stale (4) | Val (12) |
|---|---|---|---|---|
| A-no-memory | 0.000 | 0.000 | 0.000 | 0.000 |
| B-memory | 0.667 | 1.000 | 0.000 | 1.000 |
| C-distilled | 0.667 | 1.000 | 0.000 | 1.000 |
| D-combined | 1.000 | 1.000 | 1.000 | 1.000 |
H1 holds: B and C exceed A everywhere. H2 holds: D exceeds B and C on stale queries on all seeds (1.000 vs 0.000) and overall. H3 holds on the store side (audit 60/4, four misses, four read-through recoveries, propagation asserted); on the weights side there is no deletion operation by construction, and C’s 0/4 stale record is consistent with retained old values — the frozen record logs success, not C’s exact outputs, so the chapter claims the architectural asymmetry with consistent failures, not logged old-value outputs.
Costs per test query: A 3.0 rollout steps, B 1 lookup, C 1 forward pass, D 1.67 lookups-plus-steps. On failure recovery, the ledger is exact: B meets 4 stale queries and recovers 0 (no fallback exists — a hit is answered, and the hit is wrong); D meets the same 4 as misses and recovers all 4 through read-through (4/4); C meets them as memorised weights and recovers 0 (no miss state exists — a forward pass cannot “miss”); A fails all 12 regardless of staleness. Recovery here is therefore not a learned skill but an architectural slot: only the arm with a miss state and a live fallback has anywhere for recovery to happen.
The ledger behind those means: A trains 2,000 updates (~0.9 s per seed) on 120 pairs and then spends 3 policy forwards per query to fail; B trains nothing (0 updates, store populated from the snapshot) and spends 1 lookup per query to succeed on fresh queries; C trains 2,000 updates (~0.8 s per seed) on 64 stored facts and spends 1 forward per query to match B exactly; D trains nothing, spends 1 lookup on 8 queries and 1 lookup plus 3 tool steps on 4, and succeeds everywhere.
Training: A and C 2,000 updates each; B and D zero — the 2,000-update price C pays to tie B’s untrained retrieval is the freshness section’s other exhibit. Storage: B 64 entries, D 60 live plus a 4-entry retirement trail, C 1,200 parameters, A 10,400 parameters. Retrieval relevance: B retrieves the v1 value on 12/12 (perfect fidelity to the snapshot, 8/12 fidelity to the current truth); D retrieves on 8/12 and reads through on 4/4 misses. Total study wall time 6.0 seconds with a 455.1 MB peak process high-water mark; no API was called and no provider pricing exists to report.
Procedural generalisation, honestly bounded
The study generalises along exactly one axis it did not train: the read-through answers changed queries it never saw changed, because it reads the current environment rather than recalling the snapshot. Everything else is in-distribution by construction — the store covered every test key (B), the weights memorised every stored fact (C), the procedure is fixed (D). No claim is made about new tools, new schemas, longer horizons, conflicting memories, or ranked retrieval. Above all, nothing here is lifelong learning: a single fixed KB update with four changed facts, a store that never grows, a policy that never continues training.
A chapter that presented 12/12 on this task as broad procedural skill would be repeating the error Chapter 26 measured. The honest statement is narrower and still useful: for stable facts, retrieval and distillation tie; for changing facts, only the deletable carrier with a live fallback survives; the weights-versus-store decision is made at the retention policy, not at the accuracy table.
When weight updates are the wrong intervention
Three conditions, each sufficient. First, targeted erasure: if a fact may need deleting, do not distil it into weights — C’s stale 0/4 with no recourse is the demonstration. Second, cheap freshness: if facts change faster than retraining cycles, keep them in the store and pay the lookup — B’s zero training updates against C’s 2,000 for the same 0.667 is the price tag, and D’s 1.67 ops/query against B’s 1.00 is the freshness surcharge itemised.
Third, auditability: if you must prove what the agent knew and when, the store’s fingerprint and retirement trail answer directly while weights answer nothing. Weights remain right for stable, compact, latency-critical knowledge used far more often than revised — the direct-answer policy is one forward pass with no store to maintain. The decision rule is therefore not “memory beats weights” but: default to the store for facts, to weights for stable procedures, to the combination with deletion and fallback where both freshness and autonomy matter — and write down which you chose, with the retention window, before training.
A final distinction the study does not measure but the design requires: stale versus incorrect. Every stored fact here was correct at snapshot time; the four failures are pure staleness (right then, wrong now), detectable in principle by comparing snapshot version against KB version.
An incorrect fact — wrong already at insertion — would fail differently: it poisons fresh queries too, and no version comparison catches it, because the snapshot faithfully records a falsehood. Detecting incorrectness needs an independent check of the fact itself (the evaluator, a second source, a human); detecting staleness needs only versioning. The store as built supports the second (provenance per entry, audit per deletion) and nothing for the first. A memory chapter that claimed both would be claiming verification it never ran; this one records incorrectness as the unmeasured half and leaves it there.
Preparing for many teachers
One store, one KB, one update event. Chapter 28 multiplies the teachers: multiple experts, each with partial knowledge, whose outputs must be routed, aggregated, or selected. The store becomes many stores with competing claims; retrieval becomes routing; the deletion audit becomes attribution (which teacher’s fact failed?). The machinery built here — provenance per entry, audit per deletion, fresh/stale split per evaluation — transfers directly, and its limits (exact match, single update, no conflicts) define exactly what the multi-agent chapter must add.
References
Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan, K. and Cao, Y. (2023). ReAct: Synergizing Reasoning and Acting in Language Models. International Conference on Learning Representations (ICLR). arXiv:2210.03629. https://arxiv.org/abs/2210.03629
Schick, T., Dwivedi-Yu, J., Dessì, R., Raileanu, R., Lomeli, M., Zettlemoyer, L., Cancedda, N. and Scialom, T. (2023). Toolformer: Language Models Can Teach Themselves to Use Tools. Advances in Neural Information Processing Systems 36 (NeurIPS). arXiv:2302.04761. https://arxiv.org/abs/2302.04761
Legal sources
Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data (General Data Protection Regulation). Applicable 25 May 2018. https://eur-lex.europa.eu/eli/reg/2016/679/oj (retrieved 12 November 2026). Cited as L-021 for the lawfulness, minimisation, and erasure context of retention and deletion; not legal advice.