$ attention.sh

knowledge base · entry 20

The model that never stops learning

A read-through of the paper that says a model and its training were never two things — they are one nested system of memories, each learning on its own clock. HOPE is the architecture that falls out: a sequence model that edits its own update rule, in front of a spectrum of memories that never stop consolidating.

paper Nested Learning: The Illusion of Deep Learning Architectures
authors Ali Behrouz, Meisam Razaviyayn, Peilin Zhong, Vahab Mirrokni — Google Research (NeurIPS 2025)
source arXiv:2512.24695
why we read it a domain specialist must absorb new rulings and rates continuously — retraining from scratch is exactly what a sovereign deployment can't afford

every figure zooms — click it, scroll to magnify, drag to pan

part one · the problem

Why a trained model is stuck in time

figure 1 · the diagnosis

A model with anterograde amnesia

There is a neurological condition — anterograde amnesia — where a person keeps every memory from before the onset, and can hold a conversation in the present, but can never form a new long-term memory again. The paper opens with the observation that today's LLMs live in exactly that condition. A deployed model has two memories: the context window, which updates with every token and vanishes when the session ends, and the weights, frozen at the moment the authors call "the end of pre-training." Nothing connects them. What the model reads today never becomes part of what it knows.

click any figure to zoom · scroll to magnify · drag to pan

Brains don't work like this. New experience is consolidated continuously — a fast "online" pass stabilizes fragile traces as they form, and slower offline replay strengthens and reorganizes them for the long term. Crucially, this runs at many speeds at once: brain waves from fast gamma (30–100 Hz, sensory detail) down to slow delta (0.5–4 Hz, consolidation) coordinate which neurons update quickly and which integrate slowly. That multi-speed picture is the paper's engine.

Where the arc left off: DeepSeek-R1 changed the training signal, and Mamba changed the architecture. This entry questions something quieter and more radical — the assumption that a model is finished when training ends.

part two · the reframe

Nested learning: one model, many clocks

figure 2 · the core idea

Layers stack in space — learning stacks in time

The paper's central move is a change of coordinates. Stop describing a model as a stack of layers, and describe it as a set of nested optimization problems, each with its own data stream and its own update frequency — how often that component actually learns something. Order the parts by that frequency and a hidden structure appears.

Run a Transformer through this lens and the result is stark. Attention adapts to every new token — in effect, update frequency . The projections and MLP blocks were updated during pre-training and then never again — frequency 0 in deployment. Two extreme clocks, and nothing in between — which is precisely the amnesia of figure 1, restated as arithmetic. The title's point: "deep learning" is the flattened image of this nested system, with all the inner clocks hidden — the illusion of a mere stack of layers.

figure 3 · the unification

Learning is memorizing surprise

For the nested view to work, all the parts have to be the same kind of object — and the paper's most elegant section shows they are. Train a layer with backprop and watch what it stores: for each input, the gradient it receives is a local surprise signal — how wrong the layer's contribution to the prediction was. Gradient descent is then an associative memory that maps each input to how surprising it was, compressing those pairs into the weights.

The same definition covers everything else. Attention is an associative memory mapping tokens to tokens, re-solved every step. Pre-training is an associative memory over the whole corpus, solved once — which makes it just in-context learning with a very large context and a very slow clock. One kind of object, one definition, different frequencies. That's the uniform structure the rest of the paper builds on.

figure 4 · the arithmetic

Your optimizer is a memory too — a small, blurry one

Here is the reframe with the most immediate payoff. Momentum keeps an exponential moving average of gradients: m ← 0.9·m + η·g. Viewed as a memory, it's a memory of the loss landscape — and a worked line of arithmetic shows how tiny it is. With decay 0.9, the last 6 gradients account for about 50% of its state (1 − 0.96 ≈ 0.47), and the last 43 for 99%. Everything a billion-step training run learned about the landscape beyond the last ~40 steps contributes less than one percent.

Once the optimizer is a memory, you can design it like one. Give momentum an MLP instead of a single matrix (deep momentum). Swap its Hebbian update for a delta rule so it learns what to forget (delta momentum). Pass its output through a Newton-Schulz map and you have re-derived Muon from first principles. Adam falls out as the optimal memory for one particular objective. The paper's slogan in one line: expressive optimizers and expressive architectures are the same craft.

part three · the machine

Building HOPE

figure 5 · continuum memory

A spectrum of memory, not two extremes

If the disease is two clocks with an empty middle, the cure is to fill the middle. The Continuum Memory System (CMS) is a chain of MLP blocks, each with its own update period: the fastest folds in what it read every 16 tokens, the next every thousand, the slowest every few million (the paper's example runs chunk sizes 16 → 1M → 16M). Each block accumulates its own surprise while it waits, then consolidates in one step when its clock ticks — short-term memory shading into long-term knowledge with no hard boundary, exactly the gamma-to-delta spectrum of figure 1.

The design has a built-in defense against catastrophic forgetting: knowledge overwritten in a fast block still lives in the slower blocks behind it, and can be handed back — a loop through the time dimension. And it stays cheap: at any given step only the blocks whose clock is due actually update, and within a chunk every token's contribution can be computed in parallel. A Transformer is the special case with one block and a frozen clock.

figure 6 · self-modification

A model that edits its own update rule

The second component works on the fast end of the spectrum. Start from a modern recurrent memory — a Titans-style module that compresses keys and values into its state as it reads. In the standard version, the projections that make keys and values, the learning rate, and the forget gate are all frozen after pre-training. The paper makes each of them a small memory of its own, adapting in-context — and then adds the twist it calls self-modifying: the model generates its own values, the targets its memory is trained toward. It is, quite literally, learning its own update algorithm as it reads — Schmidhuber's 1993 self-referential weight matrix, made trainable at scale.

The update rule underneath is the paper's Delta Gradient Descent — a delta-rule variant whose decay adapts to each input, chosen because token streams are highly correlated and a plain gradient step treats every sample as independent. Only the query projection stays fixed; everything else about how this memory learns is itself learned, in context.

figure 7 · the architecture

HOPE, assembled

Put the two together and you have HOPE: the self-modifying sequence model where working memory used to be, followed by a CMS chain where the MLP used to be. Side by side with a Transformer block, it's the same silhouette — a token mixer, then feed-forward blocks — but every part now has a clock, and the clocks cover the whole spectrum.

Two details worth keeping. The components are separable — a HOPE-Attention variant keeps ordinary softmax attention and just adds CMS, and still beats the Transformer, so the memory spectrum helps independently of the self-modification. And existing pre-trained Transformers can be adopted into the scheme: initialize CMS blocks from their trained MLPs and let the levels adapt from there — which is how the continual-learning experiments below start from Llama.

part four · the verdict

Does the nesting pay?

results · the scoreboard

Better as a language model — much better at remembering

As a plain language model, HOPE leads its weight class. Trained from scratch at 1.3B parameters on 100B tokens, against every strong baseline trained identically:

model (1.3B / 100B tokens)Wikitext ppl ↓reasoning avg ↑
HOPE14.3958.04%
Titans (its direct ancestor)15.6056.82%
Samba (attention + Mamba hybrid)16.1554.46%
Transformer++17.9253.38%

The same ordering holds at 760M, and the gap widens with scale. On long context, HOPE holds 100% on passkey retrieval at 16K where the Transformer manages 79.8%, and on BABILong it keeps answering out to 10M tokens — territory where GPT-4-class models have already collapsed by ~256K. In the continual learning tests it was built for — class-incremental classification, learning two new languages in sequence — HOPE-adapted Llama models beat in-context learning, EWC and external-learner baselines, and adding memory levels visibly closes the forgetting gap. The ablations are clean: remove the delta update, the momentum, the weight decay or the CMS, and quality drops every time.

the honest column attention is not beaten everywhere: on short in-context recall (SWDE, SQuAD and friends) Transformers still lead, and on multi-key retrieval softmax attention stays clearly ahead of every parametric memory, HOPE included. The paper says so plainly — and its own conclusion states that catastrophic forgetting is reduced, not solved.

the math · in the paper's notation

Four equations that carry the reframe

The associative-memory definition everything reduces to, momentum unrolled as a memory, the delta rule the fast memories run on, and the clock that defines the continuum. Each one is run by hand, a few tiny steps at a time, so the general formula arrives as a pattern you have already watched form — nothing is taken on faith.

the equations · worked

Memory, momentum, delta, clock

§2 · the associative-memory definition — the paper's one primitive

M*  =  argminM Σi ℓ̃( M(ki), vi )

read aloud: of all the mappings you could build, a memory is the one that recalls its facts with the least total error. "argmin" is nothing deeper than "the choice that makes the sum smallest". To feel why that deserves the name memory, build the smallest one possible:

watch it happen · a two-fact memory, by hand

facts:   k=1 → v=3,    k=2 → v=5      memory:   M(k) = w·k

two facts to hold, and a memory with a single adjustable number, w. it cannot store both exactly — which is the interesting case, because neither can a neural network hold its whole training set.

error(w)  =  (w·1 − 3)² + (w·2 − 5)²

score any candidate w by how badly it recalls each fact, summed. try w = 2: error = 1 + 1 = 2. try w = 3: error = 0 + 1 = 1. better — keep sliding.

best: w = 2.6   →   M(1) = 2.6 (truth: 3),   M(2) = 5.2 (truth: 5)

the punchline: the best memory recalls neither fact exactly — it blends them. a memory too small for its facts doesn't file them away, it compresses them. that is what M* means, and it is what every layer of a trained network is quietly doing.

  • kithe keys — what the memory is addressed by (above: 1 and 2)
  • vithe values — what it should return (above: 3 and 5); for a backprop-trained layer, the gradient it receives: how surprising that input was
  • ℓ̃the internal loss — how recall error is scored (squared error, above)
plug in → every component in the paper is this same object at some speed: attention (keys → tokens, re-solved every step), a layer under gradient descent (inputs → surprises, solved slowly), pre-training itself (the whole corpus, solved once). one definition, many clocks.

§3 · momentum, unrolled into a memory

mt+1  =  α·mt − η·gt

read aloud: each step, shrink the old memory a little (multiply by α) and stir in the newest gradient. That one-line recurrence is all the paper starts from. The claim "momentum is a memory of every gradient it ever saw" comes from simply running the rule and looking at what piles up — so run it:

watch it happen · run the rule three steps, starting empty

m1  =  α·m0 − η·g1  =  −η·g1

the memory starts empty (m0 = 0), so after one step it holds exactly one gradient, full strength.

m2  =  α·m1 − η·g2  =  α·(−η·g1) − η·g2  =  −η·( α·g1 + g2 )

the only move: substitute what m1 was, then pull −η out front. g1 is still in the memory — but it now wears one factor of α.

m3  =  α·m2 − η·g3  =  −η·( α2·g1 + α·g2 + g3 )

same move again. everything already inside picked up one more α; the newcomer g3 enters clean. the pattern is now visible.

mt  =  −η Σi≤t αt−i gi

the punchline: the memory holds every gradient it ever saw, each wearing one coat of α per step of its age — t−i is just "how old gradient i is". that is the whole "⟹": substitute, factor, repeat. no cleverer algebra exists in it.

  • gtthe gradient at step t — the surprise being stored
  • αthe decay, 0.9 in figure 4 — every step of age multiplies a stored gradient by it once more
  • ηthe learning rate — the write strength
plug in → α = 0.9, so the weights by age run 1, 0.9, 0.81, 0.73, … all ages together sum to 1/(1−0.9) = 10 (the geometric series). the newest six sum to (1−0.9⁶)/(1−0.9) ≈ 4.7. their share of the whole memory: 4.7/10 ≈ 47% — six gradients hold half of it, forty-three hold 99%. figure 4's arithmetic, falling straight out of the ladder above.

§4 · Hebbian vs. delta — the update the fast memories run on

Hebbian:   W ← W + vk      delta:   W ← W + η ( vW k ) k

read aloud: Hebbian writes the whole value in, every time; the delta rule first recalls what it already knows — Wk — and writes only the difference. Abstract until you track one number through both rules, so track it:

watch it happen · the same fact arrives twice (k = 1, v = 5, η = 1)

start:   w = 2   →   recall w·k = 2,   truth v = 5

a one-number memory that already half-knows this fact: it recalls 2 where the truth is 5. the surprise is v − w·k = 3.

Hebbian:   w ← 2 + 5 = 7      delta:   w ← 2 + (5 − 2) = 5

Hebbian slams the whole value on top of what was already there — and overshoots to 7. delta writes only the missing 3 — and lands exactly on the truth.

the fact repeats:   Hebbian: 7 + 5 = 12, then 17, 22…      delta: 5 + (5 − 5) = 5, forever

the punchline: repetition corrupts a Hebbian memory — the same fact piles up without limit. the delta rule sees zero surprise and writes nothing. token streams repeat constantly, which is exactly why HOPE's fast memories run Delta Gradient Descent — this rule, with the decay itself made input-dependent.

  • W kthe memory's current recall for key k — the prediction the update corrects
  • v − Wkthe prediction error — the surprise, the only part worth writing

§4 · the CMS clock — the continuum, as a modulus

block ℓ updates when   t ≡ 0 (mod C(ℓ)):    W(ℓ) ← W(ℓ) − η(ℓ) Σi ∈ chunk ∇ℓi(ℓ)

read aloud: a block sleeps until the token counter reaches a multiple of its chunk size, then folds in everything that accumulated while it slept. "t ≡ 0 (mod C)" is nothing more than "t is a multiple of C" — a clock. Run one toy block:

watch it happen · one block with chunk size C = 4

t = 1, 2, 3:   weights untouched — surprise g1, g2, g3 goes into the bank

between ticks the block does almost no work: it only accumulates. this is why a whole spectrum of memories costs so little per token.

t = 4, a multiple of 4 → tick:   W ← W − η·(g1+g2+g3+g4),   bank empties

one consolidated update carrying four tokens' worth of surprise — then back to sleep until t = 8, 12, 16…

chain three blocks, C = 16, 1M, 16M  →  the same rule at three speeds

the punchline: over one 16M-token stream, the fast block ticks a million times, the middle one 16 times, the slow one exactly once. "short-term memory shading into long-term knowledge" is one equation on three clocks — and a Transformer is the degenerate case: a single block whose clock never ticks again after pre-training.

  • C(ℓ)level ℓ's chunk size — its update period, the "frequency" the whole paper orders components by
  • Σ ∇ℓithe banked surprise since the last tick — folded in all at once

part five · what we take from it

For a system that must keep up with the law

applied · our reading

Continual learning is the sovereign feature

the caveat we would flag these are proof-of-concept scales — 760M and 1.3B, tens of billions of tokens — and a stack of interacting parts (self-modification, five inner memories, a CMS schedule) that no one has yet run at production scale or hardened operationally. Recall-heavy lookups still favor attention, so a deployed system keeps retrieval regardless. This entry is a bet on a direction, not a migration plan.

And the direction rhymes with the whole arc. Entry 12 removed the human from the reward. Entry 13 removed the quadratic bill. This one aims at the wall between training and inference itself — if it falls, "shipping a model" stops meaning freezing one.

← back to the knowledge base — the full index, searchable by tag.

source

Ali Behrouz, Meisam Razaviyayn, Peilin Zhong, Vahab Mirrokni — Google Research (NeurIPS 2025). Nested Learning: The Illusion of Deep Learning Architectures. arXiv:2512.24695. The benchmark numbers, the frequency framing, the ablations and the brain-science motivation are the paper's; the amnesia sketch, the clock diagrams and the momentum arithmetic are our own illustration.

← back to the knowledge base  ·  ⚙ the illustrated decoder  ·  ▶ run the forward pass

attention.sh — a division of Jinacode Systems. Transformers, fine-tuning, and sovereign LLMs.
we're hiring the curious — hello@attention.sh