SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.11582 · ICML · 2024

SLAB: Efficient Transformers with Simplified Linear Attention and Progressive Re-parameterized Batch Normalization

Xinghao Chen, Yunhe Wang, Yehui Tang, Jialong Guo

arXiv · PDF · Open in the Atlas

Code that ran

13 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 9 failures of our instrument; 2 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-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.11582.json · badge: /api/ran/2405.11582.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
xinghaochen/slab canonical (classifier label)
classifier basis not recorded on the link
6 ran · 1 no recorded run
MS-P3/code4 community (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xinghaochen/slab/classification/models/slab_swin.py
pointer only (licence: NONE) · get_code("144d10b49baeb8a6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinghaochen/slab 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_scheduler Ran
ran; our contract draft was wrong, not the code
xinghaochen/slab/classification/lr_scheduler.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("07e8b4b487c0abb6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinghaochen/slab when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_logger Ran
ran; our contract draft was wrong, not the code
xinghaochen/slab/classification/logger.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("82e52feafbf040bb")
How it ran

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

img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xinghaochen/slab/classification/models/slab_cswin.py
pointer only (licence: NONE) · get_code("39b18f062e0cc6d9")
How it ran

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

merge Ran
ran; our contract draft was wrong, not the code
MS-P3/code4/DECO/model_utils/config.py
code served (permissive licence) · get_code("b9e24c3e3e0e88a7")
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 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 argparse

torch.manual_seed(0)

# Create a mock args object with some attributes
args = argparse.Namespace(
    learning_rate=0.001,
    batch_size=32,
    epochs=10,
    model_name="test_model",
    debug=True,
    seed=42
)

# Create a base configuration dictionary
cfg = {
    "default_lr": 0.0001,
    "default_batch": 16,
    "dataset": "cifar10"
}

ARGS = {
    "args": args,
    "cfg": cfg
}
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 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
negSamp Ran
ran on a synthesized input
MS-P3/code4/CIGF/DataHandler.py
code served (permissive licence) · get_code("84f996d9ed4e6952")
How it ran

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

import numpy as np

np.random.seed(0)

# temLabel: array-like that supports indexing with __getitem__ and has length
# The function checks temLabel[rdmItm] == 0 to filter negative samples
# We need mostly 0s with some non-zero values
temLabel = np.array([0, 0, 0, 0, 1, 0, 0, 0, 0, 0])

# sampSize: integer representing number of negative samples to collect
sampSize = 5

# nodeNum: integer representing total number of nodes to sample from
nodeNum = 10

ARGS = {
    "temLabel": temLabel,
    "sampSize": sampSize,
    "nodeNum": nodeNum
}
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 list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_cli_to_yaml Ran
ran; our contract draft was wrong, not the code
MS-P3/code4/DECO/model_utils/config.py
code served (permissive licence) · get_code("85b09f6f153fd5d3")
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 Namespace. 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 argparse
import ast

# Create a minimal parser to use as parent
parent_parser = argparse.ArgumentParser(add_help=False)

# Create base configuration dict with various types
cfg = {
    'learning_rate': 0.001,
    'epochs': 100,
    'batch_size': 32,
    'use_cuda': False,
    'model_name': 'resnet50',
    'dropout': 0.5,
    'seed': 42,
}

# Create helper dict with descriptions for some config items
helper = {
    'learning_rate': 'Learning rate for optimizer',
    'epochs': 'Number of training epochs',
    'batch_size': 'Batch size for training',
    'use_cuda': 'Whether to use CUDA',
    'model_name': 'Name of the model architecture',
}

# Create choices dict for some config items
choices = {
    'model_name': ['resnet50', 'resnet101', 'vgg16'],
}

# Path to default config
cfg_path = 'default_config.yaml'

ARGS = {
    'parser': parent_parser,
    'cfg': cfg,
    'helper': helper,
    'choices': choices,
    'cfg_path': cfg_path,
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
parse_yaml Ran
ran on a synthesized input
MS-P3/code4/DECO/model_utils/config.py
code served (permissive licence) · get_code("96a9939953d5992d")
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 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os
import yaml

# Create a temporary YAML file with valid config structure
temp_dir = tempfile.mkdtemp()
yaml_path = os.path.join(temp_dir, "config.yaml")

# Write a valid YAML file with 3 documents: config, helper, and choices
yaml_content = """
model: resnet50
learning_rate: 0.001
batch_size: 32
---
model: "Model architecture to use"
learning_rate: "Learning rate for optimization"
batch_size: "Batch size for training"
---
model: [resnet50, resnet101, vgg16]
learning_rate: [0.0001, 0.001, 0.01]
batch_size: [16, 32, 64]
"""

with open(yaml_path, 'w') as f:
    f.write(yaml_content)

ARGS = {
    "yaml_path": yaml_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
str2bool Ran
ran on a synthesized input
MS-P3/code4/D2Co/prepare_data.py
code served (permissive licence) · get_code("fceaa2d7c28f6761")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def str2bool(v):
    if v.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    else:
        raise ArgumentTypeError('Boolean value expected.')

ARGS = {
    'v': 'true'
}
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 bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
transToLsts Ran
ran on a synthesized input
MS-P3/code4/CIGF/DataHandler.py
code served (permissive licence) · get_code("68c1e936b1101784")
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. 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 numpy as np
import scipy.sparse as sp

# Create a small sparse matrix for testing
# Using a 4x3 matrix to have distinct dimensions
mat = np.array([
    [1.0, 0.0, 2.0],
    [0.0, 3.0, 0.0],
    [4.0, 0.0, 5.0],
    [0.0, 0.0, 1.0]
], dtype=np.float32)

ARGS = {
    "mat": mat,
    "mask": False,
    "norm": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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: none by the harness; any seed is in the setup block
transpose Ran
ran; our contract draft was wrong, not the code
MS-P3/code4/CIGF/DataHandler.py
code served (permissive licence) · get_code("1720c87bb3c19836")
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 csr_matrix. 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 scipy.sparse as sp
import numpy as np

# Create a small sparse matrix to transpose
# Using a 4x3 matrix (distinct dimensions)
data = np.array([1, 2, 3, 4, 5])
row = np.array([0, 1, 2, 3, 1])
col = np.array([0, 1, 2, 0, 2])
sparse_mat = sp.csr_matrix((data, (row, col)), shape=(4, 3))

ARGS = {
    "mat": sparse_mat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type csr_matrix — a csr_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a csr_matrix 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
window_reverse Ran
ran; our contract draft was wrong, not the code
xinghaochen/slab/classification/models/slab_swin.py
pointer only (licence: NONE) · get_code("61bf152e6a42a184")
How it ran

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

windows2img Ran
ran; our contract draft was wrong, not the code
xinghaochen/slab/classification/models/slab_cswin.py
pointer only (licence: NONE) · get_code("ab01fbfe58c75b08")
How it ran

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

getParam Not yet run
unverified (harvested, no recorded run)
MS-P3/code4/CIGF/Utils/NNLayers.py
code served (permissive licence) · get_code("aa92af09147be134")
How it ran

no invocation recorded.

get_config Not yet run
unverified (harvested, no recorded run)
xinghaochen/slab/classification/config.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("20681a9065c0a731")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinghaochen/slab 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 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 12 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 8 the same month, 7 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
window_reverse 227 other papers
173 dated earlier, 4 the same month, 41 later, 9 same year, order not determinable · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
window_partition 223 other papers
169 dated earlier, 4 the same month, 41 later, 9 same year, order not determinable · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
get_config 51 other papers
31 dated earlier, 4 the same month, 12 later, 4 same year, order not determinable
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03650 (2021-06)
Shuffle Transformer: Rethinking Spatial Shuffle for Vision Transformer
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
and 48 more not named here
merge 28 other papers
28 dated earlier
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 25 more not named here
parse_cli_to_yaml 20 other papers
20 dated earlier
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 17 more not named here
parse_yaml 15 other papers
15 dated earlier
1406.1078 (2014-06)
Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
and 12 more not named here
img2windows 14 other papers
10 dated earlier, 1 the same month, 2 later, 1 same year, order not determinable · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
windows2img 14 other papers
10 dated earlier, 1 the same month, 2 later, 1 same year, order not determinable · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
build_scheduler 13 other papers
7 dated earlier, 1 the same month, 3 later, 2 same year, order not determinable
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2307.06947 (2023-07)
Video-FocalNets: Spatio-Temporal Focal Modulation for Video Action Recognition
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
and 10 more not named here
create_logger 5 other papers
2 dated earlier, 2 later, 1 same year, order not determinable
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
2312.08874 (2023-12)
Agent Attention: On the Integration of Softmax and Linear Attention
00666 (2024 (year only))
AttnZero: Efficient Attention Discovery for Vision Transformers
and 2 more not named here
getParam 2 other papers
1 dated earlier, 1 the same month
2309.01103 (2023-09)
Multi-Relational Contrastive Learning for Recommendation
2405.20878 (2024-05)
SelfGNN: Self-Supervised Graph Neural Networks for Sequential Recommendation
transpose 1 other paper
1 the same month
2405.20878 (2024-05)
SelfGNN: Self-Supervised Graph Neural Networks for Sequential Recommendation

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

Repositories linked to this paper

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

Abstract

Transformers have become foundational architectures for both natural language and computer vision tasks. However, the high computational cost makes it quite challenging to deploy on resourceconstraint devices. This paper investigates the computational bottleneck modules of efficient transformer, i.e., normalization layers and attention modules. LayerNorm is commonly used in transformer architectures but is not computational friendly due to statistic calculation during inference. However, replacing LayerNorm with more efficient BatchNorm in transformer often leads to inferior performance and collapse in training. To address this problem, we propose a novel method named PRepBN to progressively replace Layer-Norm with re-parameterized BatchNorm in training. Moreover, we propose a simplified linear attention (SLA) module that is simple yet effective to achieve strong performance. Extensive experiments on image classification as well as object detection demonstrate the effectiveness of our proposed method. For example, our SLAB-Swin obtains 83.6% top-1 accuracy on ImageNet-1K with 16.2ms latency, which is 2.4ms less than that of Flatten-Swin with 0.1% higher accuracy. We also evaluated our method for language modeling task and obtain comparable performance and lower latency.

For agents

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

get_harvested_code_for_paper("2405.11582")
get_code_for_paper("2405.11582")
have("2405.11582")

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

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

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

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

Connect an agent — have() is free.