SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2507.03285 · NeurIPS · 2025

Memory Mosaics at scale

Jianyu Zhang, Léon Bottou

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2507.03285.json · badge: /api/ran/2507.03285.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
facebookresearch/MemoryMosaics community
Papers with Code archive
6 ran · 1 no recorded run
FunctionStatusWhere it lives
AttnOnlyBlock Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("70c0f7b311c3a3f6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AttnOnlyBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

ARGS = {
    'n_head': 4,
    'n_embd': 8,
    'v_shift': 1,
    'block_size': 8,
    'k_fe_type': 'linearconv',
    'v_fe_type': 'lowrlinearconv',
    'k_kernel_size': 1,
    'v_kernel_size': 2,
    'ic_dropout': 0.05,
    'hd_dropout': 0.05,
    'bias': False,
    'config': {},
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttnOnlyBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AttnOnlyBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FeatureExtractor Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("9f9ffafdaa489a78")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, FeatureExtractor: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'fe_type': 'linearconv',
    'shift': 0,
    'norm': True,
    'kernel_size': 3,
    'n_embd': 4,
    'n_head': 2,
    'bias': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FeatureExtractor — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FeatureExtractor output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
InContextAssoMemBlock Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("307af821603ce859")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, InContextAssoMemBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'n_head': 2,
    'n_embd': 4,
    'v_shift': 1,
    'block_size': 3,
    'k_fe_type': 'linearconv',
    'v_fe_type': 'lowrlinearconv',
    'k_kernel_size': 1,
    'v_kernel_size': 2,
    'ic_dropout': 0.05,
    'hd_dropout': 0.05,
    'bias': False,
    'config': {}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type InContextAssoMemBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a InContextAssoMemBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("aa22a9211483a672")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LayerNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "ndim": 4,
    "bias": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LayerNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LayerNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PersistentAssoMemBlock Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("437ee2286840dd92")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PersistentAssoMemBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

ARGS = {
    'n_head': 2,
    'n_embd': 4,
    'block_size': 8,
    'k_fe_type': 'linearconv',
    'k_kernel_size': 1,
    'ic_dropout': 0.05,
    'hd_dropout': 0.05,
    'bias': False,
    'pmem_count': 1,
    'pmem_size': 16,
    'config': {}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PersistentAssoMemBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PersistentAssoMemBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Pmem Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("102db1a21a2220f1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Pmem: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.nn import functional as F
import numpy as np

torch.manual_seed(0)

class Pmem(nn.Module):

    def __init__(self, pmem_count, pmem_size, pmem_dim, pmem_nhead, dropout):
        super().__init__()
        self.pmem_size = pmem_size
        self.pmem_dim = pmem_dim
        self.pmem_nhead = pmem_nhead
        self.pmem_count = pmem_count
        self.dropout = dropout
        self.M_k, self.M_v = ([], [])
        for i in range(self.pmem_count):
            M_k = nn.Parameter(torch.zeros(1, self.pmem_nhead, self.pmem_size, self.pmem_dim))
            M_v = nn.Parameter(torch.zeros(1, self.pmem_nhead, self.pmem_size, self.pmem_dim))
            torch.nn.init.normal_(M_k, mean=0.0, std=1 / np.sqrt(self.pmem_dim))
            torch.nn.init.normal_(M_v, mean=0.0, std=1 / np.sqrt(self.pmem_dim))
            setattr(self, f'M_k{i}', M_k)
            setattr(self, f'M_v{i}', M_v)

    def forward(self, key):
        B, _, _, _ = key.size()
        y = 0
        for i in range(self.pmem_count):
            y = y + F.scaled_dot_product_attention(key, getattr(self, f'M_k{i}').expand(B, self.pmem_nhead, self.pmem_size, self.pmem_dim), getattr(self, f'M_v{i}').expand(B, self.pmem_nhead, self.pmem_size, self.pmem_dim), is_causal=False, scale=1, dropout_p=self.dropout if self.training else 0)
        y = y / self.pmem_count
        return y

ARGS = {
    'pmem_count': 2,
    'pmem_size': 3,
    'pmem_dim': 4,
    'pmem_nhead': 5,
    'dropout': 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Pmem — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Pmem output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
StackAssoMem Not yet run
unverified (harvested, no recorded run)
facebookresearch/MemoryMosaics/Library/memory_mosaics/models/memory_mosaics.py
code served (permissive licence) · get_code("cbc1dc78c5561032")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
LayerNorm
brick of this paper's assembly: helper
10 other papers
8 dated earlier, 2 later · 6 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
2202.09244 (2022-02)
Transfer and Marginalize: Explaining Away Label Noise with Privileged Information
2309.07207 (2023-09)
EarthPT: a time series foundation model for Earth Observation
and 7 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Memory Mosaics [Zhang et al., 2025], networks of associative memories, have demonstrated appealing compositional and in-context learning capabilities on medium-scale networks (GPT-2 scale) and synthetic small datasets. This work shows that these favorable properties remain when we scale memory mosaics to large language model sizes (llama-8B scale) and real-world datasets. To this end, we scale memory mosaics to 10B size, we train them on one trillion tokens, we introduce a couple architectural modifications ("memory mosaics v2"), we assess their capabilities across three evaluation dimensions: training-knowledge storage, new-knowledge storage, and in-context learning. Throughout the evaluation, memory mosaics v2 match transformers on the learning of training knowledge (first dimension) and significantly outperforms transformers on carrying out new tasks at inference time (second and third dimensions). These improvements cannot be easily replicated by simply increasing the training data for transformers. A memory mosaics v2 trained on one trillion tokens still perform better on these tasks than a transformer trained on eight trillion tokens. 1 For clarity, "Memory Mosaics" refers to the version in Zhang et al. [2025], while "Memory Mosaics v2" refers to this scaled-up version. 2 https://github.com/facebookresearch/MemoryMosaics 39th Conference on Neural Information Processing Systems (NeurIPS 2025).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2507.03285")
get_code_for_paper("2507.03285")
have("2507.03285")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2507.03285.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2507.03285.svg)](https://syntology.ai/paper/2507.03285)

Connect an agent — have() is free.