SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2112.05682 · 2021

Self-attention Does Not Need $O(n^2)$ Memory

arXiv · PDF · Open in the Atlas

Code that ran

33 of 36 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; 3 honoured the contract we drafted, 6 violated it and 12 have no contract verdict; 12 failures of our instrument; 3 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, 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/2112.05682.json · badge: /api/ran/2112.05682.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
X-iZhang/Libra canonical (classifier label)
classifier basis not recorded on the link
11 ran · 0 no recorded run
lucidrains/memory-efficient-attention-pytorch community (classifier label)
classifier basis: plan_row
7 ran · 0 no recorded run
stability-ai/fastchat community (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
jihaonew/mm-instruct community (classifier label)
classifier basis not recorded on the link
5 ran · 0 no recorded run
AminRezaei0x443/memory-efficient-attention reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
facebookresearch/xformers extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
lucidrains/flash-cosine-sim-attention extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
lucidrains/En-transformer extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
divisible_by Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from ZhangXInFD/soundstorm-speechtokenizer
pointer only · get_code("856d86b39c6005b4")
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.

attention Ran
ran on a synthesized input
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/memory_efficient_attention.py
code served (permissive licence) · get_code("640155bcba1f2f92")
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 4, dtype family float, shape (2, 3, 4, 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
from einops import rearrange

torch.manual_seed(0)

# Tiny dimensions for attention function
batch_size = 2
num_heads = 3
seq_len_q = 4
seq_len_k = 5
head_dim = 6

# Create query, key, value tensors
# Shape: (batch, heads, seq_len, head_dim)
q = torch.randn(batch_size, num_heads, seq_len_q, head_dim)
k = torch.randn(batch_size, num_heads, seq_len_k, head_dim)
v = torch.randn(batch_size, num_heads, seq_len_k, head_dim)

# Optional mask - shape (batch, seq_len_k)
mask = torch.ones(batch_size, seq_len_k, dtype=torch.bool)

# Optional attention bias - shape (batch, heads, seq_len_q, seq_len_k)
attn_bias = torch.zeros(batch_size, num_heads, seq_len_q, seq_len_k)

ARGS = {
    'q': q,
    'k': k,
    'v': v,
    'mask': mask,
    'causal': False,
    'attn_bias': attn_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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 6) — shape (2, 3, 4, 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
calculate_tem_score Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/temporal_f1.py
code served (permissive licence) · get_code("36090e75c451149f")
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 re
from typing import List, Union

# Define ARGS dictionary with valid arguments for calculate_tem_score
ARGS = {
    'prediction_text': 'The patient shows increased lesion size with progressive enlargement and worsening symptoms.',
    'reference_text': 'There is an increase in the lesion with progression and worsening clinical status.',
    'epsilon': 1e-10
}
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 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
clean_text Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/radiology_report.py
code served (permissive licence) · get_code("46c06fec5aedf4a4")
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 str. 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 re

def clean_text(text: str) -> str:
    """
    Perform basic cleanup of text by removing newlines, dashes, and some special patterns.
    """
    text = re.sub('\\n+', ' ', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('\\(___, __, __\\)', '', text)
    text = re.sub('---, ---, ---', '', text)
    text = re.sub('\\(__, __, ___\\)', '', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('[^\\w\\s.,:;()\\-]', '', text)
    text = re.sub('\\s{2,}', ' ', text).strip()
    return text

ARGS = {
    "text": "Hello\n\nworld---this__is___a test (__, __, ___) with special chars @#$% and (---, ---, ---) patterns."
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
clean_text Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/temporal_f1.py
code served (permissive licence) · get_code("cb00b798f297e5f3")
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 str. 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 re

def clean_text(text: str) -> str:
    """
    Clean the input text by removing special characters and redundant spaces or newlines.

    Args:
        text (str): Input text.

    Returns:
        str: Cleaned text.
    """
    text = re.sub('\\n+', ' ', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('\\(___, __, __\\)', '', text)
    text = re.sub('---, ---, ---', '', text)
    text = re.sub('\\(__, __, ___\\)', '', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('[^\\w\\s.,:;()-]', '', text)
    text = re.sub('\\s{2,}', ' ', text).strip()
    return text


ARGS = {
    "text": "Hello\n\nworld___test--case\n(___, __, __)\n---, ---, ---\n(__, __, ___) with   multiple    spaces and special@#$chars!"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
compress Ran
ran; our contract draft was wrong, not the code
stability-ai/fastchat/fastchat/model/compression.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("80dde39da1ba3708")
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 Git-King-Zhan/LoReC, 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.

create_tensors Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
facebookresearch/xformers/xformers/benchmarks/benchmark_mem_eff_attention.py
pointer only (licence: NOASSERTION) · get_code("68b3637c9b987a61")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/xformers (NOASSERTION). 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.

default Ran
ran, violated the contract we drafted
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/cosine_sim_flash_attention.py
pointer only (licence: MIT); the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("60fff7c3c400d7ff")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ThomasMrY/VCT, 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.

default Ran
ran, violated the contract we drafted
lucidrains/flash-cosine-sim-attention/flash_cosine_sim_attention/flash_cosine_sim_attention.py
code served (permissive licence) · get_code("915fbeb88e13d4a3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned str. 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.

def exists(val):
    return val is not None

def default(val, d):
    if exists(val):
        return val
    return d() if callable(d) else d

# Test case 1: val is None, d is a non-callable value
val_1 = None
d_1 = 42

# Test case 2: val exists, d is a callable
val_2 = "existing_value"
d_2 = lambda: "default_value"

# Test case 3: val is None, d is a callable
val_3 = None
d_3 = lambda: [1, 2, 3]

# We'll use test case 2 for the ARGS dict
ARGS = {
    'val': val_2,
    'd': d_2
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
efficient_dot_product_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AminRezaei0x443/memory-efficient-attention/memory_efficient_attention/attention_jax.py
code served (permissive licence) · get_code("6b1a95182607abd6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ArrayImpl, ndim 4, dtype family float, shape (2, 8, 3, 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 jax
import jax.numpy as jnp
import numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Define dimensions
batch_size = 2
q_length = 8
kv_length = 16
num_heads = 3
qk_depth_per_head = 4
v_depth_per_head = 5

# Create query, key, value tensors
query = jnp.array(np.random.randn(batch_size, q_length, num_heads, qk_depth_per_head).astype(np.float32))
key = jnp.array(np.random.randn(batch_size, kv_length, num_heads, qk_depth_per_head).astype(np.float32))
value = jnp.array(np.random.randn(batch_size, kv_length, num_heads, v_depth_per_head).astype(np.float32))

# Create mask (broadcastable to [batch..., num_heads, q_length, kv_length])
mask = jnp.array(np.random.rand(batch_size, num_heads, q_length, kv_length) > 0.5)

# Create bias (broadcastable to [batch..., num_heads, q_length, kv_length])
bias = jnp.array(np.random.randn(batch_size, num_heads, q_length, kv_length).astype(np.float32))

# Define optional callback functions
def bias_calc_fn(query_idx, chunk_idx, bias, attn_weights, calc_fn_data):
    # Simple example: return bias as-is
    return bias

def mask_calc_fn(query_idx, chunk_idx, mask, attn_weights, calc_fn_data):
    # Simple example: return mask as-is
    return mask

def weights_calc_fn(query_idx, chunk_idx, attn_weights, calc_fn_data):
    # Simple example: return weights as-is
    return attn_weights

# Create calc_fn_data (can be any data structure)
calc_fn_data = {'some_param': 1.0}

ARGS = {
    'query': query,
    'key': key,
    'value': value,
    'mask': mask,
    'bias': bias,
    'precision': jax.lax.Precision.HIGHEST,
    'query_chunk_size': 4,
    'key_chunk_size': 8,
    'bias_calc_fn': bias_calc_fn,
    'mask_calc_fn': mask_calc_fn,
    'weights_calc_fn': weights_calc_fn,
    'calc_fn_data': calc_fn_data
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 4, dtype family float, shape (2, 8, 3, 5) — shape (2, 8, 3, 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
eval_decorator Ran
ran; our contract draft was wrong, not the code
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/autoregressive_wrapper.py
code served (permissive licence) · get_code("c16aee9490eb8729")
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 function. 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)

# Build a minimal model that has .training attribute and .eval()/.train() methods
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model instance
model = MinimalModel()

# Define a simple function to decorate
def dummy_eval_fn(model, x):
    return model(x)

# The eval_decorator takes a function as its only parameter
ARGS = {
    "fn": dummy_eval_fn
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
exists Ran
ran, violated the contract we drafted
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/autoregressive_wrapper.py
pointer only (licence: MIT); 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 link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ThomasMrY/VCT, 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.

expand2square Ran
ran; our contract draft was wrong, not the code
jihaonew/mm-instruct/llava/mm_utils.py
code served (permissive licence) · get_code("592b3c1a88f93d7c")
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 Image. 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.

from PIL import Image

# Create a small test image (non-square)
pil_img = Image.new('RGB', (8, 6), color='red')

# Define background color for padding
background_color = (255, 255, 255)

ARGS = {
    'pil_img': pil_img,
    'background_color': background_color,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
expand2square Ran
ran on a synthesized input
X-iZhang/Libra/libra/mm_utils.py
code served (permissive licence) · get_code("1fe910f8046380d4")
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 Image. 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.

from PIL import Image
import numpy as np

# Create a simple PIL Image for testing
# Make a rectangular image (width > height) so we can test the expansion logic
img_array = np.zeros((3, 5, 3), dtype=np.uint8)  # height=3, width=5, RGB
pil_img = Image.fromarray(img_array, mode='RGB')

# Create ARGS dict with all parameters
ARGS = {
    'pil_img': pil_img,
    'background_color': (0, 0, 0)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
extract_entities Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/temporal_f1.py
code served (permissive licence) · get_code("c17fb3de0d47f94a")
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 set. 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 re

def clean_text(text: str) -> str:
    """
    Clean the input text by removing special characters and redundant spaces or newlines.

    Args:
        text (str): Input text.

    Returns:
        str: Cleaned text.
    """
    text = re.sub('\\n+', ' ', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('\\(___, __, __\\)', '', text)
    text = re.sub('---, ---, ---', '', text)
    text = re.sub('\\(__, __, ___\\)', '', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('[^\\w\\s.,:;()-]', '', text)
    text = re.sub('\\s{2,}', ' ', text).strip()
    return text

def extract_entities(text: str, keywords: set) -> set:
    """
    Extract entities from the given text based on the provided keywords.

    Args:
        text (str): Input text.
        keywords (set): Set of keywords to extract entities.

    Returns:
        set: Set of matched keywords found in the text.
    """
    text = clean_text(text)
    pattern = '\\b(' + '|'.join((re.escape(word) for word in keywords)) + ')\\b'
    return {match.group().lower() for match in re.finditer(pattern, text.lower())}


# Setup code for extract_entities
text_input = "The quick brown fox jumps over the lazy dog. Machine learning and deep learning are important fields."
keywords_set = {"machine", "learning", "deep", "fox", "dog", "important"}

ARGS = {
    "text": text_input,
    "keywords": keywords_set
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
extract_sections Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/radiology_report.py
code served (permissive licence) · get_code("fa3bb9e402f7460c")
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 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 re

def clean_text(text: str) -> str:
    """
    Perform basic cleanup of text by removing newlines, dashes, and some special patterns.
    """
    text = re.sub('\\n+', ' ', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('\\(___, __, __\\)', '', text)
    text = re.sub('---, ---, ---', '', text)
    text = re.sub('\\(__, __, ___\\)', '', text)
    text = re.sub('[_-]+', ' ', text)
    text = re.sub('[^\\w\\s.,:;()\\-]', '', text)
    text = re.sub('\\s{2,}', ' ', text).strip()
    return text

def extract_sections(data: list) -> list:
    """
    Extract relevant text sections (e.g., findings, impression, text)
    from a list of JSON objects and clean each item.
    """
    sections_list = []
    for item in data:
        if 'reference' in item:
            cleaned_text = clean_text(item['reference'].lower())
            sections_list.append(cleaned_text)
        elif 'findings' in item:
            cleaned_text = clean_text(item['findings'].lower())
            sections_list.append(cleaned_text)
        elif 'impression' in item:
            cleaned_text = clean_text(item['impression'].lower())
            sections_list.append(cleaned_text)
        elif 'text' in item:
            cleaned_text = clean_text(item['text'].lower())
            sections_list.append(cleaned_text)
    return sections_list

# Setup code to construct valid arguments
ARGS = {
    'data': [
        {
            'reference': 'This is a reference section\nwith newlines and---dashes to clean'
        },
        {
            'findings': 'Findings: Some findings_here with underscores and (___, __, __) patterns'
        },
        {
            'impression': 'Impression section with--dashes and    multiple spaces'
        },
        {
            'text': 'Regular text (__, __, ___) with special chars @#$ and---, ---, --- patterns'
        }
    ]
}
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 list, ndim 1, dtype family float — 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
generate_stream_codet5p Ran
ran on a synthesized input
stability-ai/fastchat/fastchat/model/model_codet5p.py
code served (permissive licence) · get_code("f545ae5663fedf88")
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 generator. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 transformers import GenerationConfig, StoppingCriteria, StoppingCriteriaList, TextIteratorStreamer
from unittest.mock import Mock

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.eos_token_id = 2
        self.vocab_size = 1000
    
    def __call__(self, text, return_tensors=None):
        # Return a mock encoding with input_ids and attention_mask
        if return_tensors == 'pt':
            return {
                'input_ids': torch.tensor([[1, 5, 3, 7]]),
                'attention_mask': torch.tensor([[1, 1, 1, 1]])
            }
        return {'input_ids': [[1, 5, 3, 7]]}
    
    def decode(self, token_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True):
        return "generated text sample"

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, decoder_input_ids, attention_mask, streamer, generation_config, stopping_criteria, **kwargs):
        # Simulate generation by yielding tokens through the streamer
        token_sequence = [" generated", " text", " sample"]
        for token in token_sequence:
            streamer.put(torch.tensor([[5, 6, 7]]))
        streamer.end()
    
    def forward(self, input_ids, decoder_input_ids, attention_mask):
        return torch.randn(1, 4, 1000)

tokenizer = MockTokenizer()

model = MockModel()

params = {
    'prompt': 'def hello():',
    'temperature': 0.7,
    'repetition_penalty': 1.0,
    'top_p': 0.95,
    'top_k': 50,
    'max_new_tokens': 128,
    'stop_token_ids': [628, 198]
}

device = 'cpu'

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'params': params,
    'device': device,
    'context_len': 2048,
    'stream_interval': 2,
    'judge_sent_end': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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_chunk Ran
ran; our contract draft was wrong, not the code
X-iZhang/Libra/libra/eval/eval_vqa_libra.py
code served (permissive licence) · get_code("42a46570620cd9fa")
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 math

def split_list(lst, n):
    """Split a list into n (roughly) equal-sized chunks"""
    chunk_size = math.ceil(len(lst) / n)
    return [lst[i:i + chunk_size] for i in range(0, len(lst), chunk_size)]

def get_chunk(lst, n, k):
    chunks = split_list(lst, n)
    return chunks[k]

# Setup code
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
n = 3
k = 1

ARGS = {
    "lst": lst,
    "n": n,
    "k": k
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
get_compressed_list Ran
ran; our contract draft was wrong, not the code
stability-ai/fastchat/fastchat/model/compression.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("c5824da57107fe8c")
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 Git-King-Zhan/LoReC, 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.

is_none Ran
ran, violated the contract we drafted
jihaonew/mm-instruct/llava/eval/model_vqa_mmbench.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ASTRAL-Group/ASTRA, is pointer only (licence: NONE) · get_code("bae18947b56f2be1")
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 ASTRAL-Group/ASTRA, 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.

l2norm Ran
ran; our contract draft was wrong, not the code
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/cosine_sim_flash_attention.py
pointer only (licence: MIT); the stored copy get_code serves, from tmlresearchgroup-cas/clipure, is pointer only (licence: NONE) · get_code("3eb58dae620046d3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tmlresearchgroup-cas/clipure, 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.

load_image Ran
ran, honoured the contract we drafted
jihaonew/mm-instruct/predict.py
code served (permissive licence) · get_code("9b3c1cb391672ccb")
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 Image. 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 tempfile
from PIL import Image
import os

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.jpg")

# Create a simple test image
test_image = Image.new('RGB', (100, 100), color=(73, 109, 137))
test_image.save(temp_image_path)

# Define ARGS with a local file path
ARGS = {
    'image_file': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, requests — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
load_image_from_base64 Ran
ran, honoured the contract we drafted
X-iZhang/Libra/libra/mm_utils.py
code served (permissive licence) · get_code("c3ee9d07c900dd55")
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 PngImageFile. 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 base64
from PIL import Image
from io import BytesIO
import numpy as np

# Create a small valid image in memory
img_array = np.uint8(np.random.rand(10, 10, 3) * 255)
img = Image.fromarray(img_array, mode='RGB')

# Encode to base64
buffer = BytesIO()
img.save(buffer, format='PNG')
buffer.seek(0)
image_base64 = base64.b64encode(buffer.read()).decode('utf-8')

ARGS = {
    'image': image_base64
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PngImageFile — a PngImageFile output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PngImageFile output the recorded ndim 3 and dtype family int 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
load_json Ran
ran on a synthesized input
X-iZhang/Libra/libra/eval/radiology_report.py
code served (permissive licence) · get_code("a3698e4aaee89be7")
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 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 json
import tempfile
import os

# Create a temporary JSONL file with valid JSON objects
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.jsonl")

with open(temp_file, 'w', encoding='utf-8') as f:
    f.write(json.dumps({"id": 1, "text": "hello"}) + "\n")
    f.write(json.dumps({"id": 2, "text": "world"}) + "\n")
    f.write(json.dumps({"id": 3, "value": 42}) + "\n")

ARGS = {
    "path": temp_file
}
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 list, ndim 1, dtype family float — 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
max_neg_value Ran
ran; our contract draft was wrong, not the code
lucidrains/En-transformer/en_transformer/en_transformer.py
code served (permissive licence) · get_code("f2fe51a4a5646c6f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned float, 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)

# The function expects a tensor and returns the negative of the maximum value for that tensor's dtype
# We need to provide a tensor with a floating point dtype so torch.finfo works
t = torch.randn(2, 4)

ARGS = {
    't': t
}
Setup block drafted by
a language model, Claude Sonnet 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 float, 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
process_images Ran
ran, honoured the contract we drafted
jihaonew/mm-instruct/llava/mm_utils.py
code served (permissive licence) · get_code("344dff4791fd1381")
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 4, dtype family float, shape (2, 3, 4, 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.

from PIL import Image
import torch
import numpy as np

torch.manual_seed(0)

# Create a minimal image processor mock
class MockImageProcessor:
    def __init__(self):
        self.image_mean = [0.5, 0.5, 0.5]  # normalized values
    
    def preprocess(self, image, return_tensors=None):
        # Convert PIL image to tensor
        img_array = np.array(image).astype(np.float32) / 255.0
        # Convert to (C, H, W) format
        if len(img_array.shape) == 3:
            img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)
        else:
            img_tensor = torch.from_numpy(img_array).unsqueeze(0)
        return {'pixel_values': img_tensor.unsqueeze(0)}
    
    def __call__(self, images, return_tensors=None):
        # Handle batch of images
        processed = []
        for img in images:
            img_array = np.array(img).astype(np.float32) / 255.0
            if len(img_array.shape) == 3:
                img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)
            else:
                img_tensor = torch.from_numpy(img_array).unsqueeze(0)
            processed.append(img_tensor)
        stacked = torch.stack(processed, dim=0)
        return {'pixel_values': stacked}

# Create a minimal model config mock
class MockModelConfig:
    def __init__(self, image_aspect_ratio=None):
        self.image_aspect_ratio = image_aspect_ratio

# Create sample PIL images with different sizes
# First image: 4x3 (width x height)
img1 = Image.new('RGB', (4, 3), color=(100, 150, 200))
# Second image: 3x4 (width x height) - different aspect ratio
img2 = Image.new('RGB', (3, 4), color=(50, 100, 150))

images = [img1, img2]
image_processor = MockImageProcessor()
model_cfg = MockModelConfig(image_aspect_ratio='pad')

ARGS = {
    'images': images,
    'image_processor': image_processor,
    'model_cfg': model_cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 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
process_images Ran
ran on a synthesized input
X-iZhang/Libra/libra/mm_utils.py
code served (permissive licence) · get_code("012fae59ee4131ba")
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 4, dtype family float, shape (2, 3, 4, 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 PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a minimal image processor stand-in
class MockImageProcessor:
    def __init__(self):
        self.image_mean = [0.5, 0.5, 0.5]  # normalized values for background color
    
    def preprocess(self, image, return_tensors=None):
        # Convert PIL image to tensor
        img_array = np.array(image).astype(np.float32) / 255.0
        img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)  # CHW format
        if return_tensors == 'pt':
            return {'pixel_values': img_tensor.unsqueeze(0)}
        return img_tensor
    
    def __call__(self, images, return_tensors=None):
        # Handle list of images
        tensors = []
        for img in images:
            img_array = np.array(img).astype(np.float32) / 255.0
            img_tensor = torch.from_numpy(img_array).permute(2, 0, 1)
            tensors.append(img_tensor)
        stacked = torch.stack(tensors, dim=0)
        if return_tensors == 'pt':
            return {'pixel_values': stacked}
        return stacked

# Create a minimal model config stand-in
class MockModelConfig:
    def __init__(self):
        self.image_aspect_ratio = 'pad'

# Create test PIL images (small, distinct sizes)
img1 = Image.new('RGB', (4, 3), color='red')
img2 = Image.new('RGB', (4, 3), color='blue')
images = [img1, img2]

# Create image processor
image_processor = MockImageProcessor()

# Create model config
model_cfg = MockModelConfig()

ARGS = {
    'images': images,
    'image_processor': image_processor,
    'model_cfg': model_cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 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
process_response Ran
ran; our contract draft was wrong, not the code
stability-ai/fastchat/fastchat/model/model_chatglm.py
code served (permissive licence) · get_code("dc21db7cf25bfe72")
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 str. 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 re

def process_response(response):
    response = response.strip()
    response = response.replace('[[训练时间]]', '2023年')
    punkts = [[',', ','], ['!', '!'], [':', ':'], [';', ';'], ['\\?', '?']]
    for item in punkts:
        response = re.sub('([\\u4e00-\\u9fff])%s' % item[0], '\\1%s' % item[1], response)
        response = re.sub('%s([\\u4e00-\\u9fff])' % item[0], '%s\\1' % item[1], response)
    return response

ARGS = {
    'response': '你好,世界!这是一个测试[[训练时间]]案例:完美;对吗?'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
raise_warning_for_incompatible_cpu_offloading_configuration Ran
ran, violated the contract we drafted
stability-ai/fastchat/fastchat/model/model_adapter.py
code served (permissive licence) · get_code("0bf414a2b44babe6")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 sys
import warnings

# Set up arguments for the function
ARGS = {
    "device": "cuda",
    "load_8bit": True,
    "cpu_offloading": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
read_img Ran
ran on a synthesized input
jihaonew/mm-instruct/llava/eval/model_vqa_loader.py
code served (permissive licence) · get_code("44fab12a908ab057")
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 Image. 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 io
from PIL import Image
import numpy as np

class MockMemcacheClient:
    """Mock memcache client that stores and retrieves image data."""
    def __init__(self):
        self.cache = {}
    
    def get(self, key):
        """Retrieve value from cache."""
        return self.cache.get(key)
    
    def set(self, key, value):
        """Store value in cache."""
        self.cache[key] = value

# Create a mock memcache client with a stored image
mclient = MockMemcacheClient()

# Create a small test image and store it in the mock cache
img_array = np.random.randint(0, 256, (10, 10, 3), dtype=np.uint8)
test_img = Image.fromarray(img_array, 'RGB')
img_buffer = io.BytesIO()
test_img.save(img_buffer, format='PNG')
img_bytes = img_buffer.getvalue()

# Store the image bytes in the mock memcache
img_path = "test_image_key"
mclient.set(img_path, img_bytes)

ARGS = {
    "img_path": img_path,
    "mclient": mclient
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
route_args Ran
ran on a synthesized input
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/reversible.py
code served (permissive licence) · get_code("1f7d4befc2e41402")
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 2, 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
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - router: dict where keys are matched against args.keys()
#          values are lists indexed by depth
#          each element has routes (a tuple of two boolean-like values)
# - args: dict with keys that may match router keys, values are arbitrary
# - depth: int, used to create routed_args list and index into router[key]

# The function iterates through matched_keys, gets val = args[key],
# then for each depth level, accesses router[key][depth] which yields
# ((f_args, g_args), routes) via zip with routed_args
# routes is unpacked as two elements (for two route objects)

# Construction:
depth_val = 3

# Create a router dict
# For each key in router, the value should be a list of length depth
# Each element should be ((f_args, g_args), routes) but actually,
# looking at the zip pattern: zip(routed_args, router[key])
# routed_args has depth elements of form (dict(), dict())
# router[key] should have depth elements where each is iterable into (something, routes)
# Actually, router[key] is a list of (f_args, g_args, routes) tuples conceptually
# But the zip unpacks as ((f_args, g_args), routes)
# So router[key][depth_i] = ((f_args_placeholder, g_args_placeholder), routes)

router = {
    "param_a": [
        ((dict(), dict()), (True, False)),
        ((dict(), dict()), (False, True)),
        ((dict(), dict()), (True, True)),
    ],
    "param_b": [
        ((dict(), dict()), (False, False)),
        ((dict(), dict()), (True, False)),
        ((dict(), dict()), (False, True)),
    ],
}

# Create args dict with some keys matching router and some not
args = {
    "param_a": torch.tensor([1.0, 2.0, 3.0, 4.0]),
    "param_b": torch.tensor([5.0, 6.0, 7.0, 8.0]),
    "param_c": "unmatched_value",  # This won't be in router, so won't be routed
}

ARGS = {
    "router": router,
    "args": args,
    "depth": depth_val,
}
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 2, dtype family float — 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
split_list Ran
ran; our contract draft was wrong, not the code
X-iZhang/Libra/libra/eval/eval_vqa_libra.py
code served (permissive licence) · get_code("076c252c52cbb161")
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. 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 math

def split_list(lst, n):
    """Split a list into n (roughly) equal-sized chunks"""
    chunk_size = math.ceil(len(lst) / n)
    return [lst[i:i + chunk_size] for i in range(0, len(lst), chunk_size)]

# Setup code
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
n = 3

ARGS = {
    "lst": lst,
    "n": n
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 list — a list 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
top_k Ran
ran; our contract draft was wrong, not the code
lucidrains/memory-efficient-attention-pytorch/memory_efficient_attention_pytorch/autoregressive_wrapper.py
code served (permissive licence) · get_code("3b65d5d77510c964")
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)

# Create a small logits tensor: batch_size=2, vocab_size=4
logits = torch.randn(2, 4)

# Define ARGS dict with all parameters
ARGS = {
    "logits": logits,
    "thres": 0.9
}
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
efficient_dot_product_attention Not yet run
unverified (harvested, no recorded run)
AminRezaei0x443/memory-efficient-attention/memory_efficient_attention/attention_torch.py
code served (permissive licence) · get_code("bdb24836d5607016")
How it ran

no invocation recorded.

get_conv_template Not yet run
unverified (harvested, no recorded run)
stability-ai/fastchat/fastchat/conversation.py
code served (permissive licence) · get_code("2613e53cccc8a4b4")
How it ran

no invocation recorded.

load_compress_model Not yet run
unverified (harvested, no recorded run)
stability-ai/fastchat/fastchat/model/compression.py
code served (permissive licence) · get_code("8dacf011c6f243dc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 36 samples lifted from this paper's linked repositories, 36 carry a function identity and 0 do not. Of the 36 distinct functions with an identity, 22 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 2 the same month, 21 later) and 14 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 486 other papers
72 dated earlier, 2 the same month, 410 later, 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
split_list 197 other papers
196 later, 1 undated
2306.17107 (2023-06)
LLaVAR: Enhanced Visual Instruction Tuning for Text-Rich Image Understanding
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
2308.03349 (2023-08)
SciGraphQA: A Large-Scale Synthetic Multi-Turn Question-Answering Dataset for Scientific Graphs
and 194 more not named here
get_chunk 189 other papers
189 later
2306.17107 (2023-06)
LLaVAR: Enhanced Visual Instruction Tuning for Text-Rich Image Understanding
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
2308.03349 (2023-08)
SciGraphQA: A Large-Scale Synthetic Multi-Turn Question-Answering Dataset for Scientific Graphs
and 186 more not named here
default 163 other papers
34 dated earlier, 1 the same month, 127 later, 1 undated · 27 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
1907.01470 (2019-07)
Augmenting Self-attention with Persistent Memory
and 160 more not named here
load_image 85 other papers
85 later
2305.10973 (2023-05)
Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold
2307.10490 (2023-07)
Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMs
2308.06595 (2023-08)
VisIT-Bench: A Benchmark for Vision-Language Instruction Following Inspired by Real-World Use
and 82 more not named here
load_image_from_base64 85 other papers
85 later
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2309.07120 (2023-09)
Sight Beyond Text: Multi-Modal Training Enhances LLMs in Truthfulness and Ethics
2310.01779 (2023-10)
HallE-Control: Controlling Object Hallucination in Large Multimodal Models
and 82 more not named here
is_none 83 other papers
83 later
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2308.13566 (2023-08)
MLLM-DataEngine: An Iterative Refinement Approach for MLLM
2310.08588 (2023-10)
Octopus: Embodied Vision-Language Programmer from Environmental Feedback
and 80 more not named here
default 79 other papers
3 dated earlier, 76 later · 15 only as an assembly brick
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2010.02502 (2020-10)
Denoising Diffusion Implicit Models
and 76 more not named here
get_conv_template 69 other papers
1 dated earlier, 67 later, 1 undated
1911.03705 (2019-11)
CommonGen: A Constrained Text Generation Challenge for Generative Commonsense Reasoning
2204.07705 (2022-04)
SUPER-NATURALINSTRUCTIONS: Generalization via Declarative Instructions on 1600+ NLP Tasks
2302.13971 (2023-02)
LLaMA: Open and Efficient Foundation Language Models
and 66 more not named here
expand2square 68 other papers
68 later · 1 only as an assembly brick
2204.03541 (2022-04)
End-to-End Zero-Shot HOI Detection via Vision and Language Knowledge Distillation
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2310.01779 (2023-10)
HallE-Control: Controlling Object Hallucination in Large Multimodal Models
and 65 more not named here
process_images 44 other papers
44 later · 1 only as an assembly brick
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2310.01779 (2023-10)
HallE-Control: Controlling Object Hallucination in Large Multimodal Models
2310.17956 (2023-10)
Qilin-Med-VL: Towards Chinese Large Vision-Language Model for General Healthcare
and 41 more not named here
max_neg_value 26 other papers
26 later · 23 only as an assembly brick
2206.00923 (2022-06)
Modeling Image Composition for Complex Scene Generation
2208.01626 (2022-08)
Prompt-to-Prompt Image Editing with Cross Attention Control
2211.05556 (2022-11)
Generating astronomical spectra from photometry with conditional diffusion models
and 23 more not named here
compress 17 other papers
17 later
2303.06865 (2023-03)
FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPU
2304.10453 (2023-04)
Phoenix: Democratizing ChatGPT across Languages
2307.12981 (2023-07)
3D-LLM: Injecting the 3D World into Large Language Models
and 14 more not named here
divisible_by 17 other papers
1 dated earlier, 16 later · 5 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2203.07852 (2022-03)
Block-Recurrent Transformers
2212.11972 (2022-12)
Scalable Adaptive Computation for Iterative Generation
and 14 more not named here
l2norm 16 other papers
16 later · 4 only as an assembly brick
2202.04200 (2022-02)
MaskGIT: Masked Generative Image Transformer
2203.07852 (2022-03)
Block-Recurrent Transformers
2203.08913 (2022-03)
Memorizing Transformers
and 13 more not named here
raise_warning_for_incompatible_cpu_offloading_configuration 15 other papers
15 later
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2312.00401 (2023-12)
VIoTGPT: Learning to Schedule Vision Tools in LLMs towards Intelligent Video Internet of Things
2312.09818 (2023-12)
SMILE: Multimodal Dataset for Understanding Laughter in Video with Language Models
and 12 more not named here
get_compressed_list 13 other papers
13 later
2310.13023 (2023-10)
GraphGPT: Graph Instruction Tuning for Large Language Models
2310.17631 (2023-10)
JudgeLM: Fine-tuned Large Language Models are Scalable Judges
2024.findings-emnlp.559 (2024 (year only))
A LLM-Based Ranking Method for the Evaluation of Automatic Counter-Narrative Generation
and 10 more not named here
eval_decorator 11 other papers
2 dated earlier, 9 later
1907.05242 (2019-07)
Large Memory Layers with Product Keys
2107.11906 (2021-07)
H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequences
2206.10789 (2022-06)
Scaling Autoregressive Models for Content-Rich Text-to-Image Generation
and 8 more not named here
process_response 9 other papers
9 later
2305.12524 (2023-05)
TheoremQA: A Theorem-driven Question Answering Dataset ♠
2310.17631 (2023-10)
JudgeLM: Fine-tuned Large Language Models are Scalable Judges
2024.findings-emnlp.559 (2024 (year only))
A LLM-Based Ranking Method for the Evaluation of Automatic Counter-Narrative Generation
and 6 more not named here
top_k 6 other papers
3 dated earlier, 3 later
1812.01243 (2018-12)
Efficient Attention: Attention with Linear Complexities
2006.15020 (2020-06)
Pre-training via Paraphrasing
2107.11906 (2021-07)
H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequences
and 3 more not named here

Shown: the 20 functions present in the most other papers. 2 more shared functions are not listed 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-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

We present a very simple algorithm for attention that requires $O(1)$ memory with respect to sequence length and an extension to self-attention that requires $O(\log n)$ memory. This is in contrast with the frequently stated belief that self-attention requires $O(n^2)$ memory. While the time complexity is still $O(n^2)$, device memory rather than compute capability is often the limiting factor on modern accelerators. Thus, reducing the memory requirements of attention allows processing of longer sequences than might otherwise be feasible. We provide a practical implementation for accelerators that requires $O(\sqrt{n})$ memory, is numerically stable, and is within a few percent of the runtime of the standard implementation of attention. We also demonstrate how to differentiate the function while remaining memory-efficient. For sequence length 16384, the memory overhead of self-attention is reduced by 59X for inference and by 32X for differentiation.

For agents

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

get_harvested_code_for_paper("2112.05682")
get_code_for_paper("2112.05682")
have("2112.05682")

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

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

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

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

Connect an agent — have() is free.