SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2012.12877 · ICML · 2020

Training data-efficient image transformers & distillation through attention

Matthieu Cord, Matthijs Douze, Alexandre Sablayrolles, Hugo Touvron, Hervé Jégou, Francisco Massa

arXiv · PDF · Open in the Atlas

Code that ran

12 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 3 failures of our instrument; 7 no recorded run), measured 2026-11-21; 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/2012.12877.json · badge: /api/ran/2012.12877.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
alibaba/EasyCV community
not in the paper's declared repositories
6 ran · 3 no recorded run
omihub777/vit-cifar community
Papers with Code archive
2 ran · 1 no recorded run
hustvl/vim community
Papers with Code archive
1 ran · 0 no recorded run
holdfire/FAS community
Papers with Code archive
1 ran · 0 no recorded run
moein-shariatnia/Pix2Seq community
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
UdbhavPrasad072300/Transformer-Implementations community
Papers with Code archive
0 ran · 1 no recorded run
asrafulashiq/deit-custom community
Papers with Code archive
0 ran · 1 no recorded run
code-implementation1/Code1 community
not in the paper's declared repositories
0 ran · 1 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("c0bfabc05e380222")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. 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

INIT_ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'qk_scale': None,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'hydra_attention': False,
}

ARGS = {
    'x': torch.randn(2, 3, 4),
    'rel_pos_bias': None,
}

if __name__ == '__main__':
    attn = nn.Module()
    attn.__class__ = type('Attention', (nn.Module,), {
        '__init__': lambda self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0, hydra_attention=False: (
            nn.Module.__init__(self),
            setattr(self, 'num_heads', num_heads),
            setattr(self, 'scale', qk_scale or (dim // num_heads) ** (-0.5)),
            setattr(self, 'qkv', nn.Linear(dim, dim * 3, bias=qkv_bias)),
            setattr(self, 'attn_drop', nn.Dropout(attn_drop)),
            setattr(self, 'proj', nn.Linear(dim, dim)),
            setattr(self, 'proj_drop', nn.Dropout(proj_drop)),
            setattr(self, 'hydra_attention', hydra_attention),
        )[-1],
        'forward': lambda self, x, rel_pos_bias=None: None,
    })
    
    from torch.nn import Module, Linear, Dropout
    
    def hydra(q, k, v):
        q = q / q.norm(dim=-1, keepdim=True)
        k = k / k.norm(dim=-1, keepdim=True)
        kv = (k * v).sum(dim=-2, keepdim=True)
        out = q * kv
        return out
    
    class Attention(Module):
        def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0, hydra_attention=False):
            super().__init__()
            self.num_heads = num_heads
            head_dim = dim // num_heads
            self.scale = qk_scale or head_dim ** (-0.5)
            self.qkv = Linear(dim, dim * 3, bias=qkv_bias)
            self.attn_drop = Dropout(attn_drop)
            self.proj = Linear(dim, dim)
            self.proj_drop = Dropout(proj_drop)
            self.hydra_attention = hydra_attention
        
        def forward(self, x, rel_pos_bias=None):
            B, N, C = x.shape
            if self.hydra_attention:
                qkv = self.qkv(x).reshape(B, N, 3, self.num_heads).permute(2, 0, 1, 3)
                q, k, v = (qkv[0], qkv[1], qkv[2])
                x = hydra(q, k, v)
                x = x.reshape(B, N, C)
                x = self.proj(x)
                x = self.proj_drop(x)
                return (x, None)
            else:
                qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
                q, k, v = (qkv[0], qkv[1], qkv[2])
                attn = q @ k.transpose(-2, -1) * self.scale
                if rel_pos_bias is not None:
                    attn = attn + rel_pos_bias
                attn = attn.softmax(dim=-1)
                attn = self.attn_drop(attn)
                x = (attn @ v).transpose(1, 2).reshape(B, N, C)
                x = self.proj(x)
                x = self.proj_drop(x)
                return (x, attn)
    
    model = Attention(**INIT_ARGS)
    output = model(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
DistillationLoss Ran
ran on a synthesized input · constructed an object; no result was computed
hustvl/vim/vim/losses.py
code served (permissive licence) · get_code("b42ba639d4f94082")
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, DistillationLoss: 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)

# Base criterion - standard cross entropy loss
base_criterion = nn.CrossEntropyLoss()

# Teacher model - simple neural network that outputs logits
class TeacherModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.fc(x)

teacher_model = TeacherModel()

# Distillation type
distillation_type = 'soft'

# Alpha parameter (weight for distillation loss)
alpha = 0.5

# Temperature parameter for soft distillation
tau = 4.0

ARGS = {
    'base_criterion': base_criterion,
    'teacher_model': teacher_model,
    'distillation_type': distillation_type,
    'alpha': alpha,
    'tau': tau
}
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 DistillationLoss — 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 DistillationLoss 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
DistilledVisionTransformer Ran
ran on a synthesized input
holdfire/FAS/models/deit.py
pointer only (licence: NONE) · get_code("fee0f891e0558ff8")
How it ran

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

DropPath Ran
ran on a synthesized input
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("c713760d26bf0a45")
How it ran

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

import torch
import torch.nn as nn

def drop_path(x, drop_prob: float=0.0, training: bool=False):
    if drop_prob == 0.0 or not training:
        return x
    keep_prob = 1 - drop_prob
    shape = (x.shape[0],) + (1,) * (x.ndim - 1)
    random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x.device)
    random_tensor.floor_()
    output = x.div(keep_prob) * random_tensor
    return output

class DropPath(nn.Module):
    """Drop paths (Stochastic Depth) per sample  (when applied in main path of residual blocks).
    """

    def __init__(self, drop_prob=None):
        super(DropPath, self).__init__()
        self.drop_prob = drop_prob

    def forward(self, x):
        return drop_path(x, self.drop_prob, self.training)

    def extra_repr(self):
        return 'p={}'.format(self.drop_prob)


INIT_ARGS = {
    'drop_prob': 0.2
}

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

if __name__ == '__main__':
    model = DropPath(**INIT_ARGS)
    model.train()
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"DropPath module: {model}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Encoder Ran
ran on a synthesized input
moein-shariatnia/Pix2Seq/model.py
code served (permissive licence) · get_code("e089d779e4638b42")
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 numpy as np
from torch import nn
import timm

# Stand-in for timm.create_model to avoid actual model download
class MockTimmModel(nn.Module):
    def __init__(self, model_name, num_classes=0, global_pool='', pretrained=False):
        super().__init__()
        # Mock a small transformer-like model with tiny dimensions
        self.patch_embed = nn.Conv2d(3, 4, kernel_size=16, stride=16)
        self.pos_embed = nn.Parameter(torch.randn(1, 5, 4))  # 5 patches (1 cls + 4)
        self.blocks = nn.Sequential(
            nn.LayerNorm(4),
            nn.Linear(4, 4),
            nn.GELU(),
            nn.Linear(4, 4)
        )
        self.norm = nn.LayerNorm(4)

    def forward(self, x):
        x = self.patch_embed(x)  # [2, 3, 32, 32] -> [2, 4, 2, 2]
        x = x.flatten(2).transpose(1, 2)  # [2, 4, 4]
        cls_token = torch.zeros(2, 1, 4)  # Mock cls token
        x = torch.cat([cls_token, x], dim=1)  # [2, 5, 4]
        x = x + self.pos_embed
        x = self.blocks(x)
        x = self.norm(x)
        return x

# Patch timm.create_model to return our mock
timm.create_model = MockTimmModel

INIT_ARGS = {
    'model_name': 'deit3_small_patch16_384_in21ft1k',
    'pretrained': False,
    'out_dim': 3
}

ARGS = {
    'x': torch.randn(2, 3, 32, 32)  # batch=2, channels=3, H=W=32
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, timm, 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)
Mlp Ran
ran on a synthesized input
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("64505a0b6aa5e3d4")
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; 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

class Mlp(nn.Module):
    """ Multilayer perceptron.
    Parameters:
        act_layer: Specify the activate function, default use nn.GELU.
    """

    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x

INIT_ARGS = {
    'in_features': 4,
    'hidden_features': 6,
    'out_features': 5,
    'act_layer': nn.GELU,
    'drop': 0.1
}

ARGS = {
    'x': torch.randn(2, 4)
}
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 — 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)
MultiHeadSelfAttention Ran
ran on a synthesized input
omihub777/vit-cifar/dw_vit.py
code served (permissive licence) · get_code("295ab55989f9e8fe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 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 torch
import torch.nn as nn
import torch.nn.functional as F

class MultiHeadSelfAttention(nn.Module):

    def __init__(self, feats: int, head: int=8, dropout: float=0.0):
        super(MultiHeadSelfAttention, self).__init__()
        self.head = head
        self.feats = feats
        self.sqrt_d = self.feats ** 0.5
        self.q = nn.Linear(feats, feats)
        self.k = nn.Linear(feats, feats)
        self.v = nn.Linear(feats, feats)
        self.o = nn.Linear(feats, feats)
        self.dropout = nn.Dropout(dropout)

    def forward(self, x):
        b, n, f = x.size()
        q = self.q(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        k = self.k(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        v = self.v(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        score = F.softmax(torch.einsum('bhif, bhjf->bhij', q, k) / self.sqrt_d, dim=-1)
        attn = torch.einsum('bhij, bhjf->bihf', score, v)
        o = self.dropout(self.o(attn.flatten(2)))
        return o


INIT_ARGS = {
    'feats': 8,
    'head': 2,
    'dropout': 0.1,
}

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

if __name__ == '__main__':
    model = MultiHeadSelfAttention(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — 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, 8) — shape (2, 3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TransformerEncoder Ran
ran on a synthesized input
omihub777/vit-cifar/dw_vit.py
code served (permissive licence) · get_code("9e38671b1e2518ec")
How it ran

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

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

class MultiHeadSelfAttention(nn.Module):

    def __init__(self, feats: int, head: int=8, dropout: float=0.0):
        super(MultiHeadSelfAttention, self).__init__()
        self.head = head
        self.feats = feats
        self.sqrt_d = self.feats ** 0.5
        self.q = nn.Linear(feats, feats)
        self.k = nn.Linear(feats, feats)
        self.v = nn.Linear(feats, feats)
        self.o = nn.Linear(feats, feats)
        self.dropout = nn.Dropout(dropout)

    def forward(self, x):
        b, n, f = x.size()
        q = self.q(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        k = self.k(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        v = self.v(x).view(b, n, self.head, self.feats // self.head).transpose(1, 2)
        score = F.softmax(torch.einsum('bhif, bhjf->bhij', q, k) / self.sqrt_d, dim=-1)
        attn = torch.einsum('bhij, bhjf->bihf', score, v)
        o = self.dropout(self.o(attn.flatten(2)))
        return o

class TransformerEncoder(nn.Module):

    def __init__(self, feats: int, mlp_hidden: int, head: int=8, dropout: float=0.0):
        super(TransformerEncoder, self).__init__()
        self.la1 = nn.LayerNorm(feats)
        self.msa = MultiHeadSelfAttention(feats, head=head, dropout=dropout)
        self.la2 = nn.LayerNorm(feats)
        self.mlp = nn.Sequential(nn.Linear(feats, mlp_hidden), nn.GELU(), nn.Dropout(dropout), nn.Linear(mlp_hidden, feats), nn.GELU(), nn.Dropout(dropout))

    def forward(self, x):
        out = self.msa(self.la1(x)) + x
        out = self.mlp(self.la2(out)) + out
        return out


INIT_ARGS = {
    'feats': 4,
    'mlp_hidden': 8,
    'head': 2,
    'dropout': 0.1
}

ARGS = {
    'x': torch.randn(2, 3, 4)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_no_grad_trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("5bcbd988b672cf32")
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 to be filled with truncated normal values
tensor = torch.empty(2, 4)

# Define parameters for truncated normal distribution
mean = 0.0
std = 1.0
a = -2.0  # lower bound
b = 2.0   # upper bound

ARGS = {
    "tensor": tensor,
    "mean": mean,
    "std": std,
    "a": a,
    "b": b,
}
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
con_loss Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from TACJu/TransFG
pointer only · get_code("c1c79ef7fd065038")
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.

hydra Ran
ran; our contract draft was wrong, not the code
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("c4a17f13fadc2630")
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, 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

torch.manual_seed(0)

# The function takes q, k, v which are all tensors of shape [batch, tokens, features]
# Let's create small tensors with distinct dimensions:
# batch=2, tokens=3, features=4

batch_size = 2
num_tokens = 3
num_features = 4

q = torch.randn(batch_size, num_tokens, num_features)
k = torch.randn(batch_size, num_tokens, num_features)
v = torch.randn(batch_size, num_tokens, num_features)

ARGS = {
    "q": q,
    "k": k,
    "v": v,
}
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, 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
trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("462cf9fa4898bc51")
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 to be initialized
tensor = torch.empty(2, 4)

# Define arguments for trunc_normal_
ARGS = {
    'tensor': tensor,
    'mean': 0.0,
    'std': 1.0,
    'a': -2.0,
    'b': 2.0
}
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
Block Not yet run
unverified (harvested, no recorded run)
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("bc7c311c2770067a")
How it ran

no invocation recorded.

DeiT Not yet run
unverified (harvested, no recorded run)
UdbhavPrasad072300/Transformer-Implementations/transformer_package/models/transformer.py
code served (permissive licence) · get_code("4eae8cfd26a7bed5")
How it ran

no invocation recorded.

DepthwiseViT Not yet run
unverified (harvested, no recorded run)
omihub777/vit-cifar/dw_vit.py
code served (permissive licence) · get_code("fa8c4e7bc2b8d354")
How it ran

no invocation recorded.

DistilledVisionTransformer Not yet run
unverified (harvested, no recorded run)
asrafulashiq/deit-custom/models.py
code served (permissive licence) · get_code("2de7c7e2fe313b48")
How it ran

no invocation recorded.

ValueError Not yet run
unverified (harvested, no recorded run)
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("c152c68202903a9f")
How it ran

no invocation recorded.

VisionTransformer Not yet run
unverified (harvested, no recorded run)
alibaba/EasyCV/easycv/models/backbones/vision_transformer.py
code served (permissive licence) · get_code("a4ea24ce126312f8")
How it ran

no invocation recorded.

_add_distilation_arguments Not yet run
unverified (harvested, no recorded run)
code-implementation1/Code1/DeiT/src/args.py
pointer only (licence: NONE) · get_code("d90ec8f4e83b1d6a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, code-implementation1/Code1 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. No invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 4 later) and 15 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
trunc_normal_
brick of this paper's assembly: helper
160 other papers
4 dated earlier, 156 later · 36 only as an assembly brick
1911.10194 (2019-11)
Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation
2005.10242 (2020-05)
Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere
2007.12911 (2020-07)
Tighter risk certificates for neural networks
and 157 more not named here
Mlp
brick of this paper's assembly: helper
130 other papers
2 dated earlier, 128 later · 114 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2101.11986 (2021-01)
Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet
and 127 more not named here
DropPath
brick of this paper's assembly: helper
2 other papers
2 later · 1 only as an assembly brick
2204.12484 (2022-04)
ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation
2303.05675 (2023-03)
HumanBench: Towards General Human-centric Perception with Projector Assisted Pretraining
con_loss
brick of this paper's assembly: entry
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.07976 (2021-03)
TransFG: A Transformer Architecture for Fine-grained Recognition

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

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

Recently, neural networks purely based on attention were shown to address image understanding tasks such as image classification. These highperforming vision transformers are pre-trained with hundreds of millions of images using a large infrastructure, thereby limiting their adoption. In this work, we produce competitive convolution-free transformers by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop) on ImageNet with no external data. More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation token ensuring that the student learns from the teacher through attention. We show the interest of this token-based distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and models.

For agents

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

get_harvested_code_for_paper("2012.12877")
get_code_for_paper("2012.12877")
have("2012.12877")

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

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

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

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

Connect an agent — have() is free.