RoLaQ: Joint Rotation and Range Calibration for 2-Bit KV Caches in Multi-Head Latent Attention
Authors: Shiyu Ji, Peng Ling, Chen Lin, Shupeng Li, Yixuan Wang, Qingfu Zhu, Wanxiang Che
Organizations: Research Center for Social Computing and Interactive Robotics, Harbin Institute of Technology, China · Tsinghua University, China · Baidu Inc., China
Multi-head latent attention (MLA) compresses the content of a key-value cache into a shared latent per token, making low-bit storage attractive for long-context inference. At two bits, errors in this representation perturb both attention matching and value readout, with effects that depend on error direction and reconstruction scale. We introduce RoLaQ (Rotation-calibrated Latent Quantization), an offline method for joint rotation and range calibration. RoLaQ refines a shared rotation within subspaces defined by the frozen key and value projections, and jointly learns quantization ranges whose thresholds and reconstruction gains are coupled to control the shared signal's response. Prediction matching and attention-output supervision guide calibration with model weights frozen. Across three MLA models and six benchmarks, RoLaQ achieves the highest average accuracy among the compared 2-bit methods both without and with token protection. On DeepSeek-V2-Lite, an SGLang implementation provides 3.96 times the BF16 KV capacity under the same memory budget and 2.51 times its decode throughput with 256K input tokens.
Figures & tables
Figure 1: (a) MLA shares a content cache between keys and values. (b,c) On one A100 80GB, RoLaQ gives DeepSeek-V2-Lite 3.96× the BF16 capacity at equal memory budgets and 2.51× its decode throughput with four concurrent requests and 256K inputs.
Figure 2: Two observations on shared-latent quantization. (a) K/V energy in the leading half of the joint spectrum (mean ± layer std.; dashed: 50%). (b) Prediction KL at 8K with OSCAR’s rotation and threshold fixed, normalized by its value at g0=1.16 (vertical dashed line). DS, ML, and CPM denote DeepSeek-V2-Lite, Moonlight, and MiniCPM3.
Figure 3: Overview of RoLaQ . (a) A shared 2-bit content cache supplies both K/V paths. The dashed box groups the read-side rotation with the projections that absorb it. (b) HK+HV defines two spectral subspaces for learning the shared rotation. (c) The learned threshold determines the four-level assignments and gain g(T)=1/C(T) . (d) A frozen BF16 teacher guides joint calibration through prediction KL and attention-output loss.
Method
Knowledge & QA
Math
Code
Avg.
MMLU
CMMLU
TriviaQA
GSM8K
HumanEval
MBPP
DeepSeek-V2-Lite
BF16
58.0
64.1
65.2
37.4
28.0
43.4
49.4
RTN
40.5 / 44.9
45.8 / 51.8
41.5 / 59.6
7.0 / 15.1
12.2 / 18.9
17.6 / 28.0
27.4 / 36.4
QuaRot
53.2 / 53.8
58.6 / 60.6
60.4 / 63.4
25.5 / 30.5
25.6 / 25.0
33.8 / 38.6
42.9 / 45.3
KVarN
49.9 / 53.7
56.0 / 59.1
57.8 / 63.4
23.6 / 27.9
20.1 / 26.2
32.6 / 37.0
40.0 / 44.6
Table 1: Downstream accuracy (%) with 2-bit content caches. Each pair reports w.o. / w. token protection (without / with 4 sink and 16 recent tokens retained in BF16). BF16 is a shared reference; bold marks the best 2-bit scores at the displayed precision within each setting.
Method
S1
S2
S3
MK1
MK2
MK3
MV
MQ
Avg.
DeepSeek-V2-Lite
BF16
100.0
100.0
96.0
94.0
88.0
47.0
63.5
89.0
84.7
RTN
86.0
55.0
21.0
23.0
0.0
0.0
33.0
25.2
30.4
QuaRot
100.0
98.0
80.0
54.0
35.0
5.0
64.2
72.0
63.5
KVarN
100.0
97.0
77.0
75.0
58.0
7.0
50.5
74.5
67.4
OSCAR
100.0
89.0
70.0
52.0
7.0
1.0
55.8
62.5
54.7
Table 2: Retrieval accuracy (%) on the eight RULER retrieval tasks with 4 sink and 16 recent tokens retained in BF16. Avg. denotes the task mean; bold marks the best 2-bit scores at the displayed precision.
DeepSeek
Moonlight
(a) Calibration components
Configuration
MMLU
MBPP
MMLU
MBPP
Initialization
52.0
39.4
67.0
48.4
Rotation only
54.5
41.6
67.2
48.8
Range only
52.3
40.0
67.4
48.4
Rotation + Range
55.9
44.0
67.9
49.2
Table 3: Ablations of calibration components and objectives. (a) MMLU and MBPP accuracy (%) for different component configurations. (b) Six-task average accuracy (%) for different calibration objectives.
DeepSeek
Moonlight
Rotation
Params.
S↓
Avg. ↑
S↓
Avg. ↑
Full (Exp.)
d2
0.664
47.5
0.559
62.0
Full (Cayley)
d2
0.661
47.5
0.592
62.3
Random subspaces
d2/2
0.628
47.4
0.550
61.9
HK−HV
d2/2
0.624
47.1
0.579
62.2
HK+HV
d2/2
0.622
47.7
0.508
62.3
Table 4: Rotation search spaces. Params. counts trainable rotation parameters per layer; S is validation KL relative to OSCAR. Avg. is six-task mean accuracy (%).
Figure 4: Effect of quantizer response on DeepSeek-V2-Lite. Prediction KL to BF16 is normalized by its value at κ=1 for each context length. Using a checkpoint calibrated with full rotation and unit response, we vary the gain at inference while keeping the rotation and thresholds fixed.
Figure 5: Effect of token protection on six-task mean accuracy (%). The horizontal axis gives the number of sink + recent content tokens retained in BF16.
Figure 6: Serving performance of DeepSeek-V2-Lite on an A100 80GB GPU. (a) KV token capacity. (b,c) Decode throughput for long inputs and successive output intervals, with four concurrent requests. (d) P99 time to first token (TTFT) under increasing concurrency. OSCAR and RoLaQ share the INT2 kernels, so their overlapping curves use timings measured with RoLaQ under the same workloads.
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
Model
Type
Layers
d
dr
DeepSeek-V2-Lite
MoE
27
512
64
Moonlight-16B-A3B
MoE
27
512
64
MiniCPM3-4B
Dense
62
256
32
Appendix
Table 5: Model configurations; d and dr are the content-latent and RoPE-key dimensions.
Benchmark
Shots
Metric
MMLU
5
Accuracy
CMMLU
5
Accuracy
TriviaQA
5
Exact match
GSM8K
5
Exact match
HumanEval
0
pass@1
MBPP
3
pass@1
Appendix
Table 6: Downstream evaluation settings.
Setting
Value
Calibration data
Pile, 1,430,800 tokens
Sequence length
512–4,096 tokens
Optimizer / updates
Adam / 427
Rotation learning rate
10−3
Threshold learning rate
5×10−3
Learning-rate schedule
Cosine
Appendix
Table 7: Calibration hyperparameters.
Figure 7: Cumulative K/V projection energy in the common joint eigenbasis. Solid and dashed curves denote keys and values, respectively; shading shows one standard deviation across layers. The diagonal gives the isotropic reference. The vertical line marks the equal-dimensional split used in Figure 2 a.
Method
Knowledge & QA
Math
Code
Avg.
MMLU
CMMLU
TriviaQA
GSM8K
HumanEval
MBPP
DeepSeek-V2-Lite
BF16
58.0
64.1
65.2
37.4
28.0
43.4
49.4
RTN
43.0
49.6
55.0
13.3
18.9
26.0
34.3
QuaRot
53.1
60.1
62.4
30.3
27.4
36.2
44.9
KVarN
52.8
59.0
62.6
29.5
24.4
39.8
44.7
Appendix
Table 8: Accuracy (%) with 4 sink and 8 recent BF16 tokens.
Model
Seed
MMLU
CMMLU
TriviaQA
GSM8K
HumanEval
MBPP
Avg.
DS
42
55.1
61.5
63.8
31.6
26.8
42.4
46.9
DS
43
55.3
61.5
64.1
32.5
26.2
42.2
47.0
DS
44
54.8
61.6
64.3
32.3
23.2
40.8
46.2
std
0.21
0.04
0.24
0.47
1.96
0.87
0.44
ML
42
67.1
74.8
63.0
65.7
38.4
47.2
59.4
ML
43
67.6
74.8
63.0
67.0
42.7
48.8
60.7
Appendix
Table 9: Per-seed accuracy (%) without protection. Avg. averages six tasks; std denotes sample standard deviation.
Model
Seed
MMLU
CMMLU
TriviaQA
GSM8K
HumanEval
MBPP
Avg.
DS
42
55.6
62.5
64.4
34.1
29.9
43.2
48.3
DS
43
55.4
61.8
64.2
33.8
26.8
41.4
47.2
DS
44
55.7
62.1
64.5
33.5
25.6
41.8
47.2
std
0.15
0.34
0.16
0.30
2.20
0.95
0.61
ML
42
67.3
75.9
64.7
71.3
47.0
47.4
62.3
ML
43
67.7
75.6
64.0
68.8
42.7
51.0
61.6
Appendix
Table 10: Per-seed accuracy (%) with 4 sink and 8 recent BF16 tokens.
Model
Seed
MMLU
CMMLU
TriviaQA
GSM8K
HumanEval
MBPP
Avg.
DS
42
55.9
62.5
64.8
34.6
26.8
44.0
48.1
DS
43
55.5
61.6
64.8
34.3
29.3
42.8
48.0
DS
44
55.9
62.1
65.0
33.6
25.0
40.6
47.0
std
0.25
0.45
0.14
0.54
2.14
1.72
0.60
ML
42
67.9
76.2
65.7
70.4
46.3
49.2
62.6
ML
43
67.8
76.1
65.2
70.1
44.5
51.6
62.5
Appendix
Table 11: Per-seed accuracy (%) with 4 sink and 16 recent BF16 tokens.
Range
Validation KL S↓
Free gain
0.606 ± 0.031
κ=1
0.527 ± 0.008
Appendix
Table 12: Range calibration with HK+HV on MiniCPM3. S is validation KL relative to OSCAR (lower is better); values are mean ± sample standard deviation over three seeds.
Figure 8: Learned per-layer thresholds with κ=1 for all rotations and seeds. The dashed line is the Lloyd–Max threshold used by OSCAR.
(a) Counting both bags
Question
Mitchell is making nachos for his family. He buys two bags of chips with 55 chips each. If his family has five members, how many chips does each person get if they all get the same number?
Answer
22
BF16
22
QuaRot
Each person gets 55 / 5 = <<55/5=11>>11 chips. #### 11
OSCAR
There are 55 chips in each bag. If there are five people, each person gets 55 / 5 = <<55/5=11>>11 chips. #### 11
RoLaQ
Mitchell buys 2 * 55 = <<2*55=110>>110 chips. There are 5 members in his family, so each person gets 110 / 5 = <<110/5=22>>22 chips. #### 22
Appendix
Table 13: GSM8K examples on DeepSeek-V2-Lite. (a) Both bags must be counted. (b) The available line must be subtracted. We show BF16 final answers and the quantized models’ solutions. All quantized methods retain 4 sink and 16 recent tokens in BF16; RoLaQ uses calibration seed 42.
Method
KV tokens
GiB
Ratio
BF16
1,151,705
33.36
1.00×
OSCAR
4,564,012
33.33
3.96×
RoLaQ
4,564,012
33.33
3.96×
Appendix
Table 15: Allocated KV capacity in Figure 6 (a). GiB measures KV memory; ratios use BF16 as the reference.
Long input
Input length
BF16
RoLaQ
Speedup
1K
366.1
323.6
0.88×
2K
350.9
310.1
0.88×
4K
318.4
308.5
0.97×
8K
271.6
275.4
1.01×
16K
210.5
250.2
1.19×
Appendix
Table 16: Decode throughput (tok/s) underlying Figure 6 (b,c). Both workloads use four concurrent requests. Speedups relative to BF16 are computed from unrounded measurements.
Concurrent requests
BF16
RoLaQ
1
1.40
1.44
2
2.83
2.86
4
5.60
5.73
8
11.19
11.46
16
22.28
22.97
32
44.60
46.16
Appendix
Table 17: P99 TTFT (s) underlying Figure 6 (d). Each request has 16K input and 1K output tokens.
Multi-Head Latent Attention (MLA) enables expressive multi-head attention with compact caches for its content and decoupled RoPE paths, yet cache memory still scales linearly with context length and batch size. In this work, we establish a systematic model of MLA's dual-path quantization errors, characterizing their distinct effects on attention-output distortion and explaining the pronounced amplification of RoPE-path errors. Guided by this analysis, we introduce QuantMLA, a function-aligned framework for low-bit dual-path quantization. We derive path-specific transformation spaces that preserve full-precision computation while remaining fully fusible into model parameters offline, eliminating online transformation overhead. Within these spaces, QuantMLA learns path-specific transformations with function-aligned objectives: attention-output reconstruction captures the content path's coupled matching and aggregation errors, while positional QK reconstruction preserves the RoPE-induced component of the attention logits and admits a theoretical bound on output distortion. Across four MLA model families, QuantMLA enables, to our knowledge, the first reported joint INT4 caching of the content and RoPE caches with minimal accuracy degradation. Further compressing the content cache to INT2 while retaining the RoPE key cache at INT4 maintains competitive performance on challenging reasoning and code benchmarks. We develop a native low-bit MLA attention kernel that integrates unpacking and dequantization directly into attention computation. The physical cache layout provides 3.59x compression at 128K context, while a cache-pressure serving workload achieves 5.168x higher whole-job output throughput than BF16. The code will be released upon acceptance.
Zunhai Su, Yuxuan Sun, Jianchao Tan +5
The University of Hong Kong · Meituan LongCat Team · South China University of Technology +1
Existing low-bit KV-cache quantizers often treat each cached key as a flat vector. Under RoPE, however, a key's contribution to a future attention logit decomposes into a position-dependent sum over two-dimensional frequency blocks. This makes key-cache quantization a block-wise bit-allocation problem: high-energy RoPE blocks are more sensitive to quantization error and should receive more bits. We introduce Block-GTQ, a RoPE-aware bit allocator for key-cache quantization built on TurboQuant-MSE(TQ-MSE). For each layer and KV head, Block-GTQ computes a label-free energy score for each RoPE block and greedily allocates integer bit widths by marginal gain. Under matched K/V bit budgets, Block-GTQ better preserves RoPE query-key logits on a ten-model diagnostic panel, cutting per-layer MAE by 32-80% at 2 and 3 b/dim K-only quantization and winning all 367/367 layer comparisons against uniform TQ-MSE. These fidelity gains translate to stronger downstream long-context retrieval, understanding, and reasoning. At K2V2 on Llama-3.1-8B-Instruct, Block-GTQ raises the six-task NIAH average from 70.6 to 97.4, and the LongBench-EN average from 36.87 to 53.31. On AIME 2024/2025 with DeepSeek-R1-Distill-Qwen-7B, without an fp16 recent-key buffer, Block-GTQ at K3V2 scores 51.7/37.5, close to fp16's 54.2/37.9, whereas uniform TQ-MSE collapses to 0.0/0.0. We further implement a packed-cache serving path. On a single H800 GPU with Qwen2.5-3B-Instruct, packed K3V3 achieves 3.24x KV-cache compression with fp16-comparable quality, runs 1.34x faster than fp16 FlashAttention2 at 128K context, reduces peak memory from 56.31 GB to 19.85 GB, and remains feasible at 256K and 512K where fp16 OOMs. Code is available at https://github.com/JIA-Lab-research/blockgtq.
Fengfeng Liang, Yuechen Zhang, Jiaya Jia
1Hong Kong University of Science and Technology · 2The Chinese University of Hong Kong · 3MiMo, Xiaomi Corporation
Multi-Head Latent Attention (MLA) compresses the KV cache into a latent representation, reducing inference memory and bandwidth. Existing MHA2MLA/TransMLA methods do not support QKNorm and require costly recovery on modern LLMs, especially MoE. We present MLAfication, a QKNorm-compatible, parameter-efficient extension of MHA2MLA. It combines calibrated KNorm, parameter-efficient distillation, contribution-aware Partial-RoPE, and activation-aware joint KV initialization. Across MHA and GQA models, including QKNorm- and MoE-equipped variants, MLAfication preserves performance under substantial KV-cache compression, surpasses the current SOTA on commonsense and long-context benchmarks, and extends MLA conversion to modern architectures. On Qwen3-30B-A3B, MLAfication delivers up to 5.35× the serving throughput of BF16 GQA and, combined with 4-bit KV quantization, reduces the KV-cache footprint by 94.73%. Our code is available at https://github.com/JT-Ushio/MLAfication.