SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.19963 · ICLR · 2024

Efficient Modulation for Vision Networks

Lu Yuan, Yun Fu, Xiyang Dai, Yinpeng Chen, Jianwei Yang, Bin Xiao, Xu Ma

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 2 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/2403.19963.json · badge: /api/ran/2403.19963.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
ma-xu/EfficientMod canonical (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
ma-xu/efficientmod community
Papers with Code archive
7 ran · 2 no recorded run
FunctionStatusWhere it lives
AttMlp Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("2ff8225772081e35")
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, AttMlp: 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

torch.manual_seed(0)

ARGS = {
    "in_features": 4,
    "hidden_features": 8,
    "out_features": 3,
    "act_layer": nn.GELU,
    "drop": 0.1,
    "bias": 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 AttMlp — 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 AttMlp 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
Attention Ran
ran on a synthesized input
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("99bce211812fcf7a")
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 torch.nn as nn

INIT_ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'qk_norm': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'norm_layer': nn.LayerNorm,
}

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

if __name__ == '__main__':
    attention = nn.Module.__new__(type('Attention', (nn.Module,), {}))
    
    from torch.jit import Final
    
    class Attention(nn.Module):
        fast_attn: Final[bool]

        def __init__(self, dim, num_heads=8, qkv_bias=False, qk_norm=False, attn_drop=0.0, proj_drop=0.0, norm_layer=nn.LayerNorm):
            super().__init__()
            self.num_heads = num_heads
            self.head_dim = max(dim // num_heads, 32)
            self.scale = self.head_dim ** (-0.5)
            self.fast_attn = hasattr(torch.nn.functional, 'scaled_dot_product_attention')
            self.qkv = nn.Linear(dim, self.num_heads * self.head_dim * 3, bias=qkv_bias)
            self.q_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
            self.k_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
            self.attn_drop = nn.Dropout(attn_drop)
            self.proj = nn.Linear(self.head_dim * self.num_heads, dim)
            self.proj_drop = nn.Dropout(proj_drop)

        def forward(self, x):
            B, N, C = x.shape
            qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, self.head_dim).permute(2, 0, 3, 1, 4)
            q, k, v = qkv.unbind(0)
            q, k = (self.q_norm(q), self.k_norm(k))
            if self.fast_attn:
                x = torch.nn.functional.scaled_dot_product_attention(q, k, v, dropout_p=self.attn_drop.p)
            else:
                q = q * self.scale
                attn = q @ k.transpose(-2, -1)
                attn = attn.softmax(dim=-1)
                attn = self.attn_drop(attn)
                x = attn @ v
            x = x.transpose(1, 2).reshape(B, N, self.head_dim * self.num_heads)
            x = self.proj(x)
            x = self.proj_drop(x)
            return x

    attention = Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
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 — 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)
AttentionBlock Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("5ae73134f2b7e9b1")
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, AttentionBlock: 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
from timm.models.layers import DropPath, to_2tuple, trunc_normal_

torch.manual_seed(0)

# Define ARGS dict with all parameters for AttentionBlock
ARGS = {
    'dim': 64,
    'mlp_ratio': 4.0,
    'num_heads': 8,
    'qkv_bias': False,
    'qk_norm': False,
    'drop': 0.1,
    'attn_drop': 0.1,
    'init_values': 1e-5,
    'drop_path': 0.1,
    'act_layer': nn.GELU,
    'norm_layer': nn.LayerNorm,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttentionBlock — 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 AttentionBlock 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
BasicBlock Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("6887a267109d28d9")
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, BasicBlock: 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
from timm.models.layers import DropPath

torch.manual_seed(0)

ARGS = {
    'dim': 64,
    'mlp_ratio': 4.0,
    'conv_in_mlp': True,
    'drop': 0.1,
    'drop_path': 0.0,
    'act_layer': nn.GELU,
    'norm_layer': nn.LayerNorm,
    'bias': True,
    'use_layerscale': False,
    'layerscale_value': 0.0001,
    'conv_group_dim': 4,
    'context_size': 3,
    'context_act': nn.GELU,
    'context_f': True,
    'context_g': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BasicBlock — 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 BasicBlock 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
ContextLayer Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("c1e8702680e54378")
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, ContextLayer: 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

torch.manual_seed(0)

ARGS = {
    'in_dim': 4,
    'conv_dim': 8,
    'context_size': [3, 5],
    'context_act': nn.GELU,
    'context_f': True,
    'context_g': 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 ContextLayer — 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 ContextLayer 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
Mlp Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("3e8438d23c4ccbd4")
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, Mlp: 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

torch.manual_seed(0)

ARGS = {
    "in_features": 4,
    "hidden_features": 8,
    "out_features": 4,
    "act_layer": nn.GELU,
    "drop": 0.1,
    "bias": True,
    "conv_in_mlp": True,
    "conv_group_dim": 2,
    "context_size": 3,
    "context_act": nn.GELU,
    "context_f": True,
    "context_g": 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 Mlp — 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 Mlp 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
PatchEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("3e63ec80a2ff03d6")
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, PatchEmbed: 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
from timm.models.layers import to_2tuple

torch.manual_seed(0)

# Build a minimal norm_layer that works with the embed_dim
class MinimalNorm(nn.Module):
    def __init__(self, num_features):
        super().__init__()
        self.num_features = num_features
    
    def forward(self, x):
        # x shape: [b, h', w', c']
        # LayerNorm typically normalizes over the last dimension
        return nn.functional.layer_norm(x, (self.num_features,))

ARGS = {
    'in_chans': 3,
    'embed_dim': 96,
    'patch_size': 4,
    'patch_stride': 4,
    'patch_pad': 0,
    'norm_layer': MinimalNorm,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchEmbed — 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 PatchEmbed 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
auto_resume_helper Ran
ran; our contract draft was wrong, not the code
ma-xu/EfficientMod/utils.py
code served (permissive licence) · get_code("029a68ef3211adb5")
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 str. 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 os
import tempfile
import shutil

# Create a temporary directory with test checkpoint files
temp_dir = tempfile.mkdtemp()

# Create some checkpoint files
with open(os.path.join(temp_dir, 'checkpoint_1.pth.tar'), 'w') as f:
    f.write('dummy')

with open(os.path.join(temp_dir, 'checkpoint_2.pth.tar'), 'w') as f:
    f.write('dummy')

with open(os.path.join(temp_dir, 'last.pth.tar'), 'w') as f:
    f.write('dummy')

with open(os.path.join(temp_dir, 'other_file.txt'), 'w') as f:
    f.write('dummy')

ARGS = {
    'output_dir': temp_dir
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
BasicLayer Not yet run
unverified (harvested, no recorded run)
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("fe615e0ee7a65ace")
How it ran

no invocation recorded.

EfficientMod Not yet run
unverified (harvested, no recorded run)
ma-xu/efficientmod/models/EfficientMod.py
code served (permissive licence) · get_code("82d62fad6aa593a2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 1 the same month, 0 later) and 9 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
auto_resume_helper 1 other paper
1 the same month
2403.19967 (2024-03)
Rewrite the Stars

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

In this work, we present efficient modulation, a novel design for efficient vision networks. We revisit the modulation mechanism, which operates input through convolutional context modeling and feature projection layers, and fuses features via element-wise multiplication and an MLP block. We demonstrate that the modulation mechanism is particularly well suited for efficient networks and further tailor the modulation design by proposing the efficient modulation (EfficientMod) block, which is considered the essential building block for our networks. Benefiting from the prominent representational ability of modulation mechanism and the proposed efficient design, our network can accomplish better trade-offs between accuracy and efficiency and set new state-of-the-art performance in the zoo of efficient networks. When integrating EfficientMod with the vanilla self-attention block, we obtain the hybrid architecture which further improves the performance without loss of efficiency. We carry out comprehensive experiments to verify Effi-cientMod's performance. With fewer parameters, our EfficientMod-s performs 0.6 top-1 accuracy better than EfficientFormerV2-s2 and is 25% faster on GPU, and 2.9 better than MobileViTv2-1.0 at the same GPU latency. Additionally, our method presents a notable improvement in downstream tasks, outperforming EfficientFormerV2-s by 3.6 mIoU on the ADE20K benchmark. Code and checkpoints are available at https://github.com/ma-xu/EfficientMod.

For agents

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

get_harvested_code_for_paper("2403.19963")
get_code_for_paper("2403.19963")
have("2403.19963")

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

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

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

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

Connect an agent — have() is free.