atlas

Research map / Architectures and efficiency / Attention and transformers

HashAttention: Semantic Sparsity for Faster Inference

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Sparse attention for long-context LLMs · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes HashAttention, which learns mappings that hash keys/values and queries into 32-bit Hamming-space signatures to identify pivotal tokens for sparse SDPA, reaching 16x-32x sparsity with minimal quality loss.

Problem

Scaling attention to long contexts is costly because SDPA must read the entire KV cache per decoded token; existing top-k sparse attention methods either lose quality under heuristic token selection or need substantial auxiliary memory and are not GPU-friendly.

Approach

Frames pivotal-token identification as maximum inner product search reduced to cosine similarity, then learns independent key-value and query encoders that map vectors to compact bit signatures so top tokens are found via XOR+popcount Hamming distance on GPU.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use HashAttention instead of QuestLlama-3.1-8B-Instruct sparse attention · LongBench averagescore: 63.33 -> 64.15Helped
Apply 16x HashAttention sparsityLlama-3.1-8B-Instruct · LongBench averagescore: 48.78 -> 48.00Hurt
Apply 16x HashAttention sparsityLlama-3.1-8B-Instruct · RULER@16K averagescore: 90.66 -> 89.53Hurt
Use 32x HashAttention sparsityGPT-FAST attention · inferencelatency: up to 4.3×Helped
Use 32x HashAttention sparsityFlashDecode attention · inferencelatency: 2.54×Helped
Use 32x HashAttention sparsityGPT-FAST with Llama-3.1-8B · inferencethroughput: 3.12×Helped
Replace learned signatures with 32-bit LSH signatures (ablation)HashAttention · LongBench average at 16x compressionscore: 75.0675 -> 48.8975Hurt
Increase LSH signature width from 32 bits to 256 bits (ablation)LSH sparse attention · LongBench average at 16x compressionscore: 48.8975 -> 69.7875Helped
Increase HashAttention signature width from 16 to 32 bits (ablation)HashAttention top-64 prediction · 250 × 32K samplescross-entropy loss: 0.243 -> 0.212Helped
Increase HashAttention signature width from 32 to 64 bits (ablation)HashAttention top-64 prediction · 250 × 32K samplescross-entropy loss: 0.212 -> 0.204Helped

Surprising findings

Limitations

Experimental setup

Datasets: OpenWebText LongBench RULER

Benchmarks: LongBench RULER

Metrics: task score recall of top-k pivotal tokens attention latency end-to-end throughput cosine similarity of query-key embeddings

Baselines: StreamingLLM H2O InfLLM Double Sparsity Quest Oracle top-k LSH (random signed projections)

Builds on: Double Sparsity Quest vLLM PagedAttention StreamingLLM

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy