[Paper Review] SpAtten: Efficient Sparse Attention Architecture with Cascade Token and Head Pruning
SpAtten proposes a hardware-software co-designed sparse attention architecture that uses cascade token and head pruning, along with progressive quantization, to drastically reduce memory access and computation in attention mechanisms. By dynamically pruning unimportant tokens and heads on the fly and adapting bit-width based on confidence, SpAtten achieves up to 4059× energy savings and 162× speedup over a TITAN Xp GPU with no accuracy loss.
The attention mechanism is becoming increasingly popular in Natural Language Processing (NLP) applications, showing superior performance than convolutional and recurrent architectures. However, attention becomes the compution bottleneck because of its quadratic computational complexity to input length, complicated data movement and low arithmetic intensity. Moreover, existing NN accelerators mainly focus on optimizing convolutional or recurrent models, and cannot efficiently support attention. In this paper, we present SpAtten, an efficient algorithm-architecture co-design that leverages token sparsity, head sparsity, and quantization opportunities to reduce the attention computation and memory access. Inspired by the high redundancy of human languages, we propose the novel cascade token pruning to prune away unimportant tokens in the sentence. We also propose cascade head pruning to remove unessential heads. Cascade pruning is fundamentally different from weight pruning since there is no trainable weight in the attention mechanism, and the pruned tokens and heads are selected on the fly. To efficiently support them on hardware, we design a novel top-k engine to rank token and head importance scores with high throughput. Furthermore, we propose progressive quantization that first fetches MSBs only and performs the computation; if the confidence is low, it fetches LSBs and recomputes the attention outputs, trading computation for memory reduction. Extensive experiments on 30 benchmarks show that, on average, SpAtten reduces DRAM access by 10.0x with no accuracy loss, and achieves 1.6x, 3.0x, 162x, 347x speedup, and 1,4x, 3.2x, 1193x, 4059x energy savings over A3 accelerator, MNNFast accelerator, TITAN Xp GPU, Xeon CPU, respectively.
Motivation & Objective
- Address the inefficiency of attention mechanisms on general-purpose platforms like CPUs and GPUs, which suffer from high memory bandwidth and low arithmetic intensity.
- Overcome the limitations of existing accelerators that are optimized for CNNs and RNNs but not attention mechanisms.
- Reduce DRAM access and computation in attention models by exploiting structural redundancy in human language and attention head redundancy.
- Design a domain-specific accelerator that supports dynamic, input-dependent pruning of tokens and heads at inference time, enabling real-time efficiency gains.
- Enable efficient deployment of large NLP models like BERT and GPT-2 on resource-constrained devices by minimizing memory and energy overhead.
Proposed method
- Propose cascade token pruning that removes unimportant tokens based on cumulative attention probabilities across layers, with pruning ratios adaptive to sentence length.
- Introduce cascade head pruning that ranks and removes redundant attention heads using cumulative head magnitude scores across layers.
- Design a high-throughput, parallel top-k engine to rank token and head importance scores in real time with O(n) complexity, enabling on-the-fly pruning.
- Implement progressive quantization that first computes with only the most significant bits (MSBs); if confidence is low, fetches least significant bits (LSBs) and recomputes, trading computation for memory reduction.
- Build a specialized hardware architecture with a pipelined datapath, optimized memory hierarchy, and support for dynamic sparsity and variable bit-width to realize theoretical savings in practice.
- Co-design the algorithm and hardware such that pruning and quantization are input-dependent and applied at inference time, ensuring adaptability and minimal accuracy loss.
Experimental results
Research questions
- RQ1Can dynamic, input-dependent pruning of tokens and heads reduce attention computation and memory access without sacrificing model accuracy?
- RQ2How can a hardware accelerator efficiently support on-the-fly ranking and selection of important tokens and heads using a top-k engine with low latency?
- RQ3To what extent can progressive quantization reduce memory bandwidth and energy consumption while maintaining inference confidence?
- RQ4How do cascade pruning and progressive quantization compare in performance and energy efficiency against state-of-the-art accelerators like A³ and MNNFast?
- RQ5Can the proposed co-design approach be generalized across both discriminative (e.g., BERT) and generative (e.g., GPT-2) transformer models?
Key findings
- SpAtten reduces DRAM access by an average of 10.0× across 30 benchmarks with no accuracy loss.
- SpAtten achieves 1.6× and 3.0× speedup over the A³ and MNNFast accelerators, respectively, with 1.4× and 3.2× energy savings.
- On a TITAN Xp GPU, SpAtten achieves 162× speedup and 1193× energy savings.
- On a Xeon CPU, SpAtten achieves 347× speedup and 4059× energy savings.
- The top-k engine enables efficient, high-throughput ranking of token and head importance with O(n) time complexity, critical for real-time pruning.
- Progressive quantization allows dynamic bit-width adaptation, reducing memory bandwidth while maintaining inference confidence through iterative refinement.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.