An Image is Worth More Than 16x16 Patches: Exploring Transformers on Individual Pixels

Duy Kien Nguyen, Mido Assran, Unnat Jain, Martin R. Oswald, Cees G. M. Snoek, Xinlei Chen

Introduction

Since the dawn of deep learning, computer vision has heavily relied on inductive biases. Convolutional Neural Networks (ConvNets) are hard-coded with "locality"—the assumption that neighboring pixels are more related than distant ones—using small kernels and spatial hierarchies. When Vision Transformers (ViTs) arrived, they relaxed these constraints but didn't abandon them entirely; they still "patchify" images into 16x16 blocks and often rely on manually designed 2D position embeddings.

This research challenges that fundamental assumption. By treating individual pixels as independent tokens in a vanilla Transformer, the authors demonstrate that models can achieve superior performance in classification, regression, and image generation without any built-in knowledge of the 2D image grid.

The "Locality-Free" Method

The researchers ask a radical question: Is locality actually necessary? If we strip away the 16x16 patches and the 2D spatial priors, can a Transformer learn to see just by looking at an unordered "bag of pixels"?

To test this, they implemented a "locality-free" Transformer. Instead of the standard ViT approach of projecting 16x16 patches into tokens, they treated every single pixel as an individual token (effectively $1 \times 1$ patches).

Architecture of the locality-free Transformer treating individual pixels as tokens.

To ensure the model had zero prior knowledge of the image structure, they employed:

  1. Learned Position Embeddings: Instead of using fixed sine-cosine functions that encode 2D coordinates, they used randomly initialized, learnable embeddings.
  2. Vanilla Architecture: They used a standard Transformer encoder (and a Diffusion Transformer for generation tasks) without any modifications to handle spatial data.
  3. Permutation Tests: To prove the model wasn't "cheating" via some hidden spatial bias, they conducted experiments where they randomly permuted (shuffled) pixels before feeding them into the model, proving that patchification imposes a much stricter spatial prior than position embeddings.

Key Insights and Results

The study evaluated the "pixels-as-tokens" approach across several benchmarks, including classification (CIFAR-100, ImageNet), regression (NYU-v2 depth estimation), generation (ImageNet via VQGAN latent space), and self-supervised learning (Masked Autoencoding).

Performance improvements as patch size decreases to 1 (locality-free).

The most surprising finding is that locality is a constraint, not a requirement. Pixel-level Transformers often outperform patch-based ones of the same parameter count. This suggests that the "locality bias" in standard ViTs might actually restrict the model from capturing finer, non-local signals.

Key performance highlights include:

  • Supervised Learning: On CIFAR-100, a pixel-level ViT-Small (ViT-S/1) achieved 86.4% Acc@1, significantly outperforming the patch-based baseline (ViT-S/2) at 83.7%.
  • ImageNet: Even on the much larger ImageNet dataset, the pixel-level ViT-L/1 reached 76.9% Acc@1, besting the patch-based ViT-L/2 (75.6%).
  • Depth Estimation: The pixel-level model excelled at depth estimation (RMSE of 0.72 vs 0.80), likely because it can reason about spatial relationships at the finest possible grain.
  • Image Generation: In diffusion tasks, the locality-free DiT-L/1 achieved an FID of 4.05, outperforming the standard locality-biased DiT-L/2 (4.16).

Furthermore, the authors argue that ViT’s historical success was likely due to its ability to process higher resolutions, not the patch-based design itself. Treating pixels as tokens also simplifies the "vocabulary." A 16x16 RGB patch has a near-infinite variety of possible values, whereas a single pixel has a finite vocabulary (e.g., $256^3$ combinations), which can be leveraged via dictionary-based embeddings for even better results.

Limitations and Future Work

The primary hurdle for the "bag of pixels" approach is computational complexity. Because self-attention has a quadratic cost relative to sequence length ($O(N^2)$), treating every pixel as a token is incredibly expensive. A standard 224x224 image contains over 50,000 pixels, which is currently prohibitive for full self-attention on standard hardware.

Consequently, most experiments in this paper were conducted at lower resolutions (e.g., 32x32 or 64x64). The authors suggest that the next step for the community is to bridge this "engineering gap" using techniques like FlashAttention, linear attention, or more efficient hardware. By doing so, these highly performant, locality-free models can finally scale to high-resolution real-world images.

Summary updated

BibTeX
@inproceedings{nguyen2025image,
  author = {Duy Kien Nguyen and Mido Assran and Unnat Jain and Martin R. Oswald and Cees G. M. Snoek and Xinlei Chen},
  title = {{An Image is Worth More Than 16x16 Patches: Exploring Transformers on Individual Pixels}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=tjNf0L8QjR},
}
Figure