PatchDropout: Economizing Vision Transformers Using Patch Dropout

Yue Liu, Christos Matsoukas, Fredrik Strand, Hossein Azizpour, Kevin Smith

Abstract

Vision Transformers (ViTs) have demonstrated remarkable performance across various computer vision tasks but suffer from high computational costs due to the quadratic complexity of the self-attention mechanism relative to the number of input tokens. This limitation is particularly acute for high-resolution images. We introduce PatchDropout, a simple yet effective technique that randomly discards a large portion of input patches during training. By exploiting spatial redundancy, PatchDropout reduces computational and memory demands by up to 5x on high-resolution medical images while maintaining or even enhancing predictive accuracy. Furthermore, PatchDropout serves as a strong regularizer, improving model robustness.

Introduction

While Vision Transformers (ViTs) are powerful alternatives to Convolutional Neural Networks (CNNs), their scalability is hindered by the self-attention mechanism's quadratic complexity. For high-resolution applications like medical imaging (e.g., 896x896 pixels), the number of tokens increases sixteen-fold compared to standard 224x224 inputs, leading to prohibitive resource requirements. Previous solutions often involve complex architectural modifications. PatchDropout addresses this by asking whether all patches are necessary for effective learning, proposing a stochastic omission strategy to improve efficiency.

Methods

The PatchDropout workflow is straightforward and integrates easily into existing ViT architectures:

  1. Patchification: The input image is partitioned into non-overlapping patches (e.g., 16x16).
  2. Embedding: Linear projections and positional embeddings are applied to each patch.
  3. Stochastic Dropout: A random subset of patches is discarded based on a predefined "keep rate." For instance, a keep rate of 0.25 discards 75% of the data.
  4. Training: The transformer processes only the remaining tokens, significantly reducing the sequence length.
  5. Inference: Typically, all patches are used during inference to maximize information flow, though the model remains robust to dropout at test time.
Visualization of PatchDropout where a significant portion of input patches are randomly discarded.

Unlike importance-based pruning, PatchDropout is uniform and stochastic, requiring no additional parameters or complex scoring mechanisms.

Datasets and Evaluation

The method was evaluated on several benchmarks:

  • CSAW: A high-resolution (896x896) medical dataset for breast cancer screening.
  • ImageNet-1K: The standard large-scale natural image classification benchmark.
  • CIFAR100 & PLACES365: Used for cross-domain validation.

Key Results

PatchDropout demonstrates significant gains in both efficiency and performance, particularly at high resolutions.

Efficiency and Performance on CSAW

On the high-resolution CSAW dataset, a keep rate of 0.05 (dropping 95% of patches) achieved a 5x reduction in compute and memory while slightly improving the Area Under the Curve (AUC) compared to standard training. This suggests that the model can learn effectively from a sparse representation of the high-resolution input.

Performance and efficiency trade-offs on the CSAW dataset across different keep rates and resolutions.

Scaling and Regularization

On ImageNet-1K, dropping 50% of patches resulted in a negligible accuracy loss (~0.17%), effectively doubling training speed. PatchDropout also acts as a regularizer, similar to Dropout or Cutout, forcing the model to rely on partial information and thus reducing overfitting. This allows for a "reinvestment" strategy: using the saved compute to train larger models (e.g., ViT-Large instead of ViT-Base) or higher-resolution images within the same hardware budget.

Conclusion

PatchDropout is a simple, parameter-free method to scale Vision Transformers to high-resolution data. By leveraging spatial redundancy and providing a strong regularizing effect, it enables significant computational savings without sacrificing accuracy. Future work includes exploring its application in dense prediction tasks like segmentation and optimizing inference-time pruning.

Summary updated

BibTeX
@inproceedings{liu2023patchdropout,
  author = {Yue Liu and Christos Matsoukas and Fredrik Strand and Hossein Azizpour and Kevin Smith},
  title = {{PatchDropout: Economizing Vision Transformers Using Patch Dropout}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2023},
  doi = {10.1109/wacv56688.2023.00394},
}
Figure