SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.11062 · 2023

Scaling Transformer to 1M tokens and beyond with RMT

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-23; 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/2304.11062.json · badge: /api/ran/2304.11062.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
booydar/transformer-xl canonical (classifier label)
classifier basis: census
5 ran · 3 no recorded run
FunctionStatusWhere it lives
create_exp_dir Ran
ran; our contract draft was wrong, not the code
booydar/transformer-xl/pytorch/utils/exp_utils.py
code served (permissive licence) · get_code("3111b71c0c6db589")
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 partial. 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 functools
import os
import shutil
import tempfile

# Create a temporary directory for the experiment
temp_dir = tempfile.mkdtemp(prefix='test_exp_')

# Create some dummy script files to save
dummy_script_1 = os.path.join(temp_dir, 'script1.py')
dummy_script_2 = os.path.join(temp_dir, 'script2.py')

with open(dummy_script_1, 'w') as f:
    f.write('# dummy script 1\n')

with open(dummy_script_2, 'w') as f:
    f.write('# dummy script 2\n')

# Define experiment directory path
exp_dir_path = os.path.join(temp_dir, 'experiment')

ARGS = {
    'dir_path': exp_dir_path,
    'scripts_to_save': [dummy_script_1, dummy_script_2],
    'debug': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type partial — a partial output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a partial 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
get_logger Ran
ran; our contract draft was wrong, not the code
booydar/transformer-xl/pytorch/utils/exp_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from stefvk/Elliptical-Attention, is pointer only (licence: NONE) · get_code("d142e8a68b535885")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from stefvk/Elliptical-Attention, and GitHub detected no licence in that repository when it was checked. 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.

get_three_letters Ran
ran on a synthesized input
booydar/transformer-xl/pytorch/experiment_utils/retrieval.py
code served (permissive licence) · get_code("c5ad9198fb1047fb")
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 (30,) 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

# The function get_three_letters takes a parameter K which is used as:
# 1. K > 26 (comparison, so K should be numeric)
# 2. K passed to np.random.choice as the size parameter (should be int or array-like)
# The function returns random choices from range(11, 37) with replacement determined by K > 26

# Let's create a valid K value
K = 30  # An integer greater than 26, so replace=True

ARGS = {
    "K": K
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 (30,) — shape (30,) 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
get_three_numbers Ran
ran on a synthesized input
booydar/transformer-xl/pytorch/experiment_utils/retrieval.py
code served (permissive licence) · get_code("679c549539e38322")
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 (5,) 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

# The function get_three_numbers takes a parameter K which is used as:
# 1. Compared with 10 (K > 10) to determine the replace boolean
# 2. Passed to np.random.choice as the size parameter
# K should be an integer

ARGS = {
    "K": 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 (5,) — shape (5,) 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
sample_logits Ran
ran; our contract draft was wrong, not the code
booydar/transformer-xl/pytorch/utils/log_uniform_sampler.py
code served (permissive licence) · get_code("93228a3eb5c4d179")
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 Tensor, ndim 3, dtype family float, shape (2, 3, 6) 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

torch.manual_seed(0)

# Small embedding layer
n_vocab = 20
n_emb = 4
embedding = nn.Embedding(n_vocab, n_emb)

# Bias vector
bias = torch.randn(n_vocab)

# Labels: [b1, b2] with valid vocab indices
b1, b2 = 2, 3
labels = torch.randint(0, n_vocab, (b1, b2))

# Inputs: [b1, b2, n_emb]
inputs = torch.randn(b1, b2, n_emb)

# Sampler that implements the sample() method
class LogUniformSampler:
    def __init__(self, n_vocab, n_sample=5):
        self.n_vocab = n_vocab
        self.n_sample = n_sample
    
    def sample(self, labels):
        # Sample negative samples
        neg_samples = torch.randint(0, self.n_vocab, (self.n_sample,))
        
        # Log probabilities
        true_log_probs = torch.randn(labels.size(0), labels.size(1))
        samp_log_probs = torch.randn(self.n_sample)
        
        return true_log_probs, samp_log_probs, neg_samples

sampler = LogUniformSampler(n_vocab=n_vocab, n_sample=5)

ARGS = {
    "embedding": embedding,
    "bias": bias,
    "labels": labels,
    "inputs": inputs,
    "sampler": sampler
}
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 Tensor, ndim 3, dtype family float, shape (2, 3, 6) — shape (2, 3, 6) 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
create_sequence Not yet run
unverified (harvested, no recorded run)
booydar/transformer-xl/pytorch/experiment_utils/retrieval.py
code served (permissive licence) · get_code("e4a5158e06e5f43f")
How it ran

no invocation recorded.

scatter Not yet run
unverified (harvested, no recorded run)
booydar/transformer-xl/pytorch/utils/data_parallel.py
code served (permissive licence) · get_code("69598ced7806d8c3")
How it ran

no invocation recorded.

scatter_kwargs Not yet run
unverified (harvested, no recorded run)
booydar/transformer-xl/pytorch/utils/data_parallel.py
code served (permissive licence) · get_code("aa1de448b0528802")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 4 later) and 3 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
sample_logits 14 other papers
13 dated earlier, 1 later · 2 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
and 11 more not named here
scatter_kwargs 11 other papers
6 dated earlier, 3 later, 2 same year, order not determinable
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers
2204.03883 (2022-04)
Vision Transformers for Single Image Dehazing
and 8 more not named here
scatter 8 other papers
5 dated earlier, 2 later, 1 same year, order not determinable
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers
2204.03883 (2022-04)
Vision Transformers for Single Image Dehazing
and 5 more not named here
get_logger 3 other papers
2 dated earlier, 1 later
2004.12585 (2020-04)
A Batch Normalized Inference Network Keeps the KL Vanishing Away
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers
2406.13770 (2024-06)
Elliptical Attention
create_exp_dir 1 other paper
1 dated earlier
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers

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

A major limitation for the broader scope of problems solvable by transformers is the quadratic scaling of computational complexity with input size. In this study, we investigate the recurrent memory augmentation of pre-trained transformer models to extend input context length while linearly scaling compute. Our approach demonstrates the capability to store information in memory for sequences of up to an unprecedented two million tokens while maintaining high retrieval accuracy. Experiments with language modeling tasks show perplexity improvement as the number of processed input segments increases. These results underscore the effectiveness of our method, which has significant potential to enhance long-term dependency handling in natural language understanding and generation tasks, as well as enable large-scale context processing for memory-intensive applications.

For agents

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

get_harvested_code_for_paper("2304.11062")
get_code_for_paper("2304.11062")
have("2304.11062")

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

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

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

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

Connect an agent — have() is free.