Abstract
The "AiT" (All in Tokens) framework unifies diverse computer vision tasks—such as depth estimation and instance segmentation—into a single, token-based output space. By representing complex visual outputs as "soft tokens" (probabilistic distributions over a codebook), the model handles both discrete labels and continuous values within a unified transformer architecture. AiT achieves state-of-the-art performance on the NYUv2 depth estimation benchmark and competitive results on COCO instance segmentation, bridging the gap between discrete and continuous visual representations.
Introduction
In Natural Language Processing (NLP), tasks are unified through a common interface: tokens in, tokens out. Conversely, Computer Vision (CV) has historically relied on task-specific output formats. Object detection requires coordinates and labels; semantic segmentation uses discrete maps; depth estimation produces continuous floating-point values. This fragmentation complicates the development of general-purpose visual solvers.
The "All in Tokens" (AiT) framework addresses this by treating every visual output as a sequence of tokens. By "NLP-ifying" computer vision, AiT allows a single transformer architecture to solve fundamentally different tasks without specialized output heads, moving closer to a universal visual solver.
The AiT Framework
The AiT architecture consists of three core components designed to bridge the gap between discrete tokenization and continuous visual data.
- VQ-VAE Tokenizer/Detokenizer: A lightweight Vector Quantized Variational Autoencoder (VQ-VAE) compresses task-specific outputs (e.g., depth maps or segmentation masks) into discrete tokens. The decoder then reconstructs the original output from these tokens.
- Transformer Task Solver: A standard encoder-decoder model (Swin Transformer encoder and Transformer decoder) takes an input image and predicts the corresponding sequence of tokens.
- Soft Tokens: Traditional VQ-VAEs use "hard" tokens, which can be brittle for continuous data. AiT introduces "soft tokens"—probability vectors representing a weighted average of codebook entries. This creates an interpolable, continuous space that significantly improves accuracy for regression-heavy tasks like depth estimation.
- Mask Augmentation: To improve robustness against missing or noisy data (common in depth sensors), AiT employs mask augmentation during VQ-VAE training. Randomly masking output patches teaches the model to complete missing geometric information effectively.
Key Insights
- Universal Quantization: Any visual task can be solved by a universal transformer if a VQ-VAE can be trained to reconstruct its output. This eliminates the need for custom architectural "heads."
- Soft Inference Benefits: Using weighted averages of predicted probabilities during inference allows the model to capture fine-grained nuances in continuous data that discrete rounding would lose. This is a "free lunch" in terms of performance gains during inference.
- Efficiency: A surprisingly small VQ-VAE (approx. 2M parameters) with a modest codebook (e.g., 128 entries) is sufficient to achieve state-of-the-art results, proving that massive codebooks are not always necessary for high-fidelity reconstruction.
Experimental Results
AiT was evaluated on two distinct benchmarks: NYUv2 for monocular depth estimation (continuous, fixed-length) and COCO 2017 for instance segmentation (discrete, variable-length).
On NYUv2, AiT set a new record with an RMSE of 0.275. On COCO, it achieved a competitive 34.2 mask mAP, demonstrating its versatility. Notably, while the primary focus was auto-regressive prediction, a parallel decoder variant performed slightly better for depth (0.275 vs 0.284 RMSE), suggesting flexibility in the choice of transformer decoder depending on the task requirements.
Conclusion and Future Work
AiT successfully demonstrates that a unified token-based output space is viable for diverse vision tasks. However, challenges remain regarding sequence length for complex scenes and performance trade-offs during joint multi-task training. Future research aims to extend this "All in Tokens" philosophy to tasks like optical flow and human pose estimation, further consolidating the visual task landscape into a single, unified paradigm.
Summary updated