Abstract
The self-attention mechanism in Transformer models presents a significant computational challenge due to its quadratic complexity relative to sequence length. While sparse attention variants reduce theoretical complexity, they often suffer from poor hardware utilization on general-purpose processors. This paper introduces SALO, a specialized spatial accelerator designed for hybrid sparse attention. SALO utilizes a hardware-software co-design featuring a data scheduler for pattern mapping and a systolic array with diagonal data paths for efficient sliding window processing. Experimental results demonstrate that SALO achieves a 17.66x speedup and 272x higher energy efficiency compared to modern GPUs.
1. Introduction
The Transformer architecture has revolutionized natural language processing and computer vision. However, the core "Self-Attention" mechanism scales quadratically ($O(n^2)$) in terms of both computation and memory. This "quadratic bottleneck" limits the ability of Transformers to process long-form content, such as entire books or high-resolution images.
To mitigate this, sparse attention models like Longformer and BigBird have been developed. These models restrict the attention scope to a subset of tokens, reducing the mathematical complexity. Despite these algorithmic improvements, standard hardware like CPUs and GPUs are optimized for dense matrix operations. The irregular memory access patterns inherent in sparse attention lead to significant performance degradation on such platforms. SALO addresses this gap by providing a dedicated hardware architecture optimized for the specific data flows of sparse attention.
2. Methodology
SALO is a hardware-software co-design consisting of a specialized data scheduler and a spatial accelerator.
2.1 The Data Scheduler
The scheduler acts as an intermediary between the sparse attention patterns and the physical hardware. It employs two primary strategies:
- Data Reordering: It maps complex patterns, such as dilated attention, into linear "sliding window" patterns compatible with the systolic array.
- Data Splitting and Renormalization: To handle sequences exceeding hardware capacity, the scheduler tiles matrices. Because the Softmax operation is non-linear, SALO uses a "Weighted Sum Module" to store intermediate denominator weights, allowing partial results to be mathematically "stitched" together without loss of precision.
2.2 Spatial Accelerator Architecture
The hardware core is a systolic array of Processing Elements (PEs) optimized for data reuse:
- Diagonal Data Paths: Unlike conventional rectangular systolic arrays, SALO incorporates diagonal connections. This allows key and value vectors to "slide" across the array, maximizing data reuse for sliding window attention and reducing memory bandwidth requirements.
- Hybrid Attention Support: The architecture includes dedicated Global PE rows and columns. These allow the accelerator to process global attention (where specific tokens attend to all others) and local sliding window attention concurrently within the same data flow.
- Quantized Computation: SALO utilizes 8-bit fixed-point arithmetic, which significantly increases throughput and energy efficiency with negligible impact on model accuracy.
3. Experimental Evaluation
The researchers evaluated SALO by synthesizing the design using 45nm technology. Performance was benchmarked against an Intel Xeon CPU and an NVIDIA GTX 1080Ti GPU across several tasks:
- Natural Language Processing: Longformer models were tested on the IMDB sentiment analysis and Hyperpartisan news classification datasets.
- Computer Vision: The Vision Longformer (ViL) was evaluated using the ImageNet-1K dataset.
4. Results
SALO demonstrates substantial improvements over general-purpose hardware:
- Throughput: SALO achieved an average speedup of 17.66x over the GPU and 89.33x over the CPU.
- Energy Efficiency: The accelerator proved to be 272x more energy-efficient than the GPU, highlighting the benefits of specialized data paths.
- Hardware Utilization: SALO maintained a PE utilization rate exceeding 75%, outperforming previous sparse accelerators like Sanger by 1.33x.
- Accuracy: The transition to 8-bit quantization resulted in an accuracy drop of less than 0.15% across all benchmarks, confirming the robustness of the design.
5. Conclusion
SALO effectively addresses the hardware inefficiencies associated with sparse attention mechanisms. By aligning architectural data flow with the mathematical structure of sliding window and global attention, it provides a scalable solution for long-sequence Transformer tasks. While currently optimized for static sparse patterns, future work may extend SALO’s principles to dynamic sparsity and more advanced manufacturing nodes to further push the boundaries of Transformer efficiency.
Summary updated