SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.10852 · ICLR · 2022

Pix2seq: A Language Modeling Framework for Object Detection

Ting Chen, Geoffrey Hinton, David Fleet, Lala Li, Saurabh Saxena

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 2 violated it and 3 have no contract verdict; 4 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/2109.10852.json · badge: /api/ran/2109.10852.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
gaopengcuhk/Unofficial-Pix2Seq community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
volgachen/Pix2Seq_Pytorch community
Papers with Code archive
2 ran · 0 no recorded run
gaopengcuhk/Pretrained-Pix2Seq community
Papers with Code archive
1 ran · 1 no recorded run
gaopengcuhk/Stable-Pix2Seq community
Papers with Code archive
1 ran · 0 no recorded run
moein-shariatnia/Pix2Seq community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
DETR Ran
ran on a synthesized input · constructed an object; no result was computed
gaopengcuhk/Stable-Pix2Seq/models/detr.py
code served (permissive licence) · get_code("2630ab8a095c33dd")
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, DETR: 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 torch import Tensor
from typing import Optional, List

torch.manual_seed(0)

# Define a minimal backbone
class MinimalBackbone(nn.Module):
    def __init__(self):
        super().__init__()
        self.num_channels = 8
        self.conv = nn.Conv2d(3, self.num_channels, kernel_size=3, padding=1)
    
    def forward(self, x):
        return self.conv(x)

# Define a minimal transformer
class MinimalTransformer(nn.Module):
    def __init__(self, d_model=16, nhead=2, num_decoder_layers=2):
        super().__init__()
        self.d_model = d_model
        self.nhead = nhead
        encoder_layer = nn.TransformerEncoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=32, batch_first=True)
        self.encoder = nn.TransformerEncoder(encoder_layer, num_layers=1)
        decoder_layer = nn.TransformerDecoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=32, batch_first=True)
        self.decoder = nn.TransformerDecoder(decoder_layer, num_layers=num_decoder_layers)
        self.query_embed = nn.Embedding(100, d_model)
    
    def forward(self, src, mask, query_embed, pos):
        return self.decoder(query_embed, self.encoder(src, src_key_padding_mask=mask))

# Define NestedTensor class
class NestedTensor(object):
    def __init__(self, tensors, mask: Optional[Tensor]):
        self.tensors = tensors
        self.mask = mask

    def to(self, device):
        cast_tensor = self.tensors.to(device)
        mask = self.mask
        if mask is not None:
            cast_mask = mask.to(device)
        else:
            cast_mask = None
        return NestedTensor(cast_tensor, cast_mask)

    def decompose(self):
        return (self.tensors, self.mask)

# Define MLP class
class MLP(nn.Module):
    def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
        super().__init__()
        self.num_layers = num_layers
        h = [hidden_dim] * (num_layers - 1)
        self.layers = nn.ModuleList((nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim])))

    def forward(self, x):
        for i, layer in enumerate(self.layers):
            x = torch.nn.functional.relu(layer(x)) if i < self.num_layers - 1 else layer(x)
        return x

# Define DETR class
class DETR(nn.Module):
    def __init__(self, backbone, transformer, num_classes, num_queries, aux_loss=False):
        super().__init__()
        self.num_queries = num_queries
        self.transformer = transformer
        hidden_dim = transformer.d_model
        self.vocab_embed = MLP(hidden_dim, hidden_dim, 2003, 3)
        self.input_proj = nn.Conv2d(backbone.num_channels, hidden_dim, kernel_size=1)
        self.backbone = backbone
        self.aux_loss = aux_loss

    def forward(self, samples: NestedTensor, sequence):
        pass

# Create minimal instances
backbone = MinimalBackbone()
transformer = MinimalTransformer(d_model=16, nhead=2, num_decoder_layers=2)

# Create a NestedTensor with batch_size=2, channels=3, height=4, width=5
batch_size = 2
tensor_data = torch.randn(batch_size, 3, 4, 5)
mask_data = torch.zeros(batch_size, 4, 5, dtype=torch.bool)
samples = NestedTensor(tensor_data, mask_data)

# Create a sequence (dummy input)
sequence = torch.randn(batch_size, 10, 16)

ARGS = {
    "backbone": backbone,
    "transformer": transformer,
    "num_classes": 10,
    "num_queries": 100,
    "aux_loss": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DETR — 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 DETR 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
EncoderDecoder Ran
ran on a synthesized input · constructed an object; no result was computed
moein-shariatnia/Pix2Seq/model.py
code served (permissive licence) · get_code("7261e3dde0bad885")
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, EncoderDecoder: 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)

# Define a minimal encoder that takes an image and outputs encoder_out
class MinimalEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, image):
        # image shape: (batch, 4)
        # output shape: (batch, 8)
        return self.linear(image)

# Define a minimal decoder that takes encoder_out and tgt, and has both forward and predict methods
class MinimalDecoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(8, 3)
    
    def forward(self, encoder_out, tgt):
        # encoder_out shape: (batch, 8)
        # tgt shape: (batch, 3)
        # output shape: (batch, 3)
        return self.linear(encoder_out)
    
    def predict(self, encoder_out, tgt):
        # Same as forward for this minimal implementation
        return self.linear(encoder_out)

# Create instances
encoder = MinimalEncoder()
decoder = MinimalDecoder()

# Create sample tensors
image = torch.randn(2, 4)  # batch size 2, image dimension 4
tgt = torch.randn(2, 3)   # batch size 2, target dimension 3

ARGS = {
    "encoder": encoder,
    "decoder": decoder
}
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 EncoderDecoder — 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 EncoderDecoder 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
Pix2Seq Ran
ran on a synthesized input · constructed an object; no result was computed
volgachen/Pix2Seq_Pytorch/playground/pix2seq/pix2seq.py
pointer only (licence: NONE) · get_code("600431a357e72cd6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, volgachen/Pix2Seq_Pytorch 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.

convert_to_xywh Ran
ran, honoured the contract we drafted
gaopengcuhk/Unofficial-Pix2Seq/datasets/coco_eval.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from yuhangzang/contextdet, is pointer only (licence: NOASSERTION) · get_code("f31a58bf6457ced5")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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.

dice_loss Ran
ran, violated the contract we drafted
gaopengcuhk/Unofficial-Pix2Seq/models/segmentation.py
pointer only (licence: Apache-2.0) · get_code("ac8fe530cdad4d8c")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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.

evaluate Ran
ran; our contract draft was wrong, not the code
gaopengcuhk/Unofficial-Pix2Seq/datasets/coco_eval.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from yuhangzang/contextdet, is pointer only (licence: NOASSERTION) · get_code("fe0ddcc2d420c9a0")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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.

generate_square_subsequent_mask Ran
ran, violated the contract we drafted
gaopengcuhk/Unofficial-Pix2Seq/models/transformer.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from chend-vl/instructocr, is pointer only (licence: NONE) · get_code("894b253f35765276")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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.

nested_tensor_from_tensor_list Ran
ran; our contract draft was wrong, not the code
volgachen/Pix2Seq_Pytorch/playground/pix2seq/pix2seq.py
pointer only (licence: NONE) · get_code("8542cf00e1274bb3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, volgachen/Pix2Seq_Pytorch 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.

nested_tensor_from_tensor_list Ran
ran; our contract draft was wrong, not the code
gaopengcuhk/Pretrained-Pix2Seq/playground/pix2seq/pix2seq.py
pointer only (licence: NONE) · get_code("9b0e434afd6ba1bb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gaopengcuhk/Pretrained-Pix2Seq 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.

sigmoid_focal_loss Ran
ran; our contract draft was wrong, not the code
gaopengcuhk/Unofficial-Pix2Seq/models/segmentation.py
pointer only (licence: Apache-2.0) · get_code("5c0711aada67957e")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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.

Pix2Seq Not yet run
unverified (harvested, no recorded run)
gaopengcuhk/Pretrained-Pix2Seq/playground/pix2seq/pix2seq.py
pointer only (licence: NONE) · get_code("6bddc92dacf1a610")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, gaopengcuhk/Pretrained-Pix2Seq 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. No invocation recorded.

build_transformer Not yet run
unverified (harvested, no recorded run)
gaopengcuhk/Unofficial-Pix2Seq/models/transformer.py
pointer only (licence: Apache-2.0) · get_code("cd17dcaf812b820d")
How it ran

The body of this sample is withheld: Apache-2.0, as GitHub detects it on this paper's repository, gaopengcuhk/Unofficial-Pix2Seq, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with 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. No invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 6 later) and 6 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
sigmoid_focal_loss 56 other papers
8 dated earlier, 48 later · 1 only as an assembly brick
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2103.11731 (2021-03)
Meta-DETR: Image-Level Few-Shot Object Detection with Inter-Class Correlation Exploitation
and 53 more not named here
dice_loss 40 other papers
7 dated earlier, 33 later · 1 only as an assembly brick
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2103.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
and 37 more not named here
build_transformer 32 other papers
8 dated earlier, 24 later
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2103.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
2104.04369 (2021-04)
Video-aided Unsupervised Grammar Induction
and 29 more not named here
convert_to_xywh 24 other papers
6 dated earlier, 18 later
1512.02325 (2015-12)
SSD: Single Shot MultiBox Detector
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2103.11731 (2021-03)
Meta-DETR: Image-Level Few-Shot Object Detection with Inter-Class Correlation Exploitation
and 21 more not named here
evaluate 23 other papers
6 dated earlier, 17 later
1512.02325 (2015-12)
SSD: Single Shot MultiBox Detector
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2103.11731 (2021-03)
Meta-DETR: Image-Level Few-Shot Object Detection with Inter-Class Correlation Exploitation
and 20 more not named here
generate_square_subsequent_mask 8 other papers
3 dated earlier, 5 later · 1 only as an assembly brick
2004.09144 (2020-04)
Transformer Reasoning Network for Image-Text Matching and Retrieval
2008.05231 (2020-08)
Fine-grained Visual Textual Alignment for Cross-Modal Retrieval using Transformer Encoders
2107.03377 (2021-07)
Long Short-Term Transformer for Online Action Detection
and 5 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

We present Pix2Seq, a simple and generic framework for object detection. Unlike existing approaches that explicitly integrate prior knowledge about the task, we cast object detection as a language modeling task conditioned on the observed pixel inputs. Object descriptions (e.g., bounding boxes and class labels) are expressed as sequences of discrete tokens, and we train a neural network to perceive the image and generate the desired sequence. Our approach is based mainly on the intuition that if a neural network knows about where and what the objects are, we just need to teach it how to read them out. Beyond the use of task-specific data augmentations, our approach makes minimal assumptions about the task, yet it achieves competitive results on the challenging COCO dataset, compared to highly specialized and well optimized detection algorithms.

For agents

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

get_harvested_code_for_paper("2109.10852")
get_code_for_paper("2109.10852")
have("2109.10852")

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

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

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

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

Connect an agent — have() is free.