Peeling the Onion: Hierarchical Reduction of Data Redundancy for Efficient Vision Transformer Training

Zhenglun Kong, Haoyu Ma, Geng Yuan, Mengshu Sun, Yanyue Xie, Peiyan Dong, Xin Meng, Xuan Shen, Hao Tang, Minghai Qin, Tianlong Chen, Xiaolong Ma, Xiaohui Xie, Zhangyang Wang, Yanzhi Wang

Abstract

Vision transformers (ViTs) have recently obtained success in many applications, but their intensive computation and heavy memory usage at both training and inference time limit their generalization. Previous compression algorithms usually start from the pre-trained dense models and only focus on efficient inference, while time-consuming training is still unavoidable. In contrast, this paper points out that the million-scale training data is redundant, which is the fundamental reason for the tedious training. To address the issue, this paper aims to introduce sparsity into data and proposes an end-to-end efficient training framework from three sparse perspectives, dubbed Tri-Level E-ViT. Specifically, we leverage a hierarchical data redundancy reduction scheme, by exploring the sparsity under three levels: number of training examples in the dataset, number of patches (tokens) in each example, and number of connections between tokens that lie in attention weights. With extensive experiments, we demonstrate that our proposed technique can noticeably accelerate training for various ViT architectures while maintaining accuracy. Remarkably, under certain ratios, we are able to improve the ViT accuracy rather than compromising it. For example, we can achieve 15.2% speedup with 72.6% (+0.4) Top-1 accuracy on Deit-T, and 15.7% speedup with 79.9% (+0.1) Top-1 accuracy on Deit-S. This proves the existence of data redundancy in ViT.

Introduction

Vision Transformers (ViTs) have revolutionized computer vision by achieving state-of-the-art performance across various tasks. However, their lack of inherent inductive biases, such as spatial locality found in Convolutional Neural Networks (CNNs), makes them exceptionally data-hungry and computationally expensive to train. While significant research has focused on compressing ViTs for efficient inference, the training phase remains a major bottleneck, typically requiring fully trained dense models before pruning can occur.

The authors of "Peeling the Onion" argue that the primary cause of this inefficiency is massive data redundancy within million-scale datasets. They propose Tri-Level E-ViT, a novel framework that accelerates training by identifying and removing redundant information across three hierarchical levels: the dataset, the individual image, and the model's internal connections.

The Tri-Level E-ViT Framework

The core of the proposed method is a hierarchical approach to sparsity that "peels away" redundancy like layers of an onion.

The Tri-Level E-ViT framework integrates example-level, token-level, and attention-level sparsity for efficient training.

1. Example-Level Sparsity (The Dataset)

Not all training samples contribute equally to model learning. The framework employs Online Example Filtering to track "forgetting events"—instances where the model misclassifies an image it previously classified correctly. Images that are rarely forgotten are considered "easy" or redundant. A dynamic "remove-and-restore" strategy swaps these easy images for potentially more informative ones, maintaining a smaller, more effective active training set.

2. Token-Level Sparsity (The Image)

Images often contain significant uninformative background. Tri-Level E-ViT leverages the attention map of the [CLS] (classification) token to identify the most salient image patches. Less important tokens are pruned as data progresses through the network layers, reducing the computational load per image.

3. Attention-Level Sparsity (The Connections)

The framework further optimizes the self-attention mechanism by pruning weak connections between tokens. The Token & Attention Selector (TA-Selector) identifies and removes these unnecessary weights, mitigating the quadratic complexity inherent in standard ViT attention layers.

Crucially, this end-to-end method requires no pre-trained teacher models or complex auxiliary networks, making it a practical solution for standard training pipelines.

Experimental Evaluation and Results

The framework was evaluated on standard benchmarks including ImageNet-1K, ImageNet-V2, and COCO 2017. The results demonstrate a superior trade-off between accuracy and training efficiency.

Comparison of Tri-level E-ViT against state-of-the-art methods on ImageNet-1K, highlighting the superior accuracy-training time trade-off.

Key findings include:

  • Efficiency Gains: DeiT-T achieved a 15.2% training speedup with a +0.4% increase in Top-1 accuracy. DeiT-S saw a 15.7% speedup with a +0.1% accuracy gain.
  • Maximum Sparsity: At higher sparsity ratios, the framework reduced training time by up to 35.6% for DeiT-T with only a minimal (0.3%) drop in accuracy.
  • Sparsity as Regularization: Interestingly, removing redundant data often improved accuracy, suggesting that pruning acts as a form of regularization that helps the model focus on discriminative features.
  • Generalization: The method proved effective across diverse architectures (Swin, PiT, LV-ViT) and downstream tasks like object detection.

Conclusion and Future Work

Tri-Level E-ViT demonstrates that data redundancy is a fundamental hurdle in ViT training and that hierarchical sparsity can effectively address it. While the current implementation requires some hyperparameter tuning and introduces minor management overhead for sample swapping, the benefits in training speed and potential accuracy gains are significant. Future research will explore extending this approach to weight redundancy and applying it to larger-scale foundation models.

Summary updated

BibTeX
@inproceedings{kong2023peeling,
  author = {Zhenglun Kong and Haoyu Ma and Geng Yuan and Mengshu Sun and Yanyue Xie and Peiyan Dong and Xin Meng and Xuan Shen and Hao Tang and Minghai Qin and Tianlong Chen and Xiaolong Ma and Xiaohui Xie and Zhangyang Wang and Yanzhi Wang},
  title = {{Peeling the Onion: Hierarchical Reduction of Data Redundancy for Efficient Vision Transformer Training}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i7.26008},
}
Figure