Manuscript Offprint
arXiv:2611.03992FlagRot: Selective Rotation for Low-Bit KV Caches
Abstract
Long-context inference is bound by the KV cache, which 2-bit codes could shrink about sixfold if their error stays in check. The usual remedy rotates keys before quantizing, assuming rotation always helps. However, we observe that it does not: rotation flattens a spiky piece of a key but can give a flat one a new peak, and both coexist within one key. We therefore propose FlagRot, which stores each 32-channel piece rotated or as is, whichever has the smaller calibrated attention error, and rotates the query instead when reading. We further show that how often to decide follows the quantization axis: per-channel caches such as KIVI need one decision per head, at no write cost, while per-token caches decide per key, with the choice stored in existing sign bits. At 2.5 bits per value, FlagRot lowers the twelve-model KL divergence of KIVI from 18.7 to 12.4×10⁻³, below RotateKV on 9 of 12 models. Served as a vLLM plugin, it raises RULER at 128k tokens by +2.9 points and the LongBench v1 mean by +0.4 to +1.9 points on the three of four models where 2-bit KIVI loses accuracy. It also lowers the error of 4-bit integer and FP4 caches.¹
1 Introduction
Every decoding step of a long-context model reads the whole KV cache, so the bytes per cached value bound both the number of sequences that fit in memory and the time of each step. At 32,768 tokens the BF16 cache of Qwen3-8B takes 4.8 GB per sequence. A cache with 2-bit codes and their scales needs 2.5 to 3 bits per value instead of 16. The price is accuracy: with 2-bit round-to-nearest (RTN) codes, the LongBench v1 mean of Qwen3-8B falls by 11.0 points in our served 2.5-bit per-token setting (Table 22). Range is one source of
this error: a few large entries widen the range of their quantization group and leave few code levels for the rest (Liu et al., 2024b; Hooper et al., 2024).
Rotations attack the range problem by spreading large entries over many coordinates (Ashkboos et al., 2024; Su et al., 2025b; Zandieh et al., 2026), but we find that they spread small entries as well. The error of a uniform quantizer grows with the crest factor of a group, and a Hadamard transform pulls every group toward the crest factor of a Gaussian vector: it flattens a spike but can give a flat piece a peak. On the cached keys of Llama-3.1-8B, we measure that it makes most of the flattest pieces harder to quantize (Figure 1). Which transform is better changes from one piece to the next, from token to token and from model to model, so a single rotation for all keys leaves error behind even when it helps on average.
We therefore treat the transform as a decision of the encoder rather than a fixed preprocessing step. Our method, FlagRot, tries both versions of each 32-channel piece, plain and rotated, and selects by a calibration estimate of attention error: a key error shifts the logit of a query by , and queries concentrate on a few channels, so the decision weighs errors by calibration queries. One bit per piece records it in the sign bit of a positive quantization scale in the packed layout, so its page size does not grow; attention rotates the query into both bases instead of rotating keys back.
Selection applies to several quantizers, and we find that how often to decide depends on the quantization axis. The encoder can decide once per head from calibration data (fixed mode) or anew for every key (per-key mode). Our main system, FlagRot-KIVI, adds selection to KIVI, which quantizes keys along channels; KIVI-only is the same cache with selection off. There one decision already covers 32 tokens, and the fixed mode keeps 78% of the KL reduction with no work at write time. A second instance, FlagRot-auto, adds selec-
*All the work was done within HKUST and Xijie Huang served an advisory role.
¹Code: github.com/KunmingSHAO/FlagRot_releaser

(a) Real key sub-vectors
(b) Error increase vs. crest
(c) Choices within one key
(d) Whole-head rotation, NVFP4
Figure 1: On real cached keys, rotation helps spiky sub-vectors and hurts many flat ones. (a) Two 32-dim key sub-vectors of Llama-3.1-8B before and after , with crest factor and change of the query-weighted INT4 error. (b) Share of sub-vectors whose error rises under , by decile of the crest factor. (c) The selections of FlagRot within one key and their shares. (d) Whole-head rotation of NVFP4 caches, per model.
tion to a cache that quantizes each key on its own after centering, that is, subtracting a calibrated key mean. On such per-token caches the per-key mode lowers the error by a further 35%, against 10% on KIVI. One principle covers both: the transform is a decision of the encoder, judged by the error attention sees and renewed only as often as the statistics the quantizer pools change.
This paper makes three contributions. First, we explain when a rotation helps a low-bit key, through the crest factor of each piece and the queries that read it (Section 2). Second, we introduce FlagRot, which selects the transform of each piece by the error attention sees, records the decision in existing sign bits, and runs in vLLM as a per-channel and a per-token cache (Section 3). Third, we show that selection lowers the error of the encoders we test: at 2.5 bits per value it lowers the twelve-model KL of KIVI from to , below RotateKV (clip 1.0) on 9 of the models (Table 1). Served at that size, it adds +2.9 points to the RULER score at 128k tokens and +0.4 to +1.9 points to the Long-Bench v1 mean on the three of four models where KIVI loses accuracy (Table 2), and FlagRot-KIVI outscores the per-token cache of equal size on the three shared endpoints. At 4 bits our selection lowers the KL of INT4, MXFP4 and NVFP4 caches by 13–89% relative to RTN.
Spreading helps spiky pieces and can hurt flat ones. A uniform -bit quantizer divides the range of a group into steps, so, as a rule of thumb, at a fixed energy its error grows with the crest factor . An orthogonal keeps the energy and replaces by , and on the keys we measure, rotated pieces settle at a median crest factor of 2.2, near the 2.3 of a Gaussian vector of 32 entries. Rotation thus pulls every piece toward that value: a spike becomes flat, but a flat piece near 1) can gain a peak (Figure 1a). Among the flattest tenth of the key pieces of Llama-3.1-8B and Qwen3-8B, rotation makes the error worse for about two thirds; among the spikiest tenth it does so for about one in six (Figure 1b). With 2-bit codes, the share of pieces that

Figure 2: FlagRot. (a) At cache write, each 32-dim key sub-vector keeps or , or the whole head takes , whichever has the lower query-weighted error; the per-token branch first subtracts the calibrated key mean, and the per-channel branch decides once per completed 32-token key group. (b) INT2 pages of 80 and 97 bytes per token and KV head (), with the flags in the sign bits of the scales and 4 sink and 128 recent tokens in BF16. (c) Attention rotates the query into each basis once per step; the flags select the partial dot products, and keys are never rotated back.
rotation hurts crosses one half at of 2.27–2.35 on the four development models. The crest factor captures the trend; the exact error also depends on the min-max range and, in FP4, on a non-uniform grid, so FlagRot quantizes each candidate and measures it. Models that normalize their keys with QK-norm have flat keys throughout, and rotating whole heads hurts most of them (Figure 1d). Within a single key the pieces disagree (Figure 1c), and the same piece of the same head prefers different transforms on different tokens.
Reconstruction error is also the wrong yardstick. A key error changes the logit of a query by , so what attention sees is with , and the queries of a head concentrate their energy on a few channels. A rotation that shrinks the error of a piece spreads what remains evenly over its channels, which can move error into exactly the channels the queries read. The decision should thus weigh errors by the queries, and how often it must be renewed depends on how much the statistics behind it change from one key to the next.
Keys have one more property that matters for 2-bit codes: after RoPE, the keys of many heads share a large common offset. Subtracting the same vector from every key changes every attention logit of a query by the same amount, , so the attention weights do not change (for models without logit
soft-capping). A quantizer that works on one key at a time wastes part of its range on this offset; KIVI, which works along channels, absorbs it.
3 FlagRot
3.1 Selecting the Transform
We treat the transform as part of the code. For a vector or key group and a candidate set , the encoder picks
where is the quantizer and a positive semi-definite weight derived from the queries (Section 3.2). A head of dimension is split into pieces of channels; each piece may stay as it is or take , and the whole head may instead take . Each piece keeps the candidate with the lower , and the assembled reconstruction then competes with the reconstruction under the full , giving flags, five for . The piece-wise choice is close to the best joint one: searching all 16 combinations of the four pieces changes the KL of the two 8B models by and (Appendix A.5). Read as a coding problem, Eq. 1 trades side information for distortion: a per-key decision costs bits per key, a fixed one none.
At read time the inverse transform moves to the query:
where is the dequantized code of piece and is its stored transform; with the head flag set, the product is . The query is transformed into both bases once per decoding step and shared by all cached tokens. Value transforms are applied after the attention-weighted sum, separately per basis. The weight and all other statistics come from four calibration windows and are frozen before evaluation, so a decision depends only on the tokens it encodes. Codes and flags are written once and never revised.
The same criterion supports two modes. In the fixed mode, the decision for each layer, KV head and piece is taken once on the calibration windows and stays the same for every token; the flags are then constants and writing a key takes a single quantization. In the per-key mode, the encoder decides anew for every key it writes; it quantizes each key or key group three times (plain, with per piece and with ) and keeps the flags of the winner. Both instances below use the per-key mode unless stated otherwise.
3.2 FlagRot-KIVI and a Per-Token Instance
The quantization axis determines what one decision covers. Our main system, FlagRot-KIVI, follows KIVI and quantizes keys per channel over groups of 32 tokens, with an FP16 scale and minimum per channel and group (Liu et al., 2024b). A group is encoded when its last token is written; until then its keys stay in the BF16 window. One decision covers a whole group of one KV head, and its error is weighted by how strongly the calibration queries attend to each key:
where is the logit scale and the softmax normalizer of over its calibration window. The weight is the attention probability the calibration query would assign to ; it is capped at one because is measured on a different window and can be smaller than the true normalizer. Values are quantized per token, and their decisions weight the error by the same attention mass and by the column norms of the output projection. Because per-channel offsets absorb a shared key mean, FlagRot-KIVI needs no centering.
The second instance, FlagRot-auto, quantizes each key per token in 32-channel groups and weights the error by the second moment of the calibration queries, . Before encoding it removes the shared key offset of Section 2: it subtracts , where is the calibrated post-RoPE key mean of the head and the mask keeps the 32-channel groups in which removing the mean lowers the calibration error of an RTN cache. The BF16 sink and recent keys receive the same shift. If removing the mean raises the calibration KL of a model, the model keeps its keys unshifted; this automatic switch is the auto in the name. Values are quantized per token without rotation.
With , a token of one KV head occupies 512 bytes in BF16. FlagRot-KIVI with FP16 scales and minima, which cost 32 bits per group, needs 97 bytes, the 3.0-bit layout. Storing them in FP8 gives the packed 2.5-bit layout of 80 bytes, the size of an RTN page and of FlagRot-auto; we serve both. Both instances run in vLLM (Kwon et al., 2023) with paged INT2 storage, a BF16 buffer for 4 sink and 128 recent tokens (S4W128), CUDA graphs and prefix caching.
4 Experimental Setup
We measure fidelity as the next-token KL divergence from the BF16 model, reported and averaged over all 2048-token WikiText-2 test windows, on twelve decoder-only models from 3B to 27B parameters (Appendix A). Keys after RoPE and values are quantized, linear layers stay in BF16, and every unprotected earlier token is read from the quantized cache. Calibration uses four 2048-token windows of the WikiText-2 training split (Merity et al., 2017). We developed the method on Llama-3.1-8B, Qwen3-8B, Mistral-7B-v0.3 and Qwen3-14B; the other eight models are held out and were run once with the final settings. Unless stated otherwise, every INT2 cache uses and S4W128.
Task evaluations run our kernels in vLLM 0.30. LongBench v1 with all 21 tasks and official prompts (Bai et al., 2024) covers four models: Qwen3-8B, Llama-3.1-8B-Instruct, Qwen3.8-27B (Qwen Team, 2026) and the dense Qwen3-32B. RULER with 13 subtasks at 128k tokens (Hsieh et al., 2024) runs on Llama-3.1-8B-Instruct, the 8B
| (a) Equal size: INT2 at 2.5 bits per value | |||
|---|---|---|---|
| Cache | KL | Held-out | FlagRot-KIVI L/H |
| KIVI | 18.7 | 17.6 | 11/1 |
| RotateKV, clip 0.8 | 25.6 | 26.5 | 12/0 |
| RotateKV, clip 1.0 | 18.1 | 19.5 | 9/2 |
| FlagRot-auto (ours) | 17.8 | 17.8 | 12/0 |
| FlagRot-KIVI (ours) | 12.4 | 12.1 | - |
| (b) Selection on each encoder, by code width | |||
|---|---|---|---|
| Encoder | INT2 | INT3 | INT4 |
| RTN | 75.4 | 10.5 | 2.8 |
| + sel. | 28.5 –62% | 4.6 –56% | 1.5 –47% |
| RTN, centered | 43.4 | 6.7 | 2.0 |
| + sel. | 17.8 –59% | 3.3 –51% | 1.3 –36% |
| KIVI, FP8 | 18.7 | 3.7 | 1.7 |
| + sel. | 12.4 –34% | 2.5 –31% | 1.2 –30% |
| KIVI, FP16† | 18.4 | 3.2 | 1.2 |
| + sel. | 12.3 –33% | 2.4 –24% | 1.0 –14% |
Table 1: Simulated KL×10³ (↓) with groups of 32 and S4W128, geometric mean over twelve models and over the eight held-out ones. (a) Caches of equal size; L/H: models on which FlagRot-KIVI is significantly lower / higher than the row (paired 95% CI). (b) Each encoder without and with selection (+ sel.); percentages relative to the row above, at b+0.5 bits per value with FP8 or FP16 scale and minimum (†b+1). Models significantly lower with selection: 10–12 of 12 per cell.
model with a native 128k context. Reasoning with thinking (AIME 2024 and 2025 on Qwen3-8B) enters the per-token study of §5.3, agentic tasks (τ²-bench (Barres et al., 2026), SWE-bench Verified) the 4-bit study of §5.4, and both are reported in full in the appendix. A cache and its BF16 reference always run on the same GPU type.
KIVI-only fixes every flag of FlagRot-KIVI to the identity and shares its kernel, layout and protection; the fixed mode uses the same candidates and criterion as the per-key mode. RotateKV (Su et al., 2025b) is our simulation, validated against the perplexity of its official code, and runs with our protection at clip ratios 0.8 and 1.0. WUSH-KV runs in its published configuration (Chen et al., 2026). We report nominal 95% paired bootstrap intervals over windows, items within tasks, problems or tasks. We fixed two families of task contrasts before the last task results were in; within them, significance means a Holm-adjusted p < 0.05, and other intervals are descriptive.
5 Results
5.1 Fidelity Across Encoders and Bit Rates
At equal size, our FlagRot-KIVI has the lowest error of the 2-bit caches we compare (Table 1a). In the packed layout it fits the 2.5 bits of a per-token page and reaches a KL of 12.4, below KIVI on 11 of the twelve models, below FlagRot-auto on 12 and below RotateKV with clip 1.0, the stronger of its two settings, on 9 of them. Without Gemma-3-27B, where RotateKV degrades, the geometric means are 11.1 and 14.1. On the eight held-out models, FlagRot-KIVI reaches a geometric mean of 12.1.
Selection lowers the KL of the four encoders at INT2, INT3 and INT4, by more at lower widths (Table 1b). On KIVI it removes 34% of the KL at INT2, and 31% and 30% at INT3 and INT4; on centered per-token caches it removes 59, 51 and 36%. Without selection, packed KIVI beats FlagRot-auto on 2 models. The one model on which selection raises the INT2 KL of KIVI, Gemma-3-27B, can be told from the calibration windows alone; a per-layer check there brings it to 9.5% below KIVI and keeps the other models within their paired intervals (Appendix A.5). Selection also composes with fitted transforms: started from the transform fitted by WUSH-KV, or from RotateKV under our protection, it lowers the KL of the models we ran (Appendix A.5).
The per-channel layout also ages better with context. From 2k to 32k tokens on Qwen3-8B, the KL of FlagRot-KIVI grows by 1.4× and FlagRot-auto grows by 3.5× (Figure 3b).
Calibration on WikiText-2 transfers to other text: with these statistics, selection lowers the KL of KIVI by 24–44% on books, code, math, Chinese and German Wikipedia and 32k-token windows (Appendix A.5); other calibration windows, sources or query counts change it by at most 2.1% (Table 14).
5.2 Task Accuracy in vLLM
On long inputs, the lower error carries over to accuracy where KIVI-only loses it (Table 2). In the packed layout, selection adds +2.9 points to RULER at 128k tokens, about 26% of what KIVI-only loses, and +1.94 to the LongBench v1 mean of the dense Qwen3-32B, where KIVI-only falls 2.17 points below BF16 while FlagRot-KIVI is not separated from BF16 (−0.23 points). On the two 8B models the per-key gains are smaller,

(a) Rate-distortion

(b) Qwen3-8B
(c) Llama-3.1-8B
(d) WUSH-KV, 32k
Figure 3: Simulated KL×10³ with S4W128. (a) Geometric mean over the four development models against nominal bits per value; RTN-auto: RTN with the centering of FlagRot-auto. (b, c) Context length; 8k, 16k and 32k use 8, 6 and 4 windows. (d) WUSH-KV's fitted transform at 32k, without and with selection and RoPE-shifted calibration.
| Benchmark | Model | BF16 → KIVI → Ours | Fixed-mode gain | Per-key gain |
|---|---|---|---|---|
| RULER 128k | Llama-3.1-8B-It | 73.7 → 62.3 → 65.2 | +2.5 [+0.9, +4.1] | +2.9 [+1.2, +4.5] |
| LongBench v1 | Qwen3-8B | 49.35 → 47.28 → 47.70 | +0.72 [+0.08, +1.33] | +0.42 [-0.20, +1.04] |
| Llama-3.1-8B-It | 49.70 → 47.38 → 48.24 | +0.47 [-0.17, +1.10] | +0.86 [+0.23, +1.48] | |
| Qwen3-32B | 44.97 → 42.80 → 44.73 | - | +1.94 [+1.22, +2.66] | |
| Qwen3.8-27B | 53.49 → 53.82 → 53.25 | -0.74 [-1.19, -0.30] | -0.57 [-0.99, -0.17] |
Table 2: vLLM, 2.5 bits/value (FP8 scale and minimum, 80 B/token/KV head), S4W128 on H200. Path: BF16 → KIVI-only → FlagRot-KIVI (per-key), scores 0–100. Gains: points over KIVI-only [nominal paired 95% CI], same kernel and layout. Blue: CI above zero; -: not run. LongBench: 21-task macro-score, 4,750 items/model; RULER: 1,300 items; BF16-relative intervals: Table 18. Scores and contrasts rounded independently. *Hybrid model: KV cache in 16 of 64 layers.
+0.42 and +0.86 LongBench points. The hybrid Qwen3.8-27B keeps a KV cache in only 16 of its 64 layers, and there KIVI-only already matches BF16: selection does not add to it (-0.57 points), and FlagRot-KIVI stays within 0.24 points of BF16. At equal bytes, FlagRot-KIVI scores above FlagRot-auto on the three endpoints where both ran, by +18.5 points on RULER (Table 3). On those three paired endpoints, the 2.5-bit and 3.0-bit scores differ by at most 0.75 points. In the 3.0-bit layout, selection adds 4.2 RULER points, significant in our pre-specified Holm family, and 1.4 LongBench points on Qwen3-32B (Table 19).
Most of the selection gain needs no work at write time, as the quantization axis predicts: a KIVI group pools 32 tokens, so its best transform changes little from one group to the next (§5.3). In the fixed mode, FlagRot-KIVI gains +0.72 and +0.47 LongBench points on the 8B models and +2.5 on RULER, about as much as the per-key mode (Table 2). In the packed fidelity study its KL is 13.8 against 12.4 for the per-key mode, which is lower on 11 of the 12 models.
| Endpoint | Equal-budget gain | vs. BF16 | |
|---|---|---|---|
| vs. FlagRot-auto | vs. KIVI-only | ||
| Llama-It | +18.5 | +2.9 | -8.4 |
| RULER 128k | [+16.5, +20.4] | [+1.2, +4.5] | [-10.0, -6.8] |
| Qwen3-8B | +1.7 | +0.4 | -1.6 |
| LongBench | [+1.0, +2.4] | [-0.2, +1.0] | [-2.2, -1.1] |
| Llama-It | +1.8 | +0.9 | -1.5 |
| LongBench | [+1.1, +2.5] | [+0.2, +1.5] | [-2.0, -0.9] |
Table 3: 2.5-bit FlagRot-KIVI in vLLM: score differences in points [nominal paired 95% CI]; all 2-bit caches at 80 B/token/KV head. Blue: CI above zero. Llama-It: Llama-3.1-8B-Instruct.
5.3 Per-Token Selection and Centering
On per-token caches the decision has to follow the key. Per-key decisions agree with the fixed one on 39–44% of keys, against 62–69% of KIVI groups, and the per-key mode beats the fixed mode on the KL of 11 of 12 models and, in the HuggingFace study, on LongBench by +2.58 points after Holm correction (Table 5a). Centering and selection re-
| Group | INT4 (-%) | MXFP4 (-%) | NVFP4 (-%) |
|---|---|---|---|
| Dev. (4) | 55 [51, 61] | 69 [65, 75] | 46 [38, 53] |
| Larger (4) | 58 [13, 69] | 62 [30, 69] | 33 [17, 56] |
| Held-out (7) | 56 [41, 57] | 70 [63, 89] | 45 [42, 55] |
| All (15) | 56 [13, 69] | 67 [30, 89] | 44 [17, 56] |
Table 4: 4-bit caches without BF16 tokens: reduction of KL (%) with FlagRot relative to RTN, median over each group of models with the range in brackets. Significant (95% CI) on 15 of 15 models per format. Qwen2.5-7B uses static key centering in both caches; per-model values are in Table 25.
| (a) LongBench v1: points added by selection | ||
|---|---|---|
| Compared with | HF | vLLM |
| Qwen3-8B | ||
| Centered RTN | +3.70 [+1.77, +5.66] | +3.81 [+1.91, +5.75] |
| Fixed mode | +2.74 [+1.01, +4.52] | +1.48 [-0.15, +3.08]‡ |
| Llama-3.1-8B-Instruct | ||
| Centered RTN | +5.20 [+3.27, +7.24] | +3.69 [+1.71, +5.69] |
| Fixed mode | +2.42 [+0.61, +4.26] | +0.67 [-0.94, +2.37]‡ |
| Mean over models (Holm p) | ||
| Centered RTN | +4.45 (< 0.001) | +3.75 (< 0.001) |
| Fixed mode | +2.58 (< 0.001) | +1.07 (0.065) |
| (b) AIME24+25: paired comparisons | ||
|---|---|---|
| Comparison | Centering off | Centering on |
| RTN – BF16 | -34.8 [-43.1, -26.5] | -17.5 [-23.5, -11.9] |
| Per-key – BF16 | -13.8 [-18.5, -9.2] | -2.9 [-5.8, 0.0] |
| Per-key – RTN | +21.0 [+14.8, +27.5] | +14.6 [+10.0, +19.8] |
Table 5: Selection and centering on per-token INT2 caches (2.5-bit served layout; g=32, S4W128). Paired score differences [95% CI]. (a) Per-key selection minus the named baseline; HF: HuggingFace simulation. (b) Qwen3-8B on H20. Bold: positive CIs or Holm-significant means. Experiment settings, ‡fixed-baseline differences and AIME scores: Appendix A.6.
pair different errors: on AIME with thinking, centering recovers half of RTN's loss and selection another +14.6 points (Table 5b).
Both the criterion and the candidates matter (Table 6). Judged by plain reconstruction error, selection gives KIVI a KL of 19.1, against 18.4 without selection, and dropping either kind of candidate raises the KL of FlagRot-auto.
5.4 The 4-bit Operating Point
Selection carries over to 4-bit caches, floating-point formats included. Without protected tokens, it lowers the KL of INT4, MXFP4 and NVFP4 caches by a median of 56%, 67% and 44% over 15 models, significantly on each of them (Table 4). At this
| Variant | KL | Held-out | Worse |
|---|---|---|---|
| FlagRot-auto (per-token keys) | |||
| Full, weighted by | 17.8 | 17.8 | – |
| Plain reconstruction error | 29.2 | 30.4 | 12/12 |
| Per-piece candidates only | 23.3 | 23.4 | 11/12 |
| Whole-head candidate only | 21.0 | 21.2 | 12/12 |
| No selection | 43.4 | 45.2 | 12/12 |
| FlagRot-KIVI (per-channel keys, 3.0-bit layout) | |||
| Full, attention-weighted | 12.3 | 11.8 | – |
| Weighted by only | 13.8 | 13.4 | 11/12 |
| Plain reconstruction error | 19.1 | 19.1 | 12/12 |
| No selection (KIVI) | 18.4 | 17.1 | 11/12 |
Table 6: Ablation at INT2 with S4W128: KL×10³, geometric mean over twelve models and over the eight held-out ones. Worse: models significantly above the full method (paired 95% CI).
| vs BF16 | , 3 domains | SWE-V | |
|---|---|---|---|
| pass^1 | pass^4 | resolved | |
| FP8 | -2.6 | -4.1 | -4.8 |
| [-4.7, -0.5] | [-6.8, -1.5] | [-9.0, -0.6] | |
| FlagRot* | -0.7 | -2.5 | -2.8 |
| [-2.9, +1.6] | [-4.9, -0.1] | [-7.0, +1.4] | |
| BF16 rerun | -0.8 to +0.6 | -0.7 to -0.3 | -3.0[-7.4, +1.4] |
Table 7: Qwen3.8-27B on (16 trials per task, 278 tasks pooled) and all 500 SWE-bench Verified instances: differences in points (95% CI); gray: CI below zero. BF16 rerun: for , range over three 8-vs-8 seed splits; for SWE, a second run. *S4W128.
width the cache keeps task accuracy, agentic tasks included: on Qwen3.8-27B, its -bench pass^1 and SWE-bench Verified scores stay within the spread of a BF16 rerun, while those of FP8 fall below it (Table 7).
5.5 Cost
Our vLLM plugin turns the smaller cache into capacity (Table 9). The packed layout holds 6.1 times as many tokens as BF16 on Qwen3-8B; on the hybrid Qwen3.8-27B, whose pages also carry linear-attention state, its attention pages hold 6.3 times as many tokens and the whole cache 3.0 times. Where memory limits the batch, capacity becomes throughput: at 32k tokens, the per-token instance generates 3.0 times the BF16 and 1.4 times the FP8 token rate of Qwen3-8B within a 60 ms budget per token (Table 8). The price is decode time at large batch: at batch 64, the packed cache of the 27B model takes 33% longer per output token than BF16. Per-key decisions also cost 5% of prefill throughput, which the fixed mode avoids.
| Cache | Seqs | tok/s at TPOT ≤ | ||
|---|---|---|---|---|
| 40 ms | 60 ms | 80 ms | ||
| Qwen3-8B | ||||
| BF16 | 23 | 707 | 707 | 707 |
| FP8 | 46 | 1,494 | 1,494 | 1,494 |
| FlagRot-auto | 142 | 1,905 | 2,150 | 2,175 |
| Qwen3-32B | ||||
| BF16 | 7 | 201 | 201 | 201 |
| FP8 | 14 | 355 | 355 | 355 |
| FlagRot-auto | 39 | 405 | 552 | 580 |
Table 8: Decoding throughput at a 32k-token context on one H200 (no prefix caching): generated tokens/s of the best batch within each time-per-output-token budget. Seqs: most 32k sequences that fit in the cache. FlagRot-auto: per-token INT2 at 2.5 bits per value.
| Cache | Bits | TPOT (ms) at batch | Prefill (tok/s) | Cap. (M) | |||
|---|---|---|---|---|---|---|---|
| 64 | 32 | 8 | 1 | ||||
| BF16 | 16 | 29.1 | 22.0 | 17.1 | 14.9 | 12,031 | 0.93 |
| KIVI-only | 3.0 | 35.3 | 26.1 | 19.1 | 15.9 | 11,518 | 2.29 |
| FlagRot-KIVI | 3.0 | 40.7 | 29.0 | 19.7 | 16.0 | 10,893 | 2.29 |
| KIVI-only | 2.5 | 33.2 | 24.8 | 18.5 | 15.5 | 11,792 | 2.75 |
| FlagRot-KIVI | 2.5 | 38.7 | 27.8 | 19.1 | 15.7 | 11,172 | 2.75 |
| Per-token(FlagRot-auto) | 2.5 | 30.5 | 23.5 | 18.4 | 16.5 | 11,024 | 2.75 |
Table 9: Pure decoding of Qwen3.8-27B in vLLM on one H200 (8192-token context, no prefix caching): time per output token, prefill throughput and KV capacity in tokens at equal memory. Caches at S4W128; KIVI rows at 2.5 bits store an FP8 scale and minimum; capacity as reported by vLLM, whose pages on this hybrid model also hold the linear-attention state; BF16 was re-measured in each session within 1%.
6 Related Work
KV-cache quantizers differ mainly in the axis they quantize and the tokens they protect. KIVI quantizes keys per channel with a full-precision residual window (Liu et al., 2024b), and KVQuant adds pre-RoPE keys, non-uniform codes and sparse outliers (Hooper et al., 2024); IntactKV and OTT keep pivot tokens intact (Liu et al., 2024a; Su et al., 2025a). Other encoders use joint or vector codes (Zandieh et al., 2025; Han et al., 2025; Zhang et al., 2024), store low-rank corrections of the residual (Kang et al., 2024), reorder channels (Duanmu et al., 2024), or vary the precision across tokens (He et al., 2024; Yang et al., 2024).
Rotation methods fix their transforms during calibration or initialization. QuIP, QuIP#, QuaRot and SpinQuant rotate weights, activations or caches with fixed or learned rotations (Chee et al., 2023; Tseng et al., 2024; Ashkboos et al., 2024; Liu et al., 2025). DuQuant constructs block rotations from outlier dimensions, FlatQuant learns Kronecker-factored affine transforms, and KurTail fits a rotation that minimizes kurtosis (Lin et al., 2024; Sun et al., 2025; Akhondzadeh et al., 2025). For KV caches, RotateKV reorders channels and rotates groups of heads before RoPE (Su et al., 2025b), TurboQuant applies a random rotation before a scalar codebook (Zandieh et al., 2026), and WUSH-KV, OSCAR, OptR and AATC derive transforms or bit allocations from attention statistics (Chen et al., 2026; Zhou et al., 2026; Yun et al., 2026; Laus et al., 2026). All of these apply one transform to every key of a layer or head. FlagRot asks a different question, whether a piece should be transformed at all, and its decisions compose with such transforms: on top of the transform fitted by WUSH-KV, or of RotateKV, selection lowers the KL of the models we ran (Section 5.1). Its fixed mode, like these methods, keeps one decision per head; its per-key mode renews it without enlarging the cache.
Selecting a transform per block and signalling the selection is standard in media coding: video codecs pick among transforms per block by rate-distortion cost (Sullivan et al., 2012; Zhao et al., 2021), and Four Over Six picks between two FP4 scales per block (Cook et al., 2025). A KV cache changes both sides of that trade. The distortion is the error attention sees, weighted by calibration queries and their softmax normalizers, and the side information hides in sign bits the cache already stores. ScaNN weights quantization error by inner products with queries to choose codewords for search (Guo et al., 2020), much as GPTQ weights it by input statistics (Frantar et al., 2023); FlagRot uses such a weighting to select transforms, and lets flat pieces, which incoherence processing (Chee et al., 2023) would rotate, stay as they are.
7 Conclusion
A low-bit KV cache need not commit to one rotation for all of its keys. We made the transform a decision of the encoder, judged by the error the queries see, and showed that this lowers the error of the encoders we test and that how often to decide follows the quantization axis. At an equal 2.5 bits per value, FlagRot-KIVI has the lowest error among the 2-bit caches we evaluate on most models and recovers part of the accuracy 2-bit KIVI loses on long inputs.
Limitations
Our task evaluation covers four models from 8B to 32B parameters on NVIDIA H20 and H200 GPUs, and the fidelity study twelve to fifteen open models. The task evaluation includes no mixture-of-experts model (the 4-bit fidelity study includes Qwen3-30B-A3B), no model above 32B parameters and no other GPU generation, and our serving measurements use one inference engine. Other published low-bit caches enter our comparison through simulated KL on twelve models, and RotateKV also through LongBench in simulation; served task comparisons cover KIVI and our per-token instance. The selection statistics and the key mean are calibrated on WikiText-2 by default; we test transfer to other text and one other calibration source. The shared key shift preserves the softmax weights only for models without logit soft-capping, where calibration decides whether to apply it.
Ethics Statement
The method compresses cached keys and values during inference with existing model weights and evaluation datasets, and it introduces no new data. All models and datasets are publicly released and used under their licences.
References
Marah Abdin, Jyoti Aneja, Harkirat Behl, et al. 2024. Phi-4 technical report. Preprint, arXiv:2412.08905.
Mohammad Sadegh Akhondzadeh, Aleksandar Bojchevski, Evangelos Eleftheriou, and Martino Dazzi. 2025. KurTail: Kurtosis-based LLM quantization. In Findings of the Association for Computational Linguistics: EMNLP 2025, pages 17404–17419.
Saleh Ashkboos, Amirkeivan Mohtashami, Maximilian L. Croci, Bo Li, Pashmina Cameron, Martin Jaggi, Dan Alistarh, Torsten Hoefler, and James Hensman. 2024. QuaRot: Outlier-free 4-bit inference in rotated LLMs. In Advances in Neural Information Processing Systems.
Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. 2024. LongBench: A bilingual, multi-task benchmark for long context understanding. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
Yushi Bai, Shangqing Tu, Jiajie Zhang, Hao Peng, Xiaozhi Wang, Xin Lv, Shulin Cao, Jiazheng Xu, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. 2025.
LongBench v2: Towards deeper understanding and reasoning on realistic long-context multitasks. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
Victor Barres, Honghua Dong, Soham Ray, Xujie Si, and Karthik Narasimhan. 2026. -bench: Evaluating conversational agents in a dual-control environment. In Proceedings of the 43rd International Conference on Machine Learning.
Jerry Chee, Yaohui Cai, Volodymyr Kuleshov, and Christopher De Sa. 2023. QuIP: 2-bit quantization of large language models with guarantees. In Advances in Neural Information Processing Systems.
Jiale Chen, Vage Egiazarian, Eldar Kurtić, Torsten Hoefler, and Dan Alistarh. 2026. WUSH-KV: KV cache quantization with data-adaptive transforms. Preprint, arXiv:2609.38121.
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168.
Jack Cook, Junxian Guo, Guangxuan Xiao, Yujun Lin, Keith Wyss, Mahdi Nazemi, Asit Mishra, Carlo del Mundo, Tijmen Blankevoort, and Song Han. 2025. Four over six: More accurate NVFP4 quantization with adaptive block scaling. Preprint, arXiv:2512.02010.
Haojie Duanmu, Zhihang Yuan, Xiuhong Li, Jiangfei Duan, Xingcheng Zhang, and Dahua Lin. 2024. SKVQ: Sliding-window key and value cache quantization for large language models. In First Conference on Language Modeling.
Bradley Efron and Robert J. Tibshirani. 1993. An Introduction to the Bootstrap. Chapman & Hall.
Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. 2023. OPTQ: Accurate quantization for generative pre-trained transformers. In The Eleventh International Conference on Learning Representations.
Gemma Team, Aishwarya Kamath, Johan Ferret, et al. 2025. Gemma 3 technical report. Preprint, arXiv:2503.19786.
Gemma Team, Morgane Riviere, Shreya Pathak, et al. 2024. Gemma 2: Improving open language models at a practical size. Preprint, arXiv:2408.00118.
Aaron Grattaflori et al. 2024. The Llama 3 herd of models. Preprint, arXiv:2407.21783.
Ruiqi Guo, Philip Sun, Erik Lindgren, Quan Geng, David Simcha, Felix Chern, and Sanjiv Kumar. 2020. Accelerating large-scale inference with anisotropic vector quantization. In Proceedings of the 37th International Conference on Machine Learning.
Insu Han, Praneeth Kacham, Amin Karbasi, Vahab Mirrokni, and Amir Zandieh. 2025. PolarQuant: Quantizing KV caches with polar transformation. Preprint, arXiv:2502.02617.
Yefei He, Luoming Zhang, Weijia Wu, Jing Liu, Hong Zhou, and Bohan Zhuang. 2024. ZipCache: Accurate and efficient KV cache quantization with salient token identification. In Advances in Neural Information Processing Systems.
Coleman Hooper, Sehoon Kim, Hiva Mohammadzadeh, Michael W. Mahoney, Yakun Sophia Shao, Kurt Keutzer, and Amir Gholami. 2024. KVQuant: Towards 10 million context length LLM inference with KV cache quantization. In Advances in Neural Information Processing Systems.
Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman, Shantanu Acharya, Dima Rekesh, Fei Jia, and Boris Ginsburg. 2024. RULER: What's the real context size of your long-context language models? In First Conference on Language Modeling.
Albert Q. Jiang et al. 2023. Mistral 7B. Preprint, arXiv:2310.06825.
Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik Narasimhan. 2024. SWE-bench: Can language models resolve real-world GitHub issues? In The Twelfth International Conference on Learning Representations.
Hao Kang, Qingru Zhang, Souvik Kundu, Geonhwa Jeong, Zaoxing Liu, Tushar Krishna, and Tuo Zhao. 2024. GEAR: An efficient KV cache compression recipe for near-lossless generative inference of LLM. Preprint, arXiv:2403.05527.
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient memory management for large language model serving with PagedAttention. In Proceedings of the 29th Symposium on Operating Systems Principles.
Hannah Laus, Claudio Mayrink Verdun, Hao Wang, Flavio du Pin Calmon, and Felix Krahmer. 2026. KV cache compression through the lens of transform coding. Preprint, arXiv:2608.14191.
Hunter Lightman, Vineet Kosaraju, Yuri Burda, Harrison Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. 2024. Let's verify step by step. In The Twelfth International Conference on Learning Representations.
Haokun Lin, Haobo Xu, Yichen Wu, Jingzhi Cui, Ying-tao Zhang, Linzhan Mou, Linqi Song, Zhenan Sun, and Ying Wei. 2024. DuQuant: Distributing outliers via dual transformation makes stronger quantized LLMs. In Advances in Neural Information Processing Systems.
Yujun Lin, Haotian Tang, Shang Yang, Zhekai Zhang, Guangxuan Xiao, Chuang Gan, and Song Han. 2025. QServe: W4A8KV4 quantization and system co-design for efficient LLM serving. In Proceedings of Machine Learning and Systems.
Ruikang Liu, Haoli Bai, Haokun Lin, Yuening Li, Han Gao, Zhengzhuo Xu, Lu Hou, Jun Yao, and Chun Yuan. 2024a. IntactKV: Improving large language model quantization by keeping pivot tokens intact. In Findings of the Association for Computational Linguistics: ACL 2024.
Zechun Liu, Changsheng Zhao, Igor Fedorov, Bilge Soran, Dhruv Choudhary, Raghuraman Krishnamoorthi, Vikas Chandra, Yuandong Tian, and Tijmen Blankevoort. 2025. SpinQuant: LLM quantization with learned rotations. In The Thirteenth International Conference on Learning Representations.
Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, and Xia Hu. 2024b. KIVI: A tuning-free asymmetric 2bit quantization for KV cache. In Proceedings of the 41st International Conference on Machine Learning.
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2017. Pointer sentinel mixture models. In International Conference on Learning Representations.
Mistral AI Team. 2024. Mistral NeMo. https://mistral.ai/news/mistral-nemo.
Andrei Panferov, Jiale Chen, Soroush Tabesh, Mahdi Nikdan, and Dan Alistarh. 2025. QuEST: Stable training of LLMs with 1-bit weights and activations. In Proceedings of the 42nd International Conference on Machine Learning.
Shishir G. Patil, Huanzhi Mao, Fanjia Yan, Charlie Cheng-Jie Ji, Vishnu Suresh, Ion Stoica, and Joseph E. Gonzalez. 2025. The Berkeley function calling leaderboard (BFCL): From tool use to agentic evaluation of large language models. In Proceedings of the 42nd International Conference on Machine Learning.
Guilherme Penedo, Hynek Kydlíček, Loubna Ben Alal, Anton Lozhkov, Margaret Mitchell, Colin Raffel, Leandro Von Werra, and Thomas Wolf. 2024. The FineWeb datasets: Decanting the web for the finest text data at scale. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track.
Qwen Team. 2026. Qwen3.8-27B. https://huggingface.co/Qwen/Qwen3.8-27B.
Qwen Team, An Yang, Baosong Yang, et al. 2024. Qwen2.5 technical report. Preprint, arXiv:2412.15115.
David Rein, Betty Li Hou, Asa Cooper Stickland, Jackson Petty, Richard Yuanzhe Pang, Julien Dirani, Julian Michael, and Samuel R. Bowman. 2024. GPQA:
A graduate-level Google-proof Q&A benchmark. In First Conference on Language Modeling.
Yi Su, Yuechi Zhou, Quantong Qiu, Juntao Li, Qingrong Xia, Ping Li, Xinyu Duan, Zhefeng Wang, and Min Zhang. 2025a. Accurate KV cache quantization with outlier tokens tracing. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 12895–12915.
Zunhai Su, Hanyu Wei, Zhe Chen, Wang Shen, Linge Li, Huangqi Yu, and Kehong Yuan. 2025b. RotateKV: Accurate and robust 2-bit KV cache quantization for LLMs via outlier-aware adaptive rotations. In Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, pages 6200–6208.
Gary J. Sullivan, Jens-Rainer Ohm, Woo-Jin Han, and Thomas Wiegand. 2012. Overview of the high efficiency video coding (HEVC) standard. IEEE Transactions on Circuits and Systems for Video Technology, 22(12):1649–1668.
Yuxuan Sun, Ruikang Liu, Haoli Bai, Han Bao, Kang Zhao, Yuening Li, Jiaxin Hu, Xianzhi Yu, Lu Hou, Chun Yuan, Xin Jiang, Wulong Liu, and Jun Yao. 2025. FlatQuant: Flatness matters for LLM quantization. In Proceedings of the 42nd International Conference on Machine Learning.
Team GLM, Aohan Zeng, Bin Xu, et al. 2024. ChatGLM: A family of large language models from GLM-130B to GLM-4 all tools. Preprint, arXiv:2406.12793.
Hugo Touvron, Louis Martin, Kevin Stone, et al. 2023. Llama 2: Open foundation and fine-tuned chat models. Preprint, arXiv:2307.09288.
Albert Tseng, Jerry Chee, Qingyao Sun, Volodymyr Kuleshov, and Christopher De Sa. 2024. QuIP#: Even better LLM quantization with Hadamard incoherence and lattice codebooks. In Proceedings of the 41st International Conference on Machine Learning.
Yubo Wang, Xueguang Ma, Ge Zhang, Yuansheng Ni, Abhranil Chandra, Shiguang Guo, Weiming Ren, Aaran Arulraj, Xuan He, Ziyan Jiang, Tianle Li, Max Ku, Kai Wang, Alex Zhuang, Rongqi Fan, Xiang Yue, and Wenhu Chen. 2024. MMLU-Pro: A more robust and challenging multi-task language understanding benchmark. In Advances in Neural Information Processing Systems Datasets and Benchmarks Track.
An Yang et al. 2025. Qwen3 technical report. Preprint, arXiv:2505.09388.
June Yong Yang, Byeongwook Kim, Jeongin Bae, Beomseok Kwon, Gunho Park, Eunho Yang, Se Jung Kwon, and Dongsoo Lee. 2024. No token left behind: Reliable KV cache compression via importance-aware mixed precision quantization. Preprint, arXiv:2402.18096.
Vincent-Daniel Yun, Woosang Lim, Minsoo Cheong, Sunwoo Lee, Murali Annavaram, Sai Praneeth Karimireddy, and Sungjoo Yoo. 2026. Output-aware rotation for INT2 KV-cache quantization. Preprint, arXiv:2608.02691.
Amir Zandieh, Majid Daliri, Majid Hadian, and Vahab Mirrokni. 2026. TurboQuant: Online vector quantization with near-optimal distortion rate. In The Fourteenth International Conference on Learning Representations.
Amir Zandieh, Majid Daliri, and Insu Han. 2025. QJL: 1-bit quantized JL transform for KV cache quantization with zero overhead. In Proceedings of the AAAI Conference on Artificial Intelligence.
Tianyi Zhang, Jonah Yi, Zhaozhuo Xu, and Anshumali Shrivastava. 2024. KV cache is 1 bit per channel: Efficient large language model inference with coupled quantization. In Advances in Neural Information Processing Systems.
Xin Zhao, Seung-Hwan Kim, Yin Zhao, Hilmi E. Egilmez, Moonmo Koo, Shan Liu, Jani Lainema, and Marta Karczewicz. 2021. Transform coding in the VVC standard. IEEE Transactions on Circuits and Systems for Video Technology, 31(10):3878–3890.
Zhongzhu Zhou, Donglin Zhuang, Jisen Li, Ziyan Chen, Shuaiwen Leon Song, Ben Athiwaratkun, and Xiaoxia Wu. 2026. OSCAR: Offline spectral covariance-aware rotation for 2-bit KV cache quantization. Preprint, arXiv:2605.17757.
A 2-bit Caches: Details and Full Results
This appendix documents the INT2 experiments of §4–§5.5: the model cohort, the page layout behind the bit counts, the agreement of the served kernels with the simulator, the RoPE-shifted calibration of fitted transforms, and the per-model, per-task and serving results. Besides the names of the main text, the appendix uses three labels for exploratory variants: FlagRot-C and FlagRot-KIVI-C run selection on top of a transform fitted on calibration data, as WUSH-KV does, and FlagRot-L (4 bits only) selects from a larger candidate set of whole-head transforms.
A.1 Models
The primary INT2 cohort holds the twelve models of Table 13. Qwen3-32B enters the INT2 task study (Table 2) and a separate KL run (§5.2), but not the twelve-model cohort, and Qwen2.5-7B is treated separately because of its key-projection biases (Appendix C.2). Table 10 lists every model of the paper (Grattafori et al., 2024; Touvron et al., 2023; Yang et al., 2025; Qwen Team et al., 2024; Qwen Team, 2026; Jiang et al., 2023; Mistral AI Team, 2024;
Gemma Team et al., 2024, 2025; Abdin et al., 2024; Team GLM et al., 2024). Llama-3.1-8B is the base model in all KL results and the Instruct model in all task results.
| Model | QK- | |||||
|---|---|---|---|---|---|---|
| Layers | norm | INT2 | Suite | |||
| Development models | ||||||
| Llama-3.1-8B | 32 | 8 | 128 | no | ✓ | ✓ |
| Qwen3-8B | 36 | 8 | 128 | yes | ✓ | ✓ |
| Mistral-7B-v0.3 | 32 | 8 | 128 | no | ✓ | ✓ |
| Qwen3-14B | 40 | 8 | 128 | yes | ✓ | ✓ |
| Larger models | ||||||
| Qwen3-32B | 64 | 8 | 128 | yes | – | – |
| Qwen3-30B-A3B | 48 | 4 | 128 | yes | – | – |
| Qwen3.8-27B | 16 of 64 | 4 | 256 | yes | ✓ | ✓ |
| Gemma-3-27B | 62 | 16 | 128 | yes | ✓ | ✓ |
| Held-out models | ||||||
| Llama-2-7B | 32 | 32 | 128 | no | ✓ | ✓ |
| Llama-3.2-3B | 28 | 8 | 128 | no | ✓ | ✓ |
| Qwen2.5-7B | 28 | 4 | 128 | no | – | ✓ |
| Gemma-2-9B | 42 | 8 | 256 | no | ✓ | ✓ |
| Phi-4 | 40 | 10 | 128 | no | ✓ | ✓ |
| Mistral-NeMo-12B | 40 | 8 | 128 | no | ✓ | ✓ |
| GLM-4-9B | 40 | 2 | 128 | no | ✓ | ✓ |
Table 10: Models: attention layers with a KV cache, KV heads and head dimension . All fifteen enter the 4-bit study (Table 4). INT2: the INT2 cohort; Suite: the 4-bit baseline and protected-token comparisons (Appendix C.2).
A.2 Page Layout and Bits
KIVI-only reserves the same flag space as FlagRot-KIVI, so both use one page layout. For , a token and KV head take 80 bytes in the per-token pages: two 32-byte code blocks and four 16-bit scale words each for keys and values. The per-channel pages of FlagRot-KIVI take 80 bytes in the packed layout: 64 bytes of codes, 8 bytes of FP8 key scales and minima amortized over a 32-token group and 8 bytes of FP8 value scales and minima, with all flags in the sign bits of the FP8 scales. In both layouts the five key flags of a group sit in the sign bits of the group’s key scales and the four per-piece value flags in the sign bits of the token’s value scales; the packed layout keeps the value’s whole-head flag in the sign bit of a key-scale byte stored with the token. With FP16 scales and minima the pages take 97 bytes, 16 bytes each for keys and values plus one byte for the value’s whole-head flag; KIVI-only keeps this layout, so without selection it would need 96 bytes (3.0 bits), with the same accuracy; with the two layouts take 160 and 193 bytes. The BF16 copies of the protected tokens, the BF16 keys of the incomplete key group and the kernels’ workspace are not included. The simulator’s run counters charge the flags as 0.039 extra bits per value on each side, while the pages store them in scale sign bits and, for the FP16 layout of FlagRot-KIVI, one byte per token; the physical rates are 2.5 bits for the per-token and packed per-channel pages and 3.03 bits for the FP16 layout.
A.3 Kernels and Simulator Parity
In matched writer tests, the kernels reproduce the simulator’s selections and codes. The served-to-simulated KL ratio of the per-channel caches, in both layouts and both modes, lies between 0.96 and 1.03 on 20 to 146 windows of the 8B models and of Qwen3.8-27B, and CUDA graphs and eager execution generate identical sequences. On 60 windows of the base Llama-3.1-8B, the served KL×10³ is 18.0 for KIVI-only and 12.3 for FlagRot-KIVI; the fixed mode reaches 14.7 (FP16 layout). Table 11 times the decode attention of the two readers: the per-channel reader takes 2.7–2.9 times as long as the per-token one.
| Context | FlagRot-KIVI | FlagRot-auto | Ratio | |
|---|---|---|---|---|
| 8 | 16k | 258 | 97 | 2.7 |
| 8 | 32k | 467 | 162 | 2.9 |
| 32 | 16k | 880 | 318 | 2.8 |
| 32 | 32k | 1721 | 600 | 2.9 |
| 64 | 16k | 1723 | 592 | 2.9 |
| 64 | 32k | 3402 | 1161 | 2.9 |
Table 11: Decode attention of one layer in s (Llama-3.1-8B shapes, H20, CUDA graphs, median), FlagRot-KIVI in the packed 2.5-bit layout; Ratio: FlagRot-KIVI over FlagRot-auto.
A.4 Calibrated Base and RoPE-Shifted Calibration
The base-transform variants (FlagRot-C per token and FlagRot-KIVI-C per channel) fit invertible key, query and value transforms per head and 32-channel block from second moments (Chen et al., 2026). RoPE-shifted calibration mixes each post-RoPE calibration statistic with the average of its RoPE-shifted copies,
over the offsets , , ; the shifted statistics reuse the original calibration tokens. At 2k tokens it raises the twelve-model KL of FlagRot-C from 21.9 to 23.0 and of FlagRot-KIVI-C from 11.7 to 12.0; at 32k it lowers the KL of WUSH-KV's transform, with and without selection, on Qwen3-8B and Llama-3.1-8B (Figure 3d). Under its published QuEST-2 protocol, WUSH-KV's own KL grows by on both models over the same range of lengths. Without RoPE-shifted calibration, a base fitted on 2k windows also drifts on 32k-token PG-19 books (Table 17).
A.5 Further Simulation Results
Table 12 details the INT2 comparison of Table 1. Its first part adds the fixed mode on centered per-token caches, the page bytes of the served layouts, RotateKV with 128-value groups, and for each cache the number of models on which its KL is significantly below or above that of a reference. Its second part runs selection under the protocol of WUSH-KV, on top of the transform that WUSH-KV fits, and its third part adds selection to RotateKV. Table 13 gives the per-model KL.
Gemma-3-27B. This is the one model on which selection raises the INT2 KL of KIVI (Table 13). The cause is the query model of the criterion. In the 52 sliding-window layers, the sampled calibration queries predict that selection lowers the logit error by 29%, while the queries that actually read those keys see it rise by 29%; in the global layers prediction and measurement agree, as they do on the other models. Evaluating the criterion with the real queries of each window, which a deployed encoder cannot do, gives a KL of 18.3 against 25.1 for KIVI. A check on the calibration windows removes the regression without such queries: it measures, per layer, the logit error that the calibration queries see under the selected and the plain encoding, and turns selection off in layers where it is larger. The check turns off 27 local layers of Gemma-3-27B and at most 2 layers elsewhere (none on 5 models). With it, Gemma-3-27B reaches 22.7, 9.5% below KIVI, the other eleven models stay within their paired intervals, and the twelve-model geometric mean moves from 12.3 to 11.9. We added this check after observing the regression; all other results are reported without it.
Joint selection. Eq. 1 chooses each piece of a key on its own. Searching all 16 combinations of the four pieces under the full criterion changes the KL of Llama-3.1-8B and Qwen3-8B by -0.9% and -1.5%, both within their paired intervals, so the piece-wise choice loses little; on Gemma-3-27B, where the calibration queries misjudge the local layers, the joint search follows them further and raises the KL by +21%.
Calibration. Table 14 varies the calibration of six models. FlagRot-KIVI changes by at most 2.1% in geometric mean. FlagRot-auto needs at least two windows: with one, its centering statistics raise the KL by 5.8%, and with two or more the change stays within 1.9%.
Centering and soft-capping. On per-channel caches, centering every key group changes the simulated KL by -0.6 to +6.4% across the cohort without Gemma-2-9B. Gemma-2-9B soft-caps its attention logits at 50, and there the same centering raises the KL of KIVI by +5% and of FlagRot-KIVI by +10%.
Other encoders. In an all-layer simulation of TurboQuant (Zandieh et al., 2026), adding per-key selection before its Hadamard transform changes the twelve-model KL at S4W128 from 11.4 to 10.1 for 3-bit keys and values and from 9.2 to 7.9 for 3-bit keys and 4-bit values. The flags add 0.02 bits per value, averaged over keys and values.
WUSH-KV's published setting. Table 15 follows WUSH-KV's published 4-bit configuration: the QuEST quantizer (Panferov et al., 2025) with one scale per token and head, 16 sink and 128 recent tokens in BF16, and calibration of every method on 128 FineWeb-Edu sequences (Penedo et al., 2024) of min(32k, context length) tokens; our implementation reproduces its published perplexities on Qwen3-8B (Table 34). There, selection on top of WUSH-KV's own transform, with the whole-head candidate on keys and values, lowers the KL of WUSH-KV by 19–81% on all 12 models (geometric mean 1.51 against 2.33), and by 14–81% when only keys are selected.
Rate and distortion on all models. Table 16 extends the points of Figure 3a from the development models to all twelve. Across code widths and group sizes, with and without BF16 tokens, selection lowers the KL of RTN by 55–81% and that of KIVI by 24–54%, and FlagRot-KIVI has the lowest KL of the five caches at each point; at equal group size, the KIVI caches store 16 more metadata bits per group.
Other text. Table 17 covers all INT2 caches and lengths on other text: long books, code, mathemat-
| (a) 12 models, INT2, 4 sink + 128 recent BF16 tokens | (b) WUSH-KV setting, 12 models | |||||
|---|---|---|---|---|---|---|
| Cache | Bits | KL | Lower/higher | Cache | KL | L/H |
| RTN | 2.5 | 75.4 | WUSH-KV transform | 35.7 | ||
| RTN, centered | 2.5 | 43.4 | + selection on it | 26.7 | 12/0 | |
| Fixed mode, centered | 2.5 | 27.4 | 0/11 FA | Head selection, centered | 24.8 | 11/0 |
| FlagRot-auto | 2.5 (80 B) | 17.8 | 12/0 cRTN | FlagRot-auto | 78.8 | 1/11 |
| KIVI | 3.0 (97 B) | 18.4 | ||||
| FlagRot-KIVI | 3.0 (97 B) | 12.3 | 11/1 KIVI | (c) RotateKV, 4 models, g32, clip 0.8 | ||
| KIVI, packed§ | 2.5 | 18.7 | 2/10 FA | S4W128 | 24.0 | |
| FlagRot-KIVI, packed§ | 2.5 | 12.4 | 12/0 FA, 9/2 RKV | + selection | 22.5 | 4/0 |
| RotateKV g32, clip 0.8 | 2.5 | 25.6 | 2/10 FA, 0/12 FK | W0 | 139 | |
| RotateKV g32, clip 1.0 | 2.5 | 18.1 | 7/4 FA, 2/9 FK | + selection | 127 | 4/0 |
| RotateKV g128, clip 0.8 | 2.125 | 22.3 | 6/5 FA, 0/12 FK | |||
Table 12: Simulated KL×10³ (↓), geometric mean over models on all 2048-token WikiText-2 test windows. Bits: nominal bits per value with metadata (KIVI: FP16 scale and minimum; §FP8; others: 16 bits per group); in parentheses, page bytes per token and KV head in our kernels (97 B: 3.03 bits at D=128). Lower/higher (L/H): models whose paired 95% CI puts the KL below / above the reference (cRTN: centered RTN; FA: FlagRot-auto; FK: FlagRot-KIVI; RKV: RotateKV clip 1.0); the rest are not separated. (b) Setting of Table 15 with QuEST-2, centering statistics from 4 of its FineWeb sequences; vs WUSH-KV. (c) vs RotateKV.
| Model | Per-token | Per-token, centered | Per-channel, 2.5 bits | Per-channel, 3.0 bits | RotateKV (our simulation) | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RTN | FlagRot | RTN | Fixed | FlagRot-auto | KIVI | FlagRot-KIVI | KIVI | FlagRot-KIVI | g32, 0.8 | g32, 1.0 | g128, 0.8 | |
| Llama-3.1-8B | 115 | 25.5 | 39.8 | 27.7 | 17.2 | 18.5 | 12.7 | 18.8 | 12.8 | 16.1 | 13.8 | 14.7 |
| Qwen3-8B | 83.9 | 44.7 | 54.9 | 39.6 | 25.7 | 29.8 | 18.6 | 30.0 | 19.0 | 43.0 | 28.0 | 29.0 |
| Mistral-7B-v0.3 | 44.5 | 13.7 | 33.9 | 21.8 | 13.8 | 17.2 | 9.3 | 17.0 | 9.3 | 14.9 | 8.9 | 11.1 |
| Qwen3-14B | 56.4 | 29.6 | 35.1 | 22.8 | 17.1 | 21.3 | 13.1 | 21.1 | 13.4 | 31.9 | 17.3 | 19.1 |
| Qwen3.8-27B | 27.0 | 21.1 | 22.5 | 19.3 | 18.7 | 19.6 | 14.2 | 20.0 | 14.3 | 26.2 | 20.6 | 21.8 |
| Gemma-3-27B | 459 | 122 | 286 | 314 | 73.8 | 29.7 | 40.7 | 25.1 | 34.9 | 163 | 288 | 273 |
| Llama-2-7B | 37.3 | 12.0 | 32.1 | 15.9 | 11.6 | 13.5 | 7.4 | 12.5 | 7.3 | 17.2 | 6.7 | 10.1 |
| Llama-3.2-3B | 126 | 31.9 | 84.9 | 30.8 | 19.4 | 22.7 | 14.6 | 24.0 | 14.6 | 20.1 | 17.5 | 18.5 |
| Gemma-2-9B | 20.8 | 6.9 | 14.1 | 6.3 | 6.1 | 7.2 | 4.2 | 7.3 | 4.2 | 10.6 | 4.7 | 6.2 |
| Phi-4 | 93.7 | 25.1 | 69.6 | 36.6 | 20.9 | 20.3 | 12.1 | 19.6 | 12.0 | 19.0 | 13.2 | 16.0 |
| Mistral-NeMo-12B | 44.8 | 18.1 | 39.0 | 24.2 | 17.8 | 22.7 | 13.4 | 22.3 | 13.5 | 18.9 | 13.5 | 15.9 |
| GLM-4-9B | 275 | 199 | 25.8 | 19.8 | 14.1 | 15.2 | 10.7 | 15.2 | 10.7 | 42.8 | 35.3 | 96.6 |
| Geometric mean | 75.4 | 28.5 | 43.4 | 27.4 | 17.8 | 18.7 | 12.4 | 18.4 | 12.3 | 25.6 | 18.1 | 22.3 |
Table 13: Per-model KL×10³ of INT2 caches at S4W128 (all WikiText-2 test windows). Centered: selective key centering; per-channel 2.5 bits: FP8 scale and minimum; RotateKV columns: group size, clip ratio (2.5 bits for g32). Bold: lowest per model.
ical text and Chinese and German Wikipedia, with the calibration frozen on WikiText-2. At S4W128, FlagRot and FlagRot-KIVI lower the KL of RTN by 28–90% and 77–97% on each text and length, and FlagRot-KIVI is below KIVI on each text.
A.6 Task Results in vLLM
This subsection completes Table 2 with the remaining INT2 task results. The task settings are those of §4, and caches are compared within one GPU type.
Table 18 retains the paired intervals relative to BF16 for the packed 2.5-bit results summarized as score paths in Table 2.
Fixed mode and per-key selection (3.0 bits). Table 20 gives both modes of FlagRot-KIVI against KIVI-only on the six endpoints where all three caches were run, with the same kernel, page layout and protection. The fixed mode freezes one decision per layer, KV head and piece on the calibration windows; its simulated twelve-model KL is 13.7, between those of KIVI (18.4) and of the per-key mode (12.3).
3.0-bit layout. Table 19 gives the task results of FlagRot-KIVI with FP16 scales and minima. They show the same broad task pattern as the packed layout of Table 2; the pre-specified Holm family is defined on these 3.0-bit results.
Equal-budget per-channel and per-token caches. Table 3 compares the packed 2.5-bit per-channel cache with the 2.5-bit per-token cache on three
| Calibration variant | Δ (%) | max | L/H/T |
|---|---|---|---|
| FlagRot-KIVI (3.0-bit layout) | |||
| 1 window | +0.4 | 1.2 | 0/0/6 |
| 2 windows | -0.7 | 1.5 | 3/0/3 |
| 8 windows | -0.1 | 0.7 | 0/0/6 |
| 16 windows | +0.2 | 1.8 | 0/0/6 |
| FineWeb-Edu instead of WikiText-2 same, tested on PG-19 | +2.1 | 3.7 | 0/4/2 |
| 128 calibration queries | +1.3 | 3.5 | 0/2/4 |
| 2048 calibration queries | +1.7 | 2.4 | 0/4/2 |
| Attention weight without the cap | -1.6 | 2.1 | 4/0/2 |
| Weight renormalized per window | +0.0 | 0.6 | 0/0/6 |
| Fixed mode, 16 windows* | -0.6 | 1.2 | 0/0/6 |
| FlagRot-auto | |||
| 1 window | +5.8 | 19.6 | 0/3/3 |
| 2 windows | +1.5 | 9.4 | 0/1/5 |
| 8 windows | -1.8 | 5.3 | 4/0/2 |
| 16 windows | -1.1 | 5.8 | 1/1/4 |
| FineWeb-Edu instead of WikiText-2 same, tested on PG-19 | +1.9 | 7.8 | 2/3/1 |
| +1.3 | 7.3 | 1/2/3 | |
Table 14: Calibration sensitivity at INT2 with S4W128: change of the geometric-mean KL over six models (four development models, Llama-3.2-3B and Phi-4) relative to the default of four WikiText-2 windows, largest change on one model (max, %), and models significantly lower / higher / tied (paired 95% CI). *Development models only.
| Model | FlagRot | |||||
|---|---|---|---|---|---|---|
| Head | WUSH-KV | -H | -C_K | -C | -C 8×8 | |
| Llama-3.1-8B | 2.03 | 1.78 | 1.37 | 1.53 | 1.44 | 1.36 |
| Qwen3-8B | 14.59 | 3.57 | 7.84 | 2.34 | 2.14 | 1.93 |
| Mistral-7B-v0.3 | 1.11 | 1.03 | 0.70 | 0.85 | 0.77 | 0.72 |
| Qwen3-14B | 2.99 | 2.61 | 1.74 | 1.72 | 1.56 | 1.42 |
| Qwen3.8-27B | 5.08 | 4.70 | 3.38 | 3.62 | 3.16 | 3.26 |
| Gemma-3-27B | 13.02 | 3.41 | 3.59 | 2.52 | 2.40 | 2.25 |
| Llama-2-7B | 1.20 | 1.09 | 0.82 | 0.94 | 0.87 | 0.82 |
| Llama-3.2-3B | 2.48 | 1.99 | 1.54 | 1.65 | 1.54 | 1.46 |
| Gemma-2-9B | 1.13 | 1.08 | 0.81 | 0.91 | 0.85 | 0.81 |
| Phi-4 | 2.04 | 1.71 | 1.30 | 1.44 | 1.35 | 1.27 |
| Mistral-NeMo-12B | 1.80 | 1.95 | 1.28 | 1.60 | 1.51 | 1.41 |
| GLM-4-9B | 11.02 | 11.84 | 3.60 | 2.27 | 2.20 | 1.88 |
| Geo. mean | 3.13 | 2.33 | 1.78 | 1.63 | 1.51 | 1.41 |
Table 15: WUSH-KV's published setting: QuEST 4-bit, one scale per token and head, S16W128, 128 FineWeb-Edu calibration sequences. KL×10³; bold: best. FlagRot-C builds on WUSH-KV's transform; -C_K: keys only; -C 8×8: with FlagRot-L candidates. Qwen2.5-7B is excluded (all methods exceed 340).
long-context endpoints, at 80 bytes per token and KV head. In paired comparisons against the 3.0-bit per-channel cache, the packed cache differs by at most 0.75 points across these three endpoints.
Selection and centering: task settings. Table 5(a) uses 16 LongBench v1 tasks and 800 items. The fixed mode decides once from cali-
| Group size g | INT2 | INT3 | ||||
|---|---|---|---|---|---|---|
| 128 | 64 | 32 | 128 | 64 | 32 | |
| S4W128 | ||||||
| RTN | 223 | 106 | 75.4 | 21.1 | 13.8 | 10.5 |
| FlagRot | 54.1 | 37.0 | 28.5 | 8.1 | 6.1 | 4.6 |
| FlagRot-C | 30.7 | 25.3 | 21.9 | 5.0 | 4.6 | 4.2 |
| KIVI | 44.7 | 28.4 | 18.4 | 5.8 | 4.4 | 3.2 |
| FlagRot-KIVI | 25.6 | 18.0 | 12.3 | 3.9 | 3.1 | 2.4 |
| No BF16 tokens | ||||||
| RTN | 2603 | 1529 | 599 | 329 | 128 | 69.5 |
| FlagRot | 731 | 396 | 218 | 62.3 | 45.9 | 31.4 |
| FlagRot-C | 336 | 235 | 165 | 37.6 | 31.7 | 25.2 |
| KIVI | 226 | 136 | 85.9 | 28.4 | 20.1 | 14.1 |
| FlagRot-KIVI | 105 | 80.0 | 60.9 | 16.0 | 13.1 | 10.1 |
Table 16: Rate and distortion: geometric-mean KL×10³ over twelve models. Bits per value: b + 16/g for per-token caches, b + 32/g for KIVI; without BF16 tokens, KIVI keeps the incomplete key group in BF16.
bration data; the per-key mode decides as each key is written. The HF study uses selective centering. The vLLM fixed baseline marked ‡ instead centers all key groups and fixes value transforms. Mean comparisons pool both models and use Holm correction; the vLLM comparison against the fixed baseline does not reach p < 0.05 (p = 0.065). Table 5(b) uses 60 AIME24+25 problems with eight samples each on Qwen3-8B and H20. Its nominal paired 95% intervals use resampling clustered by problem and are unadjusted. Pass@1 (%) is 72.3 for BF16. Enabling per-key selection changes the score from 37.5 to 58.5 without centering and from 54.8 to 69.4 with centering.
Per-token caches and agentic runs. Table 22 lists every INT2 task result of the per-token caches, with RTN, uncentered selection and FlagRot-auto side by side. Table 21 gives the full τ²-bench retail results of Qwen3-8B with 16 trials per task; its pooled rows combine seed 300 with seeds 304–307.
A.7 Serving
Figure 4 and Table 23 report closed-loop τ²-bench retail serving with prefix caching. On Qwen3.8-27B at 256 agents, the BF16 server preempts requests (566/641 preemptions in its two runs) while the INT2 caches have none, and FlagRot-auto completes simulations at 0.88× the BF16 rate and FP8 at 1.03×. At 256 agents the BF16 cache of Qwen3-8B no longer holds all active conversations, on H200 and more so on the H20 with its smaller memory, so the ratios at that load mainly reflect
| Text | Len. | Win. | Llama-3.1-8B | Qwen3-8B | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| KL | Δ vs RTN (%) | KL | Δ vs RTN (%) | |||||||||
| RTN | FlagRot | FlagRot-C | KIVI | FlagRot-KIVI | RTN | FlagRot | FlagRot-C | KIVI | FlagRot-KIVI | |||
| WikiText-2 | 2k | 141/146 | 115 | −78 | −83 | −84 | −89 | 83.9 | −47 | −55 | −64 | −77 |
| PG-19 | 2k | 77 | 88.6 | −77 | −81 | −89 | −92 | 55.6 | −46 | −58 | −67 | −78 |
| PG-19 | 8k | 77 | 266 | −87 | −89 | −94 | −96 | 132 | −44 | −45 | −80 | −87 |
| PG-19 | 32k | 24 | 554 | −90 | −70 | −96 | −97 | 292 | −28 | +366 | −89 | −92 |
| Code | 2k | 150 | 82.7 | −73 | −75 | −80 | −88 | 82.4 | −45 | −57 | −70 | −80 |
| Code | 8k | 80 | 163 | −78 | −78 | −86 | −91 | 153 | −43 | −43 | −79 | −86 |
| OpenWebMath | 2k | 150 | 99.2 | −74 | −78 | −80 | −87 | 86.2 | −43 | −63 | −75 | −83 |
| Wikipedia (zh) | 2k | 150 | 101 | −80 | −85 | −78 | −88 | 62.8 | −41 | −60 | −70 | −80 |
| Wikipedia (de) | 2k | 150 | 88.8 | −77 | −79 | −73 | −84 | 64.1 | −42 | −61 | −66 | −77 |
Table 17: INT2 caches at S4W128 on other text, calibration frozen on four WikiText-2 training windows: RTN KL×10³ and the change (%) from it. Len./Win.: window length and windows per model. Bold / gray: significantly below / above RTN (paired bootstrap, 95% CI).
| Model | Task | Items | BF16 | Δ vs BF16 | Selection over KIVI-only | ||
|---|---|---|---|---|---|---|---|
| KIVI-only | FlagRot-KIVI | Fixed | Per-key | ||||
| Qwen3-8B | LongBench v1 | 4,750 | 49.35 | −2.07[-2.69, −1.47] | −1.65[-2.19, −1.12] | +0.72[+0.08, +1.33] | +0.42[-0.20, +1.04] |
| Llama-3.1-8B-It | LongBench v1 | 4,750 | 49.70 | −2.32[-2.96, −1.70] | −1.46[-2.03, −0.91] | +0.47[-0.17, +1.10] | +0.86[+0.23, +1.48] |
| Qwen3-32B | LongBench v1 | 4,750 | 44.97 | −2.17[-2.86, −1.49] | −0.23[-0.81, +0.36] | – | +1.94[+1.22, +2.66] |
| Qwen3.8-27B | LongBench v1 | 4,750 | 53.49 | +0.33[-0.07, +0.74] | −0.24[-0.59, +0.10] | −0.74[-1.19, −0.30] | −0.57[-0.99, −0.17] |
| Llama-3.1-8B-It | RULER 128k | 1,300 | 73.7 | −11.3[-12.9, −9.7] | −8.4[-10.0, −6.8] | +2.5[+0.9, +4.1] | +2.9[+1.2, +4.5] |
Table 18: FlagRot-KIVI in vLLM at 2.5 bits per value (FP8 scale and minimum, 80 B per token and KV head) with S4W128 on H200: BF16 score (%) and paired differences in points with nominal 95% CIs. Selection: FlagRot-KIVI in its fixed and per-key mode minus KIVI-only, same kernel and layout; −: not run.
| Benchmark | Model | BF16 → KIVI → Ours | Fixed-mode gain | Per-key gain |
|---|---|---|---|---|
| RULER 128k | Llama-3.1-8B-It | 73.7 → 61.8 → 65.9 | +3.9 [+2.3, +5.5] | +4.2† [+2.6, +5.8] |
| LongBench v1 | Qwen3-8B | 49.35 → 47.39 → 48.45 | +0.5 [−0.1, +1.1] | +1.05 [+0.47, +1.64] |
| Llama-3.1-8B-It | 49.70 → 47.55 → 48.21 | +0.3 [−0.3, +1.0] | +0.66 [+0.03, +1.30] | |
| Qwen3.8-27B | 53.49 → 53.63 → 53.18 | −1.0 [−1.4, −0.6] | −0.45 [−0.89, 0.00] | |
| Qwen3-32B | 44.97 → 43.25 → 44.65 | – | +1.40 [+0.72, +2.07] | |
| AIME24+25 | Qwen3-8B | 71.5 → 68.5 → 68.5 | +2.1 [−0.2, +4.4] | 0.0 [−2.7, +2.7] |
| τ²-bench retail | Qwen3.8-27B | 61.6 → 61.6 → 59.6 | – | −2.0 [−8.1, +4.4] |
Table 19: FlagRot-KIVI in vLLM, 3.0 bits/value (FP16 scale and minimum), S4W128 (H200; retail H20). Path: BF16 → KIVI-only → FlagRot-KIVI (per-key), scores 0–100. Gains: points over KIVI-only, same kernel [nominal paired 95% CI]. Fixed: decided once from calibration data; per-key: decided as each key is written. Blue: CI above zero. †Holm (per-key) on RULER, on AIME/retail, one family; LongBench CIs descriptive. Metrics: RULER 13-subtask string-match mean (1,300 items); LongBench 21-task macro-score (4,750/model); AIME pass@1 (60 problems × 8 samples); retail DB-only pass¹ (114 tasks × 4 trials). Scores/contrasts rounded independently; −: not run.
cache capacity.
Protocol. Each client process drives 8 -bench retail agents against one vLLM server with prefix caching and a 512-sequence limit, and BF16 user simulators run on separate GPUs. Through-
put counts generated tokens, completed simulations and simulations with reward 1 over a timed window after warm-up. Qwen3-8B points at 64 and 128 agents have three runs for the main caches and two elsewhere, with a third run where the half-range of
| Endpoint | KIVI-only | Fixed | Per-key |
|---|---|---|---|
| Llama-It, RULER 128k | 61.8 | +3.9[+2.3, +5.5] | +4.2[+2.5, +5.7] |
| Llama-It, LongBench | 47.5 | +0.3[−0.3, +1.0] | +0.7[+0.0, +1.3] |
| Qwen3-8B, LongBench | 47.4 | +0.5[−0.1, +1.1] | +1.1[+0.5, +1.6] |
| Qwen3.8-27B, LongBench | 53.6 | −1.0[−1.4, −0.6] | −0.5[−0.9, −0.0] |
| Qwen3-8B, AIME | 68.5 | +2.1[−0.2, +4.4] | +0.0[−2.7, +2.7] |
| Qwen3-8B, retail | 20.4 | −2.2[−6.2, +1.8] | +1.6[−2.0, +5.4] |
Table 20: Fixed and per-key selection on the 3.0-bit per-channel cache in vLLM (FP16 scales and minima; H200, same kernel, layout and protection): score minus KIVI-only in points (nominal 95% CI). Llama-It: Llama-3.1-8B-Instruct.
| Cache | pass^1 | pass^4 | msg/sim | limit | |
|---|---|---|---|---|---|
| H200, 114 tasks × 16 trials | |||||
| BF16 | 27.8 | 10.8 | 51.3 | 7.0% | |
| KIVI-only | 20.4 | −7.3[−12.0, −2.7] | 6.3 | 58.5 | 11.5% |
| FlagRot-KIVI | 22.1 | −5.7[−10.4, −0.9] | 5.4 | 62.0 | 12.3% |
| Fixed mode | 18.2 | – | – | – | – |
| FlagRot-auto | 16.2 | −11.6[−16.0, −7.4] | 3.7 | 74.5 | 22.0% |
| H20, 114 tasks × 16 trials | |||||
| BF16 | 26.8 | 10.9 | 50.9 | 6.9% | |
| FlagRot-auto | 17.4 | −9.4[−14.1, −4.7] | 4.1 | 72.6 | 22.1% |
| H20, 114 tasks × 20 trials, pooled | |||||
| BF16 | 26.4 | 10.6 | 51.4 | 7.2% | |
| FlagRot-auto | 17.1 | −9.3[−13.9, −4.9] | 3.9 | 73.0 | 22.3% |
Table 21: Qwen3-8B on -bench retail, INT2 caches at S4W128: database-state pass^1 and pass^4 (%), paired of pass^1 from BF16 (points, nominal 95% CI), messages per simulation and share hitting the step limit. KIVI rows: 3.0-bit layout; fixed mode as in Table 20. Pooled: seeds 300, 304–307. -: not recorded.
| Task | vs BF16 | |||||
|---|---|---|---|---|---|---|
| BF16 | FP8 | RTN | FlagRot | -auto | ||
| Qwen3-8B | ||||||
| LongBench v1 | 49.4 | +0.1 | −11.0 | −4.4 | −3.3 | +7.7 |
| LongBench v2 | 32.4 | 0.0 | −7.8 | −2.8 | −2.8 | +5.0 |
| RULER 32k | 73.2 | +0.7 | −32.7 | −10.7 | −8.8 | +23.9 |
| AIME24 | 75.0 | +0.4 | −35.4 | −9.6 | −1.7 | +33.7 |
| AIME25 | 69.6 | −2.5 | −34.2 | −17.9 | −4.2 | +30.0 |
| GPQA-Diamond | 58.4 | +0.2 | −13.5 | −0.5 | −2.7 | +10.8 |
| MATH-500 | 96.2 | +0.2 | −3.9 | −0.9 | −0.6 | +3.3 |
| GSM8K | 90.6 | −0.6 | −3.0 | −0.6 | +0.3 | +3.3 |
| MMLU-Pro | 61.8 | −0.2 | −10.4 | −7.0 | −3.6 | +6.8 |
| BFCL | 75.0 | +0.2 | −10.3 | −3.6 | −1.4 | +8.9 |
| airline, pass^1 | 16.5 | +3.0 | −1.5 | −4.0 | −0.5 | +1.0 |
| airline, pass^4 | 6.0 | +6.0 | +6.0 | −2.0 | −2.0 | −8.0 |
| retail, pass^1 | 24.8 | 0.0 | −19.7 | −11.8 | −9.2 | +10.5 |
| retail, pass^4 | 10.5 | −4.4 | −9.6 | −9.6 | −7.9 | +1.7 |
| telecom, pass^1 | 2.4 | −0.4 | 0.0 | −1.1 | +0.2 | +0.2 |
| telecom, pass^4 | 0.0 | 0.0 | +0.9 | 0.0 | 0.0 | −0.9 |
| SWE-bench Verified | 2.0 | −1.0 | −2.0 | −2.0 | −2.0 | 0.0 |
| Llama-3.1-8B-It | ||||||
| LongBench v1 | 49.7 | −0.2 | −16.2 | −6.0 | −3.3 | +12.9 |
| LongBench v2 | 27.8 | +0.8 | +1.4 | +2.2 | +3.2 | +1.8 |
| RULER 32k | 86.1 | −1.2 | −56.9 | −15.7 | −7.2 | +49.7 |
| GSM8K | 85.8 | −2.2 | −8.9 | −0.8 | −0.2 | +8.7 |
| MMLU-Pro | 46.6 | +0.5 | −14.6 | −5.4 | −1.2 | +13.4 |
| BFCL | 31.3 | −0.5 | −6.7 | +0.7 | −1.9 | +4.8 |
| airline, pass^1 | 28.5 | −1.0 | −26.5 | +8.5 | −1.0 | +25.5 |
| airline, pass^4 | 20.0 | 0.0 | −20.0 | +10.0 | −2.0 | +18.0 |
| retail, pass^1 | 7.0 | +0.9 | −2.9 | −3.9 | −1.3 | +1.6 |
| retail, pass^4 | 3.5 | +0.9 | −2.6 | −2.6 | 0.0 | +2.6 |
| telecom, pass^1 | 7.0 | +2.4 | −6.1 | +5.5 | −7.0 | −0.9 |
| telecom, pass^4 | 7.0 | −3.5 | −7.0 | +3.5 | −7.0 | 0.0 |
| Qwen3.8-27B | ||||||
| LongBench v1 | 53.5 | −0.1 | −1.0 | 0.0 | −0.2 | +0.7 |
| LongBench v2 | 50.7 | +0.4 | −3.6 | −2.2 | −3.4 | +0.2 |
| RULER 32k | 88.2 | −0.6 | −1.3 | +0.3 | −0.2 | +1.1 |
| AIME24 | 89.6 | −1.3 | −0.4 | −0.8 | −1.3 | −0.9 |
| AIME25 | 82.1 | +0.4 | +0.4 | −2.9 | −5.0 | −5.4 |
| GPQA-Diamond | 82.5 | −2.0 | −0.7 | −0.7 | −2.2 | −1.5 |
| MATH-500 | 98.5 | −0.3 | −0.1 | −0.5 | −0.2 | −0.1 |
| GSM8K | 96.4 | −0.2 | +0.1 | +0.2 | −0.1 | −0.2 |
| MMLU-Pro | 77.6 | −0.2 | −1.0 | −0.8 | −0.9 | +0.1 |
| airline, pass^1 | 62.0 | +3.0 | −14.5 | −0.5 | −6.5 | +8.0 |
| airline, pass^4 | 42.0 | +2.0 | −10.0 | −2.0 | −8.0 | +2.0 |
| retail, pass^1 | 61.6 | −1.3 | −4.6 | −2.4 | −2.0 | +2.6 |
| retail, pass^4 | 44.7 | −6.1 | −9.6 | −7.0 | −6.1 | +3.5 |
| telecom, pass^1 | 26.8 | −0.4 | −5.0 | −1.5 | −4.8 | +0.2 |
| telecom, pass^4 | 7.0 | −3.5 | −2.6 | −0.9 | −3.5 | −0.9 |
| SWE-bench Verified | 61.0 | −9.0 | −10.0 | −3.0 | −5.0 | +5.0 |
Table 22: Per-token INT2 caches in vLLM on all tasks: BF16 score (%) and paired differences in points. RTN, FlagRot and -auto (FlagRot-auto) use S4W128; FP8: vLLM's FP8 cache with BF16 queries. : -auto minus RTN on the same items. H200 (21-task mean); all others H20.

(a) Qwen3-8B, 64 agents
(b) Qwen3.8-27B, H200
Figure 4: Closed-loop -bench retail with prefix caching and S4W128: generated tokens/s, completed and successful simulations per hour, relative to BF16.
two exceeded 10%, and points at 256 agents have two runs (one for KIVI-only on H200 and RTN on H20); we report the median of three or the mean of two. Qwen3.8-27B has one run at 64 agents and two at 256.
Serving on a hybrid model. For Qwen3.8-27B, vLLM 0.30 sizes each full-attention page to at least the state page of the linear-attention layers, so the per-token INT2 format stores more tokens per page (784/1568/5024 tokens for BF16, FP8 and INT2).
Pure decoding. Without prefix caching and at a fixed context of 8192 tokens, the INT2 per-token cache of Qwen3.8-27B takes 4.8% more time per output token than BF16 at batch 64 (INT4: 5.3%), and at the same memory budget it holds as many tokens (2.75 against 0.93 million; Table 9).
B HuggingFace Task Study
This appendix describes the HuggingFace study behind §5.3 and Table 5(a), and the task-level comparison with RotateKV cited in §5.1. The study runs Qwen3-8B and Llama-3.1-8B-Instruct with the simulated caches in HuggingFace Transformers on 50 items of each of 16 English and code tasks of LongBench v1, with the prompts of the vLLM
| Agents Cache | tok/s | sims/h | succ./h | msg/sim | ×BF16 |
|---|---|---|---|---|---|
| Qwen3-8B, H200 | |||||
| 64 BF16 | 1354 | 3257 | 861 | 49.3 | 1.00 |
| FP8 | 1598 | 3435 | 866 | 57.4 | 1.05 |
| FlagRot, INT4 | 1508 | 3211 | 843 | 53.3 | 0.99 |
| KIVI-only | 906 | 2153 | 387 | 53.8 | 0.66 |
| FlagRot-KIVI, fixed | 972 | 1892 | 369 | 61.2 | 0.58 |
| FlagRot-KIVI | 858 | 1415 | 260 | 70.5 | 0.43 |
| FlagRot-auto | 1436 | 2046 | 288 | 72.6 | 0.63 |
| RTN | 1773 | 1070 | 46 | 89.8 | 0.33 |
| 128 BF16 | 1637 | 3826 | 1010 | 51.4 | 1.00 |
| FP8 | 1816 | 3875 | 935 | 56.9 | 1.01 |
| FlagRot, INT4 | 1866 | 3777 | 1017 | 57.6 | 0.99 |
| FlagRot-auto | 1798 | 2140 | 323 | 77.0 | 0.56 |
| RTN | 2317 | 1077 | 50 | 89.5 | 0.28 |
| 256 BF16 | 558 | 1236 | 310 | 56.0 | 1.00 |
| FP8 | 2062 | 4645 | 1124 | 56.9 | 3.76 |
| FlagRot, INT4 | 2025 | 4290 | 1014 | 59.0 | 3.47 |
| KIVI-only | 1097 | 2449 | 430 | 58.2 | 1.98 |
| FlagRot-KIVI, fixed | 1140 | 2271 | 448 | 64.6 | 1.84 |
| FlagRot-KIVI | 1035 | 1672 | 324 | 70.9 | 1.35 |
| FlagRot-auto | 1737 | 2064 | 328 | 78.7 | 1.67 |
| RTN | 2150 | 1016 | 39 | 90.2 | 0.82 |
| Qwen3-8B, H20 | |||||
| 64 BF16 | 414 | 957 | 274 | 51.1 | 1.00 |
| FP8 | 724 | 1567 | 352 | 57.2 | 1.64 |
| FlagRot, INT4 | 639 | 1362 | 309 | 55.5 | 1.42 |
| FlagRot-auto | 658 | 940 | 118 | 74.1 | 0.98 |
| RTN | 861 | 458 | 19 | 88.7 | 0.48 |
| 128 BF16 | 366 | 977 | 229 | 49.8 | 1.00 |
| FP8 | 771 | 1687 | 416 | 54.5 | 1.73 |
| FlagRot, INT4 | 742 | 1646 | 386 | 55.4 | 1.69 |
| 256 BF16 | 119 | 263 | 71 | 51.9 | 1.00 |
| FP8 | 805 | 1791 | 426 | 57.3 | 6.80 |
| FlagRot, INT4 | 730 | 1631 | 394 | 54.2 | 6.19 |
| FlagRot-auto | 656 | 891 | 139 | 74.7 | 3.38 |
| RTN | 670 | 304 | 15 | 94.0 | 1.16 |
| Qwen3.8-27B, H200 | |||||
| 64 BF16 | 680 | 1917 | 1135 | 28.9 | 1.00 |
| FP8 | 549 | 1457 | 920 | 29.3 | 0.76 |
| FlagRot, INT4 | 335 | 901 | 577 | 28.1 | 0.47 |
| FlagRot-auto | 372 | 993 | 618 | 29.4 | 0.52 |
| RTN, centered | 377 | 1005 | 573 | 28.4 | 0.52 |
| 256 BF16 | 417 | 1114 | 654 | 31.1 | 1.00 |
| FP8 | 459 | 1146 | 698 | 30.5 | 1.03 |
| FlagRot, INT4 | 269 | 720 | 433 | 29.3 | 0.65 |
| FlagRot-auto | 408 | 982 | 579 | 30.6 | 0.88 |
| RTN, centered | 450 | 1153 | 668 | 30.1 | 1.04 |
Table 23: Closed-loop -bench retail serving with prefix caching; INT2 and INT4 caches at S4W128, KIVI rows in the packed 2.5-bit layout; FP8: vLLM's FP8 cache with BF16 queries. sims/h, succ./h: completed and successful simulations per hour; ×BF16: sims/h relative to BF16.
runs. On these items, the HF BF16 scores exceed the vLLM ones by +0.11 and +0.40 points.
In the HF study, the official and the protocol-matched RotateKV configurations produce very different task scores, while the protected caches lie close together. Table 24 lists the primary caches and controls. With S4W128, RotateKV (g32, clip 0.8) scores below both FlagRot-auto and KIVI on Qwen3-8B and above both on Llama-3.1-8B-Instruct. Without a window, in its official setting, it differs from BF16 by −12.67 and −7.26 points. With clip ratio 1.0, RotateKV differs from BF16 by −2.17 [−3.43, −0.94] and −2.40 [−3.77, −1.09] points, and its direct differences from FlagRot-auto, KIVI and FlagRot-KIVI all have intervals that include zero.
| Cache | Qwen3-8B | Llama-3.1-8B-It |
|---|---|---|
| BF16 (score) | 49.90 | 50.13 |
| Per-token INT2 | ||
| RTN | −11.24 | −11.74 |
| RTN, centered | −5.92 | −6.97 |
| Fixed mode | −5.24 | −4.94 |
| Fixed mode, centered | −4.97 | −4.19 |
| FlagRot | −4.92 | −4.17 |
| FlagRot-auto | −2.23 | −1.77 |
| Per-channel INT2 | ||
| KIVI | −1.34 | −1.68 |
| FlagRot-KIVI | −1.49 | −1.28 |
| RotateKV, INT2 | ||
| g32, clip 0.8 | −3.01 | −0.63 |
| g32, clip 1.0 | −2.17 | −2.40 |
| official (W0) | −12.67 | −7.26 |
| INT3, g=128 | ||
| RTN, centered | −1.46 | −0.92 |
| FlagRot-auto | −1.11 | −0.53 |
Table 24: HuggingFace study: BF16 score (%) and differences from BF16 in points on 16 LongBench v1 tasks (50 items each); INT2, g=32, S4W128 unless noted.
C 4-bit Caches
At 4 bits, selection lowers the KL on the 15 models and three formats we test, while task scores differ little between encoders. This appendix gives the 4-bit encoder and its evaluation, the fidelity results behind §5.4, the task study and the serving kernels; the mechanism is analyzed in Appendix E.
C.1 Setup and Encoder Settings
At 4 bits, FlagRot uses the per-token key candidates of FlagRot-auto and the query-weighted criterion of §3.1 on INT4 (asymmetric, g=32), MXFP4 and NVFP4 caches. Each key head of dimension is split into sub-vectors of channels (16 for NVFP4), so every block transform stays inside one scale group. For a new token, every sub-vector selects between the identity and , and per head this selection competes with the whole-head transform . The selection takes flag bits per key head (5 for and ), stored in the sign bits of the token's INT4 or NVFP4 scales, which are always positive: one per key scale group, and the head flag in a value scale. INT4 stores its zero point in the low mantissa bits of the FP16 scale, so the cache keeps 4.5 bits per element; MXFP4, whose scales have no sign bit, stores the flags separately. Values are quantized without transform (Appendix E.2).
Selection criterion. A key error changes the logit of a query by . We weight it with the second moment of the post-RoPE queries of the head's GQA group, , estimated once on calibration data: , with the reconstruction error in the original coordinates. The encoder (i) quantizes the key three times, unrotated, with per sub-vector and with ; (ii) gives every sub-vector the candidate with the lower error under its diagonal block of ; (iii) keeps the assembled reconstruction or the one, whichever has the lower error under the full . Where values are selected, their error is weighted by the column energy of . For keys the inverse transform is moved to the query as in Eq. (2), so attention never materializes the dequantized keys.
Variants. The fixed mode fixes the selection of every key and value head on calibration data, per sub-vector or for the whole head, and stores no flags. FlagRot-C selects on top of a calibrated base transform: per head and scale group, invertible matrices for keys and for values are derived in closed form from second moments of keys, queries and output weights (Chen et al., 2026). The cache stores for the selected candidate ; queries are multiplied by , so that approximates , and the attention output by . FlagRot-L selects on keys and values among eight candidates per sub-vector (the identity, and six ) and eight per head (the per-sub-vector selection, and six ), with 15 flag bits per 128 values (27 with for NVFP4); the are diagonal matrices drawn once from a seeded generator.
| Model | INT4 (g=32) | MXFP4 | NVFP4 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| KL | Head | Fixed | FlagRot | -L | KL | Head | Fixed | FlagRot | -L | KL | Head | Fixed | |
| Development models | |||||||||||||
| Llama-3.1-8B | 20.2 | -36.8 | -40.3 | -54.2 | -72.7 | 95.1 | -70.7 | -68.3 | -72.7 | -86.7 | 26.8 | -30.4 | -33.1 |
| Qwen3-8B | 43.5 | -28.4 | -44.2 | -56.4 | -73.2 | 140.3 | +41.5 | -49.9 | -65.0 | -78.1 | 38.4 | +214.9 | -12.3 |
| Mistral-7B-v0.3 | 7.1 | -33.6 | -37.6 | -51.0 | -69.2 | 30.6 | -62.0 | -58.6 | -65.5 | -83.3 | 10.6 | -35.2 | -32.6 |
| Qwen3-14B | 25.1 | -46.3 | -49.0 | -61.4 | -75.5 | 113.3 | -56.0 | -59.3 | -75.0 | -86.0 | 24.2 | +31.6 | -12.8 |
| Larger models | |||||||||||||
| Qwen3-32B | 35.9 | -43.1 | -45.9 | -56.4 | -70.2 | 139.7 | -52.0 | -56.1 | -68.8 | -81.3 | 34.9 | +26.3 | -12.2 |
| Qwen3-30B-A3B | 53.3 | -30.4 | -48.1 | -59.5 | -74.1 | 140.4 | -18.9 | -46.3 | -59.7 | -77.3 | 47.9 | +57.0 | -4.8 |
| Qwen3.8-27B | 6.7 | -8.0 | -10.3 | -13.3 | -34.2 | 15.7 | -20.9 | -29.9 | -29.9 | -51.3 | 8.3 | -3.4 | -6.9 |
| Gemma-3-27B | 63.1 | -26.8 | -34.8 | -68.8 | -87.7 | 113.6 | -6.3 | -32.1 | -64.7 | -85.6 | 43.2 | +82.2 | -10.4 |
| Held-out models | |||||||||||||
| Llama-2-7B | 9.2 | -47.1 | -47.0 | -56.1 | -72.6 | 60.8 | -80.0 | -79.6 | -79.6 | -90.8 | 12.8 | -43.9 | -43.5 |
| Llama-3.2-3B | 23.8 | -36.6 | -42.0 | -56.5 | -74.9 | 87.1 | -61.1 | -59.5 | -67.2 | -83.6 | 30.6 | -26.1 | -29.2 |
| Qwen2.5-7B | 4697.5 | +19.7 | +14.0 | +6.2 | -49.4 | 6215.7 | +3.7 | +11.7 | +10.7 | -28.6 | 5074.7 | +31.6 | +22.3 |
| Gemma-2-9B | 5.6 | -41.0 | -42.3 | -40.9 | -60.0 | 22.6 | -69.9 | -69.6 | -69.5 | -81.5 | 7.4 | -37.8 | -38.9 |
| Phi-4 | 14.3 | -37.9 | -40.9 | -56.8 | -71.7 | 40.6 | -52.7 | -52.1 | -63.3 | -78.8 | 18.5 | -30.0 | -31.3 |
| Mistral-NeMo-12B | 9.5 | -34.4 | -38.2 | -45.2 | -64.4 | 45.6 | -68.7 | -66.2 | -67.4 | -84.3 | 12.4 | -26.3 | -25.8 |
| GLM-4-9B | 42.9 | -20.4 | -37.6 | -56.1 | -73.9 | 521.6 | -83.8 | -86.0 | -88.7 | -94.3 | 64.0 | -7.8 | -11.1 |
Table 25: 4-bit KV caches without BF16 tokens: KL×10³ without rotation and relative KL change (%) of each rotation. Head: whole-head Hadamard; Fixed: fixed mode; -L: FlagRot-L. Bold: best and significantly below zero; gray: significantly above zero (95% CI). Qwen2.5-7B without key centering.
| Model bits/elem. | INT4 | NVFP4 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RTN | TurboQ | Smooth | Head | Base | Fixed | FlagRot | -L | -C | RTN | 4/6 | 4/6+FR | FlagRot | -L | |
| 4.50 | 4.9–7.1 | 4.50 | 4.50 | 4.50 | 4.50 | 4.50 | 4.62 | 4.50 | 4.50 | 4.50 | 4.50 | 4.50 | 4.71 | |
| Llama-3.1-8B | 20.2 | 16.6 | 18.4 | 12.7 | 7.8 | 12.0 | 9.2 | 5.5 | 7.0 | 26.8 | 21.0 | 10.5 | 12.5 | 7.5 |
| Qwen3-8B | 43.5 | 27.3 | 33.2 | 31.2 | 14.8 | 24.3 | 19.0 | 11.7 | 13.3 | 38.4 | 33.4 | 19.3 | 23.9 | 15.7 |
| Mistral-7B-v0.3 | 7.1 | 6.0 | 6.7 | 4.7 | 3.2 | 4.4 | 3.5 | 2.2 | 2.8 | 10.6 | 8.4 | 4.3 | 5.2 | 3.1 |
| Qwen3-14B | 25.1 | 17.2 | 21.2 | 13.5 | 10.9 | 12.8 | 9.7 | 6.1 | 9.7 | 24.2 | 20.1 | 12.0 | 14.5 | 9.2 |
| Qwen3.8-27B | 6.7 | 8.2 | 6.2 | 6.2 | 5.2 | 6.0 | 5.8 | 4.4 | 5.1 | 8.3 | 7.2 | 6.1 | 6.9 | 5.2 |
| Gemma-3-27B | 63.1 | 72.3 | 32.5 | 46.2 | 10.8 | 41.1 | 19.7 | 7.8 | 9.8 | 43.2 | 37.9 | 17.0 | 19.0 | 8.5 |
| Llama-2-7B | 9.2 | 6.5 | 8.9 | 4.9 | 4.6 | 4.9 | 4.0 | 2.5 | 3.9 | 12.8 | 10.5 | 4.9 | 5.7 | 3.4 |
| Llama-3.2-3B | 23.8 | 20.9 | 22.5 | 15.1 | 9.2 | 13.8 | 10.4 | 6.0 | 8.0 | 30.6 | 24.9 | 12.2 | 14.6 | 8.6 |
| Qwen2.5-7B | 4697.5 | 17.9 | 3768.9 | 5621.3 | 4611.7 | 5354.1 | 4989.7 | 2378.9 | 4285.1 | 5074.7 | 6123.9 | 5950.3 | 6095.9 | 4812.4 |
| Gemma-2-9B | 5.6 | 7.1 | 5.6 | 3.3 | 3.5 | 3.2 | 3.3 | 2.2 | 3.2 | 7.4 | 6.1 | 3.6 | 4.1 | 2.8 |
| Phi-4 | 14.3 | 11.9 | 14.5 | 8.9 | 5.4 | 8.5 | 6.2 | 4.1 | 5.0 | 18.5 | 15.3 | 7.6 | 9.1 | 5.6 |
| Mistral-NeMo-12B | 9.5 | 8.0 | 9.5 | 6.2 | 5.2 | 5.9 | 5.2 | 3.4 | 4.7 | 12.4 | 10.2 | 6.0 | 7.1 | 4.5 |
| GLM-4-9B | 42.9 | 32.2 | 32.2 | 34.2 | 15.2 | 26.8 | 18.8 | 11.2 | 13.4 | 64.0 | 51.9 | 28.3 | 35.7 | 18.4 |
Table 26: Recent KV-cache quantizers without BF16 tokens: KL×10³; bold: best per group. TurboQ: TurboQuant in vLLM; Smooth: SmoothAttention; Head: whole-head Hadamard; Base: calibrated base alone; -L/-C: FlagRot-L/FlagRot-C; 4/6: Four Over Six; FR: FlagRot. Qwen2.5-7B without key centering.
| Model | S=4, W=128 | W=128 only | |||||||
|---|---|---|---|---|---|---|---|---|---|
| RTN | Fixed | FlagRot | FlagRot-C | FlagRot-L | RTN | Fixed | FlagRot | FlagRot-C | |
| Llama-3.1-8B | 2.30 | 1.52 | 1.31 | 1.28 | 1.05 | 3.22 | 1.92 | 1.83 | 1.71 |
| Qwen3-8B | 4.05 | 2.30 | 2.09 | 1.93 | 1.60 | 10.00 | 5.01 | 3.96 | 7.14 |
| Mistral-7B-v0.3 | 1.34 | 0.78 | 0.70 | 0.71 | 0.52 | 1.46 | 0.83 | 0.77 | 0.79 |
| Qwen3-14B | 2.71 | 1.69 | 1.40 | 1.46 | 1.25 | 7.36 | 3.74 | 2.78 | 5.56 |
| Qwen3.8-27B | 3.38 | 2.92 | 2.88 | 2.92 | 2.53 | 3.80 | 3.34 | 2.89 | 3.46 |
| Gemma-3-27B | 8.14 | 6.73 | 3.24 | 2.56 | 2.04 | 14.76 | 12.97 | 5.64 | 4.31 |
| Llama-2-7B | 1.33 | 0.87 | 0.82 | 0.85 | 0.65 | 1.43 | 0.90 | 0.88 | 0.90 |
| Llama-3.2-3B | 2.79 | 1.81 | 1.51 | 1.44 | 1.16 | 3.87 | 2.31 | 2.17 | 1.88 |
| Qwen2.5-7B | 659.94 | 4029.46 | 3468.10 | 3483.43 | 896.79 | 743.62 | 4066.84 | 3513.18 | 3530.62 |
| Gemma-2-9B | 1.18 | 0.82 | 0.78 | 0.81 | 0.68 | 1.70 | 1.05 | 1.08 | 1.30 |
| Phi-4 | 2.43 | 1.49 | 1.26 | 1.16 | 0.98 | 2.56 | 1.54 | 1.33 | 1.28 |
| Mistral-NeMo-12B | 1.97 | 1.32 | 1.20 | 1.27 | 0.97 | 2.35 | 1.48 | 1.43 | 1.47 |
| GLM-4-9B | 10.79 | 8.50 | 2.90 | 2.95 | 2.14 | 19.97 | 12.55 | 6.54 | 4.60 |
| Geo. mean, S=4, W=0 | 15.17 | 9.30 | 7.17 | 5.30 | 4.51 | ||||
| Geo. mean, S=4, W=32 | 4.26 | 2.66 | 2.12 | 1.92 | 1.59 | ||||
| Geo. mean, S=4, W=256 | 2.07 | 1.54 | 1.19 | 1.22 | 0.94 | ||||
Table 27: Per-model KL×10³ of INT4 caches with BF16 sink and recent tokens; geometric means for other windows exclude Qwen2.5-7B (no key centering; every per-token 4-bit cache exceeds 600).
| Task | Qwen3-8B | Llama-3.1-8B-It | Qwen3.8-27B | |||
|---|---|---|---|---|---|---|
| BF16 | Δ FlagRot [95% CI] | BF16 | Δ FlagRot [95% CI] | BF16 | Δ FlagRot [95% CI] | |
| RULER (32k) | 73.2 | -0.1 [-1.1, +0.9] | 86.1 | -0.2 [-0.8, +0.3] | 88.2 | +0.1 [-0.1, +0.3] |
| LongBench v2 | 32.4 | +0.4 [-1.0, +1.8] | 27.8 | +1.4 [+0.2, +2.6] | 50.7 | -0.6 [-3.2, +2.2] |
| LongBench v1¶ | 49.2 | 0.0 [-0.3, +0.3] | 49.6 | -0.1 [-0.5, +0.2] | 54.3 | -0.2 [-0.4, +0.1] |
| AIME24 | 75.0 | -2.5 [-6.7, +1.2] | - | - | 89.6 | +2.5 [-2.1, +8.3] |
| AIME25 | 69.6 | -4.6 [-11.2, +1.2] | - | - | 82.1 | +1.3 [-1.7, +4.2] |
| GPQA-Diamond | 58.4 | +2.2 [-0.7, +5.2] | - | - | 82.5 | -0.5 [-2.5, +1.5] |
| MATH-500 | 96.2 | +0.4 [-0.4, +1.2] | - | - | 98.5 | 0.0 [-0.5, +0.5] |
| GSM8K | 90.6 | -0.5 [-1.3, +0.2] | 85.8 | +0.2 [-0.9, +1.4] | 96.4 | -0.1 [-0.6, +0.5] |
| MMLU-Pro | 61.8 | +0.1 [-1.3, +1.6] | 46.6 | +0.1 [-1.6, +1.9] | 77.6 | -0.1 [-1.4, +1.1] |
| BFCL | 75.0 | -0.3 [-1.1, +0.6] | 31.3 | +0.9 [+0.5, +1.4] | - | - |
| τ² airline | 16.5† | 0.0 [-5.0, +4.5] | 28.5 | +1.0 [-5.0, +6.5] | 62.0 | -4.5 [-14.0, +4.0] |
| τ² retail‡ | 24.8 | 0.0 [-5.5, +5.9] | 7.0† | +0.9 [-1.5, +3.5] | 61.6 | -3.3 [-8.1, +1.8] |
| τ² telecom | 2.4† | -0.2 [-2.0, +1.3] | 7.0† | 0.0 [+0.0, +0.0] | 26.8 | -2.4 [-7.9, +3.1] |
| SWE-bench Verified§ | 2.0† | 0.0 [-4.0, +4.0] | - | - | 61.0 | -6.0 [-15.0, +3.0] |
Table 28: FlagRot (INT4, S4W128) in vLLM: BF16 score (%) and paired Δ from BF16 in points. Bold / gray: CI above / below zero. †BF16 below 20%. ‡Database-state reward. §100-instance subset. ¶Mean of 16 English tasks on H200, with its own BF16 run. -: not evaluated.
| KV cache concurrent agents | H200 | H20 | ||||
|---|---|---|---|---|---|---|
| 64 | 128 | 256 | 64 | 128 | 256 | |
| BF16† | 1381 | 1402 | 637 | 482 | 166 | 134 |
| FP8 (FlashAttention-3)† | 1468 | 1608 | 1744 | 589 | 654 | 706 |
| vLLM INT4† | 391 | 484 | 577 | 256 | 288 | 320 |
| FP8 (FlashInfer) | 1660 | 2051 | 2197 | 768 | 819 | 994 |
| FlagRot, no BF16 tokens | 1808 | 2051 | 2398 | 737 | 781 | 852 |
| RTN* (INT4, our kernels) | 1672 | 1972 | 2277 | 737 | 775 | 869 |
| Fixed mode* | 1509 | 1819 | 2190 | 623 | 741 | 831 |
| FlagRot* | 1523 | 1889 | 2062 | 703 | 783 | 829 |
| FlagRot-C* | 1269 | 1554 | 1720 | 644 | 683 | 732 |
Table 29: Serving τ²-bench retail agents with Qwen3-8B and INT4 caches: generated tokens/s. *S4W128. †Earlier run block of the same protocol.
Models, calibration and windows. The development models are Llama-3.1-8B, Qwen3-8B, Qwen3-14B and Mistral-7B-v0.3; all design decisions were taken on their WikiText-2 validation windows. We also evaluate Qwen3-32B, Qwen3-30B-A3B, Qwen3.8-27B, Gemma-3-27B and seven held-out models (Table 10). Keys and values are quantized after RoPE with linear layers in BF16; in Qwen3.8-27B only the full-attention layers, which hold the KV cache, are quantized. The selection statistics come from four 2048-token windows of WikiText-2 train. The metric is KL(BF16||Q)×10³, averaged over all positions of all 2048-token windows of the WikiText-2 test set (Merity et al., 2017); for Gemma-2 and Gemma-3 every window starts with BOS followed by 2047 text tokens. Without protected tokens, every query reads all earlier tokens, including those of its own window, from the quantized cache; S4W128 keeps the first 4 and the 128 most recent tokens in BF16. The simulation keeps full-precision INT4 scales and zero points; storing them in the deployed format changes KL by +0.7% on average. Intervals are paired percentile-bootstrap 95% intervals over windows (5000 resamples; Efron and Tibshirani, 1993), and a difference is called significant when its interval excludes zero and the effect is at least 1%.
C.2 Fidelity Across Formats
With static key centering on Qwen2.5-7B, FlagRot lowers KL by 13–89% relative to round-to-nearest (RTN) on the 15 models and three formats without protected tokens (Table 4). Table 25 adds whole-head rotation (QuaRot-style), the fixed mode and FlagRot-L, without centering: the KL of FlagRot is below that of whole-head rotation in 40 of 45 model–format pairs, and FlagRot-L lowers KL by 34–94% on the models other than Qwen2.5-7B in each format.
Recent quantizers. Table 30 compares recent per-token KV quantizers on 12 models (per model in Table 26). At 4.5 bits per element, FlagRot lowers KL by 7–57% relative to SmoothAttention (Lin et al., 2025) and by 29–73% relative to vLLM’s TurboQuant setting (Zandieh et al., 2026), which keeps the first and last two layers in BF16 and uses 4.9–7.1 bits per element. On NVFP4 it lowers the KL of RTN by 17–56% and composes with the scale selection of Four Over Six (Cook et al., 2025), lowering its KL by 15–55%. The calibrated base
of WUSH-KV alone has a lower mean KL than FlagRot (7.02 against 7.88); selection on top of the base, FlagRot-C, lowers the KL of the base by a further 3–15%. Table 15 applies selection in WUSH-KV’s own published setting (Appendix A.5).
| Method | bits | KL |
|---|---|---|
| INT4 | ||
| RTN | 4.50 | 16.72 |
| TurboQuant (vLLM) | 4.9–7.1 | 14.43 |
| SmoothAttention | 4.50 | 14.53 |
| Whole-head Hadamard | 4.50 | 11.05 |
| Calibrated base | 4.50 | 7.02 |
| Fixed mode | 4.50 | 10.15 |
| FlagRot | 4.50 | 7.88 |
| FlagRot-L | 4.62 | 4.81 |
| FlagRot-C | 4.50 | 6.30 |
| NVFP4 | ||
| RTN | 4.50 | 19.96 |
| Four Over Six | 4.50 | 16.53 |
| Four Over Six + FlagRot | 4.50 | 9.04 |
| FlagRot | 4.50 | 10.72 |
| FlagRot-L | 4.71 | 6.49 |
Table 30: Recent KV quantizers without BF16 tokens: geometric-mean KL×10³ over 12 models; bits: per cached element. Per model: Table 26.
Key centering on Qwen2.5-7B. On Qwen2.5-7B, the key-projection biases of the first and last layers add a constant offset of several hundred to a few low-frequency channels, which then sets the scale of every group that contains them; the uncentered per-token 4-bit caches reach a KL of thousands (4697 × 10⁻³ for RTN). Static key centering subtracts the calibrated per-channel mean of the post-RoPE keys from every cached key, including the BF16 ones. This changes all logits of a query by the same amount, so it leaves the unquantized softmax weights unchanged and needs no per-token metadata. With centering, FlagRot lowers the KL of RTN by 43–76% without protected tokens and by 30–43% at S4W128 across the three formats. We apply centering only to Qwen2.5-7B, whose biases cause the offset; on the other models its effect varies in sign.
Protected tokens. Table 31 combines selection with BF16 sink and recent tokens, and Table 27 gives the per-model values. For FlagRot, the geometric-mean KL falls from 7.88 without protection to 2.08 with a 128-token window and to 1.48 with four sinks added; 16 sinks lower it by a further 1%. At S4W128, the geometric-mean KL of FlagRot over the 12 models is 47% lower than that of RTN and 21% lower than that of the fixed
| BF16 sinks S | 0 | 0 | 4 | 16 |
|---|---|---|---|---|
| BF16 window W | 0 | 128 | 128 | 128 |
| RTN | 16.72 | 4.09 | 2.78 | 2.70 |
| Fixed mode | 10.15 | 2.56 | 1.88 | 1.87 |
| FlagRot | 7.88 | 2.08 | 1.48 | 1.46 |
| FlagRot-C | 6.30 | 2.23 | 1.45 | 1.42 |
| FlagRot-L | 4.81 | 1.46 | 1.16 | 1.14 |
| FP8 cache, per tensor | 3.71 |
Table 31: INT4 caches with S sink and W recent tokens in BF16: geometric-mean KL×10³ over 12 models (all but Qwen2.5-7B); per model in Table 27.
mode under the same protection, and it is below that of an unprotected FP8 cache with one scale per tensor (1.48 against 3.71). The task and serving comparisons below use S4W128.
C.3 Task Accuracy
| Cache | Qwen3-8B | Llama-3.1-8B-It | Qwen3.8-27B |
|---|---|---|---|
| BF16 | 49.15 | 49.62 | 54.27 |
| FP8 | -0.1 | -0.7 | +0.1 |
| [-0.6, +0.3] | [-1.3, -0.2] | [-0.1, +0.3] | |
| vLLM INT4 | -1.0 | -1.1 | +0.3 |
| [-1.6, -0.5] | [-1.7, -0.4] | [-0.1, +0.6] | |
| RTN* | +0.2 | -0.6 | 0.0 |
| [-0.1, +0.6] | [-1.0, -0.1] | [-0.2, +0.2] | |
| Fixed mode* | 0.0 | -0.1 | +0.1 |
| [-0.3, +0.4] | [-0.5, +0.2] | [-0.2, +0.3] | |
| FlagRot* | 0.0 | -0.1 | -0.2 |
| [-0.3, +0.3] | [-0.5, +0.2] | [-0.4, +0.1] | |
| FlagRot-C* | -0.1 | -0.3 | -0.1 |
| [-0.4, +0.2] | [-0.7, +0.0] | [-0.3, +0.2] | |
| FlagRot | +0.1 | -0.6 | +0.1 |
| [-0.4, +0.6] | [-1.1, -0.1] | [-0.2, +0.4] | |
| vs RTN* | -0.3 | +0.5 | -0.2 |
| [-0.6, +0.1] | [+0.0, +1.0] | [-0.4, +0.0] |
Table 32: LongBench v1 (16 English tasks), INT4 caches on H200: BF16 score and paired differences in points (95% CI, items resampled within tasks). Bold / gray: CI above / below zero. S4W128; vs RTN: FlagRot* minus RTN*.
The task study holds the served model and the items fixed and changes only the KV cache. We serve Qwen3-8B, Llama-3.1-8B-Instruct and Qwen3.8-27B in vLLM (Kwon et al., 2023) with BF16 weights on one GPU per server, with BF16, FP8 and vLLM's INT4 cache and with RTN, the fixed mode, FlagRot and FlagRot-C at S4W128 (marked *). The tasks cover long-context retrieval and understanding (RULER at 32k tokens (Hsieh et al., 2024), 13 subtasks with 100 items each; LongBench v1 (Bai et al., 2024), all 21 tasks with
contexts truncated in the middle to 31.5k tokens; LongBench v2 (Bai et al., 2025), all 503 items truncated to 32k tokens), reasoning with long generations (AIME 2024/2025 with 8 samples per problem, GPQA-Diamond (Rein et al., 2024) and MATH-500 (Lightman et al., 2024) with 3, using the models' recommended sampling), short tasks (GSM8K (Cobbe et al., 2021), MMLU-Pro (Wang et al., 2024)), tool use (BFCL (Patil et al., 2025), all 4441 items; -bench (Barres et al., 2026), airline, retail and telecom with 4 trials per task and a BF16 Qwen3-8B user simulator) and coding (a fixed 100-instance subset of SWE-bench Verified (Jimenez et al., 2024) with mini-SWE-agent). Each task uses identical items, prompts and sampling for all caches; tasks without a sampling setting above decode greedily, and unparseable answers count as wrong. Samples of an item are averaged before pairing, and intervals are percentile bootstrap over items (2000 resamples). Within a task, every cache and its BF16 reference run on the same GPU type; LongBench v1 runs on H200.
Table 28 reports 36 model-task pairs: 34 paired 95% intervals of FlagRot include zero and 2 lie above it. On the 16 English tasks of LongBench v1, the differences of FlagRot from BF16 are -0.01, -0.12 and -0.16 points on Qwen3-8B, Llama-3.1-8B-Instruct and Qwen3.8-27B, and its direct differences from RTN* are -0.25 [-0.62, +0.13], +0.49 [+0.01, +0.96] and -0.18 [-0.40, +0.04] points (Table 32). Table 7 extends the agentic evaluation of Qwen3.8-27B to 16 -bench trials per task over all three domains and to all 500 SWE-bench Verified instances, with a second BF16 run as a reference for run-to-run spread.
C.4 Kernels and Serving
The 4-bit cache is a KV-cache data type of vLLM: our cache writer, paged decode-attention kernels and a prefill kernel run inside vLLM's model runner and are captured in CUDA graphs. Each INT4 group stores its zero point in the four low mantissa bits of its FP16 scale and its flag in the sign bit, so the page layout is that of symmetric INT4. For keys, each query head is transformed once per step into every candidate basis, the products of all variants are computed on the tensor cores, and each token selects its products by its stored flags. Prefill chunks with at most 2048 new tokens (4096 for ) attend directly over the INT4 pages of a cached prefix, converting each page tile in shared memory and applying the per-token in-verse transforms there; longer chunks dequantize the prefix to BF16. Every token is encoded into the pages when it is written, so a full page is a valid prefix-cache block; the BF16 copies of the W most recent tokens live in a per-request ring and those of the S sink tokens in a pool shared by requests with the same first tokens. The cache writers are bit-identical to the reference encoder, the decode kernels agree with float64 attention over the dequantized cache within max() relative to the largest output in 410 cases per format, where is the error of BF16 SDPA on the same inputs, and the KL of the served cache agrees with the simulated quantizer within 3% on 20 WikiText-2 windows for the 8B models.
Table 29 reports the generation throughput of Qwen3-8B serving -bench retail agents, multi-turn tool-use conversations that reuse long prefixes, at 64 to 256 concurrent agents with prefix caching. Against the faster FP8 backend, FlagRot* serves at the throughput on H200 and on H20, and the fixed mode at and ; with the BF16 sink and window tokens, FlagRot runs at (H200) and (H20) of its throughput without them, and it retains of the throughput of plain INT4 with our kernels. In the capacity-limited runs where the BF16 cache preempts requests, at 128 and 256 agents on H20 and 256 on H200, FlagRot generates and as many tokens per second as BF16. Each client process drives 8 agents, every server uses one GPU with 90% of its memory and a 512-sequence limit, and the user simulators run on separate GPUs. Each point is the mean of two runs on different GPUs or hosts, or the median of three where their half-range exceeded 10% of the mean; some H20 points at 256 agents are medians of 3-4 matched repeats. Throughput is generated tokens per second over a timed window after warm-up (vLLM 0.30.0, PyTorch 2.13 with CUDA 13.0, FlashInfer 0.6.18).
D Baselines and Reproductions
Every external baseline was run from official code or kernels where they exist and checked against a reference (Table 33); the comparisons of §5.1 and Appendix C rest on these implementations.
4-bit baselines. vLLM's INT4 cache and Turbo-Quant reproduce vLLM's kernels bit-exactly, including vLLM's randomized Hadamard and its rounding to BF16; Four Over Six is transcribed
| Baseline | Source | Check |
|---|---|---|
| vLLM INT4 | vLLM kernels | bit-exact |
| TurboQuant | vLLM kernels | bit-exact |
| Four Over Six | vLLM CUDA code | transcribed |
| KIVI | official code | bit-exact |
| SmoothAttention | QServe code | same calibration |
| QuaRot, SpinQuant | official code | PPL within 1.1% |
| RotateKV | official code | PPL 5.509/5.511 |
| WUSH-KV | paper | published PPL |
Table 33: How each external baseline was obtained and checked.
from vLLM's CUDA code. KIVI uses its official quantization functions, which our implementation matches bit-exactly on captured keys and values, together with its residual policy (keys are quantized once 128 have accumulated); a group whose values are all equal, which occurs on Qwen2.5-7B and divides by zero in the official code, is kept exact. SmoothAttention follows QServe's calibration with key maxima after RoPE and . For QuaRot and SpinQuant, we ran the official code with 4-bit keys and values and BF16 weights and activations on Llama-3.1-8B and Qwen3-8B (Qwen3 ported to both code bases), including SpinQuant's rotation learning; with the same quantizer and transforms our framework agrees with the official perplexities within 1.1% in all 14 configurations, and within 0.21% in 11 of them. WUSH-KV is implemented from its paper, with the QuEST constant set to the value that minimizes the mean squared error on a standard Gaussian, as its definition prescribes; Table 34 compares our evaluation with its published perplexities.
| 4-bit KV cache | WUSH-KV paper | Our evaluation |
|---|---|---|
| No transform | 11.36 | 11.34 |
| Hadamard | 9.77 | 9.77 |
| WUSH | 9.73 | 9.74 |
Table 34: WikiText-2 perplexity of the WUSH-KV evaluation on Qwen3-8B (QuEST, one scale per token and head, 16 sink and 128 recent tokens, FineWeb-Edu calibration); BF16: 9.72 in the paper, 9.73 here.
RotateKV at 2 bits. With its official settings (grouped-head Hadamard before RoPE, channel reordering, , clip ratio 0.8, 20 sink tokens), our RotateKV simulation gives a WikiText-2 perplexity of 5.509 for Llama-2-7B at 2 bits and 4096 tokens, against 5.511 from the official code. In the protocol-matched runs we keep the reordering, calibrate it on our four training windows and replace its sink tokens with S4W128.
E Mechanism
Whether a Hadamard rotation lowers the error of a 4-bit key depends on the vector, the model and the format, and a few stored bits per token capture most of what a per-token selection can gain. This appendix supports the analysis of §2 and the design of Appendix C.1.
E.1 When Rotation Helps
A Hadamard transform spreads a spike over all coordinates, but it can also concentrate the energy of a flat vector. On INT4 caches of Llama-3.1-8B and Qwen3-8B, H₃₂ raises the query-weighted error of 65–72% of the flattest tenth of the key sub-vectors and of 14–19% of the spikiest tenth; on NVFP4, with H₁₆ per scale group, the share is 38–60% across the deciles of the crest factor (Figure 1b), so the crest factor alone does not predict the outcome.
Models. Rotating whole heads, which helps Llama-3.1-8B on the three 4-bit formats, raises the KL of MXFP4 and NVFP4 caches on Qwen3-8B by 41% and 215% (Table 25). The harm lies in the keys and in the E2M1 grid rather than in the E4M3 scales (Table 35): with exact FP32 scales the increase on Qwen3-8B persists (+264%), whereas a uniform 4-bit grid of the same range turns it into a reduction (−27%). Rotation flattens the key groups, which E2M1 represents worse than spiky ones: its error relative to the uniform grid is 0.59–0.99 before rotation and 1.21–2.55 after it. Across the 15 models, the change of the attention-weighted logit error agrees in sign with the KL change in 14 cases (Spearman ρ = 0.94), whereas simple key statistics do not separate the models on which whole-head rotation helps from those on which it hurts (Table 36).
Tokens. The best transform also differs between the sub-vectors of one key and from token to token (Figure 1c): with a per-token selection among I and H₃₂ per sub-vector and H₁₂₈ per head, 40–43% of the key sub-vectors of INT4 caches take the whole-head transform, 37–39% take H₃₂ and 18–23% stay untransformed. For a given (layer, head, sub-vector), the decision of FlagRot-L agrees with its majority for 0.71–0.82 of the tokens on average (Figure 5a). A transform fixed per head or sub-vector cannot follow this variation: on validation windows, a static selection among these candidates,
| Quantized Group scale | K+V | K | V | K | K | K |
|---|---|---|---|---|---|---|
| Grid | E4M3 | E4M3 | E4M3 | FP32 | E4M3 | FP32 |
| E2M1 | E2M1 | E2M1 | E2M1 | unif. | unif. | |
| With QK-norm | ||||||
| Qwen3-8B | +210 | +228 | -3 | +264 | -32 | -27 |
| Qwen3-14B | +31 | +34 | +4 | +46 | -48 | -44 |
| Gemma-3-27B | +82 | +93 | +1 | +97 | -1 | -3 |
| Without QK-norm | ||||||
| Llama-3.1-8B | -30 | -35 | +8 | -28 | -44 | -39 |
| Mistral-7B-v0.3 | -36 | -39 | +2 | -34 | -43 | -41 |
| Phi-4 | -30 | -33 | 0 | -30 | -51 | -50 |
Table 35: Source of the NVFP4 sign flip: relative KL change (%) of whole-head Hadamard rotation without BF16 tokens; the unquantized cache stays in BF16 (groups of 16; unif.: uniform 15-level grid). Bold / gray: significantly below / above zero (95% CI).
| Model | QK-norm | ch. ratio | crest | kurt. | Head rot. (%) | |
|---|---|---|---|---|---|---|
| MXFP4 | NVFP4 | |||||
| Llama-3.1-8B | no | 7.1 | 4.91 | 8.5 | -71 | -30 |
| Qwen3-8B | yes | 8.2 | 4.98 | 9.9 | +41 | +215 |
| Mistral-7B-v0.3 | no | 7.1 | 4.72 | 7.8 | -62 | -35 |
| Qwen3-14B | yes | 7.6 | 4.81 | 9.0 | -56 | +32 |
| Qwen3-32B | yes | 6.5 | 4.62 | 8.0 | -52 | +26 |
| Qwen3-30B-A3B | yes | 11.0 | 6.28 | 17.0 | -19 | +57 |
| Llama-2-7B | no | 9.9 | 6.21 | 15.8 | -80 | -44 |
| Llama-3.2-3B | no | 7.6 | 5.24 | 9.2 | -61 | -26 |
| Qwen2.5-7B | no | 8.9 | 5.28 | 10.4 | +4 | +32 |
| Gemma-2-9B | no | 9.1 | 6.27 | 11.6 | -70 | -38 |
| Phi-4 | no | 10.2 | 6.34 | 15.9 | -53 | -30 |
| Mistral-NeMo-12B | no | 8.6 | 5.86 | 12.6 | -69 | -26 |
| GLM-4-9B | no | 10.0 | 5.72 | 15.7 | -84 | -8 |
Table 36: Post-RoPE key statistics on two validation windows (median over layers and KV heads) and the relative KL change of whole-head rotation. ch. ratio: largest/median channel RMS; crest: max/RMS of a key vector; kurt.: its kurtosis over channels.
made layer by layer with the true KL divergence, lowers the KL of INT4 caches by 43%, and a per-token selection among the same candidates by 59% (Table 38).
E.2 Why a Few Stored Bits Suffice
Keeping the best of quantizations of a key costs bits, and most of the gain comes from the first candidates. Across sign-flipped whole-head Hadamard transforms on one validation window of Llama-3.1-8B, the smaller of two query-weighted errors of a key is on average 0.64 of a single one, and the smallest of 64 is 0.30.
Selection criterion. On test windows of the development models, per-token selection of the default candidates by plain reconstruction error lowers the KL of INT4 caches by 41%, as much as a static selection (41%); weighted by , the

(a) Agreement with majority
(b) Keys vs. values
(c) Head-level selection
Figure 5: (a) Agreement of the per-token decision whether a sub-vector takes a block transform with its majority decision (mean over layers, heads and sub-vectors; FlagRot-L, INT4, test windows; 0.5: even split). (b) Per-token transforms on values, keys or both (relative KL change w.r.t. no rotation; FlagRot-L, validation windows of the development models). (c) Share of tokens per head-level selection for keys.
same selection lowers it by 56%, and by 46% at S4W128, where the plain-error selection gains 35% (Table 37). On NVFP4, query weighting raises the reduction from 23% to 46% without protected tokens and from 27% to 46% at S4W128.
| Selection | INT4 | NVFP4 | ||
|---|---|---|---|---|
| W0 | S4W128 | W0 | S4W128 | |
| RTN (KL) | 19.8 | 2.40 | 22.8 | 3.29 |
| Static | ||||
| K only | -41 | -37 | -23 | -37 |
| K and V (fixed mode) | -42 | -39 | -23 | -37 |
| Per token, K only | ||||
| by MSE | -41 | -35 | -23 | -27 |
| by (FlagRot) | -56 | -46 | -46 | -46 |
Table 37: Transform selection rules on the test windows of the four development models: RTN geometric-mean KL×10³ and mean KL change (%) from RTN, with the same candidates in every row. Bold: significantly below RTN on each of the four models (95% CI).
Keys, not values. In the eight-candidate validation ablation, selecting on keys alone recovers 93–94% of the KL reduction of selecting on keys and values, and selecting on values alone lowers KL by 4–5% (Figure 5b). A key error shifts that token's logit for every later query before the softmax, whereas a value error enters the output scaled by the token's attention weight. On INT4, keys-only selection lowers KL by 56% with 0.02 stored flag bits per element (Table 38).
Design space. Table 38 covers uniform rotations, static selections per sub-vector or head and per-token selections with different candidates and criteria. Larger candidate sets add to the gain of FlagRot
with diminishing returns (FlagRot-L: 73% at 0.12 bits per element), and each head-level candidate of FlagRot-L is selected for some tokens, the whole-head transforms for a minority (Figure 5c).
| Decision | bits | INT4 | MXFP4 | NVFP4 |
|---|---|---|---|---|
| Uniform | ||||
| Every block | 0.000 | -37.0 | -51.5 | +4.9 |
| Whole head | 0.000 | -35.1 | -39.1 | +42.4 |
| Static (one selection per vector or head) | ||||
| Block bits | 0.000 | -37.4 | -54.5 | -8.6 |
| Block bits | whole head | 0.000 | -42.2 | -59.2 | -23.0 |
| Same, by true KL per layer | 0.000 | -42.9 | -60.6 | -23.5 |
| Dynamic (chosen per token at cache write) | ||||
| Block bits, MSE | 0.031 | -40.8 | -58.9 | -22.4 |
| Block bits, | 0.031 | -51.4 | -68.3 | -38.9 |
| Block bits | whole head, | 0.039 | -58.9 | -74.0 | -47.7 |
| Same, attention-weighted | 0.039 | -59.6 | -75.2 | -49.1 |
| Same, , keys only (FlagRot) | 0.020 | -55.9 | -69.5 | -46.0 |
| Codebook 3×4, | 0.078 | -68.0 | -80.3 | -60.3 |
| Same, attention-weighted | 0.078 | -68.3 | -80.9 | -60.7 |
| Codebook 8×8, (FlagRot-L) | 0.117 | -72.7 | -83.9 | -66.2 |
Table 38: Design space of the rotation decision (four development models, 40 WikiText-2 validation windows): mean KL change (%) from no rotation. bits: extra bits per element to store the selection (, ).