SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1901.02860 · 2019

Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context

Ruslan Salakhutdinov, Yiming Yang, Quoc Le, Zihang Dai, Zhilin Yang, Jaime Carbonell

arXiv · PDF · Open in the Atlas

Code that ran

67 of 143 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (37 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 1 violated it and 44 have no contract verdict; 18 failures of our instrument; 76 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/1901.02860.json · badge: /api/ran/1901.02860.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
shanghai-digital-brain-laboratory/bdm-db1 community
Papers with Code archive
10 ran · 4 no recorded run
kimiyoung/transformer-xl marked official in Papers with Code
Papers with Code archive
8 ran · 5 no recorded run
Jmkernes/PAR-Transformer-XL community
Papers with Code archive
7 ran · 4 no recorded run
facebookresearch/code-prediction-transformer community
Papers with Code archive
6 ran · 2 no recorded run
cedrickchee/pytorch-pretrained-BERT community
Papers with Code archive
4 ran · 13 no recorded run
huggingface/xlnet community
Papers with Code archive
4 ran · 9 no recorded run
benkrause/dynamiceval-transformer community
Papers with Code archive
4 ran · 8 no recorded run
NVIDIA/DeepLearningExamples community
Papers with Code archive
4 ran · 7 no recorded run
mustafaaljadery/gemma-2b-10m community
Papers with Code archive
4 ran · 3 no recorded run
opendilab/DI-engine community
not in the paper's declared repositories
3 ran · 2 no recorded run
TimDettmers/transformer-xl community (classifier label)
classifier basis not recorded on the link
2 ran · 10 no recorded run
AIResearchHub/transformergallery community
Papers with Code archive
2 ran · 2 no recorded run
park-cheol/ASR-Conformer community
Papers with Code archive
2 ran · 0 no recorded run
okkteam/Transformer-Transducer community
Papers with Code archive
2 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
Machine-Learning-Tokyo/Poetry-GAN community (classifier label)
classifier basis not recorded on the link
1 ran · 2 no recorded run
inzva/fake-academic-paper-generation community
Papers with Code archive
1 ran · 1 no recorded run
sooftware/Attention-Implementation community
Papers with Code archive
1 ran · 0 no recorded run
jincan333/lot community
not in the paper's declared repositories
0 ran · 2 no recorded run
sooftware/conformer community
Papers with Code archive
0 ran · 1 no recorded run
listenviolet/XLNet community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
AdaptiveEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
cedrickchee/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py
code served (permissive licence) · get_code("e77541c1b4b15830")
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, AdaptiveEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define ARGS dict with all parameters for AdaptiveEmbedding
ARGS = {
    'n_token': 100,
    'd_embed': 16,
    'd_proj': 8,
    'cutoffs': [30, 60],
    'div_val': 1,
    'sample_softmax': False,
}

# Verify the setup works by instantiating and running forward pass
if __name__ == "__main__":
    model = nn.AdaptiveEmbedding(**ARGS)
    
    # Create sample input tensor with token indices
    inp = torch.randint(0, ARGS['n_token'], (2, 4))
    
    # Run forward pass
    output = model(inp)
    
    print(f"Input shape: {inp.shape}")
    print(f"Output shape: {output.shape}")
    print(f"Expected output shape: (2, 4, {ARGS['d_proj']})")
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 AdaptiveEmbedding — 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 AdaptiveEmbedding 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
AdaptiveEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("1ae137f0cee15e33")
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, AdaptiveEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Parameters for AdaptiveEmbedding
n_token = 100  # Total number of tokens
d_embed = 8    # Embedding dimension
d_proj = 6     # Projection dimension (different from d_embed to test projection)
cutoffs = [30, 60]  # Cutoff points for adaptive embedding
div_val = 2    # Divisor for hierarchical embeddings
sample_softmax = False  # Whether to use sparse embeddings

ARGS = {
    'n_token': n_token,
    'd_embed': d_embed,
    'd_proj': d_proj,
    'cutoffs': cutoffs,
    'div_val': div_val,
    'sample_softmax': sample_softmax
}
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 AdaptiveEmbedding — 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 AdaptiveEmbedding 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
AdaptiveEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
NVIDIA/DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL/pytorch/mem_transformer.py
pointer only (licence: NONE) · get_code("8a8691f05cb1b5da")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, NVIDIA/DeepLearningExamples 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.

Attention Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("e3217ee8bd314909")
How it ran

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

Block Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("548da299b3bc04e9")
How it ran

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

DecoderLayer Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("e8aac29a19d0c2e7")
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, DecoderLayer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define parameters for DecoderLayer
n_head = 2
d_model = 4
d_head = 2
d_inner = 8
dropout = 0.1

# Optional kwargs
kwargs = {
    'dropatt': 0.1,
    'pre_lnorm': False
}

ARGS = {
    'n_head': n_head,
    'd_model': d_model,
    'd_head': d_head,
    'd_inner': d_inner,
    'dropout': dropout,
    **kwargs
}
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 DecoderLayer — 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 DecoderLayer 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
GEGLU Ran
ran on a synthesized input
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("845f84e3a319753d")
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 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
import torch.nn as nn
import torch.nn.functional as F

class GEGLU(nn.Module):
    """
    References:
        Shazeer et al., "GLU Variants Improve Transformer," 2020.
        https://arxiv.org/abs/2002.05202
    """

    def geglu(self, x):
        assert x.shape[-1] % 2 == 0
        a, b = x.chunk(2, dim=-1)
        return a * F.gelu(b)

    def forward(self, x):
        return self.geglu(x)


INIT_ARGS = {}

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

if __name__ == '__main__':
    model = GEGLU(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    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 — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GPT2Model Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("72ccb5501088c2b4")
How it ran

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

GatoInputBase Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("6a748d270690866b")
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, GatoInputBase: 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 dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class GatoInputBase:
    position_id: torch.tensor
    attention_mask: torch.tensor
    loss_mask: torch.tensor
    label: torch.tensor

    def get_datasize(self):
        gb = 0
        for e in [self.position_id, self.attention_mask, self.loss_mask, self.label]:
            if e is not None:
                gb += e.element_size() * e.nelement()
        gb /= 1024 * 1024 * 1024
        return gb

    def to(self, **kwargs):
        from dataclasses import asdict
        for k, v in asdict(self).items():
            if v is not None:
                setattr(self, k, v.to(**kwargs))

    def apply(self, fn, *args, **kwargs):
        from dataclasses import asdict
        for k, v in asdict(self).items():
            if v is not None:
                setattr(self, k, fn(v, *args, **kwargs))

    def append(self, other):
        from dataclasses import asdict
        assert type(self).__name__ == type(other).__name__
        for k, v in asdict(self).items():
            if v is None:
                continue
            other_v = getattr(other, k)
            new_v = torch.cat([v, other_v], dim=0)
            setattr(self, k, new_v)

    @staticmethod
    def merge_into_one(data2merge):
        from dataclasses import asdict
        t = data2merge[0]
        t.apply(lambda x: [x])
        for i in range(1, len(data2merge)):
            for k, v in asdict(data2merge[i]).items():
                if v is not None:
                    t_v = getattr(t, k)
                    t_v.append(v)
        return t


ARGS = {
    "position_id": torch.randint(0, 10, (2, 4)),
    "attention_mask": torch.ones((2, 4), dtype=torch.float32),
    "loss_mask": torch.ones((2, 4), dtype=torch.float32),
    "label": torch.randint(0, 5, (2, 4)),
}
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 GatoInputBase — 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 GatoInputBase 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
GemmaConfig Ran
ran on a synthesized input · constructed an object; no result was computed
mustafaaljadery/gemma-2b-10m/src/gemma.py
pointer only (licence: NONE) · get_code("709b8a145b15f0ca")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mustafaaljadery/gemma-2b-10m 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.

GemmaRotaryEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
mustafaaljadery/gemma-2b-10m/src/gemma.py
pointer only (licence: NONE) · get_code("39c5be8f7b1c0490")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mustafaaljadery/gemma-2b-10m 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.

ICTaskInput Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("ad41eff0feadfd69")
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, ICTaskInput: 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 dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class ICTaskInput:
    position_id: torch.tensor
    attention_mask: torch.tensor
    loss_mask: torch.tensor
    label: torch.tensor
    prompt_seq: torch.tensor
    img_seq: torch.tensor
    text_seq: torch.tensor
    img_id_seq: torch.tensor

ARGS = {
    "position_id": torch.arange(0, 8, dtype=torch.long).reshape(2, 4),
    "attention_mask": torch.ones(2, 4, dtype=torch.float32),
    "loss_mask": torch.ones(2, 4, dtype=torch.float32),
    "label": torch.randint(0, 10, (2, 4), dtype=torch.long),
    "prompt_seq": torch.randint(0, 100, (2, 5), dtype=torch.long),
    "img_seq": torch.randn(2, 6, 3),
    "text_seq": torch.randint(0, 50, (2, 7), dtype=torch.long),
    "img_id_seq": torch.randint(0, 20, (2, 3), dtype=torch.long),
}
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 ICTaskInput — 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 ICTaskInput output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("39480331817170e8")
How it ran

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

Linear Ran
ran on a synthesized input
park-cheol/ASR-Conformer/model/attention.py
pointer only (licence: NONE) · get_code("84585e9be4407fc4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, park-cheol/ASR-Conformer 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.

LogUniformSampler Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("220657028509cfb1")
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, LogUniformSampler: 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

torch.manual_seed(0)

# LogUniformSampler.__init__ takes range_max and n_sample
# range_max: int, the maximum value for the range
# n_sample: int, the number of samples to draw

ARGS = {
    'range_max': 100,
    'n_sample': 10
}
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 LogUniformSampler — 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 LogUniformSampler 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
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("df5a6cf54dd0aca6")
How it ran

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

MultiHeadAttn Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("d99c9cc9af9de483")
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, MultiHeadAttn: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

class MultiHeadAttn(nn.Module):

    def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False):
        super(MultiHeadAttn, self).__init__()
        self.n_head = n_head
        self.d_model = d_model
        self.d_head = d_head
        self.dropout = dropout
        self.q_net = nn.Linear(d_model, n_head * d_head, bias=False)
        self.kv_net = nn.Linear(d_model, 2 * n_head * d_head, bias=False)
        self.drop = nn.Dropout(dropout)
        self.dropatt = nn.Dropout(dropatt)
        self.o_net = nn.Linear(n_head * d_head, d_model, bias=False)
        self.layer_norm = nn.LayerNorm(d_model)
        self.scale = 1 / d_head ** 0.5
        self.pre_lnorm = pre_lnorm

    def forward(self, h, attn_mask=None, mems=None):
        if mems is not None:
            c = torch.cat([mems, h], 0)
        else:
            c = h
        if self.pre_lnorm:
            c = self.layer_norm(c)
        head_q = self.q_net(h)
        head_k, head_v = torch.chunk(self.kv_net(c), 2, -1)
        head_q = head_q.view(h.size(0), h.size(1), self.n_head, self.d_head)
        head_k = head_k.view(c.size(0), c.size(1), self.n_head, self.d_head)
        head_v = head_v.view(c.size(0), c.size(1), self.n_head, self.d_head)
        attn_score = torch.einsum('ibnd,jbnd->ijbn', (head_q, head_k))
        attn_score.mul_(self.scale)
        if attn_mask is not None and attn_mask.any().item():
            if attn_mask.dim() == 2:
                attn_score.masked_fill_(attn_mask[None, :, :, None], -float('inf'))
            elif attn_mask.dim() == 3:
                attn_score.masked_fill_(attn_mask[:, :, :, None], -float('inf'))
        attn_prob = F.softmax(attn_score, dim=1)
        attn_prob = self.dropatt(attn_prob)
        attn_vec = torch.einsum('ijbn,jbnd->ibnd', (attn_prob, head_v))
        attn_vec = attn_vec.contiguous().view(attn_vec.size(0), attn_vec.size(1), self.n_head * self.d_head)
        attn_out = self.o_net(attn_vec)
        attn_out = self.drop(attn_out)
        if self.pre_lnorm:
            output = h + attn_out
        else:
            output = self.layer_norm(h + attn_out)
        return output


n_head = 2
d_model = 8
d_head = 4
dropout = 0.1
dropatt = 0.1
pre_lnorm = False

h = torch.randn(3, 2, 8)
attn_mask = torch.zeros(3, 3, dtype=torch.bool)
mems = torch.randn(1, 2, 8)

ARGS = {
    'n_head': n_head,
    'd_model': d_model,
    'd_head': d_head,
    'dropout': dropout,
    'dropatt': dropatt,
    'pre_lnorm': pre_lnorm
}
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 MultiHeadAttn — 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 MultiHeadAttn 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
MultiHeadAttn Ran
ran on a synthesized input · constructed an object; no result was computed
NVIDIA/DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL/pytorch/mem_transformer.py
pointer only (licence: NONE) · get_code("e672e8a20905b62b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, NVIDIA/DeepLearningExamples 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.

MultiHeadedAttention Ran
ran on a synthesized input · constructed an object; no result was computed
okkteam/Transformer-Transducer/tt/transformer/attention.py
pointer only (licence: NONE) · get_code("5597fd8e1219b866")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, okkteam/Transformer-Transducer 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.

NLPTaskInput Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("7eb33bec45fe09f3")
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, NLPTaskInput: 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 dataclasses import dataclass, asdict
from typing import Optional, Union, List

torch.manual_seed(0)

@dataclass
class GatoInputBase:
    position_id: Optional[torch.tensor]
    attention_mask: Optional[torch.tensor]
    loss_mask: Optional[torch.tensor]
    label: Optional[torch.tensor]

    def get_datasize(self):
        gb = 0
        for e in [self.position_id, self.attention_mask, self.loss_mask, self.label]:
            if e is not None:
                gb += e.element_size() * e.nelement()
        gb /= 1024 * 1024 * 1024
        return gb

    def to(self, **kwargs):
        for k, v in asdict(self).items():
            if v is not None:
                setattr(self, k, v.to(**kwargs))

    def apply(self, fn, *args, **kwargs):
        for k, v in asdict(self).items():
            if v is not None:
                setattr(self, k, fn(v, *args, **kwargs))

    def append(self, other):
        assert type(self).__name__ == type(other).__name__
        for k, v in asdict(self).items():
            if v is None:
                continue
            other_v = getattr(other, k)
            new_v = torch.cat([v, other_v], dim=0)
            setattr(self, k, new_v)

    @staticmethod
    def merge_into_one(data2merge: List['GatoInputBase']):
        t = data2merge[0]
        t.apply(lambda x: [x])
        for i in range(1, len(data2merge)):
            for k, v in asdict(data2merge[i]).items():
                if v is not None:
                    t_v = getattr(t, k)
                    t_v.append(v)
        return t

@dataclass
class NLPTaskInput(GatoInputBase):
    text_seq: Union[List, torch.tensor]
    text_len: Union[List, torch.tensor]

batch_size = 2
seq_len = 4
vocab_size = 8

ARGS = {
    'position_id': torch.arange(seq_len, dtype=torch.long).unsqueeze(0).expand(batch_size, -1),
    'attention_mask': torch.ones(batch_size, seq_len, dtype=torch.float32),
    'loss_mask': torch.ones(batch_size, seq_len, dtype=torch.float32),
    'label': torch.randint(0, vocab_size, (batch_size, seq_len), dtype=torch.long),
    'text_seq': torch.randint(0, vocab_size, (batch_size, seq_len), dtype=torch.long),
    'text_len': torch.tensor([seq_len, seq_len], dtype=torch.long),
}
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 NLPTaskInput — 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 NLPTaskInput 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
PatchEmbeddings Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("b54068382071f8c8")
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, PatchEmbeddings: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math
import collections
import einops

torch.manual_seed(0)

# Create a small input tensor for testing
# Shape: (batch_size=2, channels=3, height=32, width=32)
# This needs to be divisible by patch_size for the rearrange operation
pixel_values = torch.randn(2, 3, 32, 32, dtype=torch.float32)

ARGS = {
    "patch_size": 16,
    "num_channels": 3,
    "embed_dim": 768,
    "data_type": torch.half,
}
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 PatchEmbeddings — 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 PatchEmbeddings 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
PathLSTM Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/code-prediction-transformer/model.py
pointer only (licence: NOASSERTION) · get_code("5fb8aacfbced509d")
How it ran

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

PositionalEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("142586d370dc7c1e")
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, PositionalEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class PositionalEmbedding(nn.Module):

    def __init__(self, demb):
        super().__init__()
        self.demb = demb
        inv_freq = 1 / 10000 ** (torch.arange(0.0, demb, 2.0) / demb)
        self.register_buffer('inv_freq', inv_freq)

    def forward(self, pos_seq, bsz=None):
        sinusoid_inp = torch.ger(pos_seq, self.inv_freq)
        pos_emb = torch.cat([sinusoid_inp.sin(), sinusoid_inp.cos()], dim=-1)
        if bsz is not None:
            return pos_emb[None, :, :].expand(bsz, -1, -1)
        else:
            return pos_emb[None, :, :]

ARGS = {
    'demb': 4
}
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 PositionalEmbedding — 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 PositionalEmbedding 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
PositionalEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
cedrickchee/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py
code served (permissive licence) · get_code("06ce2b899569db5b")
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, PositionalEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class PositionalEmbedding(nn.Module):

    def __init__(self, demb):
        super(PositionalEmbedding, self).__init__()
        self.demb = demb
        inv_freq = 1 / 10000 ** (torch.arange(0.0, demb, 2.0) / demb)
        self.register_buffer('inv_freq', inv_freq)

    def forward(self, pos_seq, bsz=None):
        sinusoid_inp = torch.ger(pos_seq, self.inv_freq)
        pos_emb = torch.cat([sinusoid_inp.sin(), sinusoid_inp.cos()], dim=-1)
        if bsz is not None:
            return pos_emb[:, None, :].expand(-1, bsz, -1)
        else:
            return pos_emb[:, None, :]

ARGS = {
    'demb': 4
}
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 PositionalEmbedding — 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 PositionalEmbedding 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
PositionalEncoding Ran
ran on a synthesized input · constructed an object; no result was computed
AIResearchHub/transformergallery/transformer/transformerxl.py
code served (permissive licence) · get_code("07bf8cf6e731d1bc")
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, PositionalEncoding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "d_model": 4,
    "max_len": 8,
    "device": torch.device("cpu")
}
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 PositionalEncoding — 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 PositionalEncoding 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
PositionwiseFF Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("eed8c286b97219b7")
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, PositionwiseFF: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'd_model': 8,
    'd_inner': 16,
    'dropout': 0.1,
    'activation': 'gelu',
    'pre_lnorm': False,
    'layer_norm_epsilon': 1e-05
}
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 PositionwiseFF — 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 PositionwiseFF 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
PositionwiseFF Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("c96fba039a607703")
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, PositionwiseFF: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'd_model': 4,
    'd_inner': 8,
    'dropout': 0.1,
    'pre_lnorm': False
}
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 PositionwiseFF — 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 PositionwiseFF 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
ProjectedAdaptiveLogSoftmax Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("338c39719307318d")
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, ProjectedAdaptiveLogSoftmax: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Parameters for ProjectedAdaptiveLogSoftmax
n_token = 100
d_embed = 8
d_proj = 6
cutoffs = [10, 50]  # tokens split into clusters at these cutoff points
div_val = 1
keep_order = False

ARGS = {
    "n_token": n_token,
    "d_embed": d_embed,
    "d_proj": d_proj,
    "cutoffs": cutoffs,
    "div_val": div_val,
    "keep_order": keep_order,
}
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 ProjectedAdaptiveLogSoftmax — 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 ProjectedAdaptiveLogSoftmax 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
ProjectedAdaptiveLogSoftmax Ran
ran on a synthesized input · constructed an object; no result was computed
NVIDIA/DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL/pytorch/mem_transformer.py
pointer only (licence: NONE) · get_code("4088ee884194d7c4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, NVIDIA/DeepLearningExamples 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.

ProjectedAdaptiveLogSoftmax Ran
ran on a synthesized input · constructed an object; no result was computed
inzva/fake-academic-paper-generation/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("7d9e9736e6c57d11")
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, ProjectedAdaptiveLogSoftmax: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Small setup for ProjectedAdaptiveLogSoftmax
n_token = 100
d_embed = 16
d_proj = 12
cutoffs = [20, 50]  # Defines clusters at boundaries
div_val = 1
keep_order = False

ARGS = {
    'n_token': n_token,
    'd_embed': d_embed,
    'd_proj': d_proj,
    'cutoffs': cutoffs,
    'div_val': div_val,
    'keep_order': keep_order
}
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 ProjectedAdaptiveLogSoftmax — 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 ProjectedAdaptiveLogSoftmax 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
RLTaskInput Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("2e57dbd19f63d3f4")
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, RLTaskInput: 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 typing import List, Union

torch.manual_seed(0)

# Create small tensors for the base class parameters
position_id = torch.randint(0, 10, (2, 4))
attention_mask = torch.ones(2, 4)
loss_mask = torch.ones(2, 4)
label = torch.randint(0, 5, (2, 4))

# Create sequences for RLTaskInput
text_seq = [torch.randint(0, 100, (4,)) for _ in range(2)]
vision_seq = [torch.randn(3, 4) for _ in range(2)]
tensor_seq = [torch.randn(5, 4) for _ in range(2)]

ARGS = {
    "position_id": position_id,
    "attention_mask": attention_mask,
    "loss_mask": loss_mask,
    "label": label,
    "text_seq": text_seq,
    "vision_seq": vision_seq,
    "tensor_seq": tensor_seq,
}
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 RLTaskInput — 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 RLTaskInput 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
RelMultiHeadAttention Ran
ran on a synthesized input · constructed an object; no result was computed
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("4c8b264bb79a35a1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

RelMultiHeadAttn Ran
ran on a synthesized input · constructed an object; no result was computed
kimiyoung/transformer-xl/pytorch/mem_transformer.py
code served (permissive licence) · get_code("fe28ba867add05c0")
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, RelMultiHeadAttn: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define ARGS dict with all required parameters
ARGS = {
    "n_head": 2,
    "d_model": 8,
    "d_head": 4,
    "dropout": 0.1,
    "dropatt": 0.1,
    "tgt_len": 3,
    "ext_len": 2,
    "mem_len": 4,
    "pre_lnorm": False,
}
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 RelMultiHeadAttn — 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 RelMultiHeadAttn 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
RelMultiHeadAttn Ran
ran on a synthesized input · constructed an object; no result was computed
NVIDIA/DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL/pytorch/mem_transformer.py
pointer only (licence: NONE) · get_code("8fa37260188b5fd8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, NVIDIA/DeepLearningExamples 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.

RelPositionMultiHeadedAttention Ran
ran on a synthesized input · constructed an object; no result was computed
okkteam/Transformer-Transducer/tt/transformer/attention.py
pointer only (licence: NONE) · get_code("4977fa89216a56fa")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, okkteam/Transformer-Transducer 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.

RelativeMultiHeadAttention Ran
ran on a synthesized input
sooftware/Attention-Implementation/attentions.py
code served (permissive licence) · get_code("c018d465b6253b94")
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; 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 torch.nn as nn

# INIT_ARGS: parameters for RelativeMultiHeadAttention.__init__
INIT_ARGS = {
    'd_model': 16,
    'num_heads': 4,
    'dropout_p': 0.1
}

# ARGS: parameters for RelativeMultiHeadAttention.forward
batch_size = 2
seq_length = 5
d_model = INIT_ARGS['d_model']

query = torch.randn(batch_size, seq_length, d_model)
key = torch.randn(batch_size, seq_length, d_model)
value = torch.randn(batch_size, seq_length, d_model)
pos_embedding = torch.randn(batch_size, seq_length, d_model)
mask = torch.zeros(batch_size, 1, seq_length, dtype=torch.bool)
mask[:, :, -1] = True  # mask the last position

ARGS = {
    'query': query,
    'key': key,
    'value': value,
    'pos_embedding': pos_embedding,
    'mask': mask
}
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
RelativeMultiHeadAttention Ran
ran on a synthesized input
park-cheol/ASR-Conformer/model/attention.py
pointer only (licence: NONE) · get_code("032b78da6979837c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, park-cheol/ASR-Conformer 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.

TransfoXLConfig Ran
ran on a synthesized input · constructed an object; no result was computed
cedrickchee/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py
code served (permissive licence) · get_code("a97a22ac6fb31922")
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, TransfoXLConfig: 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 copy
import json
import sys
from io import open

ARGS = {
    'vocab_size_or_config_json_file': 267735,
    'cutoffs': [20000, 40000, 200000],
    'd_model': 1024,
    'd_embed': 1024,
    'n_head': 16,
    'd_head': 64,
    'd_inner': 4096,
    'div_val': 4,
    'pre_lnorm': False,
    'n_layer': 18,
    'tgt_len': 128,
    'ext_len': 0,
    'mem_len': 1600,
    'clamp_len': 1000,
    'same_length': True,
    'proj_share_all_but_first': True,
    'attn_type': 0,
    'sample_softmax': -1,
    'adaptive': True,
    'tie_weight': True,
    'dropout': 0.1,
    'dropatt': 0.0,
    'untie_r': True,
    'init': 'normal',
    'init_range': 0.01,
    'proj_init_std': 0.01,
    'init_std': 0.02
}
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 TransfoXLConfig — 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 TransfoXLConfig 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
TransformerEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
AIResearchHub/transformergallery/transformer/transformerxl.py
code served (permissive licence) · get_code("c7b5eb55f15a37de")
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, TransformerEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "vocab_size": 100,
    "d_model": 8,
    "max_len": 16,
    "device": torch.device("cpu")
}
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 TransformerEmbedding — 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 TransformerEmbedding 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
VQATaskInput Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("2a023fc4bac8d229")
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, VQATaskInput: 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 typing import List, Union

torch.manual_seed(0)

ARGS = {
    "position_id": torch.randint(0, 10, (2, 4)),
    "attention_mask": torch.ones(2, 4, dtype=torch.float32),
    "loss_mask": torch.ones(2, 4, dtype=torch.float32),
    "label": torch.randint(0, 5, (2, 4)),
    "prompt_seq": torch.randint(0, 100, (2, 8)),
    "img_seq": torch.randn(2, 6, 3),
    "text_seq": torch.randint(0, 50, (2, 5)),
    "img_id_seq": torch.randint(0, 1000, (2,)),
    "ques_id_seq": torch.randint(0, 500, (2,)),
    "ques_len": torch.tensor([3, 4], dtype=torch.long),
}
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 VQATaskInput — 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 VQATaskInput 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
VisionEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
shanghai-digital-brain-laboratory/bdm-db1/src/model/transformer_xl.py
code served (permissive licence) · get_code("2a5f4bac2414eb0f")
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, VisionEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math
import collections
import einops

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.fp16 = False
        self.vision_patch_size = 16
        self.vision_num_input_channels = 3
        self.n_embed = 64
        self.vision_position_vocab_size = 128
        self.vision_hidden_dropout_prob = 0.1

config = Config()

ARGS = {
    "config": config
}
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 VisionEmbedding — 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 VisionEmbedding 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
_cache_mem Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
benkrause/dynamiceval-transformer/tf/model.py
code served (permissive licence) · get_code("773651748c9618d6")
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 EagerTensor, ndim 2, dtype family float, shape (5, 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 tensorflow as tf
import numpy as np

# Create small test tensors
curr_out = tf.constant(np.random.randn(2, 4).astype(np.float32))
prev_mem = tf.constant(np.random.randn(3, 4).astype(np.float32))
mem_len = 5

ARGS = {
    "curr_out": curr_out,
    "prev_mem": prev_mem,
    "mem_len": mem_len,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (5, 4) — shape (5, 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
_cache_mem Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
huggingface/xlnet/modeling.py
code served (permissive licence) · get_code("9d5e914b24b8911a")
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 EagerTensor, ndim 2, dtype family float, shape (5, 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 tensorflow as tf
import numpy as np

# Create small tensors for testing
# curr_out: should be a tensor that can be sliced and concatenated
curr_out = tf.constant(np.random.randn(6, 4).astype(np.float32))

# prev_mem: can be None or a tensor
prev_mem = tf.constant(np.random.randn(3, 4).astype(np.float32))

# mem_len: integer specifying memory length
mem_len = 5

# reuse_len: optional integer for reuse length
reuse_len = 2

ARGS = {
    'curr_out': curr_out,
    'prev_mem': prev_mem,
    'mem_len': mem_len,
    'reuse_len': reuse_len
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (5, 4) — shape (5, 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
add_and_scale Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from owos/flexitokens
pointer only; the stored copy get_code serves, from owos/flexitokens, is pointer only (licence: NONE) · get_code("78d91efd74e4d12a")
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.

assign_to_gpu Ran
ran on a synthesized input
TimDettmers/transformer-xl/tf/gpu_utils.py
code served (permissive licence) · get_code("6b2a8f1c93d0b071")
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 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 tensorflow as tf

# The function assign_to_gpu takes two parameters:
# - gpu: an integer specifying which GPU to use
# - ps_dev: a string specifying the parameter server device

# Looking at the function body, it returns a closure _assign that:
# 1. Takes an op (which can be a tf.NodeDef or an object with a .node_def attribute)
# 2. Checks if op.node_def.op == 'Variable'
# 3. Returns either ps_dev or a GPU device string

# Create a minimal mock NodeDef-like object for testing
class MockNodeDef:
    def __init__(self, op_type='MatMul'):
        self.op = op_type

class MockOp:
    def __init__(self, op_type='MatMul'):
        self.node_def = MockNodeDef(op_type)

# Define the arguments
ARGS = {
    'gpu': 0,
    'ps_dev': '/device:CPU:0'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — 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
batchify Ran
ran on a synthesized input
TimDettmers/transformer-xl/tf/data_utils.py
code served (permissive licence) · get_code("36eed0b265968be7")
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 2, dtype family int, shape (10, 20) 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

# Create sample data - a 1D array of integers
data = np.arange(100, dtype=np.int32)

# Define batch_size
batch_size = 10

# Define num_passes
num_passes = 2

ARGS = {
    "data": data,
    "batch_size": batch_size,
    "num_passes": num_passes
}
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 2, dtype family int, shape (10, 20) — shape (10, 20) 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
build_normalization Ran
ran; our contract draft was wrong, not the code
opendilab/DI-engine/ding/torch_utils/network/transformer.py
code served (permissive licence) · get_code("c92e4fc990bba2fe")
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 type. 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)

# Test case 1: BatchNorm with dimension 1
ARGS_1 = {
    'norm_type': 'BN',
    'dim': 1
}

# Test case 2: BatchNorm with dimension 2
ARGS_2 = {
    'norm_type': 'BN',
    'dim': 2
}

# Test case 3: LayerNorm without dimension
ARGS_3 = {
    'norm_type': 'LN',
    'dim': None
}

# Test case 4: InstanceNorm with dimension 1
ARGS_4 = {
    'norm_type': 'IN',
    'dim': 1
}

# Test case 5: InstanceNorm with dimension 2
ARGS_5 = {
    'norm_type': 'IN',
    'dim': 2
}

# Test case 6: SyncBN without dimension
ARGS_6 = {
    'norm_type': 'SyncBN',
    'dim': None
}

# Use the first test case as the primary ARGS
ARGS = ARGS_1
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 type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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
build_tf_to_pytorch_map Ran
ran; our contract draft was wrong, not the code
cedrickchee/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py
code served (permissive licence) · get_code("35ef111fc00c21b4")
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 torch
import torch.nn as nn

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.tie_projs = [False]
        self.tie_weight = True
        self.untie_r = False

class LayerNorm(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.weight = nn.Parameter(torch.randn(dim))
        self.bias = nn.Parameter(torch.randn(dim))

class DecAttn(nn.Module):
    def __init__(self, d_model=4, d_head=2):
        super().__init__()
        self.layer_norm = LayerNorm(d_model)
        self.o_net = nn.Linear(d_model, d_model)
        self.qkv_net = nn.Linear(d_model, 3 * d_model)
        self.r_net = nn.Linear(d_model, d_model)
        self.r_r_bias = nn.Parameter(torch.randn(d_model))
        self.r_w_bias = nn.Parameter(torch.randn(d_model))

class PosFeedForward(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.layer_norm = LayerNorm(d_model)
        self.CoreNet = nn.Sequential(
            nn.Linear(d_model, d_ff),
            nn.ReLU(),
            nn.Linear(d_ff, d_ff),
            nn.Linear(d_ff, d_model)
        )

class TransformerLayer(nn.Module):
    def __init__(self, d_model=4):
        super().__init__()
        self.dec_attn = DecAttn(d_model)
        self.pos_ff = PosFeedForward(d_model)

class WordEmb(nn.Module):
    def __init__(self, vocab_size=100, d_model=4, n_cutoffs=1):
        super().__init__()
        self.emb_layers = nn.ModuleList([nn.Embedding(vocab_size, d_model) for _ in range(n_cutoffs)])
        self.emb_projs = nn.ModuleList([nn.Linear(d_model, d_model) for _ in range(n_cutoffs)])

class AdaptiveSoftmax(nn.Module):
    def __init__(self, vocab_size=100, d_model=4, n_cutoffs=1):
        super().__init__()
        self.cluster_weight = nn.Parameter(torch.randn(n_cutoffs, d_model))
        self.cluster_bias = nn.Parameter(torch.randn(n_cutoffs))
        self.out_layers = nn.ModuleList([nn.Linear(d_model, vocab_size) for _ in range(n_cutoffs)])
        self.out_projs = nn.ModuleList([nn.Linear(d_model, d_model) for _ in range(n_cutoffs)])

class Transformer(nn.Module):
    def __init__(self, d_model=4, n_layers=2, n_cutoffs=1):
        super().__init__()
        self.word_emb = WordEmb(vocab_size=100, d_model=d_model, n_cutoffs=n_cutoffs)
        self.layers = nn.ModuleList([TransformerLayer(d_model) for _ in range(n_layers)])
        self.r_r_bias = nn.Parameter(torch.randn(d_model))
        self.r_w_bias = nn.Parameter(torch.randn(d_model))

class Model(nn.Module):
    def __init__(self, d_model=4, n_layers=2, n_cutoffs=1):
        super().__init__()
        self.transformer = Transformer(d_model=d_model, n_layers=n_layers, n_cutoffs=n_cutoffs)
        self.crit = AdaptiveSoftmax(vocab_size=100, d_model=d_model, n_cutoffs=n_cutoffs)

config = Config()
model = Model(d_model=4, n_layers=2, n_cutoffs=1)

ARGS = {
    'model': model,
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
create_lookahead_mask Ran
ran, honoured the contract we drafted
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("499bf5fee7915c78")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

embedding_lookup Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
benkrause/dynamiceval-transformer/tf/model.py
code served (permissive licence) · get_code("9109ba9791e44324")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create a small lookup table (embedding matrix)
# Shape: [vocab_size, embedding_dim]
lookup_table = tf.constant(
    np.random.randn(8, 4).astype(np.float32),
    dtype=tf.float32
)

# Create input indices for embedding lookup
# Test with 2D input (batch_size, seq_len)
x = tf.constant([[1, 3, 5], [2, 4, 6]], dtype=tf.int32)

# Define arguments
ARGS = {
    'lookup_table': lookup_table,
    'x': x,
    'use_tpu': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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: none by the harness; any seed is in the setup block
fc_block Ran
ran; our contract draft was wrong, not the code
opendilab/DI-engine/ding/torch_utils/network/transformer.py
code served (permissive licence) · get_code("c1184d27672a7461")
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 Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'in_channels': 4,
    'out_channels': 8,
    'activation': nn.ReLU(),
    'norm_type': 'LN',
    'use_dropout': True,
    'dropout_probability': 0.5,
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
left_shift Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("8d59a6d5900428f5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

positional_embedding Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
benkrause/dynamiceval-transformer/tf/model.py
code served (permissive licence) · get_code("d50e8679cde3a927")
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 EagerTensor, ndim 3, dtype family float, shape (5, 2, 8) 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 tensorflow as tf
import numpy as np

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

# Create pos_seq: a 1D tensor of position indices
# Using shape [5] as a reasonable sequence length
pos_seq = tf.constant([0, 1, 2, 3, 4], dtype=tf.float32)

# Create inv_freq: inverse frequencies for positional encoding
# Using shape [4] for embedding dimension / 2
inv_freq = tf.constant([1.0, 0.1, 0.01, 0.001], dtype=tf.float32)

# Create bsz: batch size
bsz = 2

ARGS = {
    'pos_seq': pos_seq,
    'inv_freq': inv_freq,
    'bsz': bsz
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (5, 2, 8) — shape (5, 2, 8) 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
positional_embedding Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
huggingface/xlnet/modeling.py
code served (permissive licence) · get_code("9bf0f6e6298f3fbe")
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 EagerTensor, ndim 3, dtype family float, shape (5, 2, 8) 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 tensorflow as tf
import numpy as np

# Set random seed for reproducibility
tf.random.set_seed(0)

# Create pos_seq: a 1D tensor of positions
# Using shape [5] for sequence length
pos_seq = tf.constant([0, 1, 2, 3, 4], dtype=tf.float32)

# Create inv_freq: inverse frequencies for positional encoding
# Using shape [4] for embedding dimension / 2
inv_freq = tf.constant([1.0, 0.1, 0.01, 0.001], dtype=tf.float32)

# bsz: batch size (optional parameter)
bsz = 2

ARGS = {
    'pos_seq': pos_seq,
    'inv_freq': inv_freq,
    'bsz': bsz,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (5, 2, 8) — shape (5, 2, 8) 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
positional_encoding Ran
ran, honoured the contract we drafted
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("2398c4a5c285bdc4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

positionwise_ffn Ran
ran; our contract draft was wrong, not the code
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("f7a746d73ab2f28c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

post_process Ran
ran on a synthesized input
Machine-Learning-Tokyo/Poetry-GAN/lang_model.py
code served (permissive licence) · get_code("9d6735f22035b700")
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 string

ARGS = {
    "text": "xxmaj hello xxup world i am here\nthis is a test. it's xxbos great xxrep and (fun) because we're learning!"
}
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
rel_shift Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
benkrause/dynamiceval-transformer/tf/model.py
code served (permissive licence) · get_code("d37883dc58ff9b69")
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 EagerTensor, ndim 4, dtype family float, shape (2, 3, 4, 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 tensorflow as tf
import numpy as np

# Create a small 4D tensor for testing rel_shift
# Shape: [batch_size=2, seq_len=3, dim1=4, dim2=5]
# This matches the expected input shape for the function
x = tf.constant(np.random.randn(2, 3, 4, 5).astype(np.float32))

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 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
rel_shift Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
huggingface/xlnet/modeling.py
code served (permissive licence) · get_code("5f7c5b38aeb29bf5")
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 EagerTensor, ndim 4, dtype family float, shape (2, 4, 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 tensorflow as tf
import numpy as np

# Create a small tensor with shape [batch_size=2, seq_len=5, num_heads=3, depth=4]
# The function reshapes and slices this tensor for relative shift computation
x = tf.constant(
    np.random.randn(2, 5, 3, 4).astype(np.float32)
)

# klen parameter: maximum length to keep after shifting
# Set to -1 (no truncation) or a positive value like 4
klen = -1

ARGS = {
    "x": x,
    "klen": klen,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 4, dtype family float, shape (2, 4, 3, 4) — shape (2, 4, 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: none by the harness; any seed is in the setup block
relative_position_logits Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Jmkernes/PAR-Transformer-XL/par_model.py
pointer only (licence: NONE) · get_code("edeef97857b7cdca")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jmkernes/PAR-Transformer-XL 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.

Showing the first 60. An agent gets every one from get_harvested_code_for_paper("1901.02860").

Also present in other papers' code

Of 143 samples lifted from this paper's linked repositories, 143 carry a function identity and 0 do not. Of the 137 distinct functions with an identity, 41 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 40 later) and 96 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
rotate_half
brick of this paper's assembly: helper
360 other papers
357 later, 3 undated · 30 only as an assembly brick
2203.08913 (2022-03)
Memorizing Transformers
2302.13971 (2023-02)
LLaMA: Open and Efficient Foundation Language Models
2305.14167 (2023-05)
DetGPT: Detect What You Need via Reasoning
and 357 more not named here
repeat_kv
brick of this paper's assembly: helper
243 other papers
241 later, 2 undated · 22 only as an assembly brick
2203.08913 (2022-03)
Memorizing Transformers
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
2307.06945 (2023-07)
In-context Autoencoder for Context Compression in a Large Language Model
and 240 more not named here
apply_rotary_pos_emb
brick of this paper's assembly: helper
94 other papers
91 later, 3 undated · 6 only as an assembly brick
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
2309.11674 (2023-09)
A Paradigm Shift in Machine Translation: Boosting Translation Performance of Large Language Models
2024.findings-emnlp.22 (2024 (year only))
XRec: Large Language Models for Explainable Recommendation
and 91 more not named here
cached_path
brick of this paper's assembly: helper
27 other papers
1 dated earlier, 26 later · 5 only as an assembly brick
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1908.02265 (2019-08)
ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks
1908.03557 (2019-08)
VisualBERT: A Simple and Performant Baseline for Vision and Language
and 24 more not named here
sample_logits
brick of this paper's assembly: helper
14 other papers
14 later · 2 only as an assembly brick
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
and 11 more not named here
scatter_kwargs 11 other papers
11 later
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers
2204.03883 (2022-04)
Vision Transformers for Single Image Dehazing
2207.00735 (2022-07)
Can Language Models Make Fun? A Case Study in Chinese Comical Crosstalk
and 8 more not named here
build_tf_to_pytorch_map
brick of this paper's assembly: helper
10 other papers
10 later
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
and 7 more not named here
scatter 8 other papers
8 later
2106.06295 (2021-06)
Going Beyond Linear Transformers with Recurrent Fast Weight Programmers
2204.03883 (2022-04)
Vision Transformers for Single Image Dehazing
2207.00735 (2022-07)
Can Language Models Make Fun? A Case Study in Chinese Comical Crosstalk
and 5 more not named here
PositionalEmbedding
brick of this paper's assembly: helper, model
4 other papers
4 later · 3 only as an assembly brick
2004.08178 (2020-04)
Highway Transformer: Self-Gating Enhanced Self-Attentive Networks
2101.02402 (2021-01)
Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs
2207.06881 (2022-07)
Recurrent Memory Transformer
and 1 more not named here
PositionwiseFF
brick of this paper's assembly: helper, model
3 other papers
3 later · 2 only as an assembly brick
2101.02402 (2021-01)
Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs
2207.06881 (2022-07)
Recurrent Memory Transformer
2605.15562 (2026-05)
GiLT: Augmenting Transformer Language Models with Dependency Graphs
assign_to_gpu 3 other papers
2 dated earlier, 1 later
1602.02410 (2016-02)
Exploring the Limits of Language Modeling
1606.04934 (2016-06)
Improving Variational Inference with Inverse Autoregressive Flow
2004.13922 (2020-04)
Revisiting Pre-trained Models for Chinese Natural Language Processing
load_tf_weights_in_transfo_xl
brick of this paper's assembly: helper
3 other papers
3 later
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
1911.00720 (2019-11)
ZEN: Pre-training Chinese Text Encoder Enhanced by N-gram Representations
2005.02439 (2020-05)
Contextualizing Hate Speech Classifiers with Post-hoc Explanation
to_2tuple
brick of this paper's assembly: helper
3 other papers
3 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2203.15350 (2022-03)
End-to-End Transformer Based Model for Image Captioning
2404.10710 (2024-04)
Autoregressive Pre-Training on Pixels and Texts
DecoderLayer
brick of this paper's assembly: helper, model
2 other papers
2 later · 1 only as an assembly brick
2101.02402 (2021-01)
Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs
2207.06881 (2022-07)
Recurrent Memory Transformer
LogUniformSampler
brick of this paper's assembly: helper
2 other papers
2 later · 2 only as an assembly brick
2004.08178 (2020-04)
Highway Transformer: Self-Gating Enhanced Self-Attentive Networks
2207.06881 (2022-07)
Recurrent Memory Transformer
PositionalEncoding
brick of this paper's assembly: helper
2 other papers
2 later · 1 only as an assembly brick
2004.05150 (2020-04)
Longformer: The Long-Document Transformer
2203.08913 (2022-03)
Memorizing Transformers
RelLearnableDecoderLayer
brick of this paper's assembly: model
2 other papers
2 later
2101.02402 (2021-01)
Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs
2207.06881 (2022-07)
Recurrent Memory Transformer
TransformerEmbedding
brick of this paper's assembly: helper
2 other papers
2 later · 1 only as an assembly brick
2004.05150 (2020-04)
Longformer: The Long-Document Transformer
2203.08913 (2022-03)
Memorizing Transformers
embedding_lookup
brick of this paper's assembly: helper
2 other papers
2 later · 1 only as an assembly brick
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
2004.13922 (2020-04)
Revisiting Pre-trained Models for Chinese Natural Language Processing
get_from_cache
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
2101.08106 (2021-01)
Learning to Augment for Data-Scarce Domain BERT Knowledge Distillation

Shown: the 20 functions present in the most other papers. 21 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

More are linked than shown here.

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

Abstract

Transformers have a potential of learning longer-term dependency, but are limited by a fixed-length context in the setting of language modeling. We propose a novel neural architecture Transformer-XL that enables learning dependency beyond a fixed length without disrupting temporal coherence. It consists of a segment-level recurrence mechanism and a novel positional encoding scheme. Our method not only enables capturing longer-term dependency, but also resolves the context fragmentation problem. As a result, Transformer-XL learns dependency that is 80% longer than RNNs and 450% longer than vanilla Transformers, achieves better performance on both short and long sequences, and is up to 1,800+ times faster than vanilla Transformers during evaluation. Notably, we improve the state-ofthe-art results of bpc/perplexity to 0.99 on en-wiki8, 1.08 on text8, 18.3 on WikiText-103, 21.8 on One Billion Word, and 54.5 on Penn Treebank (without finetuning). When trained only on WikiText-103, Transformer-XL manages to generate reasonably coherent, novel text articles with thousands of tokens. Our code, pretrained models, and hyperparameters are available in both Tensorflow and PyTorch 1 . * Equal contribution. Order determined by swapping the one in Yang et al. (2017).

For agents

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

get_harvested_code_for_paper("1901.02860")
get_code_for_paper("1901.02860")
have("1901.02860")

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

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

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

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

Connect an agent — have() is free.