SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.15269 · 2024

MambaIRv2: Attentive State Space Restoration

arXiv · PDF · 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 0 have no contract verdict; 6 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2411.15269.json · badge: /api/ran/2411.15269.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
csguoh/mambair canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/mambair/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("52d96aa31ed74a56")
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, 3, 4, 5) 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 tensor with batch size 2 and some feature dimensions
# Shape: (batch=2, channels=3, height=4, width=5) to have distinct dimensions
x = torch.randn(2, 3, 4, 5)

# drop_prob: probability of dropping a path (between 0 and 1)
drop_prob = 0.2

# training: boolean flag indicating if we're in training mode
training = True

ARGS = {
    'x': x,
    'drop_prob': drop_prob,
    'training': training
}
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, 3, 4, 5) — shape (2, 3, 4, 5) 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
flops_selective_scan_fn Ran
ran, honoured the contract we drafted
csguoh/mambair/analysis/utils_fvcore.py
code served (permissive licence) · get_code("5f390d616fb142ad")
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
import torch.nn as nn

torch.manual_seed(0)

# Analyzing the function:
# - B: batch size (int)
# - L: sequence length (int)
# - D: hidden dimension (int)
# - N: state dimension (int)
# - with_D: boolean flag
# - with_Z: boolean flag
# - with_complex: boolean flag (must be False)

# The function only uses these parameters in arithmetic operations,
# so we just need to provide valid integer and boolean values.

ARGS = {
    "B": 2,
    "L": 256,
    "D": 768,
    "N": 16,
    "with_D": True,
    "with_Z": False,
    "with_complex": False,
}
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
flops_selective_scan_ref Ran
ran, honoured the contract we drafted
csguoh/mambair/analysis/utils_fvcore.py
code served (permissive licence) · get_code("0b84e99fd1e93dd6")
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 float, 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 numpy as np

# ARGS dict for flops_selective_scan_ref
ARGS = {
    'B': 2,
    'L': 256,
    'D': 768,
    'N': 16,
    'with_D': True,
    'with_Z': False,
    'with_Group': True,
    'with_complex': False,
}
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 float, 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
img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/mambair/analysis/model_zoo/cat.py
code served (permissive licence) · get_code("15c613ecceb6aa71")
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 (16, 6, 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 small image tensor with shape (B, C, H, W)
# Using distinct sizes: B=2, C=4, H=8, W=6
img = torch.randn(2, 4, 8, 6)

# H_sp and W_sp are spatial partition sizes
# They must divide H and W evenly
# H=8, so H_sp can be 2, 4, or 8. Using H_sp=2
# W=6, so W_sp can be 2, 3, or 6. Using W_sp=3
H_sp = 2
W_sp = 3

ARGS = {
    "img": img,
    "H_sp": H_sp,
    "W_sp": W_sp,
}
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 (16, 6, 4) — shape (16, 6, 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
import_abspy Ran
ran; our contract draft was wrong, not the code
csguoh/mambair/analysis/utils_fvcore.py
code served (permissive licence) · get_code("e582f87a53fb23d4")
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 module. 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 sys
import tempfile
import importlib.util

# Create a temporary directory structure with a minimal module
temp_dir = tempfile.mkdtemp()
module_dir = os.path.join(temp_dir, 'classification')
os.makedirs(module_dir, exist_ok=True)

# Create a minimal 'models' module
models_file = os.path.join(module_dir, 'models.py')
with open(models_file, 'w') as f:
    f.write("# Minimal models module\nDUMMY_VAR = 42\n")

# Create __init__.py to make it a package
init_file = os.path.join(module_dir, '__init__.py')
with open(init_file, 'w') as f:
    f.write("")

ARGS = {
    'name': 'models',
    'path': module_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 module — a module output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a module 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_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/mambair/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("60363d0620f5778d")
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)
# h and w must be divisible by window_size
# Using distinct dimensions: b=2, h=8, w=12, c=4
# window_size=4 divides both h and w

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
csguoh/mambair/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("4f003e9ad9b7a7cb")
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  # 2
num_windows_w = w // window_size  # 3
num_windows = num_windows_h * num_windows_w  # 6

# Total number of windows across batch
total_windows = num_windows * b  # 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
windows2img Ran
ran; our contract draft was wrong, not the code
csguoh/mambair/analysis/model_zoo/cat.py
code served (permissive licence) · get_code("8cb23a62748d3b1c")
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 4, dtype family float, shape (2, 8, 8, 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

torch.manual_seed(0)

# Understand the function:
# - img_splits_hw: tensor of shape (B', N, C) where B' = B * (H/H_sp) * (W/W_sp)
# - H_sp, W_sp: spatial dimensions of each window
# - H, W: full image height and width
# - Returns reconstructed image of shape (B, H, W, C)

# Let's set concrete values:
# B = 2 (batch size)
# H = 8, W = 8 (full image dimensions)
# H_sp = 4, W_sp = 4 (window/patch dimensions)
# C = 3 (channels)

B = 2
H = 8
W = 8
H_sp = 4
W_sp = 4
C = 3

# Calculate B' (number of patches per batch)
# B' = B * (H/H_sp) * (W/W_sp) = 2 * (8/4) * (8/4) = 2 * 2 * 2 = 8
B_prime = B * (H // H_sp) * (W // W_sp)

# img_splits_hw shape: (B', N, C)
# where N = H_sp * W_sp = 4 * 4 = 16
N = H_sp * W_sp
img_splits_hw = torch.randn(B_prime, N, C)

ARGS = {
    "img_splits_hw": img_splits_hw,
    "H_sp": H_sp,
    "W_sp": W_sp,
    "H": H,
    "W": W,
}
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 4, dtype family float, shape (2, 8, 8, 3) — shape (2, 8, 8, 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: 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, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 1 the same month, 7 later) and 0 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
drop_path 224 other papers
186 dated earlier, 6 the same month, 24 later, 7 same year, order not determinable, 1 undated · 38 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2007.09384 (2020-07)
Multi-Scale Positive Sample Refinement for Few-Shot Object Detection
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
and 221 more not named here
img2windows 14 other papers
12 dated earlier, 1 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
12 dated earlier, 1 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
flops_selective_scan_fn 12 other papers
7 dated earlier, 5 later
2401.10166 (2024-01)
VMamba: Visual State Space Model
2402.15648 (2024-02)
MambaIR: A Simple Baseline for Image Restoration with State-Space Model
2403.17839 (2024-03)
ReMamber: Referring Image Segmentation with Mamba Twister
and 9 more not named here
window_partition 12 other papers
11 dated earlier, 1 later · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 9 more not named here
window_reverse 11 other papers
10 dated earlier, 1 later · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 8 more not named here
flops_selective_scan_ref 9 other papers
7 dated earlier, 2 later
2401.10166 (2024-01)
VMamba: Visual State Space Model
2402.15648 (2024-02)
MambaIR: A Simple Baseline for Image Restoration with State-Space Model
2403.09977 (2024-03)
EfficientVMamba: Atrous Selective Scan for Light Weight Visual Mamba
and 6 more not named here
import_abspy 1 other paper
1 dated earlier
2402.15648 (2024-02)
MambaIR: A Simple Baseline for Image Restoration with State-Space Model

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

Repositories linked to this paper

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

Abstract

The Mamba-based image restoration backbones have recently demonstrated significant potential in balancing global reception and computational efficiency. However, the inherent causal modeling limitation of Mamba, where each token depends solely on its predecessors in the scanned sequence, restricts the full utilization of pixels across the image and thus presents new challenges in image restoration. In this work, we propose MambaIRv2, which equips Mamba with the non-causal modeling ability similar to ViTs to reach the attentive state space restoration model. Specifically, the proposed attentive state-space equation allows to attend beyond the scanned sequence and facilitate image unfolding with just one single scan. Moreover, we further introduce a semantic-guided neighboring mechanism to encourage interaction between distant but similar pixels. Extensive experiments show our MambaIRv2 outperforms SRFormer by even 0.35dB PSNR for lightweight SR even with 9.3\% less parameters and suppresses HAT on classic SR by up to 0.29dB. Code is available at https://github.com/csguoh/MambaIR.

For agents

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

get_harvested_code_for_paper("2411.15269")
get_code_for_paper("2411.15269")
have("2411.15269")

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

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

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

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

Connect an agent — have() is free.