SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1906.08237 · 2019

XLNet: Generalized Autoregressive Pretraining for Language Understanding

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

arXiv · PDF · Open in the Atlas

Code that ran

15 of 24 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 7 failures of our instrument; 9 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1906.08237.json · badge: /api/ran/1906.08237.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
samwisegamjeee/pytorch-transformers community (classifier label)
classifier basis not recorded on the link
11 ran · 6 no recorded run
chesterdu/contrastive_summary community
Papers with Code archive
2 ran · 0 no recorded run
zihangdai/xlnet marked official in Papers with Code
Papers with Code archive
1 ran · 1 no recorded run
fanchenyou/transformer-study community
Papers with Code archive
1 ran · 0 no recorded run
zaradana/Fast_BERT community
Papers with Code archive
0 ran · 1 no recorded run
utterworks/fast-bert community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
swish Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_bert.py
code served (permissive licence) · get_code("0f786c407fb1ee4c")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:33:52Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function swish takes a single parameter 'x' which is used with:
# - torch.sigmoid(x) - requires a tensor
# - x * ... - requires a tensor that supports multiplication
# So x should be a tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SupConLoss Ran
ran on a synthesized input
chesterdu/contrastive_summary/src/model.py
pointer only (licence: NONE) · get_code("624bba127433de69")
How it ran

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

XLNet Ran
ran on a synthesized input · constructed an object; no result was computed
fanchenyou/transformer-study/transformer_xlnet_4.py
pointer only (licence: NONE) · get_code("30647553d552c86f")
How it ran

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

build_tf_to_pytorch_map Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/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
build_tf_xlnet_to_pytorch_map Ran
ran on a synthesized input
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_xlnet.py
code served (permissive licence) · get_code("c92ba449e48ecffe")
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)

# Build minimal attention layer
class RelAttn(nn.Module):
    def __init__(self, d_model=4, num_heads=2):
        super().__init__()
        self.layer_norm = nn.LayerNorm(d_model)
        self.o = nn.Linear(d_model, d_model)
        self.q = nn.Linear(d_model, d_model)
        self.k = nn.Linear(d_model, d_model)
        self.r = nn.Linear(d_model, d_model)
        self.v = nn.Linear(d_model, d_model)
        self.r_r_bias = torch.randn(4)
        self.r_w_bias = torch.randn(4)
        self.r_s_bias = torch.randn(4)
        self.seg_embed = torch.randn(2, 4)

# Build minimal feedforward layer
class FFN(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.layer_norm = nn.LayerNorm(d_model)
        self.layer_1 = nn.Linear(d_model, d_ff)
        self.layer_2 = nn.Linear(d_ff, d_model)

# Build minimal transformer layer
class TransformerLayer(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.rel_attn = RelAttn(d_model=d_model)
        self.ff = FFN(d_model=d_model, d_ff=d_ff)

# Build minimal transformer
class Transformer(nn.Module):
    def __init__(self, num_layers=2, d_model=4, d_ff=8, untie_r=False):
        super().__init__()
        self.word_embedding = nn.Embedding(100, d_model)
        self.mask_emb = torch.randn(d_model)
        self.layer = nn.ModuleList([TransformerLayer(d_model, d_ff) for _ in range(num_layers)])
        self.untie_r = untie_r
        
        if not untie_r:
            self.r_r_bias = torch.randn(d_model)
            self.r_w_bias = torch.randn(d_model)
            self.r_s_bias = torch.randn(d_model)
            self.seg_embed = torch.randn(2, d_model)

# Build full model with optional lm_loss, sequence_summary, logits_proj
class XLNetModel(nn.Module):
    def __init__(self, num_layers=2, d_model=4, d_ff=8, untie_r=False, with_lm_loss=True, with_sequence_summary=False, with_logits_proj=False):
        super().__init__()
        self.transformer = Transformer(num_layers=num_layers, d_model=d_model, d_ff=d_ff, untie_r=untie_r)
        if with_lm_loss:
            self.lm_loss = nn.Linear(d_model, 100)
        if with_sequence_summary:
            self.sequence_summary = nn.Module()
            self.sequence_summary.summary = nn.Linear(d_model, d_model)
        if with_logits_proj:
            self.logits_proj = nn.Linear(d_model, 1)

# Build config
class Config:
    def __init__(self, untie_r=False, finetuning_task=None):
        self.untie_r = untie_r
        self.finetuning_task = finetuning_task

# Create instances
model = XLNetModel(num_layers=2, d_model=4, d_ff=8, untie_r=False, with_lm_loss=True, with_sequence_summary=True, with_logits_proj=True)
config = Config(untie_r=False, finetuning_task="regression")
tf_weights = {
    'model/sequnece_summary/summary/kernel': True,
    'model/regression_regression/logit/kernel': True,
}

ARGS = {
    "model": model,
    "config": config,
    "tf_weights": tf_weights,
}
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
gelu Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_gpt2.py
code served (permissive licence) · get_code("8d23fbe2b99b840b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Create a small tensor for testing
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gelu Ran
ran, honoured the contract we drafted
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_bert.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from tanmay1618/text_to_sql_bert, is pointer only (licence: NONE) · get_code("fdc64f4c72036ae4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from tanmay1618/text_to_sql_bert, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gelu Ran
ran on a synthesized input
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_xlnet.py
code served (permissive licence) · get_code("b05b2bb38c0e4e72")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 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 math
import torch

torch.manual_seed(0)

# The gelu function takes a single parameter 'x' which should be a tensor
# The function applies mathematical operations on it (tanh, pow, multiplication)
# So x needs to be a torch.Tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gelu Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_xlm.py
code served (permissive licence) · get_code("b3c2618f6b7fb60c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 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 math
import torch

torch.manual_seed(0)

# Create a small tensor for the input
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_masks Ran
ran on a synthesized input
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_xlm.py
code served (permissive licence) · get_code("f5d8d44f65a08b76")
How it ran

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

torch.manual_seed(0)

# slen: sequence length (int)
# lengths: tensor of actual sequence lengths for each batch item
# causal: boolean for whether to use causal masking
# padding_mask: optional pre-computed padding mask

slen = 5
bs = 2

# lengths should have shape (bs,) with values <= slen
lengths = torch.tensor([3, 4], dtype=torch.long)

# causal mask flag
causal = False

# padding_mask is optional, set to None to let the function compute it
padding_mask = None

ARGS = {
    "slen": slen,
    "lengths": lengths,
    "causal": causal,
    "padding_mask": padding_mask,
}
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 tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prune_conv1d_layer Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_utils.py
code served (permissive licence) · get_code("7183a17dd79327a8")
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 Conv1D. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

class Conv1D(nn.Module):
    def __init__(self, nf, nx):
        super(Conv1D, self).__init__()
        self.nf = nf
        w = torch.empty(nx, nf)
        nn.init.normal_(w, std=0.02)
        self.weight = nn.Parameter(w)
        self.bias = nn.Parameter(torch.zeros(nf))

    def forward(self, x):
        size_out = x.size()[:-1] + (self.nf,)
        x = torch.addmm(self.bias, x.view(-1, x.size(-1)), self.weight)
        x = x.view(*size_out)
        return x

# Create a Conv1D layer to prune
# nf=5 (output features), nx=4 (input features)
layer = Conv1D(nf=5, nx=4)

# Create an index tensor to select which dimensions to keep
# dim=1 means we're pruning the output dimension
# Select indices [0, 2] from the output features
index = torch.tensor([0, 2], dtype=torch.long)

# dim parameter: prune along dimension 1 (output features)
dim = 1

ARGS = {
    "layer": layer,
    "index": index,
    "dim": dim
}
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 Conv1D — a Conv1D output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv1D 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
prune_linear_layer Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_utils.py
code served (permissive licence) · get_code("d30d6c3098df2c42")
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 Linear. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

# Create a linear layer to prune
# Using distinct sizes: input_features=3, output_features=4
layer = nn.Linear(in_features=3, out_features=4, bias=True)

# Create an index tensor to select which output features to keep
# Selecting 2 out of 4 output features
index = torch.tensor([0, 2], dtype=torch.long)

# dim=0 means we're pruning along the output dimension (rows of weight matrix)
dim = 0

ARGS = {
    "layer": layer,
    "index": index,
    "dim": dim,
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
relative_positional_encoding Ran
ran, honoured the contract we drafted
zihangdai/xlnet/modeling.py
code served (permissive licence) · get_code("4276ef7411886c72")
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 (10, 4, 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

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

ARGS = {
    'qlen': 5,
    'klen': 5,
    'd_model': 8,
    'clamp_len': 4,
    'attn_type': 'bi',
    'bi_data': True,
    'bsz': 4,
    'dtype': tf.float32,
}
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 EagerTensor, ndim 3, dtype family float, shape (10, 4, 8) — shape (10, 4, 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
sample_logits Ran
ran; our contract draft was wrong, not the code
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_transfo_xl_utilities.py
code served (permissive licence) · get_code("93228a3eb5c4d179")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 6) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

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

# Bias vector
bias = torch.randn(n_vocab)

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

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

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

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

ARGS = {
    "embedding": embedding,
    "bias": bias,
    "labels": labels,
    "inputs": inputs,
    "sampler": sampler
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 6) — shape (2, 3, 6) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
scl_model_Xlnet Ran
ran on a synthesized input · constructed an object; no result was computed
chesterdu/contrastive_summary/src/model.py
pointer only (licence: NONE) · get_code("1370bb66bcbac8f1")
How it ran

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

XLNetForMultiLabelSequenceClassification Not yet run
unverified (harvested, no recorded run)
zaradana/Fast_BERT/0_fast_bert/modeling.py
code served (permissive licence) · get_code("ea4abb20faaddb4d")
How it ran

no invocation recorded.

XLNetForMultiLabelSequenceClassification Not yet run
unverified (harvested, no recorded run)
utterworks/fast-bert/fast_bert/modeling.py
code served (permissive licence) · get_code("de032896e6064f69")
How it ran

no invocation recorded.

load_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_bert.py
code served (permissive licence) · get_code("03a94dbb436249a3")
How it ran

no invocation recorded.

load_tf_weights_in_gpt2 Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_gpt2.py
code served (permissive licence) · get_code("07bb0220eb5b609f")
How it ran

no invocation recorded.

load_tf_weights_in_openai_gpt Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_openai.py
code served (permissive licence) · get_code("42ee168c3ae12e60")
How it ran

no invocation recorded.

load_tf_weights_in_transfo_xl Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_transfo_xl.py
code served (permissive licence) · get_code("23d246e59ef9447b")
How it ran

no invocation recorded.

load_tf_weights_in_xlnet Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_xlnet.py
code served (permissive licence) · get_code("4a94662ff3b5c5cf")
How it ran

no invocation recorded.

prune_layer Not yet run
unverified (harvested, no recorded run)
samwisegamjeee/pytorch-transformers/pytorch_transformers/modeling_utils.py
code served (permissive licence) · get_code("e31093ffc8275cff")
How it ran

no invocation recorded.

transformer_xl Not yet run
unverified (harvested, no recorded run)
zihangdai/xlnet/modeling.py
code served (permissive licence) · get_code("346015e252bc02c1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 23 distinct functions with an identity, 18 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 4 the same month, 17 later) and 5 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
swish 206 other papers
9 dated earlier, 2 the same month, 195 later · 44 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1805.12114 (2018-05)
Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models
1809.01357 (2018-09)
Zero Shot Learning for Code Education: Rubric Sampling with Deep Learning Inference
and 203 more not named here
gelu 198 other papers
8 dated earlier, 4 the same month, 186 later · 32 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.10125 (2019-01)
Glyce: Glyph-vectors for Chinese Character Representations
and 195 more not named here
gelu 51 other papers
3 dated earlier, 3 the same month, 45 later · 8 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
and 48 more not named here
prune_linear_layer 29 other papers
1 dated earlier, 1 the same month, 27 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1906.08230 (2019-06)
Evaluating Protein Transfer Learning with TAPE
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
and 26 more not named here
gelu 17 other papers
1 dated earlier, 16 later
1905.12790 (2019-05)
A Generalized Framework of Sequence Generation with Application to Undirected Sequence Models
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
1911.02116 (2019-11)
Unsupervised Cross-lingual Representation Learning at Scale
and 14 more not named here
prune_conv1d_layer 16 other papers
16 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
1911.00720 (2019-11)
ZEN: Pre-training Chinese Text Encoder Enhanced by N-gram Representations
and 13 more not named here
sample_logits 14 other papers
1 dated earlier, 13 later · 2 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
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
build_tf_to_pytorch_map 10 other papers
1 dated earlier, 9 later
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
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
load_tf_weights_in_openai_gpt 8 other papers
8 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2002.01808 (2020-02)
K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters
2004.03829 (2020-04)
Exploring Versatile Generative Language Model Via Parameter-Efficient Transfer Learning
and 5 more not named here
prune_layer 7 other papers
7 later
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
2005.00558 (2020-05)
POINTER: Constrained Progressive Text Generation via Insertion-based Generative Pre-training
2007.02439 (2020-07)
Pretrained Generalized Autoregressive Model with Adaptive Probabilistic Label Clusters for Extreme Multi-label Text Classification
and 4 more not named here
load_tf_weights_in_transfo_xl 6 other papers
6 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2002.01808 (2020-02)
K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters
2004.03829 (2020-04)
Exploring Versatile Generative Language Model Via Parameter-Efficient Transfer Learning
and 3 more not named here
build_tf_xlnet_to_pytorch_map 4 other papers
4 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2007.02439 (2020-07)
Pretrained Generalized Autoregressive Model with Adaptive Probabilistic Label Clusters for Extreme Multi-label Text Classification
2010.05607 (2020-10)
The elephant in the interpretability room: Why use attention as explanation when we have saliency methods?
and 1 more not named here
get_masks 3 other papers
3 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2005.00558 (2020-05)
POINTER: Constrained Progressive Text Generation via Insertion-based Generative Pre-training
2010.05607 (2020-10)
The elephant in the interpretability room: Why use attention as explanation when we have saliency methods?
load_tf_weights_in_bert 3 other papers
3 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2005.00558 (2020-05)
POINTER: Constrained Progressive Text Generation via Insertion-based Generative Pre-training
2021.emnlp-main.721 (2021 (year only))
YASO: A Targeted Sentiment Analysis Evaluation Dataset for Open-Domain Reviews
load_tf_weights_in_xlnet 3 other papers
3 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2007.02439 (2020-07)
Pretrained Generalized Autoregressive Model with Adaptive Probabilistic Label Clusters for Extreme Multi-label Text Classification
2010.05607 (2020-10)
The elephant in the interpretability room: Why use attention as explanation when we have saliency methods?
gelu 2 other papers
2 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2007.02439 (2020-07)
Pretrained Generalized Autoregressive Model with Adaptive Probabilistic Label Clusters for Extreme Multi-label Text Classification
load_tf_weights_in_gpt2 2 other papers
2 later
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2005.00558 (2020-05)
POINTER: Constrained Progressive Text Generation via Insertion-based Generative Pre-training
transformer_xl
brick of this paper's assembly: entry
1 other paper
1 dated earlier
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context

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

Repositories linked to this paper

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

Abstract

With the capability of modeling bidirectional contexts, denoising autoencoding based pretraining like BERT achieves better performance than pretraining approaches based on autoregressive language modeling. However, relying on corrupting the input with masks, BERT neglects dependency between the masked positions and suffers from a pretrain-finetune discrepancy. In light of these pros and cons, we propose XLNet, a generalized autoregressive pretraining method that (1) enables learning bidirectional contexts by maximizing the expected likelihood over all permutations of the factorization order and (2) overcomes the limitations of BERT thanks to its autoregressive formulation. Furthermore, XLNet integrates ideas from Transformer-XL, the state-of-the-art autoregressive model, into pretraining. Empirically, under comparable experiment settings, XLNet outperforms BERT on 20 tasks, often by a large margin, including question answering, natural language inference, sentiment analysis, and document ranking. 1 . * Equal contribution. Order determined by swapping the one in [9]. 1 Pretrained models and code are available at https://github.com/zihangdai/xlnet 33rd Conference on Neural Information Processing Systems (NeurIPS 2019),

For agents

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

get_harvested_code_for_paper("1906.08237")
get_code_for_paper("1906.08237")
have("1906.08237")

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

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

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

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

Connect an agent — have() is free.