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

DevFeed: [TriAttention: Unified Sparse Mixed-Precision Attention for Long-Context LLM Inference](<https://devfeed.tech/articles/triattention-unified-sparse-mixed-precision-attention-for-long-context-llm-inference-120176.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.07256>)

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

Published: 2026-11-06T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [quantization](<https://devfeed.tech/topics/quantization.md>), [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>)

Tags: [attention](<https://devfeed.tech/tags/attention.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [kv-cache](<https://devfeed.tech/tags/kv-cache.md>), [llm-inference](<https://devfeed.tech/tags/llm-inference.md>), [long-context](<https://devfeed.tech/tags/long-context.md>), [precision](<https://devfeed.tech/tags/precision.md>), [quantization](<https://devfeed.tech/tags/quantization.md>), [sparsity](<https://devfeed.tech/tags/sparsity.md>)

## AI overview

TriAttention assigns query-key tiles to skipping, 4-bit, or 8-bit computation, reflecting that some interactions tolerate lower precision but remain important to retain. It represents each attention head's policy with two diagonal-distance boundaries, then uses offline calibration of projected-output error and full-tile cost to select boundaries across the model under a shared computation budget. During prefill, a fused kernel groups work by precision and combines both precisions into one normalized output; quantized keys and values are reused in a compressed KV cache during decoding to reduce repeated prompt-data reads. The abstract reports up to 7.88x end-to-end generation speedup over Torch attention and 2.65x over a BF16 baseline, with quality comparable to the original models on general-purpose and long-context tasks.

## Source excerpt

arXiv:2611.07256v1 Announce Type: cross 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.88x over the Torch attention and 2.65x 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.