Papers › Memorizing Transformers
Memorizing Transformers
Yuhuai Wu, Markus N. Rabe, DeLesley Hutchins, Christian Szegedy
Language models typically need to be trained or finetuned in order to acquire new knowledge, which involves updating their weights. We instead envision language models that can simply read and memorize new data at inference time, thus acquiring new knowledge immediately. In this work, we extend language models with the ability to memorize the internal representations of past inputs. We demonstrate that an approximate kNN lookup into a non-differentiable memory of recent (key, value) pairs improves language modeling across various benchmarks and tasks, including generic webtext (C4), math papers (arXiv), books (PG-19), code (Github), as well as formal theorems (Isabelle). We show that the performance steadily improves when we increase the size of memory up to 262K tokens. On benchmarks including code and mathematics, we find that the model is capable of making use of newly defined functions and theorems during test time.
In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.
Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.
For agents, on Syntology's MCP service (how to connect):
get_harvested_code_for_paper(arxiv_id="2203.08913")get_code(code_sha256="…")with a sample'scode_sha256from the list belowget_citation_path(paper_1="2203.08913", paper_2="…")with another paper's arXiv id or titleget_concepts_for_paper(arxiv_id="2203.08913")
Code
Syntology 34 code samples: 32 from 4 repositories linked to this paper, 2 identical to code harvested from another paper's repository. Across all 34: 23 ran (of which 6 constructed an object rather than computing a result; 18 with no instrument failure: 3 honoured, 1 violated, 14 with no contract checked; 5 where Syntology's instrument failed) · 11 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.
By repository: official repository: 15 samples from 1 repository, 12 ran (8 with no instrument failure; 4 where Syntology's instrument failed); community (archive-listed): 17 samples from 3 repositories, 9 ran (8 with no instrument failure; 1 where Syntology's instrument failed); 2 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.
Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 3 of the 23 samples that ran have no recorded date.
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
Code Syntology ran Syntology
34 samples harvested: 23 ran (of which 6 constructed an object rather than computing a result; 18 with no instrument failure: 3 honoured, 1 violated, 14 with no contract checked; 5 where Syntology's instrument failed) · 11 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.
Licence: 2 of the 34 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.
Harvested from 4 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. 2 samples are listed last, in a group without a repository. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 1 sample that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.
Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.
Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.
A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.
census: 13 implementations from 12 papers, 10 distinct outputs across 4 buckets, one shared input per bucket memorizing_transformers_pytorch/memorizing_transformers_pytorch.py ran · metamorphic tier: deterministic MIT (permissive) ·
4673cf1999dcca6b · report
fixture: returned Attention · level recorded 2026-09-22 b2191b4a6430d0af · report
fixture: returned KNN · level recorded 2026-09-22 2832f7cf743c7f86 · report
fixture: returned KNNAttention · level recorded 2026-09-22 246054b031dda4de · report
fixture: returned KNNMemory · level recorded 2026-09-22 25d9116c53cb8eb2 · report
fixture: returned PreNormResidual · level recorded 2026-09-22 9304ca35acfd717d · report
fixture: returned T5RelativePositionBias · level recorded 2026-09-22 dd330ab84432cbc2 · report
fixture: signature arr:list/1/int · returned bool · level recorded 2026-09-22 76123fa16b69b8d4 · report
fixture: signature val:int/0/int · returned list · level recorded 2026-09-22 1bdfb9459bbcd869 · report
fixture: signature tensor:Tensor/3/float, pattern:str/0/str · returned Tensor · level recorded 2026-09-22 5844bf2b191c00ed · report
fixture: signature x:ndarray/1/int, y:ndarray/1/int · returned ndarray · level recorded 2026-09-22 census: 11 implementations from 39 papers, 3 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 1 of 2, arg 1: rank 2, kind float, dtype float32 memorizing_transformers_pytorch/memorizing_transformers_pytorch.py ran · honoured contract fingerprinted MIT (permissive) ·
f3232418205f7cbd · report
fixture: signature t:Tensor/2/float · returned Tensor · level recorded, date not recorded 2aa06e7db15eb39b · report
fixture: signature arr:list/1/int · returned list · level recorded, date not recorded 3cb1714e61d5fad7 · report
c25e09cec3306193 · report
2ef0e2f355bf12a6 · report
d92db56afc61ab11 · report
fixture: signature params:FrozenDict/0/? · returned dict · level recorded 2026-09-24 7deb74a26342f2d3 · report
fixture: signature shape:tuple/1/int, use_importance:bool/0/bool, dtype:callable/0/? · returned tuple · level recorded 2026-09-24 1f2be62797cfccf1 · report
fixture: signature step:int/0/int, every_steps:int/0/int · returned bool · level recorded 2026-09-24 b90643346c166065 · report
fixture: signature x:Tensor/4/float, seq_len:int/0/int · returned tuple · level recorded 2026-09-24 b704c9a5be0a15d7 · report
fixture: signature x:Tensor/4/float, seq_len:int/0/int · returned tuple · level recorded 2026-09-22 0765abcf04c608f6 · report
fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22 90915865fd797169 · report
fixture: signature hidden_states:Tensor/3/float · returned Tensor · level recorded 2026-09-22 580c588511c469d9 · report
fixture: signature x:Tensor/3/float, seq_len:int/0/int · returned tuple · level recorded 2026-09-22 census: 14 implementations from 15 papers, 8 distinct outputs across 7 buckets, one shared input per bucket src/llama/modeling.py ran; the contract check could not run (RAISES) Apache-2.0 (permissive) ·
49d79a24934a30e3 · report
fixture: signature q:Tensor/3/float, k:Tensor/3/float, cos:Tensor/4/float, sin:Tensor/4/float, position_ids:Tensor/2/int · returned tuple · level recorded 2026-09-22 4039fb9f24228670 · report
a7a01f367b6da9da · report
7419a094e9f98c3a · report
ecccb74da133bd6a · report
29b4a33fabd0b32e · report
7fd92c090cad8a75 · report
cbf31de811fec75e · report
c25efb685f36ecd3 · report
2 samples are identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
f70dcb896366697c · report
fixture: signature val:int/0/int, length:int/0/int · returned tuple · level recorded 2026-09-22 census: 5 implementations from 103 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 1, kind int, dtype int64 repository not located ran · violated contract licence of this copy not recorded ·
aa5486a3650902d8 · report
fixture: signature val:Tensor/1/int · returned bool · level recorded, date not recorded Method as code Syntology
What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.
3 assemblies on this paper: 3 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).
3 sibling assemblies for Memorizing Transformers (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.
harvested Assembly for Memorizing Transformers (graph method: Memorizing Transformers). 19 bricks; individually on a fixture: 16 ran (of which 7 constructed an object rather than computing a result; 11 with no instrument failure: 2 honoured, 2 violated, 7 with no contract checked; 5 where Syntology's instrument failed) · 3 unverified. The assembly has not been run end-to-end.
one of 3 siblings
- MemorizingTransformer entry · level 0 · unverified ·
c25e09cec3306193 - Attention model · level 1 · ran ·
4673cf1999dcca6b - FeedForward model · level 1 · ran ·
bea49fdbe8f8578a - KNNAttention model · level 1 · ran ·
2832f7cf743c7f86 - KNNMemoryList helper · level 0 · unverified ·
3cb1714e61d5fad7 - PreNormResidual model · level 1 · ran ·
25d9116c53cb8eb2 - T5RelativePositionBias model · level 1 · ran ·
9304ca35acfd717d - cast_tuple helper · level 1 · ran · honoured contract ·
f70dcb896366697c - default helper · level 1 · ran · violated contract ·
60fff7c3c400d7ff - exists helper · level 1 · ran · violated contract ·
aa5486a3650902d8 - unique helper · level 1 · ran · our draft was wrong ·
2aa06e7db15eb39b - l2norm helper · level 1 · ran · our draft was wrong ·
3eb58dae620046d3 - KNNMemory model · level 1 · ran ·
246054b031dda4de - multi_context helper · level 0 · unverified ·
2ef0e2f355bf12a6 - KNN helper · level 1 · ran ·
b2191b4a6430d0af - all_el_unique helper · level 1 · ran · our draft was wrong ·
dd330ab84432cbc2 - cast_list helper · level 1 · ran · honoured contract ·
76123fa16b69b8d4 - check_shape helper · level 1 · ran; the contract check could not run (RAISES) ·
1bdfb9459bbcd869 - count_intersect helper · level 1 · ran; the contract check could not run (RAISES) ·
5844bf2b191c00ed
harvested Assembly for Memorizing Transformers (graph method: Memorizing Transformers). 7 bricks; individually on a fixture: 4 ran (of which 4 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 3 unverified; every one of the 4 samples that ran constructed an object rather than computing a result. The assembly has not been run end-to-end.
one of 3 siblings
- MemorizingTransformer entry · level 0 · unverified ·
c25efb685f36ecd3 - AttentionLayer helper · level 0 · unverified ·
7fd92c090cad8a75 - MemorizingLayer model · level 0 · unverified ·
cbf31de811fec75e - TransformerEmbedding helper · level 1 · ran ·
4d2255c33fd872a1 - FeedForward helper · level 1 · ran ·
2893a3bddf619d82 - PositionalEncoding helper · level 1 · ran ·
6c89fcd0771cd674 - TokenEmbedding helper · level 1 · ran ·
0840d53a3e87bbd0
harvested Assembly for Memorizing Transformers (graph method: Memorizing Transformers). 15 bricks; individually on a fixture: 10 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 5 where Syntology's instrument failed) · 5 unverified. The assembly has not been run end-to-end.
one of 3 siblings
- ExtendedLlamaForCausalLM entry · level 0 · unverified ·
ecccb74da133bd6a - ExtendedLlamaModel helper · level 0 · unverified ·
29b4a33fabd0b32e - ExtendedLlamaConfig helper · level 0 · unverified ·
a7a01f367b6da9da - ExtendedLlamaDecoderLayer model · level 0 · unverified ·
7419a094e9f98c3a - LlamaRMSNorm model · level 1 · ran ·
90915865fd797169 - _expand_mask helper · level 1 · ran · our draft was wrong ·
24b08fbedd93aff0 - _make_causal_mask helper · level 1 · ran; the contract check could not run ·
72d28356d328b1e1 - ExtendedLlamaAttention model · level 0 · unverified ·
4039fb9f24228670 - LlamaMLP model · level 1 · ran ·
0765abcf04c608f6 - LlamaDynamicNTKScalingRotaryEmbedding helper · level 1 · ran ·
b90643346c166065 - LlamaLinearScalingRotaryEmbedding helper · level 1 · ran ·
b704c9a5be0a15d7 - LlamaRotaryEmbedding helper · level 1 · ran ·
580c588511c469d9 - apply_rotary_pos_emb helper · level 1 · ran; the contract check could not run (RAISES) ·
49d79a24934a30e3 - repeat_kv helper · level 2 · ran; the contract check could not run ·
3c76e52815c5401d - rotate_half helper · level 1 · ran · our draft was wrong ·
e03d53ba9d4f9ae5
Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2203.08913") returns these assemblies with each brick's role and wiring (how to connect).
Tasks
Results from the paper archive 2025-07-28
No leaderboard rows for this paper in the archive.
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections