SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.15358 · ICCV · 2021

Multi-Scale Vision Longformer: A New Vision Transformer for High-Resolution Image Encoding

Jianfeng Gao, Lei Zhang, Lu Yuan, Xiyang Dai, Jianwei Yang, Pengchuan Zhang, Bin Xiao

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 (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 2 violated it and 2 have no contract verdict; 3 failures 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/2103.15358.json · badge: /api/ran/2103.15358.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
microsoft/vision-longformer canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
microsoft/VisionLongformerForObjectDetection community (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
default Ran
ran, violated the contract we drafted
microsoft/VisionLongformerForObjectDetection/msvit/performer.py
pointer only (licence: MIT); the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("60fff7c3c400d7ff")
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 ThomasMrY/VCT, 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.

exists Ran
ran, violated the contract we drafted
microsoft/VisionLongformerForObjectDetection/msvit/performer.py
pointer only (licence: MIT); the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("aa5486a3650902d8")
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 ThomasMrY/VCT, 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.

find_modules Ran
ran; our contract draft was wrong, not the code
microsoft/vision-longformer/src/models/msvit.py
code served (permissive licence) · get_code("4e291c3ece372165")
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 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)

# Create a simple neural network module with various layer types
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 8, kernel_size=3)
        self.bn1 = nn.BatchNorm2d(8)
        self.relu = nn.ReLU()
        self.linear1 = nn.Linear(8, 4)
        self.linear2 = nn.Linear(4, 2)
        self.dropout = nn.Dropout(0.5)
        
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = x.view(x.size(0), -1)
        x = self.linear1(x)
        x = self.dropout(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

# The function looks for modules of a specific type
# We'll search for Linear modules
module_type = nn.Linear

ARGS = {
    'nn_module': model,
    'type': module_type
}
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 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
get_module_device Ran
ran; our contract draft was wrong, not the code
microsoft/vision-longformer/src/models/msvit.py
code served (permissive licence) · get_code("f8ef5ca2539fcee5")
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 device. 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)

# Create a simple nn.Module with parameters
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

module = SimpleModule()

ARGS = {
    "module": module
}
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 device — a device output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a device 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
init_ Ran
ran, honoured the contract we drafted
microsoft/vision-longformer/src/models/msvit.py
code served (permissive licence) · get_code("3444251df88e6169")
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 2, dtype family float, shape (2, 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
import math

torch.manual_seed(0)

tensor = torch.randn(2, 4)

ARGS = {
    "tensor": tensor
}
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 2, dtype family float, shape (2, 4) — shape (2, 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
resize_pos_embed_1d Ran
ran on a synthesized input
microsoft/VisionLongformerForObjectDetection/converter.py
code served (permissive licence) · get_code("0b417de020bf073b")
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 (2, 8, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small positional embedding tensor
# Shape: (batch_size, num_tokens, embedding_dim)
posemb = torch.randn(2, 5, 4)

# Create shape_new as a tuple representing the new shape
# Should have at least 2 elements (the function accesses shape_new[1])
shape_new = (2, 8)

ARGS = {
    "posemb": posemb,
    "shape_new": shape_new,
}
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 (2, 8, 4) — shape (2, 8, 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
resize_pos_embed_2d Ran
ran on a synthesized input
microsoft/VisionLongformerForObjectDetection/converter.py
code served (permissive licence) · get_code("3d16b011ef55503e")
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 2, dtype family float, shape (9, 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 math
import torch

torch.manual_seed(0)

# The function resizes positional embeddings in 2D.
# posemb: a 1D tensor of shape (ntok_old, embed_dim) where ntok_old must be a perfect square
# shape_new: a tuple/list where shape_new[0] is ntok_new, which must also be a perfect square

# Create a positional embedding tensor
# Let's use a 4x4=16 token grid with embedding dim 8
posemb = torch.randn(16, 8)

# Create shape_new with a different grid size (3x3=9 tokens)
shape_new = (9, 8)

ARGS = {
    "posemb": posemb,
    "shape_new": shape_new,
}
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 2, dtype family float, shape (9, 8) — shape (9, 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
softmax_kernel Ran
ran; our contract draft was wrong, not the code
microsoft/VisionLongformerForObjectDetection/msvit/performer.py
code served (permissive licence) · get_code("757aee54843af070")
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, 3, 4, 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
from einops import rearrange, repeat

torch.manual_seed(0)

# Create small test tensors
batch_size = 2
num_heads = 3
seq_len = 4
feature_dim = 5
projection_dim = 6

# data: shape (b, h, seq_len, feature_dim)
data = torch.randn(batch_size, num_heads, seq_len, feature_dim)

# projection_matrix: shape (projection_dim, feature_dim)
projection_matrix = torch.randn(projection_dim, feature_dim)

ARGS = {
    'data': data,
    'projection_matrix': projection_matrix,
    'is_query': True,
    'normalize_data': True,
    'eps': 0.0001,
    'device': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, 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, 6) — shape (2, 3, 4, 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
mask_invalid_locations Not yet run
unverified (harvested, no recorded run)
microsoft/VisionLongformerForObjectDetection/msvit/slidingchunk_2d.py
code served (permissive licence) · get_code("ca8f2c57ed27ae92")
How it ran

no invocation recorded.

slidingchunk_2dautograd Not yet run
unverified (harvested, no recorded run)
microsoft/VisionLongformerForObjectDetection/msvit/slidingchunk_2d.py
code served (permissive licence) · get_code("56b6ba9dcdd328f4")
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, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 2 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
exists 486 other papers
35 dated earlier, 5 the same month, 444 later, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
default 163 other papers
14 dated earlier, 4 the same month, 144 later, 1 undated · 27 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
1907.01470 (2019-07)
Augmenting Self-attention with Persistent Memory
and 160 more not named here
get_module_device 5 other papers
2 dated earlier, 3 later · 3 only as an assembly brick
2006.07733 (2020-06)
Bootstrap your own latent: A new approach to self-supervised Learning
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2206.12038 (2022-06)
BYOL-S: Learning Self-supervised Speech Representations by Bootstrapping
and 2 more not named here
find_modules 3 other papers
1 dated earlier, 2 later · 1 only as an assembly brick
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2108.12630 (2021-08)
GroupFormer: Group Activity Recognition with Clustered Spatial-Temporal Transformer
2401.16423 (2024-01)
Synchformer: Efficient Synchronization from Sparse Cues
init_ 2 other papers
1 dated earlier, 1 later
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2207.14676 (2022-07)
Global-Local Self-Distillation for Visual Representation Learning
softmax_kernel 2 other papers
1 dated earlier, 1 later
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2207.14676 (2022-07)
Global-Local Self-Distillation for Visual Representation Learning
mask_invalid_locations 1 other paper
1 dated earlier
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
slidingchunk_2dautograd 1 other paper
1 dated earlier
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions

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

This paper presents a new Vision Transformer (ViT) architecture Multi-Scale Vision Longformer, which significantly enhances the ViT of [12] for encoding highresolution images using two techniques. The first is the multi-scale model structure, which provides image encodings at multiple scales with manageable computational cost. The second is the attention mechanism of Vision Longformer, which is a variant of Longformer [3], originally developed for natural language processing, and achieves a linear complexity w.r.t. the number of input tokens. A comprehensive empirical study shows that the new ViT significantly outperforms several strong baselines, including the existing ViT models and their ResNet counterparts, and the Pyramid Vision Transformer from a concurrent work [47], on a range of vision tasks, including image classification, object detection, and segmentation. The models and source code are released at https://github.com/microsoft/visionlongformer.

For agents

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

get_harvested_code_for_paper("2103.15358")
get_code_for_paper("2103.15358")
have("2103.15358")

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

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

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

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

Connect an agent — have() is free.