TensorX
返回文献探索

Paper · arXiv 2406.16747

Sparser is Faster and Less is More: Efficient Sparse Attention for Long-Range Transformers

Chao Lou, Zixia Jia, Zilong Zheng, Kewei Tu

19 upvotesJune 24, 2024arXiv 预印本
AI 摘要

SPARSEK Attention addresses inefficiencies in autoregressive Transformers by providing linear time complexity and constant memory footprint, enabling efficient processing of long sequences and integration into large pre-trained models.

autoregressive Transformersextended context windowcomputational complexityKV memoryself-attention mechanismsSPARSEK Attentionscoring networkdifferentiable top-k mask operatorgradient-based optimizationlanguage modelingdownstream tasksLarge Language Models (LLMs)

Abstract

Accommodating long sequences efficiently in autoregressive Transformers, especially within an extended context window, poses significant challenges due to the quadratic computational complexity and substantial KV memory requirements inherent in self-attention mechanisms. In this work, we introduce SPARSEK Attention, a novel sparse attention mechanism designed to overcome these computational and memory obstacles while maintaining performance. Our approach integrates a scoring network and a differentiable top-k mask operator, SPARSEK, to select a constant number of KV pairs for each query, thereby enabling gradient-based optimization. As a result, SPARSEK Attention offers linear time complexity and constant memory footprint during generation. Experimental results reveal that SPARSEK Attention outperforms previous sparse attention methods and provides significant speed improvements during both training and inference, particularly in language modeling and downstream tasks. Furthermore, our method can be seamlessly integrated into pre-trained Large Language Models (LLMs) with minimal fine-tuning, offering a practical solution for effectively managing long-range dependencies in diverse applications.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
Sparser is Faster and Less is More: Efficient Sparse Attention for Long-Range Transformers | TensorX