EpistemicPhysics
Survey · Neuroscience

What a sleeping brain can rehearse

Explore how new observations, fading evidence, and rehearsal change a memory.

· 11 min read · 2 interactive demos

Imagine a little animal learning where to find breakfast. A rustle usually predicts food in the garden. In the cave, the same rustle usually predicts an empty patch of ground. The animal must learn the cue, recognize the room, notice when things change, and carry something useful into tomorrow.

Then it falls asleep. Patterns associated with its adventures become active again. What could these extra rounds accomplish?

Epistemic Physics invites us to follow several quantities together: the balance of a prediction, the amount of trials behind it, the context in which it applies, and the lineage of the observations being reused. Those quantities let us tell apart learning from a new visit and learning how to use a remembered visit.

One surprise, two amounts of movement

Start with a transparent probability learner. Let Y count food visits and N count empty visits. Add a fixed Beta prior with positive parameters α0,β0. The posterior parameters, total amount, and mean prediction are

α=α0+Y,β=β0+N,A=α+β,μ=αA.

Here μ is the predicted probability of food. A includes the prior. For a new outcome x, with x=1 for food and x=0 for empty ground,

μ′=Aμ+xA+1=μ+1A+1⏟learning gain(x−μ).

The prediction error x−μ measures the surprise in the direction relevant to this update. The learning gain tells us what fraction of that gap the new observation closes. This identity is exact for one new Bernoulli trial with unit weight.

Suppose two learners both predict food with mean μ=0.5. One has A=2, the other A=20. Food moves their means to 2/3 and 11/21 respectively. The same starting prediction and the same new outcome produce different movements. The second learner is less malleable under this update rule.

The two learners also have different posterior variances,

Var⁡(p)=μ(1−μ)A+1,

where p is the unknown food probability. Variance describes the distribution’s spread; gain describes the response to a new trial. In this model they share a denominator, while remaining different quantities.

A synapse can carry a history

A synapse is a connection through which one neuron influences another. Synaptic plasticity means that its effectiveness can change with experience. The small update above offers a useful question for such a connection: could its present state carry both a preferred value and information about how readily that value should move?

Aitchison and colleagues’ Bayesian account of synaptic plasticity proposes uncertainty-dependent changes in synaptic learning rates. That supplies a neuroscience motivation for treating learning gain as a state-dependent quantity. Our Beta calculation supplies a particularly simple exact example; identifying a measured synapse with these specific parameters would require an additional model.

Metaplasticity means a change in the conditions or rules governing later plasticity. Imagine a volume knob whose stiffness itself changes with use. In the chosen Beta learner, accumulating trials automatically lowers later gain. This is one mathematical way to give the current learning rule a memory of its past.

QuestionTransparent learnerNeuroscience connection to explore
What value is currently favored?Mean μA prediction or effective connection strength
How far does the next observation move it?Gain 1/(A+1)State-dependent plasticity
How can that responsiveness change?Accumulation or discounting of raw trialsMetaplasticity and adaptation
Where did this update come from?Observation lineageReused experience versus new input

This also clarifies the difference between an amount that makes a belief harder to change and a physical timescale. A biological circuit needs its own mechanism and clock for implementing an update. The membrane chapter explores an instructive case where increased conductance reduces displacement while speeding up electrical settling.

When yesterday’s garden becomes today’s cave

Keeping every old observation works well for a stable probability. A changing environment asks a different question: how relevant is yesterday’s food supply to breakfast today?

Choose a retention factor 0≤λ≤1. At each step, first discount the raw ledger and then add the new trial:

Y′=λY+x,N′=λN+(1−x).

The prior remains separate: α′=α0+Y′ and β′=β0+N′. Immediately before adding the new outcome, the amount is A−=α0+β0+λ(Y+N). The next gain is therefore 1/(A−+1). For a quiet step, discount without adding an outcome.

A convenient clock is a half-life h: after h quiet steps, an old trial retains half its weight. Setting λ=2−1/h achieves exactly that. We have chosen a fading-memory model; ordinary inference for a single fixed Bernoulli probability does not itself prescribe this discount.

Predict before touching: after a cue reversal, which learner turns fastest? Which reacts more to one unusual outcome?

Give memory a half-life

How long should a clue keep its vote?

Both learners start with the same cue: support on 24 of 30 steps. Reverse the cue, add an outcome, or let time pass. The blue learner gradually discounts old input; the rose learner keeps all of it.

Fading memoryKeep every clueSupport / opposition
Predicted support05010001530Model steps
Fading prediction
75.9%
Permanent prediction
79.0%
Retained input amount
14.7 / 30
Next-step learning gain
0.063 / 0.031
Old input keeps half its weight after 12 quiet steps. The prior stays in place, so a long silence takes the fading prediction toward 50%. Short memory responds quickly to reversals, and gives isolated outcomes more sway.

A chosen leaky-evidence model, with the Jeffreys prior added once. “Gain” is the fraction of the gap to the next outcome closed by its update, after discounting. Moving the half-life recomputes both histories from their beginning.

Try the memory clock in the playground.

Wark, Fairhall, and Rieke found that visual adaptation in the retina operates across multiple timescales, with its time course depending on stimulus history and how distinguishable a change is. That makes a fixed half-life a useful starting experiment. An adventurous next step is to let the evidence for a change alter the retention factor itself.

A returning context deserves a returning memory

Suppose the garden remains fruitful while the cave remains sparse. Erasing the garden ledger every time the animal enters the cave would lose useful structure. We can instead retain one ledger per context, Yc,Nc, where c identifies the room.

Now two mechanisms become visible. Adaptation changes a prediction within a context. Context-specific recall selects a previously learned prediction. A fast behavioral switch could come from either mechanism, or both. Learning which context is active is another inference problem; in the next demo the room label is supplied so we can inspect the memory mechanics directly.

This distinction connects to context as an explanation of conflict: apparent disagreement can become two useful conditional predictions once the missing variable is retained.

A sleeping brain gets another practice round

Wilson and McNaughton recorded hippocampal place-cell ensembles, groups of neurons associated with an animal’s location. Cells that fired together during behavior showed increased coactivation during subsequent sleep compared with preceding sleep. Their result supports re-expression of waking experience during sleep, a phenomenon relevant to consolidation, the processes through which memories become stabilized or reorganized.

A replayed observation has two useful identities: it is a new presentation to a learning mechanism, and it descends from an existing source observation. Keeping that lineage lets us improve a computation without automatically increasing the number of visits to the world.

The next experiment maintains two room-specific Beta ledgers and a separate practiced readout qc. A rehearsal pass moves the readout toward the stored posterior mean μc:

qc′=qc+η(μc−qc),η=14.

This is one gradient-descent step on the squared-error loss (qc−μc)2/2. After k passes its error is exactly (qc−μc)(1−η)k. Practice has a concrete job: fit an initially imperfect readout to an already available target. The demo provides no added environmental information during rehearsal.

Memory practice

Rehearse the right room

Bring both teal readouts into their sky target bands. Choose a room, then practice its stored visits.

Each band allows a gap of 3 percentage points from the stored prediction.

Choose a room to practice. The target is its stored prediction.

8 original visits in garden; 0 rehearsals. Each room has its own readout. The invitation band is a task tolerance, not a probability interval.

Inspect the source ledger, replay counter, and model
++++++−−

Original visits: + food, − empty. Showing the most recent 24 when the ledger is longer.

Source-aware targetPracticed readoutEvery replay counted
Source-aware target72.2%
Practiced readout50.0%
Every replay counted72.2%
Original visits in this room
8
Rehearsal passes
0
Amount A: source / replay counter
9 / 9
Next-visit gain: source / counter
0.100 / 0.100
Each rehearsal closes one quarter of the readout's gap to the stored posterior mean. It creates 8 new presentations and zero new visits. Switch rooms to retrieve its separately trained readout.

Explicit toy rule: q ← q + 0.25(μ − q), one gradient step on (q − μ)²/2. Each room has a supplied label and one Beta(½, ½) prior. Original source IDs remain fixed through replay. Only new visits change the source-aware target. This demonstrates fitting a readout, rather than measuring biological consolidation or learning an unknown context. This sandbox allows up to 64 visits and 64 rehearsals per room; reset to begin another run.

Rehearse the two rooms in the playground.

Watch the rose counter. Replaying all stored observations preserves their empirical food fraction, but counting those presentations as fresh trials inflates A and lowers the gain assigned to the next actual visit. The fixed prior also loses relative influence, so the rose mean can move slightly even though the world supplied nothing new. The teal readout improves toward its target while the source-aware ledger keeps its original amount.

Pack three questions for the next expedition

Could a circuit keep a slowly changing store of experiences alongside a rapidly adjustable readout? Could a surprising context switch change the chosen memory before it changes any synapse? Could replay prioritize badly learned readouts while preserving which trials share an origin?

These questions suggest different measurements. Track behavioral updating after genuinely new input, performance after rehearsal without new input, and recovery when an old context returns. A model that predicts all three has explained more than a learning curve alone. For the broader scope of exploratory connections, see the disclaimer.