OpenAttention: One Percent Is Enough with Tail Proxies
Organizations: Sogang University · Samsung Electronics · Pusan National University
Abstract
Sparse attention reads only a small subset of the key-value cache, and how to treat the unread tail remains a key challenge. Discarding the tail biases the output, and sampling it as previous approaches do fails at reads of 5% and below, where the tail likely holds heavy hitters the selector missed. Our key observation is that the simplest possible proxy, one token that folds the entire tail into its count-aware mean, already yields lower output error than a sample at every read behind a practical selector. We further show in closed form that at low reads sampling nearly doubles the weight error of discarding while a single proxy stays below it. Building on these findings, we explore approximating the dense attention distribution with a few proxies that target the tail. We propose OpenAttention, a pipeline of clustering, ErrorGate and top-k selection followed by a count-aware mean proxy. To implement clustering and selection both efficiently and effectively, we design training-free Query-Geometry Clustering (QGC) and a Query-Geometry Selector (QGS), which compress the keys while respecting the query directions. Additionally, unlike prior methods that rank clusters by centroid alone, ErrorGate allocates the exact read by the estimated weight error of each cluster. On RULER-32K HARD with Llama-3.1-8B, OpenAttention retains 99% of dense accuracy at a 1% read. It also achieves state-of-the-art accuracy across models, context lengths and datasets. Our customized attention kernel for OpenAttention runs the decode attention stage 10 faster than dense attention at a 1% read.
Figures & tables
| clustering | dim | avg |
|---|---|---|
| token position | – | 84.37 |
| -means on keys only | 128 | 85.42 |
| QGC (ours) | 16 | 86.30 |
| selector | ms | ||
|---|---|---|---|
| SparQ | 0.96 | 0.94 | 0.29 |
| Loki | 0.84 | 0.75 | 0.18 |
| Quest | 0.77 | 0.66 | 0.33 |
| Double Sparsity | 0.97 | 0.95 | 0.50 |
| Squeezed Attention | 0.92 | 0.86 | 0.23 |
| HashAttention | 0.74 | 0.63 | 0.24 |
| ranking statistic | avg |
|---|---|
| mean logit (mass) | 85.99 |
| variance | 84.81 |
| estimated error (ours) | 86.30 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| selector | read | (f / m) | (f / m) | (f / m) | ||||
|---|---|---|---|---|---|---|---|---|
| HashAttention | 10% | 0.212 | 0.176 | 2.36 | 1585 | 0.401 / 0.398 | 0.173 / 0.171 | 0.176 / 0.176 |
| 5% | 0.245 | 0.212 | 2.41 | 791 | 0.477 / 0.480 | 0.208 / 0.206 | 0.212 / 0.212 | |
| 3% | 0.268 | 0.236 | 2.43 | 473 | 0.527 / 0.530 | 0.233 / 0.230 | 0.236 / 0.236 | |
| 1% | 0.315 | 0.286 | 2.47 | 156 | 0.628 / 0.623 | 0.282 / 0.280 | 0.286 / 0.286 | |
| 0.5% | 0.345 | 0.316 | 2.48 | 76 | 0.687 / 0.684 | 0.312 / 0.310 | 0.316 / 0.316 | |
| 0.1% | 0.406 | 0.386 | 2.50 | 13 | 0.812 / 0.855 | 0.381 / 0.380 | 0.386 / 0.385 |
| custom | 1% read | 3% read | |||
|---|---|---|---|---|---|
| method | kernel | ||||
| dense attention (fused SDPA) | – | 0.06 | 1.20 | 0.06 | 1.22 |
| HashAttention | 0.12 | 0.54 | 0.11 | 1.65 | |
| vAttention (lower bound) | 0.37 | 0.67 | 0.35 | 1.75 | |
| MagicPIG (lower bound) | 0.13 | 0.55 | 0.11 | 1.65 | |
| OpenAttention, unfused gather | 0.29 | 0.46 | 0.27 | 1.26 | |
| proxy | avg | qa_1 | qa_2 | vt | fwe | mk_2 | mk_3 | mv | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10% | 512 | 2493 | 32 | 23% | 86.59 | 78.0 | 49.5 | 95.2 | 92.7 | 95.0 | 99.5 | 96.2 |
| 10% | 256 | 2877 | 32 | 12% | 86.85 | 78.0 | 50.5 | 95.0 | 94.2 | 94.5 | 99.5 | 96.2 |
| 5% | 256 | 1238 | 32 | 23% | 86.51 | 76.5 | 51.0 | 94.9 | 93.2 | 94.5 | 99.5 | 96.0 |
| 5% | 192 | 1335 | 32 | 18% | 86.98 | 79.0 | 50.5 | 95.1 | 93.5 | 95.0 | 99.5 | 96.2 |
| 5% | 128 | 1431 | 32 | 12% | 86.83 | 78.5 | 50.0 | 95.2 | 94.3 | 95.0 | 99.5 | 95.2 |
| 10% | 384 | 2685 | 32 | 18% | 86.60 | 77.5 | 50.0 | 95.1 | 93.0 | 95.0 | 99.5 | 96.1 |
| budget | method | read | avg | qa_1 | qa_2 | vt | fwe | mk_2 | mk_3 | mv |
|---|---|---|---|---|---|---|---|---|---|---|
| 100% | dense | 100% | 87.04 | 79.0 | 50.0 | 95.2 | 93.3 | 95.0 | 100.0 | 96.8 |
| 10% | MagicPIG | 10.0% | 52.52 | 51.0 | 39.0 | 90.2 | 88.8 | 30.0 | 3.5 | 65.1 |
| HashAttention | 10.0% | 81.23 | 70.5 | 45.5 | 87.9 | 89.8 | 88.0 | 91.0 | 95.9 | |
| vAttention | 10.0% | 83.08 | 73.0 | 46.0 | 91.3 | 92.2 | 92.5 | 91.0 | 95.6 | |
| OpenAttention (ours) | 10.0% | 87.08 | 79.0 | 51.0 | 95.3 | 92.7 | 95.0 | 100.0 | 96.6 | |
| 5% | MagicPIG | 5.1% | 34.42 | 36.0 | 33.5 | 71.5 | 88.3 | 2.5 | 0.0 | 9.1 |
| proxies | ErrorGate | QGS | avg | qa_1 | qa_2 | vt | fwe | mk_2 | mk_3 | mv |
|---|---|---|---|---|---|---|---|---|---|---|
| 67.35 | 62.0 | 45.5 | 84.0 | 91.7 | 63.0 | 31.5 | 93.8 | |||
| ✓ | 77.91 | 74.5 | 45.5 | 91.8 | 92.8 | 82.5 | 63.0 | 95.2 | ||
| ✓ | ✓ | 85.90 | 78.5 | 49.0 | 95.6 | 92.2 | 94.0 | 96.0 | 96.0 | |
| ✓ | ✓ | 86.73 | 78.0 | 51.0 | 95.6 | 92.0 | 94.5 | 99.5 | 96.5 | |
| ✓ | ✓ | ✓ | 86.82 | 78.5 | 50.5 | 95.8 | 92.2 | 94.5 | 99.5 | 96.8 |
| configuration | realised read | output error |
| target read 1% : 14 of 40 configurations within the target | ||
| , nominal 1.0%, sampling share 0.50 (chosen) | 1.00% | 0.470 |
| , nominal 0.8%, sampling share 0.50 | 0.90% | 0.579 |
| , nominal 0.4%, sampling share 0.25 | 0.83% | 0.628 |
| , nominal 0.4%, sampling share 0.25 (none fits: smallest read) | 3.16% | 0.489 |
| , nominal 0.4%, sampling share 0.25 (none fits: smallest read) | 9.32% | 0.383 |
| target read | fixed ( , 50/50) | protocol-chosen | measured read |
|---|---|---|---|
| 1% | 37.36 | 36.29 | 1.0% |
| 3% | 57.15 | 55.74 | 3.0% |
| 5% | 68.70 | 68.86 | 5.0% |
| 10% | 82.26 | 83.08 | 10.0% |
| method (3% read) | gov_rep. | multi_news | LB-v2 |
|---|---|---|---|
| dense | 36.08 | 26.61 | 30.00 |
| HashAttention | 35.34 | 22.09 | 23.30 |
| vAttention | 31.05 | 16.33 | – |
| OpenAttention (static only) | 35.53 | 26.80 | 33.30 |
| method | gov_report (ROUGE-L) | multi_news (ROUGE-L) |
|---|---|---|
| dense | 36.08 | 26.61 |
| HashAttention | 35.34 | 22.09 |
| vAttention | 31.05 | 16.33 |
| OpenAttention (HashAttention selector, static-metric partition) | 35.95 | 26.99 |
| OpenAttention (static metric only: selector and partition) | 35.53 | 26.80 |
| OpenAttention (static instruction tokens as question) | 34.68 | 26.93 |
| method | avg | qa_1 | qa_2 | vt | fwe | mk_2 | mk_3 | mv |
|---|---|---|---|---|---|---|---|---|
| dense attention | 87.04 | 79.0 | 50.0 | 95.2 | 93.3 | 95.0 | 100.0 | 96.8 |
| StreamingLLM (2048) | 28.00 | 50.5 | 37.5 | 5.3 | 88.3 | 5.0 | 5.0 | 4.4 |
| + OpenAttention at 10% | 28.28 | 52.0 | 37.5 | 5.4 | 88.7 | 5.0 | 5.0 | 4.4 |
| SnapKV (2048) | 69.98 | 77.5 | 49.0 | 88.6 | 82.2 | 93.5 | 3.0 | 96.1 |
| + OpenAttention at 10% | 69.49 | 76.0 | 48.0 | 87.7 | 83.5 | 93.5 | 2.5 | 95.2 |
| PyramidKV (2048) | 70.34 | 78.0 | 49.5 | 90.6 | 82.5 | 93.5 | 2.0 | 96.2 |
| context | method | read | avg | qa_1 | qa_2 | vt | fwe | mk_2 | mk_3 | mv |
|---|---|---|---|---|---|---|---|---|---|---|
| 16K | dense | 100% | 87.14 | 86.0 | 51.0 | 93.2 | 91.0 | 95.0 | 98.0 | 95.8 |
| MagicPIG | 3.0% | 46.91 | 49.0 | 32.0 | 83.2 | 79.7 | 14.0 | 0.0 | 70.5 | |
| HashAttention | 3.0% | 67.41 | 84.0 | 53.0 | 78.4 | 83.0 | 62.0 | 20.0 | 91.5 | |
| vAttention | 3.0% | 52.69 | 60.0 | 41.0 | 73.4 | 83.7 | 21.0 | 1.0 | 88.8 | |
| OpenAttention (ours) | 3.0% | 87.49 | 86.0 | 54.0 | 94.0 | 89.7 | 95.0 | 98.0 | 95.8 | |
| 32K | dense | 100% | 87.75 | 83.0 | 50.0 | 95.2 | 93.3 | 96.0 | 100.0 | 96.8 |
Efficient Attention
Efficient attention reduces the compute, memory traffic, and cache costs of Transformer attention while preserving useful long-range interactions.
See all 138 papers