atlas

Research map / Learning theory and algorithms / Matrix and tensor methods

HyperAttention: Long-context Attention in Near-Linear Time

ICLR 2024 · Learning theory and algorithms › Matrix and tensor methods · approach: Structured low-rank learning · 9 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 HyperAttention, a near-linear-time approximate attention mechanism combining sortLSH-based large-entry detection with uniform column sampling and a recursive causal-masking extension, applied to pretrained LLMs without fine-tuning.

Problem

Quadratic cost of exact softmax attention for long contexts; prior provable subquadratic methods assume bounded entries or low stable rank and do not support causal masking, and KDE-based approaches are impractical.

Approach

Find large attention entries with Hamming-sorted LSH blocks, estimate the softmax normalizer D by combining exact masked row sums with uniform column sampling, and approximate the product with values via row-norm sampling; the guarantee relies on two fine-grained parameters (max column norm of D^-1 A and ratio of row norms after removing heavy entries) rather than bounded entries. Causal attention

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
replace exact attention with HyperAttentionChatGLM2-6B-32K · 32k contextperplexity: 5.6 to 6.3Hurt
replace exact attention with HyperAttentionsingle attention layer · 131k sequence length, no causal maskingspeedup over FlashAttention: 54×Helped
replace exact attention with HyperAttentionsingle attention layer · 131k sequence length, causal maskingspeedup over FlashAttention: 5.4×Helped
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench single-qatask score: 80.63 -> 71.32Hurt
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench multi-qatask score: 68.14 -> 62.97Hurt
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench summarizationtask score: 53.12 -> 52.13Hurt
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench few-shottask score: 186.58 -> 169.02Hurt
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench synthetictask score: 84.00 -> 80.00Hurt
replace 14 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench codetask score: 99.57 -> 92.12Hurt
replace 28 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench summarizationtask score: 53.12 -> 46.28Hurt
replace 28 attention layers with HyperAttention (ablation)ChatGLM2-6B-32K · LongBench codetask score: 99.57 -> 73.68Hurt

Surprising findings

Limitations

Experimental setup

Datasets: LongBench ImageNet

Benchmarks: LongBench ImageNet

Metrics: perplexity speedup task-specific LongBench scores wall-clock time

Baselines: FlashAttention 2 KDEFormer

Builds on: KDEFormer FlashAttention 2 Hamming sorted LSH Approximate matrix multiplication via row norm sampling

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