Beyond BotResearch
Research / Conversational memory

R³M.

A fact is corrected. How does a model know which version to use later? R³M adds trainable memory to frozen GPT-2 rather than putting every previous turn back into the prompt.

Conversational memory

Experiment log

How many steps help?

Reported measurements from controlled experiments, not live inference.

Exact match by reasoning steps

Four overwrites, trained with one to three. Scores count the top token across the entire GPT-2 vocabulary.

1
34.4%
2
46.1%
4
68%
8
99.2%
12
99.2%

Experimental findings · frozen GPT-2

Memory outside the prompt.

Earlier turns exist only in the adapter. To answer, the model must retrieve the latest value or follow a chain it has never seen at that depth.

Latest-value recall
99.2%
Depth 4 · eight reasoning steps
Dual-chain reasoning
92.2%
Depth 5 · seven reasoning steps
Adapter parameters
1.46M
Base model weights unchanged

Research question

Give memory its own clock.

R³M stands for Recursive, Routed, Replay-Consolidating Memory. The goal is to separate slowly changing language knowledge from fast-changing facts about a conversation. A reasoning loop can then spend more steps on a hard question without adding the entire history to its prompt.

The experiments target a single 24 GB GPU. This is a proof of concept on controlled tasks, not a general-purpose assistant.

Architecture

Inside SlotCursor.

The Kaleidos adapter pairs an early read from GPT-2 with a small working register and a movable cursor. Neither the early read nor the cursor alone explains the result.

Read before syntax dominates

A hook at GPT-2 block 1 captures a fact before sentence structure obscures its identity. After centering, the similarity between alpha in a note and alpha in a query is 0.968, versus 0.757 for different keys. At the last layer that ordering reverses (0.574 versus 0.937). PCA projects the centered features into 128 dimensions.

Bind keys to nearby values

A local rotary encoder with a four-token window binds a key to its value or its next pointer within a turn, without blending distant turns.

Keep intermediate answers

Eight working slots start from the question and preserve intermediate bindings between reads. A later lookup need not erase the result of an earlier one.

Move through turns

Four cursor heads learn differentiable left, stay and right moves. An attention sink lets a slot skip an irrelevant turn rather than overwrite a useful binding.

Return to the same space

A zero-initialized projection injects the result just before the language head. For pointer chains, frozen PCA and unmodified values keep the output of one hop usable as the key for the next.

Development history

What the earlier designs missed.

A recurrent model from scratch

Each token reset the reasoning state. Detached write gradients and a collapsed write gate prevented the model from learning useful memory updates. Prose perplexity could not establish whether it was reasoning.

A compact hybrid base

The roughly 50M-parameter prototype used a short gated convolution rather than long-range recurrence. Mask alignment and prompt truncation also limited the distillation experiments.

The first frozen-model adapter

Disabled gradients blocked memory-write learning. Reading the final layer mixed up variable identity and syntactic role; a flat slot bank had no cursor to distinguish an old fact from its replacement.

Experiment A

Which fact is current?

Train on one to three overwrites, then test four, with unrelated turns mixed in. Scores are top-1 exact match over all 50,257 GPT-2 tokens, not an eight-way multiple choice.

Unseen overwrite depth 4
Memory configurationExact match
Memory disabled0.0%
Original episodic · last layer31.2%
Original episodic · early layer34.4%
SlotCursor · last layer46.1%
SlotCursor · early layer98.4%

On training depths one to three, accuracy reached 100% at each depth. At depth four, disabling cursor movement reduced the 98.4% result to 53.9%.

Inference budget · overwrite depth 4
Reasoning stepsExact match
134.4%
246.1%
468.0%
899.2%
1299.2%

Experiment B

Follow the chain.

Two disjoint chains of equal length lead to different colors. Picking an endpoint without following the requested chain cannot beat 50%. Training stopped at depth two; the test extends to depth five without further training.

Dual-chain task · full-vocabulary exact match
DepthSplitSlotCursor + early tap
1Training range100%
2Training range100%
3Unseen100%
4Unseen98.4%
5Unseen92.2%

At depth five, the original episodic adapter reached 46.1% and a last-layer SlotCursor reached 43.8%. The early-layer adapter reached 94.5% under the easier eight-way metric.

More steps are not always better

With one to four steps, depth-five accuracy ranged from 10.2% to 16.4%. It jumped to 85.9% at six, peaked at 92.2% at seven, then fell to 88.3% at eight and 71.9% at twelve.

Limits & next steps

What remains open.

Preserving everyday language

With empty memory, perplexity stayed at 74.71 and KL divergence was zero. Three distracting turns raised overwrite-mode perplexity to 77.34 (KL 0.0323). In multi-hop mode it rose to 188.1 (KL 2.23). Stronger preservation training or an explicit off-switch remains to be tested.

Tracking changes of state

Partial swaps between registers with irrelevant turns stalled at roughly 25–30% accuracy. Intermediate supervision and explicit stop training are candidate next experiments.

Moving beyond synthetic tasks

Transfer to instruction-tuned models such as Gemma-4-E2B-it and mixed, free-form conversations is a research goal, not a demonstrated result.

Source: project-reported experiments. Benchmark outputs and adapter checkpoints: R3M/outputs/kaleidos_revival/.