Paper Breakdowns  /  Titans
Paper 32~8 min readGoogle · 2025
Paper Breakdown

Titans,
explained.

Every model you've used has two speeds of memory: the context window (perfect recall, brutally expensive, forgets everything when full) and the weights (vast knowledge, frozen at training time). Titans asks the question in between: what if part of the model could keep learning while it reads — writing the surprising parts of your document into its own weights, at test time, on the fly?

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

Two memories, and the gap between them

Attention is a phenomenal short-term memory: every token can look at every other token, losslessly. The price is quadratic cost and a hard window — outside it, the past simply doesn't exist. Recurrent architectures like Mamba take the opposite trade: compress all history into a fixed-size state. Linear cost, unlimited length — but compression is lossy, and details fade.

Model weights are the third store: a vast long-term memory of everything seen in training — and completely frozen at inference. Nothing you show a deployed model changes them. So the field's dilemma: perfect-but-bounded recall, or unbounded-but-lossy compression, with no memory that grows during use. Titans aims squarely at that gap.

02

A memory that learns while it reads

Titans adds a neural long-term memory: a small MLP whose whole job is to store associations — and whose weights are updated during inference. As the sequence streams in, each chunk can trigger a gradient step on the memory module. Reading is training, for that one small component; the backbone stays frozen.

Inference step, with a memory that writes
Incoming tokens
Surprise check
prediction error
Gradient write
memory weights update
Attention + memory
answer from both

Retrieval is just a forward pass: query the memory MLP and it reproduces what it stored. Because the memory is weights — not a token buffer — its capacity doesn't consume the context window, and reading a 2M-token document doesn't mean attending over 2M tokens. The distant past lives in the memory; attention handles the recent window it's actually good at.

The key idea

Stop choosing between "keep every token" and "compress everything." Keep a learner in the loop: a module that trains on your input as it arrives, so the past is stored the way models store everything durable — in weights.

03

What gets written? Whatever surprises it

A memory that writes everything equally would drown in routine text. Titans borrows a page from human memory: we remember what violates expectations. Its write strength is driven by a surprise metric — the gradient of the memory's prediction error on the incoming input. Content the memory already anticipates yields small gradients: barely stored. Content that breaks its expectations yields large gradients: written hard.

"…the meeting is at 3pm on Thursday…" low surprise → faint write
"…the launch code is TANGO-7-ECHO…" high surprise → strong write

The elegance is that the signal is free — it's the same gradient the update already computes. Surprise decides what to remember; the gradient step decides how. One mechanism, both jobs.

04

Momentum and forgetting — memory as an optimizer

Raw surprise has failure modes: a single shocking token shouldn't erase context (surprise spikes then vanishes), and a finite memory that never forgets eventually overwrites itself into mush. Titans handles both with tools straight out of optimization.

Momentum smooths the write signal: past surprise carries into the present, so an important passage keeps getting written even when individual tokens stop being shocking. A learned forgetting gate (weight decay on the memory) fades stale associations to make room — adaptive, data-dependent forgetting rather than a fixed horizon. The memory module is, in effect, a tiny optimizer with momentum and decay, running inside inference.

05

Three ways to wire the memory in

The paper tests three placements of the memory relative to attention:

VariantHow memory meets attention
Memory as Context (MAC)Retrieved memories are prepended as extra tokens; attention reads current window + recalled past together. Best overall.
Memory as Gate (MAG)Memory and attention run in parallel branches, blended by a learned gate.
Memory as Layer (MAL)Memory is a layer the sequence passes through before attention.

Alongside both sits a small set of persistent memory tokens — learnable, input-independent parameters holding task knowledge. Three stores, three timescales: persistent (trained, fixed), long-term (written at test time), short-term (attention over the window).

06

What the experiments showed

Across language modeling and reasoning benchmarks, Titans outperformed both Transformer baselines and modern recurrent models (Mamba-class) at comparable sizes. The headline demo is needle-in-a-haystack at extreme length: retrieving planted facts with high accuracy in contexts beyond 2 million tokens — lengths where windowed attention can't even see the needle and compressed states have long since blurred it.

Just as telling: on the BABILong benchmark (reasoning across facts scattered through book-length text), a modest Titans model beat far larger models, including ones wielding retrieval. Learned test-time memory wasn't just cheaper than a giant window — it was better at using the far past.

07

Why it matters

Titans reopened a question the field had parked: maybe long context isn't a window problem but a memory problem. Instead of racing to attend over ever-more tokens, let part of the model learn its input. That framing — test-time learning as an architectural primitive — has rippled into follow-up architectures, memory research, and the agent world's obsession with what to remember across long horizons.

It also completes a neat symmetry with the reasoning era: test-time compute spends more thinking per query; Titans spends learning per query. Both push intelligence out of the frozen-training paradigm and into the moment of use — which is likely where the next architectural decade gets decided.

Read next

Titans answers the same scaling pain as Mamba (fixed-state compression) and FlashAttention (making the window cheaper) — three different bets on the memory bottleneck.

Frequently asked

Quick answers

What is Titans?

A Google architecture pairing attention with a neural long-term memory whose weights update during inference — the model memorizes what it reads, at test time.

What does "memorize at test time" mean?

The memory module keeps training while the model runs: incoming tokens trigger gradient writes to its weights. Reading is training, for that one component.

What is the surprise metric?

Write strength follows the gradient of prediction error: expected content is barely stored, expectation-violating content is written hard — like human memory.

How does it compare to Mamba and Transformers?

Attention is precise but window-bound; Mamba is linear but lossy. Titans keeps attention for the recent window and learns the far past — winning on 2M+ token recall.

Finished this one? 0 / 42 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns