Automatic Attention Pruning: Improving and Automating Model Pruning using Attentions

Kaiqi Zhao, Animesh Jain, Ming ZhaoAISTATS 2023

Introduction

Deep Learning models have achieved remarkable performance across various domains but often come with a high computational cost, making deployment on edge devices challenging. Model pruning—the removal of redundant parameters—is a common strategy to mitigate this. However, traditional pruning methods often fall into two traps: unstructured pruning that yields no real-world speedup on standard hardware, and structured pruning that requires intensive manual hyper-parameter tuning to maintain accuracy.

Automatic Attention Pruning (AAP) is a novel framework designed to automate this "black art." By leveraging activation-based attention maps and an adaptive iterative policy, AAP generates hardware-efficient models that meet specific user-defined targets without manual intervention.

Methodology: Attention-Based Pruning

The core innovation of AAP lies in how it identifies unimportant filters. Rather than relying solely on weight magnitudes, which may not accurately reflect a filter's contribution to the final output, AAP analyzes the activations.

Activation-Based Importance

AAP calculates an "Attention Mean" for each filter. If a filter's output consistently lacks meaningful patterns or remains near zero across a batch of data, it is deemed redundant. This approach captures how the model actually perceives features in the input data, making it more robust than weight-based methods.

Visualization of activation outputs across different filters. Some filters (e.g., filter_2, filter_14, filter_16) show near-zero activity, indicating they are candidates for pruning.

Adaptive Iterative Policy

To eliminate manual tuning, AAP employs an adaptive iterative process. Users set a target, such as a maximum allowable accuracy loss or a specific parameter reduction. The algorithm then iteratively prunes the model. A key feature is the "roll back" mechanism: if a pruning step causes accuracy to drop below the threshold, the system reverts to the previous state and attempts a more conservative pruning step. This ensures the final model meets the user's constraints without exhaustive trial and error.

Experimental Evaluation

The authors evaluated AAP on standard benchmarks including MNIST, CIFAR-10, Tiny-ImageNet, and ImageNet, using architectures like ResNet, VGG, and MobileNet.

Key Results

AAP consistently outperforms state-of-the-art (SOTA) methods by achieving higher compression rates for the same accuracy levels. For instance, on ResNet-56 with CIFAR-10, AAP achieved a 79.11% parameter reduction with zero accuracy loss, significantly surpassing previous methods that managed between 13% and 56% reduction at the same accuracy level.

Comparative performance of AAP against other pruning methods on ResNet architectures. AAP-P achieves superior parameter and FLOP reduction at various target levels.

Beyond theoretical metrics, the authors demonstrated real-world utility by testing on a Raspberry Pi 3B+. Pruned models showed inference speedups of 1.2x to 3.6x, confirming that the structured approach translates effectively to commodity hardware performance.

Conclusion and Future Work

AAP provides a robust, "set-it-and-forget-it" solution for structured model pruning. By prioritizing activations over weights and automating the iterative process, it lowers the barrier for deploying high-performance models on resource-constrained devices. Future research may extend this framework to Transformer architectures and explore multi-objective optimization to balance accuracy, memory, and latency simultaneously.

Summary updated

BibTeX
@inproceedings{zhao2023automatic,
  author = {Kaiqi Zhao and Animesh Jain and Ming Zhao},
  title = {{Automatic Attention Pruning: Improving and Automating Model Pruning using Attentions}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
}
Figure