MemoChain: Verifiable Constant-Size Memory for Language Models

Long-horizon LLM agents carry memory either as an ever-growing prompt (O(n) tokens per query) or as a vector store (O(n) index, no synthesis). We present MemoChain, a neural memory that is constant-size, streaming, and cryptographically verifiable. The entire history of a document collection or chat session folds into a fixed 22,528-byte state (11 heads x 32 keys x 32 values, Q14 fixed-point int16) updated by a Delta rule in O(1) per document. Because the fold is pure integer arithmetic, the same inputs produce bit-identical state digests in Python, native Rust, and a zkVM, which lets us attach Mina-style recursive zero-knowledge proofs: a third party verifies in ~28 ms that a 22 KB memory capsule was honestly computed from a committed input sequence under a committed writer, without re-reading the history and without seeing the raw inputs. We train the memory without any teacher model: gradients from a frozen causal LM's cross-entropy loss flow through differentiable memory-token injection, a reader head, and a straight-through Q14 quantizer into the Delta-rule writer. On held-out PersonaMem-style QA (4,237 questions, 30 unseen users, 200 documents each), the self-trained 22 KB capsule lifts a frozen Qwen3-8B decoder from 58.18% to 64.69% (hard questions 30.84% to 38.16%), matching a 388 MB cross-attention memory teacher (64.76% / 38.16%) whose KV cache occupies 4.10 MB, at 181.8x smaller memory and with zero teacher dependence in training. A capacity ablation shows the memory gain saturates at a 10 KiB state on gist-style QA: growing the state 8.8x moves the gain by only +0.007 nats. Training the same 22 KB capsule on a real developer's 241 coding sessions doubles coding-session recall (+0.94 to +1.76 nats) while retaining 96.6% of the personal-QA gain. We release the full stack: an OpenAI- and Anthropic-compatible memory proxy in daily use (~55 MB RAM, 0 extra GPU, 90% measured input-token reduction on local vLLM and 66.8% billed cost reduction on OpenRouter), bit-exact Rust and SP1 zkVM implementations, and an honesty audit including negative results.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-26
DOI
https://doi.org/10.5281/zenodo.24545514
Primary Topic
Topic Modeling
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

MemoChain: Verifiable Constant-Size Memory for Language Models

Branislav Đalić
1 links
Zenodo (CERN European Organization for Nuclear Research)
Topic Modeling
preprint

MemoChain: Verifiable Constant-Size Memory for Language Models

Branislav Đalić
preprint en

Abstract

Long-horizon LLM agents carry memory either as an ever-growing prompt (O(n) tokens per query) or as a vector store (O(n) index, no synthesis). We present MemoChain, a neural memory that is constant-size, streaming, and cryptographically verifiable. The entire history of a document collection or chat session folds into a fixed 22,528-byte state (11 heads x 32 keys x 32 values, Q14 fixed-point int16) updated by a Delta rule in O(1) per document. Because the fold is pure integer arithmetic, the same inputs produce bit-identical state digests in Python, native Rust, and a zkVM, which lets us attach Mina-style recursive zero-knowledge proofs: a third party verifies in ~28 ms that a 22 KB memory capsule was honestly computed from a committed input sequence under a committed writer, without re-reading the history and without seeing the raw inputs. We train the memory without any teacher model: gradients from a frozen causal LM's cross-entropy loss flow through differentiable memory-token injection, a reader head, and a straight-through Q14 quantizer into the Delta-rule writer. On held-out PersonaMem-style QA (4,237 questions, 30 unseen users, 200 documents each), the self-trained 22 KB capsule lifts a frozen Qwen3-8B decoder from 58.18% to 64.69% (hard questions 30.84% to 38.16%), matching a 388 MB cross-attention memory teacher (64.76% / 38.16%) whose KV cache occupies 4.10 MB, at 181.8x smaller memory and with zero teacher dependence in training. A capacity ablation shows the memory gain saturates at a 10 KiB state on gist-style QA: growing the state 8.8x moves the gain by only +0.007 nats. Training the same 22 KB capsule on a real developer's 241 coding sessions doubles coding-session recall (+0.94 to +1.76 nats) while retaining 96.6% of the personal-QA gain. We release the full stack: an OpenAI- and Anthropic-compatible memory proxy in daily use (~55 MB RAM, 0 extra GPU, 90% measured input-token reduction on local vLLM and 66.8% billed cost reduction on OpenRouter), bit-exact Rust and SP1 zkVM implementations, and an honesty audit including negative results.

Zenodo (CERN European Organization for Nuclear Research)
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon