In Natural Language Processing (NLP), large language models have successfully unified a massive variety of tasks—such as translation, summarization, and question answering—under a single text-in, text-out framework. Computer vision, however, has historically remained highly fragmented.
Because vision tasks have fundamentally different outputs (e.g., object detection requires bounding boxes, instance segmentation requires dense pixel masks, and keypoint detection requires specific coordinates), researchers have traditionally built highly specialized architectures like Mask R-CNN and designed complex, bespoke loss functions for each task.
This paper tackles this fragmentation by proposing a unified "pixel-to-sequence" interface for computer vision. By treating diverse tasks as a single sequence generation problem, the authors demonstrate that a single Transformer model with shared weights can achieve competitive performance across multiple core vision tasks without relying on specialized architectures or task-specific loss functions.
Methods: The Pixel-to-Sequence Framework
The authors extend the Pix2Seq framework, framing vision tasks as a translation problem: Pixels + Task Prompt $\rightarrow$ Sequence of discrete tokens.
Architecture and Tokenization
The model uses a standard encoder-decoder setup. A Vision Transformer (ViT-B) encodes the image pixels, and an autoregressive Transformer decoder generates the output sequence one token at a time.
The "secret sauce" of this approach is tokenization. To make diverse outputs look like language, continuous image coordinates are quantized into discrete tokens:
- Object Detection: Bounding boxes become a sequence of 5 tokens:
[ymin, xmin, ymax, xmax, class]. - Instance Segmentation: Instead of dense pixel grids, masks are represented as polygons. The polygon's vertices are converted into a sequence of coordinate tokens.
- Keypoints: Sequences of
(y, x)coordinates representing specific body parts. - Captioning: Standard text tokens.
Prompting and Training
All tasks share a single vocabulary of 35,000 tokens. To tell the model what to do, it is fed a short prompt (e.g., [Detect], [Segment], [Describe]).
The model is trained using a simple next-token prediction objective (maximizing likelihood via cross-entropy). This completely eliminates the need for task-specific loss functions like Focal Loss or bipartite matching. The authors use "batch mixing" to train the model jointly across all tasks simultaneously.
Key Insights
- No Task-Specific Priors Needed: The most surprising takeaway is that specialized inductive biases (like non-maximum suppression or region proposal networks) are not strictly necessary to solve complex localization tasks. Standard autoregressive next-token prediction is sufficient.
- A Universal Vocabulary Works: Bounding box coordinates, polygon vertices, and English words can all live harmoniously in the same discrete vocabulary space without confusing the model.
- Prompt-Driven Vision: Just like prompting a language model changes its behavior, prompting a vision model allows it to dynamically switch between outputting text, boxes, or polygons using the exact same output head.
- Polygons over Pixels: Framing segmentation as a sequence of polygon vertices is a clever workaround to avoid dense pixel prediction, allowing segmentation to fit neatly into the sequence-to-sequence paradigm.
Results
The model was trained and evaluated on the MS-COCO 2017 benchmark, which is ideal because a single image often contains ground-truth annotations for boxes, masks, keypoints, and captions simultaneously. Initial pre-training for object detection weights was done on Objects365.
A single multi-task model (132M parameters) trained simultaneously on all four tasks achieved highly competitive results against strong, specialized baselines. At a 1024x1024 image resolution, the unified multi-task model achieved:
- Object Detection: 46.5 AP (outperforming Faster R-CNN at 42.0 AP and DETR at 44.9 AP).
- Instance Segmentation: 38.2 AP (outperforming Mask R-CNN at 37.1 AP).
- Keypoint Detection: 64.8 AP (outperforming Mask R-CNN at 63.1 AP).
- Image Captioning: 34.9 BLEU (outperforming a specialized Transformer baseline at 34.3).
Furthermore, the multi-task model performed on par with, or slightly better than, single-task versions of the exact same architecture, proving that weight-sharing across diverse tasks does not degrade performance.
Limitations and Future Work
While highly flexible, the framework does have limitations. Because the model uses autoregressive decoding (generating one token at a time), inference can be slow. This is especially true for instance segmentation, where polygons require long sequences of tokens. Additionally, polygon-based segmentation can be noisy; to get clean masks, the authors had to sample multiple sequences during inference and average them, adding to the computational cost.
Future directions include exploring non-autoregressive sequence modeling to drastically speed up inference. The authors also note that the model would likely see massive benefits from scaling up both the parameter count and the pre-training data, such as utilizing large-scale image-text pairs.
Summary updated