SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.01915 · ICML · 2024

xT: Nested Tokenization for Larger Context in Large Images

Trevor Darrell, Jitendra Malik, Karttikeya Mangalam, Ritwik Gupta, Shufan Li, Tyler Zhu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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.01915.json · badge: /api/ran/2403.01915.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
bair-climate-initiative/xT marked official in Papers with Code
Papers with Code archive
7 ran · 4 no recorded run
FunctionStatusWhere it lives
AbstractModel Ran
ran on a synthesized input · constructed an object; no result was computed
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("d22a704c40119ed6")
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, AbstractModel: 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)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
        self.bn1 = nn.BatchNorm2d(16)
        self.conv_transpose1 = nn.ConvTranspose2d(16, 8, kernel_size=3, padding=1)
        self.bn2 = nn.BatchNorm2d(8)
    
    def forward(self, x):
        return x

model = SimpleModel()

ARGS = {}
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 AbstractModel — 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 AbstractModel 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
ClassificationDecoder Ran
ran on a synthesized input · constructed an object; no result was computed
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("e3ac9279f9b974ee")
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, ClassificationDecoder: 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)

class ClassificationDecoder(nn.Module):

    def __init__(self, in_dim, num_classes, mlp_ratio=4):
        super().__init__()
        self.layers = nn.Sequential(nn.Linear(in_dim, in_dim * mlp_ratio), nn.GELU(), nn.LayerNorm(in_dim * mlp_ratio), nn.Linear(in_dim * mlp_ratio, num_classes))

    def forward(self, enc_results, mem):
        xx = enc_results[-1]
        xx = xx.mean((-1, -2))
        logits = self.layers(xx)
        return {'label': logits}


# Create a small instance of the decoder
decoder = ClassificationDecoder(in_dim=4, num_classes=3, mlp_ratio=4)

# Create mock enc_results: list of tensors with shape (batch, height, width, channels)
# Using batch=2, height=5, width=6, channels=4
enc_results = [torch.randn(2, 5, 6, 4)]

# Create mock mem: can be None or any object since it's not used in forward
mem = None

ARGS = {
    'in_dim': 4,
    'num_classes': 3,
    'mlp_ratio': 4
}
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 ClassificationDecoder — 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 ClassificationDecoder 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
ContextEncoderConfig Ran
ran on a synthesized input · constructed an object; no result was computed
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("7b7827a7eeaca7c5")
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, ContextEncoderConfig: 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 dataclasses import dataclass

torch.manual_seed(0)

ARGS = {
    'enabled': True,
    'no_memory': False,
    'n_layer': 12,
    'hidden_size': 768,
    'mem_chip': 4,
    'num_heads': 8,
    'mlp_ratio': 4,
    'tiling': 'naive',
    'context_patch_len': 100,
    'skip_connection': False,
    'classification_mode': False,
    'grad_ratio': 1.0,
    'attention_method': 'hyper',
    'in_context_patches': -1,
}
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 ContextEncoderConfig — 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 ContextEncoderConfig 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
LlamaMLP Ran
ran on a synthesized input · constructed an object; no result was computed
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("5e4a5c0a25c89d9c")
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, LlamaMLP: 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
from torch import nn

torch.manual_seed(0)

ARGS = {
    "hidden_size": 4,
    "intermediate_size": 8,
}
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 LlamaMLP — 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 LlamaMLP 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
ViTAttention Ran
ran on a synthesized input · constructed an object; no result was computed
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("88f7eacf03f1d5b8")
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, ViTAttention: 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
from torch import nn

torch.manual_seed(0)

class ViTAttention(nn.Module):

    def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0, use_mask=False, **kwargs):
        super().__init__()
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.scale = qk_scale or head_dim ** (-0.5)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim)
        self.proj_drop = nn.Dropout(proj_drop)
        self.use_mask = use_mask
        if use_mask:
            self.att_mask = nn.Parameter(torch.Tensor(self.num_heads, 196, 196))

    def forward(self, x):
        B, N, C = x.shape
        qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = (qkv[0], qkv[1], qkv[2])
        attn = q @ k.transpose(-2, -1) * self.scale
        if self.use_mask:
            attn = attn * torch.sigmoid(self.att_mask).expand(B, -1, -1, -1)
        attn = attn.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x = (attn @ v).transpose(1, 2).reshape(B, N, C)
        x = self.proj(x)
        x = self.proj_drop(x)
        return x

ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'qk_scale': None,
    'attn_drop': 0.1,
    'proj_drop': 0.1,
    'use_mask': 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 ViTAttention — 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 ViTAttention 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_2d_sincos_pos_embed Ran
ran, honoured the contract we drafted
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("57beaaa0fe0fdf0d")
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 ndarray, ndim 2, dtype family float, shape (16, 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Define arguments for get_2d_sincos_pos_embed
ARGS = {
    "embed_dim": 8,      # Must be even; output dimension for each position
    "grid_size": 4,      # Height and width of the grid
    "cls_token": False,  # Whether to prepend a class token
    "i": 0,              # Row offset for grid
    "j": 0,              # Column offset for grid
}
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 ndarray, ndim 2, dtype family float, shape (16, 8) — shape (16, 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
get_2d_sincos_pos_embed_base Ran
ran, honoured the contract we drafted
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("8f00b8ca42062354")
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 ndarray, ndim 2, dtype family float, shape (16, 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 numpy as np

ARGS = {
    'embed_dim': 8,
    'grid_size': 4,
    'cls_token': False,
    'i': 0,
    'j': 0,
}
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 ndarray, ndim 2, dtype family float, shape (16, 8) — shape (16, 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
LLMAttention Not yet run
unverified (harvested, no recorded run)
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("13afd6063f6e370a")
How it ran

no invocation recorded.

LLMClassificationDecoder Not yet run
unverified (harvested, no recorded run)
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("5cc207b2201a86ca")
How it ran

no invocation recorded.

LLMLayer Not yet run
unverified (harvested, no recorded run)
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("a21b33d5b3eaac55")
How it ran

no invocation recorded.

xT Not yet run
unverified (harvested, no recorded run)
bair-climate-initiative/xT/xt/models/decoders/decoder.py
code served (permissive licence) · get_code("a6a3973adcfa45f7")
How it ran

no invocation recorded.

Also present in other papers' code

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

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

Modern computer vision pipelines handle large images in one of two sub-optimal ways: down-sampling or cropping. These two methods incur significant losses in the amount of information and context present in an image. There are many downstream applications in which global context matters as much as high frequency details, such as in real-world satellite imagery; in such cases researchers have to make the uncomfortable choice of which information to discard. We introduce xT, a simple framework for vision transformers which effectively aggregates global context with local details and can model large images end-to-end on contemporary GPUs. We select a set of benchmark datasets across classic vision tasks which accurately reflect a vision model's ability to understand truly large images and incorporate fine details over large scales and assess our method's improvement on them. xT is a streaming, two-stage architecture that adapts existing vision backbones and long sequence language models to effectively model large images without quadratic memory growth. We are able to increase accuracy by up to 8.6% on challenging classification tasks and F 1 score by 11.6 on context-dependent segmentation on images as large as 29,000 x 29,000 pixels. Code and pre-trained weights are available at https://github.com/bair-climate-initiative/xT. * Denotes co-first authorship. Co-first authors will prioritize their names on their resumes/websites.

For agents

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

get_harvested_code_for_paper("2403.01915")
get_code_for_paper("2403.01915")
have("2403.01915")

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

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

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

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

Connect an agent — have() is free.