Research portal

Mathematical note

Budgeted memory lifecycle

math/memory-lifecycle.md

Edition
Site v0.3.0 · continuous main snapshot
Source revision
ec2865b0eac15148675c629981a545632b3571c5
Extent
763 words
Public route
https://www.cordana.dev/math/memory-lifecycle/
Mapped records2 mapped records

Direct repository links only; no document-level evidence status is implied.

Purpose

Turn selective replay, consolidation, and forgetting into a costed decision problem. This note specifies a testable controller; it does not claim that its score is biologically implemented or optimal.

Memory items and actions

At maintenance cycle tt, the candidate memory set is Mt\mathcal{M}_t. Each item iMti \in \mathcal{M}_t may receive one action

ai,tA={defer,replay,merge,externalize,weaken,delete}.a_{i,t} \in \mathcal{A} = \{\text{defer},\text{replay},\text{merge},\text{externalize}, \text{weaken},\text{delete}\}.

The action is versioned. weaken and delete are invalid unless an external provenance record or explicit retention-policy exception exists.

Expected utility

For item ii and action aa, estimate

Gi,a,t=ΔL^i,a,t+λRΔR^i,a,t+λSΔS^i,a,tλDD^i,a,t,G_{i,a,t} = \widehat{\Delta L}_{i,a,t} + \lambda_R \widehat{\Delta R}_{i,a,t} + \lambda_S \widehat{\Delta S}_{i,a,t} - \lambda_D \widehat{D}_{i,a,t},

where:

  • ΔL^i,a,t\widehat{\Delta L}_{i,a,t} is the predicted reduction in future task loss relative to defer (dimensionless loss units);
  • ΔR^i,a,t\widehat{\Delta R}_{i,a,t} is the predicted reduction in a declared risk metric (risk units);
  • ΔS^i,a,t\widehat{\Delta S}_{i,a,t} is the predicted improvement in schema-consistent transfer (dimensionless score units);
  • D^i,a,t\widehat{D}_{i,a,t} is predicted destructive-action harm, including rare memory loss and provenance failure (harm units);
  • λR\lambda_R has units loss/risk;
  • λS\lambda_S has units loss/score; and
  • λD\lambda_D has units loss/harm.

The terms cannot be added before the conversion coefficients and evaluation sets are declared. Novelty, uncertainty, reward surprise, familiarity, and interference are features used to estimate these outcomes, not interchangeable units of utility.

Resource model

For each candidate action, predict:

  • Ei,a,tE_{i,a,t} — energy in joules;
  • Bi,a,tB_{i,a,t} — data moved in bytes;
  • Ti,a,tT_{i,a,t} — wall time in seconds; and
  • Wi,a,tW_{i,a,t} — slow-model optimizer updates (count).

The scheduler selects binary variables xi,a,t{0,1}x_{i,a,t} \in \{0,1\}:

maxxiMtaAxi,a,t(Gi,a,tλEEi,a,t)\max_x \sum_{i \in \mathcal{M}_t} \sum_{a \in \mathcal{A}} x_{i,a,t} \left(G_{i,a,t} - \lambda_E E_{i,a,t}\right)

subject to

axi,a,t=1i,\sum_a x_{i,a,t} = 1 \quad \forall i, i,axi,a,tEi,a,tEtmax,i,axi,a,tBi,a,tBtmax,\sum_{i,a} x_{i,a,t}E_{i,a,t} \le E_t^{\max}, \qquad \sum_{i,a} x_{i,a,t}B_{i,a,t} \le B_t^{\max}, i,axi,a,tTi,a,tTtmax,i,axi,a,tWi,a,tWtmax.\sum_{i,a} x_{i,a,t}T_{i,a,t} \le T_t^{\max}, \qquad \sum_{i,a} x_{i,a,t}W_{i,a,t} \le W_t^{\max}.

λE\lambda_E has units loss/joule. The four budgets prevent a scheduler from appearing efficient by hiding memory traffic, time, or optimizer work behind a single energy proxy.

This is a multiple-choice multidimensional knapsack problem when predictions are fixed. The first experiment need not solve it exactly; greedy, learned, and standard replay priorities are compared under the same budgets.

The illustrative single-item price envelope shows how the upper admissible action can change with λE\lambda_E. Its gains, costs, and selected actions are hypothetical and are not a fitted policy.

Reconsolidation gate

Retrieval produces a candidate branch rather than mutating the stored item in place. Let mi,tm_{i,t} be a calibrated mismatch statistic and θt\theta_t a gate:

zi,t=1[mi,t>θt].z_{i,t} = \mathbb{1}[m_{i,t} > \theta_t].

If zi,t=0z_{i,t}=0, the item remains read-only. If zi,t=1z_{i,t}=1, an update branch is allowed but promotion still requires regression and provenance tests. Because the exact biological prediction-error boundary is disputed under C-040, θt\theta_t is an experimental variable, not a biological constant.

Required ablations are:

  1. always read-only;
  2. always writable on retrieval;
  3. fixed mismatch threshold;
  4. calibrated risk-dependent threshold; and
  5. explicit source-version change rather than inferred mismatch.

Schema-fit gate

Let si,ts_{i,t} be schema-fit estimated on a held-out structural probe and qi,tq_{i,t} be shortcut risk. A candidate may receive a cheaper merge path only when

si,tτsandqi,tτq.s_{i,t} \ge \tau_s \quad \text{and} \quad q_{i,t} \le \tau_q.

The thresholds τs\tau_s and τq\tau_q are calibrated on validation streams with both compatible items and deceptive near-matches. Training loss alone is not a schema-fit measure.

Measurement protocol

Report both realized and predicted quantities:

QuantityUnitBoundary
replay compute energyJaccelerator or node, declared per run
memory trafficbytehost–device and device memory reported separately
maintenance timeswall clock, including scheduler
optimizer workupdate countslow-model updates only
retentiontask metric by item agefixed evaluation stream
adaptationevents or seconds to thresholdafter declared change point
obsolete intrusionerror count/rateoutdated association probes
destructive erroritem count/ratedeleted state later shown necessary
provenance recoveryfractiondeleted items reconstructable from source

Calibration error between predicted GG and realized outcome is itself a core result. A scheduler that makes good-looking choices only after seeing future tests is invalid.

Falsification

The memory-lifecycle controller fails its first test if a conventional single-priority or reservoir baseline matches its quality–risk–energy frontier, if scheduling overhead consumes the saved replay budget, or if destructive errors exceed the declared safety bound.