Introduction
The evolution of Large Language Models (LLMs) has pushed the boundaries of context window sizes, with modern applications often requiring the processing of sequences exceeding 128,000 tokens. However, the self-attention mechanism—the core of the Transformer architecture—exhibits quadratic computational complexity relative to sequence length. While dynamic sparsity has emerged as a strategy to mitigate this by focusing computation on the most relevant tokens, it introduces significant overhead. Traditional sparse accelerators often decouple prediction, sorting, and computation, leading to high latency and a "memory wall" where data movement between on-chip buffers and off-chip DRAM becomes the primary bottleneck.
To address these challenges, we present SOFA (Compute-Memory Optimized Sparsity Accelerator), a hardware-algorithm co-design that optimizes Large-scale Token Parallel Processing (LTPP). SOFA introduces a unified pipeline that fuses prediction and computation through cross-stage coordinated tiling, significantly reducing memory traffic and computational overhead.
Architectural Innovations
SOFA’s efficiency stems from four primary innovations designed to streamline the sparse attention pipeline:
1. Multiplier-Free Sparsity Prediction (DLZS)
Traditional sparsity predictors rely on standard matrix multiplication, which can be as costly as the attention mechanism itself. SOFA utilizes Differential Leading Zero Summation (DLZS), a multiplier-free predictor. By operating in the log-domain using leading-zero counts and bit-shifts, DLZS estimates token importance with minimal hardware area and power consumption. This approach leverages the insight that "top-k" selection for sparsity does not require high-precision floating-point arithmetic.
2. Distributed Sorting (SADS)
Sorting long sequences is traditionally a memory-intensive global operation. SOFA introduces Sphere-search-aided Distributed Sorting (SADS), which exploits the Distributed Cluster Effect (DCE). The authors observed that important tokens are typically distributed across the sequence rather than clustered. SADS leverages this by breaking rows into sub-segments for independent, tiled sorting, allowing for high parallelism and reduced on-chip memory requirements.
3. Sorted-Updating FlashAttention (SU-FA)
Standard FlashAttention requires multiple passes to manage numerical stability (e.g., max-value tracking for softmax). SOFA’s Sorted-Updating FlashAttention (SU-FA) utilizes the importance rankings from the SADS stage to process tokens in descending order of significance. This ordered processing simplifies the normalization math, allowing the hardware to skip redundant comparisons and reduce the number of expensive non-linear operations like exponentiations.
4. Reuse-Aware Schedule Scheme (RASS)
To further bridge the memory gap, the Reuse-Aware Schedule Scheme (RASS) reorders execution tasks to maximize the temporal and spatial reuse of Key (K) and Value (V) tensors. By keeping data within on-chip buffers longer, RASS reduces off-chip DRAM traffic by approximately 33%.
Experimental Evaluation
SOFA was implemented in 28nm CMOS technology and evaluated against a diverse suite of benchmarks, including BERT, GPT-2, Bloom, and Llama models, as well as the Pyramid Vision Transformer (PVT) for computer vision tasks.
Performance and Efficiency
When compared to the Nvidia A100 GPU, SOFA achieves a 9.5× speedup and 71.5× higher energy efficiency. Against other state-of-the-art (SOTA) research accelerators such as SpAtten and Energon, SOFA demonstrates an average improvement of 9.3× in speed and 15.8× in energy efficiency.
Memory and Accuracy
The cross-stage coordinated tiling strategy results in a 79% reduction in off-chip DRAM access compared to conventional dynamic sparsity methods. Crucially, these performance gains are achieved with minimal impact on model fidelity; accuracy loss remains below 2% across all tested benchmarks, with many tasks showing 0% loss under moderate sparsity settings.
Conclusion and Future Work
SOFA demonstrates that the bottlenecks of long-sequence Transformer inference can be overcome by tightly coupling hardware architecture with algorithmic sparsity. By moving away from decoupled processing stages toward a coordinated tiling approach, SOFA effectively dismantles the memory wall for large-scale token processing. Future research may explore the application of SOFA’s principles to speculative decoding and extreme-scale distributed inference systems.
Summary updated