SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 136810051 · ECCV · 2022

AMixer: Adaptive Weight Mixing for Self-Attention Free Vision Transformers

Yongming Rao, Wenliang Zhao, Jiwen Lu, Jie Zhou

Open in the Atlas

Code that ran

8 of 8 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; 2 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/136810051.json · badge: /api/ran/136810051.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
raoyongming/AMixer canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
build_dataset Ran
ran on a synthesized input
raoyongming/AMixer/datasets.py
code served (permissive licence) · get_code("f5676508e53925ba")
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 torch
import os
import tempfile
from torchvision import datasets, transforms
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
from timm.data import create_transform
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a temporary directory with minimal CIFAR-like structure
temp_dir = tempfile.mkdtemp()

# For CIFAR dataset simulation, we need to create the directory structure
cifar_path = os.path.join(temp_dir, 'cifar')
os.makedirs(cifar_path, exist_ok=True)

# For image_folder dataset simulation
image_folder_path = os.path.join(temp_dir, 'image_folder')
os.makedirs(os.path.join(image_folder_path, 'class_0'), exist_ok=True)
os.makedirs(os.path.join(image_folder_path, 'class_1'), exist_ok=True)

# Create minimal dummy images
for i in range(2):
    img = Image.fromarray(np.random.randint(0, 255, (32, 32, 3), dtype=np.uint8))
    img.save(os.path.join(image_folder_path, 'class_0', f'img_{i}.jpg'))
    img.save(os.path.join(image_folder_path, 'class_1', f'img_{i}.jpg'))

# For IMNET (ImageNet) dataset simulation
imnet_path = os.path.join(temp_dir, 'imnet')
os.makedirs(os.path.join(imnet_path, 'train', 'class_0'), exist_ok=True)
os.makedirs(os.path.join(imnet_path, 'val', 'class_0'), exist_ok=True)

for i in range(2):
    img = Image.fromarray(np.random.randint(0, 255, (224, 224, 3), dtype=np.uint8))
    img.save(os.path.join(imnet_path, 'train', 'class_0', f'img_{i}.jpg'))
    img.save(os.path.join(imnet_path, 'val', 'class_0', f'img_{i}.jpg'))

# Create args object as a simple class
class Args:
    def __init__(self):
        self.input_size = 224
        self.imagenet_default_mean_and_std = True
        self.color_jitter = 0.4
        self.aa = 'rand-m9-mstd0.5-inc1'
        self.train_interpolation = 'bicubic'
        self.reprob = 0.25
        self.remode = 'pixel'
        self.recount = 1
        self.crop_pct = None
        self.data_set = 'image_folder'
        self.data_path = image_folder_path
        self.eval_data_path = image_folder_path
        self.nb_classes = None

ARGS = {
    'is_train': True,
    'args': Args()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, timm, torch, torchvision — 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
build_transform Ran
ran; our contract draft was wrong, not the code
raoyongming/AMixer/datasets.py
pointer only (licence: MIT); the stored copy get_code serves, from techmonsterwang/illama, is pointer only (licence: NONE) · get_code("6a0317bfd6be9557")
How it ran

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

cosine_scheduler Ran
ran, honoured the contract we drafted
raoyongming/AMixer/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from boyazeng/understand_bias, is pointer only (licence: NONE) · get_code("b700fb0a3496b255")
How it ran

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

get_num_layer_for_hornet Ran
ran on a synthesized input
raoyongming/AMixer/optim_factory.py
code served (permissive licence) · get_code("f927688aac4ba833")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function get_num_layer_for_hornet takes a single parameter: var_name
# It's a string that represents a variable name in a model architecture
# The function parses this string to determine layer groupings

# Test with various valid var_name formats that the function handles:
var_name_downsample_0 = 'downsample_layers.0.conv'
var_name_downsample_1 = 'downsample_layers.1.norm'
var_name_downsample_3 = 'downsample_layers.3.weight'
var_name_stages_0_0 = 'stages.0.0.mlp'
var_name_stages_2_5 = 'stages.2.5.norm'
var_name_stages_3_1 = 'stages.3.1.weight'
var_name_other = 'backbone.layer1'

# We'll use one representative example for ARGS
ARGS = {
    'var_name': 'stages.2.5.norm'
}
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 int, ndim 0, dtype family int, 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
get_parameter_groups Ran
ran; our contract draft was wrong, not the code
raoyongming/AMixer/optim_factory.py
pointer only (licence: MIT); the stored copy get_code serves, from boyazeng/understand_bias, is pointer only (licence: NONE) · get_code("0ef0019514eaaa09")
How it ran

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

rfft_flop_jit Ran
ran, honoured the contract we drafted
raoyongming/AMixer/calc_flops.py
pointer only (licence: MIT); the stored copy get_code serves, from liuting20/sparse-tuning, is pointer only (licence: NONE) · get_code("a78c001f6f0d381c")
How it ran

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

window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
raoyongming/AMixer/amixer_swin.py
code served (permissive licence) · get_code("f9fd6241d935f07b")
How it ran

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

import torch

torch.manual_seed(0)

# Create a tensor with shape (B, H, W, C)
# B = 2 (batch size)
# H = 8 (height, must be divisible by window_size)
# W = 12 (width, must be divisible by window_size)
# C = 4 (channels)
# window_size = 4

B = 2
H = 8
W = 12
C = 4
window_size = 4

x = torch.randn(B, H, W, C)

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

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 8, 12, 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

torch.manual_seed(0)

# Define parameters
# We need windows of shape (num_windows*B, window_size, window_size, C)
# where num_windows = (H // window_size) * (W // window_size)

B = 2
H = 8
W = 12
window_size = 4
C = 6

# Calculate num_windows
num_windows_h = H // window_size  # 8 // 4 = 2
num_windows_w = W // window_size  # 12 // 4 = 3
num_windows = num_windows_h * num_windows_w  # 2 * 3 = 6

# Total number of windows across batch
total_windows = num_windows * B  # 6 * 2 = 12

# Create windows tensor
windows = torch.randn(total_windows, window_size, window_size, C)

ARGS = {
    'windows': windows,
    'window_size': window_size,
    'H': H,
    'W': W
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 8, 12, 6) — shape (2, 8, 12, 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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 6 later) and 2 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
29 dated earlier, 154 later, 44 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
27 dated earlier, 155 later, 41 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
cosine_scheduler 26 other papers
1 dated earlier, 21 later, 4 same year, order not determinable
1905.02244 (2019-05)
Searching for MobileNetV3
136860514 (2022 (year only))
SLIP: Self-supervision meets Language-Image Pre-training
2206.02967 (2022-06)
Masked Unsupervised Self-training for Label-free Image Classification
and 23 more not named here
get_parameter_groups 18 other papers
1 dated earlier, 13 later, 4 same year, order not determinable
1905.02244 (2019-05)
Searching for MobileNetV3
136860514 (2022 (year only))
SLIP: Self-supervision meets Language-Image Pre-training
2211.05781 (2022-11)
Demystify Transformers & Convolutions in Modern Image Deep Networks
and 15 more not named here
build_transform 9 other papers
2 dated earlier, 6 later, 1 same year, order not determinable
1905.02244 (2019-05)
Searching for MobileNetV3
2105.13677 (2021-05)
ResT: An Efficient Transformer for Visual Recognition
2211.05781 (2022-11)
Demystify Transformers & Convolutions in Modern Image Deep Networks
and 6 more not named here
rfft_flop_jit 1 other paper
1 later
2405.14700 (2024-05)
Sparse-Tuning: Adapting Vision Transformers with Efficient Fine-tuning and Inference

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

Vision Transformers have shown state-of-the-art results for various visual recognition tasks. The dot-product self-attention mechanism that replaces convolution to mix spatial information is commonly recognized as the indispensable ingredient behind the success of vision Transformers. In this paper, we thoroughly investigate the key differences between vision Transformers and recent all-MLP models. Our empirical results show the superiority of vision Transformers mainly comes from the data-dependent token mixing strategy and the multi-head scheme instead of query-key interactions. Inspired by this observation, we propose a computationally and parametrically efficient operation named adaptive weight mixing to generate attention weights without token-token interactions. Based on this operation, we develop a new architecture named as AMixer to capture both long-term and short-term spatial dependencies without self-attention. Extensive experiments demonstrate that our adaptive weight mixing is more efficient and effective than previous weight generation methods and our AMixer can achieve a better trade-off between accuracy and complexity than vision Transformers and MLP models on both ImageNet and downstream tasks. Code is available at https://github.com/raoyongming/AMixer.

For agents

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

get_harvested_code_for_paper("136810051")
get_code_for_paper("136810051")
have("136810051")

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

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

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

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

Connect an agent — have() is free.