HiSA: Sparsifying the Hidden Dimension of RoPE Attention in LLMs
Ambroise Borbely, Mathieu Salzmann, Olivier Verscheure
cs.LG, cs.CL
2026-11-20
HiSA keeps a RoPE pair only while rotation stays under 90°, computing ~29% of Q·K at 4K. From-scratch 135M and 360M models still beat dense loss; 16K decoding is ~42% faster.
Cheaper attention usually means fewer tokens. Sliding windows, KV eviction, and block routing all shrink the set of keys. Once a query is paired with a key, the dot product still runs over the full head.
RoPE, rotary position embeddings, splits that product into 2D frequency pairs. Each pair rotates with position, and distance shows up only as a relative angle. A fast pair finishes a turn within a few tokens, so shifting a distant key by one position swings its score. A slow pair barely moves across the whole context. Language does not depend on an exact offset that far away. The practical question is whether those large-angle terms have to be computed.
HiSA, Hidden Sparse Attention, does not touch the projections. Pair l contributes to the score only while the RoPE rotation between query and key stays under an angle budget Φ. The default is 90°, under a quarter turn. Softmax and values stay as they are. The sparsity is on the feature axis.
Each pair has its own window, ending at Δmax,l = Φ/θl. Nearby keys are scored on every pair. Distant keys keep only the slow pairs. A key drops out of the softmax once every pair has expired. That horizon is the reach, fixed by the slowest pair. At head dimension 64, Φ = 90°, and base b = 10^4, the fastest pair sees about 2 tokens and the slowest about 11,800. At b = 2×10^4 the reach is about 23,000 tokens. The pattern depends only on distance and frequency: no new parameters, no runtime selection. A key component can leave the cache when its window ends.
The exact mask is a poor fit for wide GPU tiles, because keys in one tile expire at different distances. Flash-HiSA turns the rule into blocks inside FlashAttention-3, forward and backward. The sequence is cut into blocks of 128 tokens and the features into chunks of 16, which is 8 pairs. Between two blocks, the kept pairs are those the exact rule would keep at the closest distance, and a split chunk is zeroed in the query. The block rule adds at most 127 extra tokens per pair. It is a different model, so training and inference must use the same block length.
The models follow SmolLM-135M and SmolLM-360M, with head dimension 64 and grouped-query attention. Training is from scratch on OpenWebText, about 20 tokens per parameter: 2.7B for 135M and 7.24B for 360M. Dense and HiSA differ only in the attention rule.
| Setup | Method | Val. loss | Share of dot product |
| 135M, b=10^4 | Dense | 2.906 | 100% |
| 135M, b=10^4 | HiSA | 2.880 | 29.3% |
| 135M, b=2×10^4 | Dense | 2.908 | 100% |
| 135M, b=2×10^4 | HiSA | 2.869 | 34.2% |
| 360M, b=10^4 | Dense | 2.587 | 100% |
| 360M, b=10^4 | HiSA | 2.575 | 29.3% |
On the 135M run with b=10^4, HiSA is lower in every position band. At 2K-4K the losses are 2.804 versus 2.830. Every finite budget from 45° to 360° beats dense attention. 90° is the compromise between compute and loss.
On one H200, the exact Triton kernel runs at 119k tokens/s with loss 2.880. Dense SDPA in FlashAttention-2 runs at 205k tokens/s with loss 2.906, so the exact rule is about 1.7× slower. Dense FlashAttention-3 runs at 236k tokens/s with loss 2.904. Flash-HiSA computes 34.8% of the dot product, reaches loss 2.892, and trains at 238k tokens/s. The loss gain shrinks to about 0.012.
A 4K model with b=2×10^4 is then extended to 16K on 540M tokens, about 20% of pretraining, mixing PG19 and OpenWebText. Exact HiSA scores 3.170 on PG19 versus 3.205 for dense, and 3.071 versus 3.111 on OpenWebText, at 20.2% of the dot product. The 8K-16K band is 3.140 versus 3.174. Flash-HiSA scores 3.190 versus 3.212 on PG19, computes 21.7% of the product, and trains at 135k versus 143k tokens/s.
Decoding is on the same H200. At 16K, b=2×10^4, and batch 128, dense FlashAttention-3 does 9.2k tokens/s with a 45.0 GiB KV cache. Flash-HiSA does 13.0k tokens/s and 29.1 GiB, the speedup reported as about 42%. At 4K, b=10^4, and batch 128, the rates are 23.2k versus 20.4k, and the cache is 7.7 GiB versus 11.2 GiB. The same kernel with no pair dropped is still 13% faster.
Switching the dense 135M checkpoint to HiSA with no extra training moves the loss from 2.906 to 2.937. After 1.35B more tokens on each side, HiSA reaches 2.836 and continued dense training reaches 2.838.
Dense training learns to damp the large-angle terms. The control swaps a pair for the same position in another document: same rotation, unrelated content. At the start of training the real term and the control are close. After about 1B tokens, only 2%-5% of cells under 90° fall below the control, while the share below the control at 180°-360° rises from 33% to 48%. In SmolLM-135M, trained on about 600B tokens, 87%-95% of cells past 180° sit below the control. Influence from terms past 720°, relative to terms under 45°, falls from 4.6% to 2.1% by the end of this run, and to 0.5% in SmolLM-135M.
The mask is fixed before any token is read. Kernels can skip whole multiplies, and a frequency chunk can leave the KV cache when its window ends. ATFlash and WavePrune also limit each RoPE pair by wavelength, but every key and value stays in memory. HiSA's default keeps a quarter turn, and validation loss at the training length is lower.
The working setups are training from scratch, or converting a dense model with more tokens. A switch with no extra training raises the loss. These runs do not shorten training. They save decode throughput and memory. The loss gaps are about 0.01 to 0.04: fewer products, and a slightly better loss.
The models stop at 360M, and the metric is validation loss. There is no downstream eval and no matched comparison with token-sparse methods such as NSA or MoBA. Larger models, downstream benchmarks, and better kernels are still open.
Dropping about 70% of the query-key products does not make the exact rule faster to train. The kernel is the bottleneck. Flash-HiSA recovers the speed and keeps about half the loss gain. Of the roughly 42% decode speedup, 13% remains when no frequency pair is dropped.
At the same base b=10^4, the loss gap shrinks from 0.026 at 135M to 0.012 at 360M. Suppression of large angles is still increasing at 2.7B tokens. It is much stronger in SmolLM-135M at about 600B. Whether a fully trained large model still gains, and whether tasks that need exact offsets get worse, is untested. If the block length differs, the block rule and the exact rule no longer match.