DEFA: Efficient Deformable Attention Acceleration via Pruning-Assisted Grid-Sampling and Multi-Scale Parallel Processing

Yansong Xu, Dongxu Lyu, Zhenyu Li, Yuzhou Chen, Zilong Wang, Gang Wang, Zhican Wang, Haomin Li, Guanghui He

Abstract

Multi-Scale Deformable Attention (MSDeformAttn) has emerged as a critical component in state-of-the-art object detection models like Deformable DETR and DINO, offering theoretical efficiency by sampling sparse key points. However, its implementation on standard hardware is hindered by irregular memory access patterns, where sampling procedures can consume over 60% of runtime while performing minimal computation. We propose DEFA, an algorithm-architecture co-design that accelerates MSDeformAttn through dual-level pruning and inter-level parallel processing. DEFA achieves up to 31.9x speedup and 37.7x energy efficiency over high-end GPUs with minimal impact on detection accuracy.

The Memory Bottleneck in Deformable Attention

Unlike traditional Transformers that attend to every pixel, Deformable Attention samples a small set of points across multiple image scales. While mathematically efficient, this "grid-sampling" creates a "data movement nightmare" on CPUs and GPUs. The irregular memory access leads to high cache miss rates and processor idling. On an NVIDIA RTX 3090Ti, the sampling procedure accounts for the majority of execution time despite its low FLOP count. DEFA addresses this by tackling both the redundancy in the algorithm and the inefficiencies in hardware execution.

Algorithm-Level Pruning

DEFA introduces two pruning strategies to reduce the workload before it reaches the hardware:

  • Probability-Aware Point Pruning (PAP): Attention mechanisms often assign near-zero weights to many sampling points. PAP identifies these low-importance points early and skips their computation, reducing memory access by approximately 84%.
  • Frequency-Weighted Fmap Pruning (FWP): By observing that certain feature map pixels are sampled more frequently than others, FWP prunes unimportant pixels (around 43%) based on historical sampling patterns.
Overview of the PAP and FWP pruning mechanisms within the DEFA framework.

Architecture-Level Innovation

To resolve hardware-level bottlenecks, DEFA implements a specialized architecture:

  • Inter-Level Parallel Processing: Standard hardware typically processes one image scale at a time, leading to "bank conflicts" when multiple units attempt to access the same memory bank. DEFA instead processes points across different scales simultaneously. This approach ensures that memory units remain utilized without clashing, significantly increasing throughput.
  • Fine-Grained Operator Fusion: DEFA fuses sampling and aggregation steps into a single pipeline within a reconfigurable Processing Element (PE) array, minimizing the need to move data to off-chip RAM.
Comparison between intra-level and inter-level parallel processing, demonstrating how DEFA avoids memory bank conflicts.

Evaluation and Results

The researchers evaluated DEFA using the COCO 2017 benchmark across three major models: Deformable DETR, DN-DETR, and DINO.

  • Performance: DEFA delivers a 10.1x to 31.9x speedup over NVIDIA RTX 2080Ti and 3090Ti GPUs.
  • Efficiency: It is 20.3x to 37.7x more energy-efficient than GPUs and outperforms existing specialized accelerators by 2.2x to 3.7x.
  • Accuracy: Despite aggressive pruning, the average loss in Mean Average Precision (mAP) is only ~0.8, maintaining high detection performance.
  • Hardware Footprint: Synthesized on a 40nm process, the design occupies 2.63 $mm^2$ and consumes just 99.8 mW.

Conclusion

DEFA demonstrates that the primary bottleneck in modern vision Transformers is often memory access rather than raw computation. By combining intelligent pruning with a hardware architecture designed for multi-scale parallelism, DEFA provides a scalable solution for deploying high-performance object detection models on edge and specialized hardware. Future work may extend these optimizations to the decoder stages and 3D detection tasks.

Summary updated

BibTeX
@inproceedings{xu2024defa,
  author = {Yansong Xu and Dongxu Lyu and Zhenyu Li and Yuzhou Chen and Zilong Wang and Gang Wang and Zhican Wang and Haomin Li and Guanghui He},
  title = {{DEFA: Efficient Deformable Attention Acceleration via Pruning-Assisted Grid-Sampling and Multi-Scale Parallel Processing}},
  booktitle = {DAC},
  year = {2024},
}
Figure