SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.08913 · ICLR · 2022

Memorizing Transformers

Yuhuai Wu, Markus Rabe, Christian Szegedy, Delesley Hutchins

arXiv · PDF · Open in the Atlas

Code that ran

23 of 34 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; 3 honoured the contract we drafted, 1 violated it and 14 have no contract verdict; 5 failures of our instrument; 11 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2203.08913.json · badge: /api/ran/2203.08913.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
google-research/meliad canonical (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
lucidrains/memorizing-transformers-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
12 ran · 3 no recorded run
normal-computing/extended-mind-transformers community
Papers with Code archive
6 ran · 5 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
AIResearchHub/transformergallery community
Papers with Code archive
0 ran · 3 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("4673cf1999dcca6b")
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, Attention: 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
from torch import nn

torch.manual_seed(0)

# Build the Attention module with minimal valid arguments
ARGS = {
    "dim": 64,
    "heads": 8,
    "dim_head": 8,
    "dropout": 0.1,
    "xl_max_memories": 5,
}

# Create a small input tensor for forward pass testing
x = torch.randn(2, 10, 64)  # batch=2, seq_len=10, dim=64

# Create optional xl_memory tensor if needed
xl_memory = torch.randn(2, 3, 2, 8)  # batch=2, mem_len=3, 2 (for k,v), dim_head=8

# Create optional rel_pos_bias tensor
rel_pos_bias = torch.randn(1, 8, 15, 15)  # heads=8, max_seq for bias

# Test forward pass arguments
forward_kwargs = {
    "x": x,
    "xl_memory": xl_memory,
    "rel_pos_bias": rel_pos_bias,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Attention — 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 Attention 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
KNN Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("b2191b4a6430d0af")
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, KNN: 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 numpy as np
import faiss

# Create KNN instance with minimal valid parameters
dim = 4
max_num_entries = 100
cap_num_entries = False
M = 15
keep_stats = False

ARGS = {
    "dim": dim,
    "max_num_entries": max_num_entries,
    "cap_num_entries": cap_num_entries,
    "M": M,
    "keep_stats": keep_stats,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, faiss, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KNN — 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 KNN 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
KNNAttention Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("2832f7cf743c7f86")
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, KNNAttention: 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 import nn as nn_module
import math

torch.manual_seed(0)

# Create a minimal KNN memory class that satisfies the interface used in forward()
class MinimalKNNMemory:
    def __init__(self, dim_head=64, num_heads=8):
        self.dim_head = dim_head
        self.num_heads = num_heads
        self.memories = []
    
    def search(self, q, num_retrieved):
        # q shape: (b, h, n, d)
        b, h, n, d = q.shape
        # Return mem_kv of shape (b, h, n, num_retrieved, 2) and mem_mask of shape (b, h, n, num_retrieved)
        mem_kv = torch.randn(b, h, n, num_retrieved, 2, self.dim_head)
        mem_mask = torch.ones(b, h, n, num_retrieved, dtype=torch.bool)
        return mem_kv, mem_mask
    
    def add(self, kv_memories):
        # kv_memories shape: (b, *, 2, d_head)
        self.memories.append(kv_memories)

# Instantiate the KNN memory
knn_memory = MinimalKNNMemory(dim_head=64, num_heads=8)

# Build the KNNAttention module
knn_attention = nn.Module()  # placeholder, will be replaced by actual instance

# Create input tensor: (batch=2, seq_len=5, dim=256)
x = torch.randn(2, 5, 256)

# Create xl_memory as optional parameter: (batch=2, seq_len=3, 2, dim_head=64)
xl_memory = torch.randn(2, 3, 2, 64)

# Create rel_pos_bias as optional parameter: (1, num_heads=8, max_seq=10, max_seq=10)
rel_pos_bias = torch.randn(1, 8, 10, 10)

# Define ARGS dict with all parameters for KNNAttention.__init__
ARGS = {
    'dim': 256,
    'heads': 8,
    'dim_head': 64,
    'dropout': 0.1,
    'num_retrieved_memories': 32,
    'xl_max_memories': 3,
    'attn_scale_init': 20,
    'gate_output': False,
}

# Additional forward() arguments to be passed
FORWARD_ARGS = {
    'x': x,
    'knn_memory': knn_memory,
    'xl_memory': xl_memory,
    'add_knn_memory': True,
    'rel_pos_bias': rel_pos_bias,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KNNAttention — 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 KNNAttention 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
KNNMemory Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("246054b031dda4de")
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, KNNMemory: 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 numpy as np
from pathlib import Path
import tempfile

torch.manual_seed(0)

# Create a temporary directory for memmap file
temp_dir = tempfile.mkdtemp()
memmap_filename = str(Path(temp_dir) / 'knn.memory.memmap')

ARGS = {
    'dim': 4,
    'max_memories': 16,
    'num_indices': 2,
    'memmap_filename': memmap_filename,
    'multiprocessing': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, faiss, joblib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KNNMemory — 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 KNNMemory 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
LlamaDynamicNTKScalingRotaryEmbedding Ran
ran on a synthesized input
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("b90643346c166065")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

INIT_ARGS = {
    'dim': 8,
    'max_position_embeddings': 16,
    'base': 10000,
    'device': None,
    'scaling_factor': 2.0
}

# Create a dummy input tensor: [batch_size, num_heads, seq_len, head_dim]
# The forward method expects x and seq_len
# Looking at the forward method, it uses seq_len to slice the cached embeddings
# and returns cos/sin tensors shaped for the sequence length
batch_size = 2
num_heads = 3
seq_len = 12
head_dim = 8  # Should match dim in INIT_ARGS

x = torch.randn(batch_size, num_heads, seq_len, head_dim)

ARGS = {
    'x': x,
    'seq_len': seq_len
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LlamaLinearScalingRotaryEmbedding Ran
ran on a synthesized input
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("b704c9a5be0a15d7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

INIT_ARGS = {
    'dim': 4,
    'max_position_embeddings': 2048,
    'base': 10000,
    'device': None,
    'scaling_factor': 1.0,
}

ARGS = {
    'x': torch.randn(2, 1, 8, 4),
    'seq_len': 512,
}

# Construct and call
class LlamaRotaryEmbedding(torch.nn.Module):
    """Rotary Positional Embedding"""

    def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
        super().__init__()
        self.dim = dim
        self.max_position_embeddings = max_position_embeddings
        self.base = base
        inv_freq = 1.0 / self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim)
        self.register_buffer('inv_freq', inv_freq, persistent=False)
        self._set_cos_sin_cache(seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype())

    def _set_cos_sin_cache(self, seq_len, device, dtype):
        self.max_seq_len_cached = seq_len
        t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
        freqs = torch.einsum('i,j->ij', t, self.inv_freq)
        emb = torch.cat((freqs, freqs), dim=-1)
        self.register_buffer('cos_cached', emb.cos()[None, None, :, :].to(dtype), persistent=False)
        self.register_buffer('sin_cached', emb.sin()[None, None, :, :].to(dtype), persistent=False)

    def forward(self, x, seq_len=None):
        if seq_len > self.max_seq_len_cached:
            self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
        return (self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype), self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype))

class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding):
    """LlamaRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""

    def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
        self.scaling_factor = scaling_factor
        super().__init__(dim, max_position_embeddings, base, device)

    def _set_cos_sin_cache(self, seq_len, device, dtype):
        self.max_seq_len_cached = seq_len
        t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
        t = t / self.scaling_factor
        freqs = torch.einsum('i,j->ij', t, self.inv_freq)
        emb = torch.cat((freqs, freqs), dim=-1)
        self.register_buffer('cos_cached', emb.cos()[None, None, :, :].to(dtype), persistent=False)
        self.register_buffer('sin_cached', emb.sin()[None, None, :, :].to(dtype), persistent=False)

model = LlamaLinearScalingRotaryEmbedding(**INIT_ARGS)
output = model(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LlamaMLP Ran
ran on a synthesized input
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("0765abcf04c608f6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 transformers.activations import ACT2FN

class LlamaMLP(nn.Module):
    """MLP Module"""

    def __init__(self, config):
        super().__init__()
        self.config = config
        self.hidden_size = config.hidden_size
        self.intermediate_size = config.intermediate_size
        self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
        self.act_fn = ACT2FN[config.hidden_act]

    def forward(self, x):
        if self.config.pretraining_tp > 1:
            slice = self.intermediate_size // self.config.pretraining_tp
            gate_proj_slices = self.gate_proj.weight.split(slice, dim=0)
            up_proj_slices = self.up_proj.weight.split(slice, dim=0)
            down_proj_slices = self.down_proj.weight.split(slice, dim=1)
            gate_proj = torch.cat([torch.nn.functional.linear(x, gate_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
            up_proj = torch.cat([torch.nn.functional.linear(x, up_proj_slices[i]) for i in range(self.config.pretraining_tp)], dim=-1)
            intermediate_states = (self.act_fn(gate_proj) * up_proj).split(slice, dim=2)
            down_proj = [torch.nn.functional.linear(intermediate_states[i], down_proj_slices[i]) for i in range(self.config.pretraining_tp)]
            down_proj = sum(down_proj)
        else:
            down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
        return down_proj


class Config:
    def __init__(self, hidden_size, intermediate_size, hidden_act, pretraining_tp):
        self.hidden_size = hidden_size
        self.intermediate_size = intermediate_size
        self.hidden_act = hidden_act
        self.pretraining_tp = pretraining_tp


INIT_ARGS = {
    "config": Config(
        hidden_size=4,
        intermediate_size=8,
        hidden_act="silu",
        pretraining_tp=1
    )
}

ARGS = {
    "x": torch.randn(2, 3, 4)
}

if __name__ == "__main__":
    mlp = LlamaMLP(**INIT_ARGS)
    output = mlp(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LlamaRMSNorm Ran
ran on a synthesized input
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("90915865fd797169")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn

class LlamaRMSNorm(nn.Module):
    """LlamaRMSNorm is equivalent to T5LayerNorm"""

    def __init__(self, hidden_size, eps=1e-06):
        """
        LlamaRMSNorm is equivalent to T5LayerNorm
        """
        super().__init__()
        self.weight = nn.Parameter(torch.ones(hidden_size))
        self.variance_epsilon = eps

    def forward(self, hidden_states):
        """Apply RMS Norm"""
        input_dtype = hidden_states.dtype
        hidden_states = hidden_states.to(torch.float32)
        variance = hidden_states.pow(2).mean(-1, keepdim=True)
        hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
        return self.weight * hidden_states.to(input_dtype)


INIT_ARGS = {
    "hidden_size": 4,
    "eps": 1e-06,
}

ARGS = {
    "hidden_states": torch.randn(2, 3, 4),
}

if __name__ == "__main__":
    model = LlamaRMSNorm(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output dtype:", output.dtype)
    print("Output:", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LlamaRotaryEmbedding Ran
ran on a synthesized input
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("580c588511c469d9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

INIT_ARGS = {
    'dim': 8,
    'max_position_embeddings': 16,
    'base': 10000,
    'device': None,
}

ARGS = {
    'x': torch.randn(2, 4, 8),
    'seq_len': 12,
}

# Construct and call
embedding = torch.nn.Module.__new__(type('LlamaRotaryEmbedding', (torch.nn.Module,), {
    '__init__': lambda self, dim, max_position_embeddings=2048, base=10000, device=None: (
        torch.nn.Module.__init__(self),
        setattr(self, 'dim', dim),
        setattr(self, 'max_position_embeddings', max_position_embeddings),
        setattr(self, 'base', base),
        self.register_buffer('inv_freq', 1.0 / base ** (torch.arange(0, dim, 2).float().to(device) / dim), persistent=False),
        self._set_cos_sin_cache(seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()),
    )[-1],
    '_set_cos_sin_cache': lambda self, seq_len, device, dtype: (
        setattr(self, 'max_seq_len_cached', seq_len),
        (t := torch.arange(seq_len, device=device, dtype=self.inv_freq.dtype)),
        (freqs := torch.einsum('i,j->ij', t, self.inv_freq)),
        (emb := torch.cat((freqs, freqs), dim=-1)),
        self.register_buffer('cos_cached', emb.cos()[None, None, :, :].to(dtype), persistent=False),
        self.register_buffer('sin_cached', emb.sin()[None, None, :, :].to(dtype), persistent=False),
    )[-1],
    'forward': lambda self, x, seq_len=None: (
        self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype) if seq_len > self.max_seq_len_cached else None,
        (self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype), self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype)),
    )[-1],
}))

# Simpler direct implementation
class LlamaRotaryEmbedding(torch.nn.Module):
    def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
        super().__init__()
        self.dim = dim
        self.max_position_embeddings = max_position_embeddings
        self.base = base
        inv_freq = 1.0 / self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim)
        self.register_buffer('inv_freq', inv_freq, persistent=False)
        self._set_cos_sin_cache(seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype())

    def _set_cos_sin_cache(self, seq_len, device, dtype):
        self.max_seq_len_cached = seq_len
        t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
        freqs = torch.einsum('i,j->ij', t, self.inv_freq)
        emb = torch.cat((freqs, freqs), dim=-1)
        self.register_buffer('cos_cached', emb.cos()[None, None, :, :].to(dtype), persistent=False)
        self.register_buffer('sin_cached', emb.sin()[None, None, :, :].to(dtype), persistent=False)

    def forward(self, x, seq_len=None):
        if seq_len > self.max_seq_len_cached:
            self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
        return (self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype), self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype))

model = LlamaRotaryEmbedding(**INIT_ARGS)
output = model(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
PreNormResidual Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("25d9116c53cb8eb2")
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, PreNormResidual: 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
from torch import nn

torch.manual_seed(0)

# Create a simple function module that will be used as fn
class SimpleFn(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x, **kwargs):
        return self.linear(x)

# Alternative fn that returns a tuple
class TupleFn(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x, **kwargs):
        return (self.linear(x), "extra_output")

# Set up the arguments
dim = 4
fn = SimpleFn(dim)

ARGS = {
    "dim": dim,
    "fn": fn
}
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 PreNormResidual — 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 PreNormResidual 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
T5RelativePositionBias Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("9304ca35acfd717d")
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, T5RelativePositionBias: 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
from torch import nn
import math

torch.manual_seed(0)

ARGS = {
    'scale': 2.0,
    'num_buckets': 32,
    'max_distance': 128,
    'heads': 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type T5RelativePositionBias — 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 T5RelativePositionBias 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
all_el_unique Ran
ran; our contract draft was wrong, not the code
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("dd330ab84432cbc2")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np

torch.manual_seed(0)

# Analyze the function:
# all_el_unique(arr) checks if all elements in arr are unique
# by comparing len(set(arr)) == len(arr)
# This works with any hashable sequence/iterable

# Test case 1: list with unique elements
arr_unique = [1, 2, 3, 4, 5]

ARGS = {
    "arr": arr_unique
}
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 bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("49d79a24934a30e3")
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) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

torch.manual_seed(0)

# Analyze the function:
# - q: tensor, used with .size(-2), *, rotate_half()
# - k: tensor, used with *, rotate_half()
# - cos: tensor, used with .squeeze(1).squeeze(0), indexing with position_ids
# - sin: tensor, used with .squeeze(1).squeeze(0), indexing with position_ids
# - position_ids: tensor, used for indexing cos/sin, .shape access, slicing with [:, -s_q:]

# Dimensions:
# - q and k need matching last dimension (hidden_dim), and q needs seq_len dimension
# - cos and sin need to support indexing by position_ids values
# - position_ids should have shape (batch, seq_len) with values in valid range for cos/sin

batch_size = 2
seq_len = 3
hidden_dim = 4
max_position = 10

# q: (batch, seq_len, hidden_dim)
q = torch.randn(batch_size, seq_len, hidden_dim)

# k: (batch, seq_len, hidden_dim)
k = torch.randn(batch_size, seq_len, hidden_dim)

# cos and sin: need to be indexable by position_ids
# They come in with shape (1, 1, max_position, hidden_dim) based on squeeze operations
cos = torch.randn(1, 1, max_position, hidden_dim)
sin = torch.randn(1, 1, max_position, hidden_dim)

# position_ids: (batch, seq_len) with values in range [0, max_position)
position_ids = torch.randint(0, max_position, (batch_size, seq_len))

ARGS = {
    "q": q,
    "k": k,
    "cos": cos,
    "sin": sin,
    "position_ids": position_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
cast_list Ran
ran, honoured the contract we drafted
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("76123fa16b69b8d4")
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 list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np

torch.manual_seed(0)

# The function cast_list takes a single parameter 'val'
# It checks if val is a list, and returns it as-is if it is,
# otherwise wraps it in a list.

# Test with a non-list value (will be wrapped in a list)
ARGS = {
    'val': 42
}
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 list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
cast_tuple Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from lucidrains/phenaki-pytorch
pointer only · get_code("f70dcb896366697c")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_shape Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("1bdfb9459bbcd869")
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) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from einops import rearrange

torch.manual_seed(0)

# The function check_shape takes:
# - tensor: a tensor to rearrange
# - pattern: a string pattern for einops rearrange
# - **kwargs: additional keyword arguments passed to rearrange

# Create a small tensor with distinct dimensions
tensor = torch.randn(2, 4, 3)

# Create a valid einops pattern
# For a 3D tensor of shape (2, 4, 3), we can use pattern like "b h w"
pattern = "b h w"

ARGS = {
    "tensor": tensor,
    "pattern": pattern,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
count_intersect Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("5844bf2b191c00ed")
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 ndarray, ndim 1, dtype family int, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
from einops import rearrange

# Create small numpy arrays for x and y
x = np.array([1, 2, 3, 4])  # shape (4,)
y = np.array([2, 3, 5, 6])  # shape (4,)

ARGS = {
    'x': x,
    'y': y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
exists Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from ThomasMrY/VCT
pointer only; the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("aa5486a3650902d8")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

flatten_dict_string_keys Ran
ran on a synthesized input
google-research/meliad/model_info.py
code served (permissive licence) · get_code("d92db56afc61ab11")
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 dict. 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 flax
import flax.core
import flax.traverse_util

# Create a nested dictionary structure that mimics Flax parameters
# This will be unfrozen, flattened, and converted to string keys

nested_params = {
    'dense': {
        'kernel': [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]],
        'bias': [0.1, 0.2, 0.3]
    },
    'conv': {
        'weight': [[7.0, 8.0], [9.0, 10.0]],
        'params': {
            'scale': [1.5, 2.5]
        }
    }
}

# Freeze it as Flax would have it
frozen_params = flax.core.freeze(nested_params)

ARGS = {
    'params': frozen_params
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
identity Ran
ran, honoured the contract we drafted
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("f3232418205f7cbd")
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) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

torch.manual_seed(0)

# The identity function takes a single parameter 't' and returns it unchanged
# We'll provide a simple tensor as the argument
t = torch.randn(2, 4)

ARGS = {
    "t": t
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
initial_kvi Ran
ran on a synthesized input
google-research/meliad/transformer/attention.py
code served (permissive licence) · get_code("7deb74a26342f2d3")
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 tuple. 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 jax.numpy as jnp

ARGS = {
    "shape": (2, 4, 8),
    "use_importance": True,
    "dtype": jnp.float32,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
should_run Ran
ran on a synthesized input
google-research/meliad/training_task.py
code served (permissive licence) · get_code("1f2be62797cfccf1")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

torch.manual_seed(0)

ARGS = {
    "step": 5,
    "every_steps": 2,
}
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 bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
unique Ran
ran; our contract draft was wrong, not the code
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("2aa06e7db15eb39b")
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) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np

torch.manual_seed(0)

# The function `unique` takes an iterable `arr` and returns a list of unique elements
# by using a dict to track seen elements. It works with any hashable objects.

# Create a simple list with some duplicate elements
arr = [1, 2, 3, 2, 1, 4, 3, 5]

ARGS = {
    "arr": arr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
AttentionLayer Not yet run
unverified (harvested, no recorded run)
AIResearchHub/transformergallery/transformer/memorizingtransformer.py
code served (permissive licence) · get_code("7fd92c090cad8a75")
How it ran

no invocation recorded.

ExtendedLlamaAttention Not yet run
unverified (harvested, no recorded run)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("4039fb9f24228670")
How it ran

no invocation recorded.

ExtendedLlamaConfig Not yet run
unverified (harvested, no recorded run)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("a7a01f367b6da9da")
How it ran

no invocation recorded.

ExtendedLlamaDecoderLayer Not yet run
unverified (harvested, no recorded run)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("7419a094e9f98c3a")
How it ran

no invocation recorded.

ExtendedLlamaForCausalLM Not yet run
unverified (harvested, no recorded run)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("ecccb74da133bd6a")
How it ran

no invocation recorded.

ExtendedLlamaModel Not yet run
unverified (harvested, no recorded run)
normal-computing/extended-mind-transformers/src/llama/modeling.py
code served (permissive licence) · get_code("29b4a33fabd0b32e")
How it ran

no invocation recorded.

KNNMemoryList Not yet run
unverified (harvested, no recorded run)
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("3cb1714e61d5fad7")
How it ran

no invocation recorded.

MemorizingLayer Not yet run
unverified (harvested, no recorded run)
AIResearchHub/transformergallery/transformer/memorizingtransformer.py
code served (permissive licence) · get_code("cbf31de811fec75e")
How it ran

no invocation recorded.

MemorizingTransformer Not yet run
unverified (harvested, no recorded run)
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("c25e09cec3306193")
How it ran

no invocation recorded.

MemorizingTransformer Not yet run
unverified (harvested, no recorded run)
AIResearchHub/transformergallery/transformer/memorizingtransformer.py
code served (permissive licence) · get_code("c25efb685f36ecd3")
How it ran

no invocation recorded.

multi_context Not yet run
unverified (harvested, no recorded run)
lucidrains/memorizing-transformers-pytorch/memorizing_transformers_pytorch/memorizing_transformers_pytorch.py
code served (permissive licence) · get_code("2ef0e2f355bf12a6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 34 samples lifted from this paper's linked repositories, 34 carry a function identity and 0 do not. Of the 34 distinct functions with an identity, 9 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 9 later) and 25 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
exists
brick of this paper's assembly: helper
486 other papers
83 dated earlier, 6 the same month, 394 later, 1 same year, order not determinable, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
identity 21 other papers
1 dated earlier, 19 later, 1 undated · 2 only as an assembly brick
2011.10043 (2020-11)
Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning
2302.04761 (2023-02)
Toolformer: Language Models Can Teach Themselves to Use Tools
2306.15687 (2023-06)
Voicebox: Text-Guided Multilingual Universal Speech Generation at Scale
and 18 more not named here
cast_tuple
brick of this paper's assembly: helper
9 other papers
2 dated earlier, 7 later · 1 only as an assembly brick
2106.02689 (2021-06)
RegionViT: Regional-to-Local Attention for Vision Transformers
2108.00154 (2021-08)
CrossFormer: A Versatile Vision Transformer Hinging on Cross-scale Attention
2210.02399 (2022-10)
Phenaki: Variable Length Video Generation From Open Domain Textual Description
and 6 more not named here
LlamaRMSNorm
brick of this paper's assembly: model
6 other papers
6 later · 5 only as an assembly brick
2401.07159 (2024-01)
Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
2402.01469 (2024-02)
AMOR: A Recipe for Building Adaptable Modular Knowledge Agents Through Process Feedback
2402.14905 (2024-02)
MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Cases
and 3 more not named here
LlamaLinearScalingRotaryEmbedding
brick of this paper's assembly: helper
5 other papers
5 later · 3 only as an assembly brick
2401.07159 (2024-01)
Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
2402.01469 (2024-02)
AMOR: A Recipe for Building Adaptable Modular Knowledge Agents Through Process Feedback
2406.12335 (2024-06)
Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matters
and 2 more not named here
LlamaDynamicNTKScalingRotaryEmbedding
brick of this paper's assembly: helper
4 other papers
4 later · 2 only as an assembly brick
2401.07159 (2024-01)
Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
2406.12335 (2024-06)
Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matters
2407.03157 (2024-07)
Let the Code LLM Edit Itself When You Edit the Code
and 1 more not named here
LlamaRotaryEmbedding
brick of this paper's assembly: helper
3 other papers
3 later · 2 only as an assembly brick
2401.07159 (2024-01)
Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
2406.12335 (2024-06)
Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matters
2502.17599 (2025-02)
MEDA: Dynamic KV Cache Allocation for Efficient Multimodal Long-Context Inference
LlamaMLP
brick of this paper's assembly: model
2 other papers
2 later · 1 only as an assembly brick
2310.03668 (2023-10)
GoLLIE: Annotation Guidelines improve Zero-Shot Information-Extraction
2412.00876 (2024-12)
Dynamic-LLaVA: Efficient Multimodal Large Language Models via Dynamic Vision-language Context Sparsification
check_shape
brick of this paper's assembly: helper
2 other papers
2 later
2411.17606 (2024-11)
HyperSeg: Towards Universal Visual Segmentation with Large Language Model
2412.14006 (2024-12)
InstructSeg: Unifying Instructed Visual Segmentation with Multi-modal Large Language Models

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-22.

Repositories linked to this paper

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

Abstract

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.

For agents

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

get_harvested_code_for_paper("2203.08913")
get_code_for_paper("2203.08913")
have("2203.08913")

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

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

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

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

Connect an agent — have() is free.