paper-with-me

홈 › Papers

HashAttention: Semantic Sparsity for Faster Inference

2024-12-19 · Aditya Desai, Shuo Yang, Alejandro Cuadron, Ana Klimovic, Matei Zaharia, Joseph E. Gonzalez, Ion Stoica

Utilizing longer contexts is increasingly essential to power better AI systems. However, the cost of attending to long contexts is high due to the involved softmax computation. While the scaled dot-product attention (SDPA) exhibits token sparsity, with only a few pivotal tokens significantly contributing to attention, leveraging this sparsity effectively remains an open challenge. Previous methods either suffer from model degradation or require considerable additional resources. We propose HashAttention --a principled approach casting pivotal token identification as a recommendation problem. Given a query, HashAttention encodes keys and queries in Hamming space capturing the required semantic similarity using learned mapping functions. HashAttention efficiently identifies pivotal tokens for a given query in this Hamming space using bitwise operations, and only these pivotal tokens are used for attention computation, significantly improving overall attention efficiency. HashAttention can reduce the number of tokens used by a factor of $1/32\times$ for the Llama-3.1-8B model with LongBench, keeping average quality loss within 0.6 points, while using only 32 bits per token auxiliary memory. At $32\times$ sparsity, HashAttention is $3{-}6\times$ faster than LightLLM and $2.5{-}4.5\times$ faster than gpt-fast on Nvidia-L4 GPU.

📄 PDF Abstract BibTeX arXiv:2412.14468

Code (0)

등록된 구현이 없습니다.

Tasks

GPUSemantic SimilaritySemantic Textual Similarity

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…

Similar Papers 제목 키워드 기반

Bidirectional Sparse Attention for Faster Video Diffusion Training

2025-09-01 · Chenlu Zhan, Wen Li, Chuyu Shen, Jun Zhang 외 arxiv

Video diffusion Transformer (DiT) models excel in generative quality but hit major computational bottlenecks when producing high-resolution, long-duration videos. The quadratic complexity of full attention leads to prohi…

Semantic Similarity

SparseVILA: Decoupling Visual Sparsity for Efficient VLM Inference

2025-10-20 · Samir Khaki, Junxian Guo, Jiaming Tang, Shang Yang 외 arxiv

Vision Language Models (VLMs) have rapidly advanced in integrating visual and textual reasoning, powering applications across high-resolution image understanding, long-video analysis, and multi-turn conversation. However…

Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time

2023-10-26 · Zichang Liu, Jue Wang, Tri Dao, Tianyi Zhou 외

Large language models (LLMs) with hundreds of billions of parameters have sparked a new wave of exciting AI applications. However, they are computationally expensive at inference time. Sparsity is a natural approach to r…

In-Context Learning

Weight Block Sparsity: Training, Compilation, and AI Engine Accelerators

2024-07-12 · Paolo D'Alberto, Taehee Jeong, Akshai Jain, Shreyas Manjunath 외

Nowadays, increasingly larger Deep Neural Networks (DNNs) are being developed, trained, and utilized. These networks require significant computational resources, putting a strain on both advanced and limited devices. Our…

Code GenerationGPU

Inference in topic models: sparsity and trade-off

2015-12-10 · Khoat Than, Tu Bao Ho

Topic models are popular for modeling discrete data (e.g., texts, images, videos, links), and provide an efficient way to discover hidden structures/semantics in massive data. One of the core problems in this field is th…

Topic Models