When Linear Attention Meets Autoregressive Decoding: Towards More Effective and Efficient Linearized Large Language Models
Haoran You, Yichao Fu, Zheng Wang, Amir Yazdanbakhsh, Yingyan Celine Lin
TL;DR
The paper analyzes the efficacy of linear attention for autoregressive LLMs and its compatibility with speculative decoding, revealing that naïvely applying encoder-focused LAs to autoregressive decoders underperforms due to temporal dependencies and information leakage. It proposes a causal, masked DWConv augmentation with grouped attention to improve locality while preserving causality, and introduces an unfolded DWConv approach to align with tree-based speculative decoding. Across multiple LLMs and long-context tasks, augmented LAs deliver up to a 6.67 perplexity reduction and up to 2x generation speedups, while enabling longer sequence lengths (e.g., 32K). These results establish a practical pathway for more efficient training and deployment of autoregressive LLMs in long-context scenarios.
Abstract
Autoregressive Large Language Models (LLMs) have achieved impressive performance in language tasks but face two significant bottlenecks: (1) quadratic complexity in the attention module as the number of tokens increases, and (2) limited efficiency due to the sequential processing nature of autoregressive LLMs during generation. While linear attention and speculative decoding offer potential solutions, their applicability and synergistic potential for enhancing autoregressive LLMs remain uncertain. We conduct the first comprehensive study on the efficacy of existing linear attention methods for autoregressive LLMs, integrating them with speculative decoding. We introduce an augmentation technique for linear attention that ensures compatibility with speculative decoding, enabling more efficient training and serving of LLMs. Extensive experiments and ablation studies involving seven existing linear attention models and five encoder/decoder-based LLMs consistently validate the effectiveness of our augmented linearized LLMs. Notably, our approach achieves up to a 6.67 reduction in perplexity on the LLaMA model and up to a 2$\times$ speedup during generation compared to prior linear attention methods. Codes and models are available at https://github.com/GATECH-EIC/Linearized-LLM.
