Efficient Attention Network: Accelerate Attention by Searching Where to Plug

Zhongzhan Huang, Senwei Liang, Mingfu Liang, Wei He, Haizhao YangarXiv 2020

Abstract

Recent advancements in deep convolutional neural networks (CNNs) have popularized plug-and-play self-attention modules to enhance model generalization. However, the standard practice of inserting these modules into every residual block—the "full-plugging" approach—leads to significant increases in computational cost and parameter counts as networks grow deeper. We propose the Efficient Attention Network (EAN), a framework that optimizes attention efficiency through two key mechanisms: module sharing and reinforcement learning-based connection searching. By identifying a sparse set of optimal connection points, EAN maintains high accuracy while reducing parameter overhead and accelerating inference. Our experiments across ImageNet, CIFAR-100, and various transfer tasks demonstrate that EAN consistently outperforms traditional dense-plugging baselines.

Introduction

Self-attention mechanisms, such as Squeeze-and-Excitation (SE), have become essential components for boosting CNN performance. Despite their efficacy, the prevailing integration strategy is inefficient. Standard architectures typically connect an individual attention module to every block of the backbone. This approach suffers from two primary drawbacks: computational overhead, where each module adds to the cumulative inference time, and parameter explosion, where the model size grows linearly with network depth.

EAN addresses these issues by challenging the assumption that attention is required at every layer. By searching for the most impactful locations to "plug" attention, EAN identifies redundant modules that can be removed without sacrificing—and sometimes even improving—model performance.

The EAN Framework

The EAN framework consists of two main components designed to maximize efficiency:

  1. Module Sharing: Instead of assigning unique parameters to every block, EAN shares a single attention module across the backbone (or specific stages). This drastically reduces the total number of parameters added to the base model.
  2. Connection Searching: To determine where the shared module should interact with the backbone, we employ a reinforcement learning (RL) controller.
Structural comparison of EAN against standard attention integration methods.

The search process involves pre-training a "supernet" where attention modules are stochastically activated, allowing the backbone to co-adapt to various connection schemes. An RL controller, trained via Proximal Policy Optimization (PPO), then generates binary strings representing potential connection patterns. The reward function for this controller balances validation accuracy, sparsity (to favor faster models), and a "curiosity bonus" using Random Network Distillation (RND) to ensure the search explores diverse architectural configurations.

Experimental Results

We evaluated EAN on ImageNet-1K and CIFAR-100 using popular attention modules including SE, Spatial Group-wise Enhance (SGE), and Dense-and-Implicit Attention (DIA).

Performance and Efficiency

On ImageNet with a ResNet-50 backbone, EAN-SE reduced the relative inference time increment from 25.92% (the standard "Org-full" baseline) to just 10.35%, while simultaneously improving top-1 accuracy from 77.35% to 77.40%. This demonstrates that sparse, optimized connections can be more effective than dense ones.

Performance comparison on ImageNet: EAN variants (ours) achieve higher accuracy with significantly lower inference overhead compared to full-plugging baselines.

Transferability and Qualitative Analysis

Connection schemes discovered on ImageNet proved highly transferable to other domains, such as crowd counting (ShanghaiTech) and semantic segmentation (Pascal VOC 2012). Furthermore, Grad-CAM visualizations reveal that EAN models produce more focused and cleaner heatmaps on target objects compared to vanilla or full-attention models, suggesting that the searched connections help the network capture more informative features.

Conclusion

The Efficient Attention Network (EAN) provides a robust solution to the inefficiencies of modern attention-enhanced CNNs. By combining parameter sharing with an automated search for sparse connections, EAN achieves a superior trade-off between accuracy, model size, and inference speed. Future work may explore hardware-aware search rewards to further optimize EAN for specific edge-computing environments.

Summary updated

BibTeX
@misc{huang2020efficient,
  author = {Zhongzhan Huang and Senwei Liang and Mingfu Liang and Wei He and Haizhao Yang},
  title = {{Efficient Attention Network: Accelerate Attention by Searching Where to Plug}},
  year = {2020},
  eprint = {2011.14058},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2011.14058},
}
Figure