Papers
Topics
Authors
Recent
Search
2000 character limit reached

HSR-Enhanced Sparse Attention Acceleration

Published 14 Oct 2024 in cs.LG, cs.AI, and cs.CL | (2410.10165v2)

Abstract: LLMs have demonstrated remarkable capabilities across various applications, but their performance on long-context tasks is often limited by the computational complexity of attention mechanisms. We introduce a novel approach to accelerate attention computation in LLMs, particularly for long-context scenarios. We leverage the inherent sparsity within attention mechanisms, both in conventional Softmax attention and ReLU attention (with ReLU<sup>α\mathsf{ReLU}<sup>\alpha activation, α∈N+\alpha \in \mathbb{N}_+), to significantly reduce the running time complexity. Our method employs a Half-Space Reporting (HSR) data structure to identify non-zero or ``massively activated'' entries in the attention matrix. We present theoretical analyses for two key scenarios: generation decoding and prompt prefilling. Our approach achieves a running time of O(mn<sup>4/5)O(mn<sup>{4/5}) significantly faster than the naive approach O(mn)O(mn) for generation decoding, where nn is the context length, mm is the query length, and dd is the hidden dimension. We can also reduce the running time for prompt prefilling from O(mn)O(mn) to O(mn<sup>1</sup>−1/⌊d/2⌋+mn<sup>4/5)O(mn<sup>{1</sup> - 1 / \lfloor d/2\rfloor} + mn<sup>{4/5}). Our method introduces only provably negligible error for Softmax attention. This work represents a significant step towards enabling efficient long-context processing in LLMs.

Citations (10)

Summary

No one has generated a summary of this paper yet.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.