Lune

ICML2025Top-tier venue

HashAttention: Semantic Sparsity for Faster Inference

Aditya Desai, Shuo Yang, Alejandro Cuadron, Matei Zaharia, Joseph E. Gonzalez, Ion Stoica

Abstract

Leveraging long contexts is crucial for advanced AI systems, but attention computation poses a scalability challenge. While scaled dot-product attention (SDPA) exhibits token sparsity, i.e. only a few pivotal tokens significantly contribute to output, exploiting this sparsity remains challenging. Existing methods either suffer from quality degradation or require substantial additional resources. We show that identifying pivotal tokens is a Maximum Inner Product Search (MIPS) problem. However, existing MIPS solutions are not well-suited for SDPA, as they are not GPUfriendly and often underperform due to the separated query and key distributions. This paper introduces HashAttention, framing 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 using bitwise operations and computes attention using only these tokens, improving the overall attention efficiency. Trained on generic data, HashAttention reduces tokens used by up to 16× with minimal quality loss, requiring only 32 bits of auxiliary memory per token. Sparsity can be further improved to 32× through task-specific fine-tuning. On A100 GPU, at 32× sparsity, incorporating HashAttention reduces attention latency by up to 4.3× in GPT-FAST and 2.54× in FlashDecode, and achieves up to 3.12× higher throughput for GPT-FAST.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

9 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Efficient Streaming Language Models with Attention Sinks cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites Efficient Streaming Language Models with Attention Sinks
  • Efficient Streaming Language Models with Attention Sinks cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity cites Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
  • Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual Sparsity cites Efficient Memory Management for Large Language Model Serving with PagedAttention
  • MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference cites Efficient Streaming Language Models with Attention Sinks
  • MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference cites Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
  • MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM Inference cites Efficient Memory Management for Large Language Model Serving with PagedAttention
  • Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention cites Efficient Streaming Language Models with Attention Sinks
  • Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • Overcoming Long Context Limitations of State Space Models via Context Dependent Sparse Attention cites Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
  • vAttention: Verified Sparse Attention via Sampling cites Efficient Streaming Language Models with Attention Sinks
  • vAttention: Verified Sparse Attention via Sampling cites H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers9

  1. Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse AttentionJingyang Yuan, Huazuo Gao, Damai Dai, Junyu Luo et al.ACL 2025 · 334 citations
  2. Polar Sparsity: High Throughput Batched LLM Inferencing with Scalable Contextual SparsitySusav Shrestha, Bradley W. Settlemyer, Nikoli Dryden, A. L. Narasimha ReddyNeurIPS 2025 · 8 citations
  3. Overcoming Long Context Limitations of State Space Models via Context Dependent Sparse AttentionZhihao Zhan, Jianan Zhao, Zhaocheng Zhu, Jian TangNeurIPS 2025 · 7 citations
  4. MPCache: MPC-Friendly KV Cache Eviction for Efficient Private LLM InferenceWenxuan Zeng, Ye Dong, Jinjin Zhou, Jin Tan et al.NeurIPS 2025 · 4 citations
  5. vAttention: Verified Sparse Attention via SamplingAditya Desai, Kumar Krishna Agrawal, Shuo Yang, Alejandro Cuadron et al.ICLR 2026 · 3 citations

Builds on18

  1. Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni et al.NeurIPS 2020 · 19,162 citations
  2. FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 citations
  3. Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han et al.ICLR 2024 · 1,714 citations
  4. Efficient Memory Management for Large Language Model Serving with PagedAttentionWoosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng et al.SOSP 2023 · 1,016 citations
  5. H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen et al.NeurIPS 2023 · 1,003 citations

Related papers

  1. Token Sparse Attention: Efficient Long-Context Inference with Interleaved Token SelectionDongwon Jo, Beomseok Kang, Jiwon Song, jae-joon kimICML 2026 · 1 citation
  2. Scaling Attention via Feature SparsityYan Xie, Tiansheng Wen, Tangda Huang, Bo Chen et al.ICLR 2026 · 3 citations
  3. Training-Free Hashing-Based Attention via Binary Principal ComponentsDaohai Yu, Zhanpeng Zeng, Keyu Chen, Wenhao Li et al.ICML 2026
  4. SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM PrefillingXiaodong Ji, Hailin Zhang, Fangcheng Fu, Bin CuiICML 2026 · 3 citations
  5. HATA: Trainable and Hardware-Efficient Hash-Aware Top-k Attention for Scalable Large Model InferencePing Gong, Jiawei Yi, Shengnan Wang, Juncheng Zhang et al.ACL Findings 2025 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines