about
ThriftAttention: Selective Mixed Precision for Long-Context FP4 Attention (arxiv.org)
4 points by joesharratt29 131 days ago | hide | past | pdf | 1 comment on HN

In plain words: 4-bit attention is faster on long inputs but drops quality, because errors pile up in the few blocks holding the most important words. Computing just 5% of blocks at 16-bit precision and the rest at 4 bits recovers 89.1% of the quality it loses.

Abstract

Efficient attention algorithms are critical to mitigate the quadratic cost of attention in long-context workloads. Prior work utilises block-scaled quantisation techniques on Blackwell GPUs to move attention computation to 4-bit precision to accelerate inference. However, these techniques result in significant quality degradation in long-context settings. We show that the output impact of quantisation error is highly non-uniform and increases with the importance of each query-key interaction, concentrating functionally relevant error in a small number of attention blocks that contain the most important tokens. We propose ThriftAttention, a low-bit attention variant that delivers near-FP16 long-context quality at FP4 inference efficiency. This approach proceeds in two stages. First, a heuristic rapidly selects a small number of important query-key block pairs for FP16 precision. Second, the selected blocks are computed in FP16 and the remaining blocks in FP4, with both paths merged via online softmax into a single output. We demonstrate across long-context benchmarks and model families that by computing only 5% of query-key blocks in FP16, ThriftAttention recovers on average 89.1% of the FP4-to-FP16 performance gap. We show ThriftAttention's advantage grows with sequence length, mitigating the systematic FP4 quality degradation observed at longer contexts. The code is available at https://github.com/joesharratt1229/ThriftAttention.

Joe Sharratt
arXiv:2605.23081 · cs.LG · submitted May 21, 2026
abstract · pdf · html

add comment on HN

FP4 attention is fast but in long-context settings its quality degrades. ThriftAttention solves this by computing the most important 5% of blocks in FP16, the remainder in FP4. We find that this approach recovers over 90% of the performance gap between FP4 and FP16 on long-context evaluation benchmarjs. The repo has a graph of the tradeoffs: https://github.com/joesharratt1229/ThriftAttention