arXiv:2611.07256cs.LGNov 2026

Manuscript Offprint

arXiv:2611.07256

TriAttention: Unified Sparse Mixed-Precision Attention for Long-Context LLM Inference

Hanzhi Zhang, Qiao Zhang, Qinglei Cao, Heng Fan, Yan Huang, Kewei Sha, Yunhe Feng

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Sparsity and quantization reduce the cost of attention by skipping interactions and lowering the precision of those retained. However, useful interactions differ in their precision requirements: some tolerate low-precision scores while remaining sensitive to removal. We therefore introduce TriAttention, which assigns query-key (QK) tiles to skipping, 4-bit, or 8-bit computation, using 4-bit to retain quantization-tolerant interactions at lower cost. To represent compactly, we encode each head's computation regions with two diagonal-distance boundaries, keeping policy storage independent of context length. Offline calibration then evaluates candidate boundary pairs using normalized projected-output errors and complete-tile execution costs. Using these measurements, a model-wide allocator selects each head's boundaries to minimize calibration error under a shared computation budget. During prefill, the selected boundaries generate precision-grouped traversals for a fused kernel that skips omitted tiles and combines contributions from both QK precisions into one normalized attention output. The quantized keys and values prepared during prefill are then reused in a compressed key-value (KV) cache for decoding, reducing repeated reads of prompt data. Experiments show that TriAttention achieves end-to-end generation speedups of up to 7.88×7.88\times over the Torch attention and 2.65×2.65\times over the BF16 baseline. Meanwhile, TriAttention maintains quality comparable to the original models on general-purpose and long-context tasks. These results show how a compact retention-and-precision policy translates local sensitivities into attention computation and repeated KV-cache access. The implementation is https://github.com/HanzhiZhang-Ulrica/TriAttention.

1 INTRODUCTION

Efficient deployment of large language models (LLMs) requires reducing inference latency while preserving model quality across conversational assistance, code generation, reasoning, and document summarization (Grattafori et al., 2024; Bai et al., 2024). For attention, this involves both matrix computation during prompt processing (prefill) and repeated key-value (KV) cache reads during token generation (decode) (Dao et al., 2022; Yang et al., 2025). Sparsity reduces attention computation by skipping selected interactions, while quantization accelerates query-key (QK) multiplication through lower-precision arithmetic (Jiang et al., 2024; Zhang et al., 2025b). However, attention interactions differ in their sensitivity to skipping and reduced precision: some can be removed with little effect on the output, while other useful contributions tolerate lower QK precision but remain sensitive to removal. Model quality therefore depends on both which interactions are retained and the precision used to compute their contributions.

Figure 1 contrasts efficient attention strategies and illustrates their long-context QA and inference-throughput differences. Dense attention kernels reduce memory transfers and improve GPU utilization, yet still evaluate a quadratic number of causal interactions (Dao et al., 2022; Dao, 2024). To reduce the interaction count, structured sparse methods select attention patterns or spans, but retained regions still incur floating-point computation. Therefore, further savings from sparsity require excluding more context, and discarding useful interactions degrades model quality (Lai et al., 2025; Jiang et al., 2024; Fu et al., 2024; Zhu et al., 2025). Quantized attention increases QK multiplication throughput with lower-bit arithmetic. However, using a uniformly higher precision protects sensitive regions but spends unnecessary computation on regions that tolerate lower precision, while reducing precision to suit tolerant regions introduces excessive error in sensitive ones and degrades model quality (Zhang et al., 2025b; 2024a). Sparse quantized attention combines skipping with low-bit QK computation, yet retained regions still share one precision even though some require higher score accuracy and others tolerate further quantization (Zhang et al., 2025a). This leads to our central question: how can attention jointly allocate retention and precision for efficient GPU execution?

1^{1}LLaVi Lab, Computer Science & Engineering, University of North Texas. 2^{2}Computer Science, Saint Louis University. 3^{3}Data Science, University of North Texas.

{hanzhi.zhang, heng.fan, yan.huang, kewei.sha, yunhe.feng}@unt.edu {qiao.zhang, qinglei.cao}@slu.edu.

Figure

Figure 1. Attention computation choices and inference performance. Top left: attention maps and token-interaction graphs compare dense, sparse, quantized, and sparse-quantized designs with TriAttention, which jointly assigns skipping, 4-bit, and 8-bit. Bottom left: LooGLE single-hop QA F1 at 64K. Right: throughput across input lengths. Both evaluations use Llama-3.2-3B-Instruct.

Our key insight is that attention regions differ in their sensitivity to skipping and reduced score precision. Exploiting these differences lets us preserve useful context at lower cost while reserving higher precision for sensitive regions. However, translating this flexibility into efficient inference requires resolving two coupled challenges. For allocation, comparable reductions in computation produce different output errors across layers and heads, so a compression level tolerated by some regions introduces excessive errors in less tolerant regions and degrades model quality. For execution, an explicit tile-action map grows quadratically with context length. Query-block traversal metadata also competes with staged K/V operands for shared memory.

To address these challenges, we introduce TriAttention, a sparse mixed-precision attention method that jointly assigns skipping, 4-bit, and 8-bit QK computation within each head. To control policy-metadata growth, we define each layer-head configuration using two diagonal-distance boundaries that describe entire computation regions with storage independent of context length. To compare sensitivity across layers and heads, offline calibration measures each candidate boundary pair's error after output projection and normalizes it by the layer's reference attention-output energy. We pair these errors with complete-tile costs, so allocation accounts for the full computation performed on retained tiles. Using these comparisons, a global allocator selects a boundary pair under a shared budget, preserving more computation in sensitive regions and concentrating savings in more tolerant ones. During prefill, the selected boundaries generate only the current query block's retained tile indices, keeping traversal metadata local to the work staged in shared memory. The fused kernel processes these indices in precision groups to reuse query operands, skips omitted

tiles, and combines retained contributions into one normalized attention output. At prompt completion, the selected ranges determine which prepared quantized keys and values are packed into the decode cache, extending the allocation's savings from prefill to repeated prompt-data reads.

Across the evaluated workloads, TriAttention achieves end-to-end generation speedups of up to 7.88× over models using Torch attention and 2.65× over the BF16 baseline. These efficiency gains are achieved while maintaining quality comparable to the original models on general-purpose tasks and long-context question answering.

References (66)