SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.06446 · 2023

SpectFormer: Frequency and Attention is what you need in a Vision Transformer

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2304.06446.json · badge: /api/ran/2304.06446.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
Hazqeel09/ellzaf_ml reimplementation (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
build_finetune_optimizer Ran
ran; our contract draft was wrong, not the code
Hazqeel09/ellzaf_ml/ellzaf_ml/tools/build_optimizer.py
code served (permissive licence) · get_code("4a4c555b7cc644cc")
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 AdamW. 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
from functools import partial

torch.manual_seed(0)

class SimpleViTModel(nn.Module):
    """Minimal ViT-like model for testing"""
    def __init__(self):
        super().__init__()
        self.cls_token = nn.Parameter(torch.randn(1, 1, 4))
        self.pos_embed = nn.Parameter(torch.randn(1, 197, 4))
        self.patch_embed = nn.Linear(3, 4)
        self.blocks = nn.ModuleList([
            nn.Linear(4, 4) for _ in range(12)
        ])
        self.rel_pos_bias = nn.Linear(4, 4)
        self.head = nn.Linear(4, 10)
        
    def forward(self, x):
        return self.head(self.blocks[-1](x))
    
    def no_weight_decay(self):
        return {'cls_token', 'pos_embed'}
    
    def no_weight_decay_keywords(self):
        return {'rel_pos_bias'}


class SimpleCNNModel(nn.Module):
    """Minimal CNN-like model for testing"""
    def __init__(self):
        super().__init__()
        self.stem = nn.Conv2d(3, 4, 3)
        self.stages = nn.ModuleList([
            nn.Sequential(nn.Conv2d(4, 4, 3), nn.BatchNorm2d(4))
            for _ in range(4)
        ])
        self.head = nn.Linear(4, 10)
        
    def forward(self, x):
        x = self.stem(x)
        for stage in self.stages:
            x = stage(x)
        return self.head(x.mean(dim=[2, 3]))
    
    def no_weight_decay(self):
        return set()
    
    def no_weight_decay_keywords(self):
        return set()


ARGS = {
    'model': SimpleViTModel(),
    'lr': 1e-4,
    'distil': False,
    'vit': True,
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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_pretrain_optimizer Ran
ran; our contract draft was wrong, not the code
Hazqeel09/ellzaf_ml/ellzaf_ml/tools/build_optimizer.py
code served (permissive licence) · get_code("fb8ed2605c193c08")
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 AdamW. 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
from torch import optim as optim

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        self.bias_layer = nn.Linear(2, 1)
        
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        x = self.bias_layer(x)
        return x
    
    def no_weight_decay(self):
        return set()
    
    def no_weight_decay_keywords(self):
        return ()

model = SimpleModel()

ARGS = {
    'model': model,
    'lr': 0.001
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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
get_pretrain_param_groups Ran
ran; our contract draft was wrong, not the code
Hazqeel09/ellzaf_ml/ellzaf_ml/tools/build_optimizer.py
code served (permissive licence) · get_code("2089fe788b366d85")
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 list, 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        self.bias_param = nn.Parameter(torch.randn(2))
        self.norm = nn.LayerNorm(2)
        
    def forward(self, x):
        return self.norm(self.linear2(self.linear1(x)))

model = SimpleModel()

ARGS = {
    'model': model,
    'skip_list': ('linear1.weight',),
    'skip_keywords': ('norm',)
}
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 list, ndim 1, dtype family float — 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
pair Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from LINs-lab/DynMoE
pointer only · get_code("6ba8cee9f5daea41")
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.

posemb_sincos_2d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Hazqeel09/ellzaf_ml/ellzaf_ml/models/spectformer.py
code served (permissive licence) · get_code("17f6d223949a7e58")
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 (12, 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

torch.manual_seed(0)

# Create a small patches tensor
# Shape: (batch, height, width, dim)
# The function unpacks this as: _, h, w, dim, device, dtype = (*patches.shape, patches.device, patches.dtype)
patches = torch.randn(2, 3, 4, 8, dtype=torch.float32)

ARGS = {
    "patches": patches,
    "temperature": 10000,
    "dtype": torch.float32,
}
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 (12, 8) — shape (12, 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 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
pair 90 other papers
29 dated earlier, 58 later, 2 same year, order not determinable, 1 undated · 8 only as an assembly brick
2004.13649 (2020-04)
Image Augmentation Is All You Need: Regularizing Deep Reinforcement Learning from Pixels
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.15691 (2021-03)
ViViT: A Video Vision Transformer
and 87 more not named here
posemb_sincos_2d 5 other papers
3 dated earlier, 2 later
2110.09057 (2021-10)
Training Deep Neural Networks with Adaptive Momentum Inspired by the Quadratic Optimization
2204.00595 (2022-04)
Monarch: Expressive Structured Matrices for Efficient and Accurate Training
2205.03990 (2022-05)
Multi-resolution partial differential equations preserved learning framework for spatiotemporal dynamics
and 2 more not named here

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

Repositories linked to this paper

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

Abstract

Vision transformers have been applied successfully for image recognition tasks. There have been either multi-headed self-attention based (ViT \cite{dosovitskiy2020image}, DeIT, \cite{touvron2021training}) similar to the original work in textual models or more recently based on spectral layers (Fnet\cite{lee2021fnet}, GFNet\cite{rao2021global}, AFNO\cite{guibas2021efficient}). We hypothesize that both spectral and multi-headed attention plays a major role. We investigate this hypothesis through this work and observe that indeed combining spectral and multi-headed attention layers provides a better transformer architecture. We thus propose the novel Spectformer architecture for transformers that combines spectral and multi-headed attention layers. We believe that the resulting representation allows the transformer to capture the feature representation appropriately and it yields improved performance over other transformer representations. For instance, it improves the top-1 accuracy by 2\% on ImageNet compared to both GFNet-H and LiT. SpectFormer-S reaches 84.25\% top-1 accuracy on ImageNet-1K (state of the art for small version). Further, Spectformer-L achieves 85.7\% that is the state of the art for the comparable base version of the transformers. We further ensure that we obtain reasonable results in other scenarios such as transfer learning on standard datasets such as CIFAR-10, CIFAR-100, Oxford-IIIT-flower, and Standford Car datasets. We then investigate its use in downstream tasks such of object detection and instance segmentation on the MS-COCO dataset and observe that Spectformer shows consistent performance that is comparable to the best backbones and can be further optimized and improved. Hence, we believe that combined spectral and attention layers are what are needed for vision transformers.

For agents

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

get_harvested_code_for_paper("2304.06446")
get_code_for_paper("2304.06446")
have("2304.06446")

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

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

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

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

Connect an agent — have() is free.