StructKV: Preserving the Structural Skeleton for Scalable Long-Context Inference
Authors: Zhirui Chen, Peiyang Liu, Ling Shao
Organizations: UCAS-Terminus AI Lab, University of Chinese Academy of Sciences, China · National Engineering Research Center for Software Engineering, Peking University
As Large Language Models (LLMs) scale to support context windows exceeding one million tokens, the linear growth of Key-Value (KV) cache imposes severe memory capacity and bandwidth bottlenecks, constraining the efficiency of long-context inference. Existing compression approaches typically prioritize tokens based on local saliency metrics to decouple prefill computation from decoding memory. However, these methods often rely on local saliency snapshots at a specific layer, thereby systematically discarding tokens that act as global information hubs across the network depth but appear temporarily dormant at the specific layer selected for pruning. To address this limitation, we propose StructKV, a structure-aware KV cache compression framework that introduces three core innovations: First, Global In-Degree Centrality aggregates attention patterns across the network depth to identify global information hubs. Second, Dynamic Pivot Detection utilizes information-theoretic metrics to adaptively locate the optimal layer for compression. Finally, Structural Propagation and Decoupling separates the computational budget from the memory storage budget. Experimental results on the LongBench and RULER benchmarks demonstrate that StructKV effectively preserves long-range dependencies and retrieval robustness.
Figures & tables
Figure 1: Comparison of StructKV with state-of-the-art methods. (a) Accuracy retention under varying KV cache budgets. StructKV (red line) demonstrates superior robustness, maintaining near-lossless performance even at extreme compression rates, whereas baselines suffer significant degradation. (b) A holistic comparison showing that StructKV effectively resolves the trilemma of prefill speed, decoding latency, and long-context accuracy.
Figure 2: The Three-Phase Workflow of StructKV. Phase 1: The model processes full context while accumulating global centrality scores ( Cglobal ). Phase 2: The Auto-Detector triggers a structural phase transition. The context is filtered using Cglobal , decoupling the propagation budget ( Rstruct ) from the storage budget ( RKV ). Phase 3: Deep layers operate on the reduced "structural skeleton" for maximum speed.
Single-Doc QA
Multi-Doc QA
Summarization
Few-shot
Synthetic
Code
Method
Prefill
KV
NrtvQA
Qasper
MF-en
HotpotQA
2Wiki
Musique
GovRep
QMSum
MNews
TREC
Trivia
SAMSum
PCount
PRe
Lcc
RB-P
Avg.
Full-context
Full-context
100%
100%
30.21
45.53
55.01
56.01
46.65
31.28
35.13
25.28
27.25
73.00
91.64
43.80
8.91
99.50
63.38
56.64
49.33
Decoding-Only
StreamingLLM
100%
10%
26.05
26.29
33.68
48.07
37.93
25.03
25.37
21.49
19.97
58.50
88.46
42.61
7.91
88.00
61.07
54.94
41.59
100%
20%
27.99
28.89
34.42
51.21
41.03
24.43
28.34
22.08
22.16
64.00
89.96
42.27
8.66
85.00
62.02
56.85
43.08
Table 1: LongBench results on LLaMA-3.1-8B-Instruct.
Figure 3: Adaptability of Pivot Selection on Qwen-2.5 Series, Llama-3.1-8B-Instruct and Ministral-8B-Instruct.
Figure 4: Visualization of Dynamic Pivot Detection on Qwen-2.5-32B-Instruct.
Figure 5: Layer-wise Hidden State Fidelity.
Method
Prefill
KV
8K
16K
32K
64K
128K
Avg.
Reference
Full-context
100%
100%
90.1
95.0
83.4
85.5
76.3
86.0
Decoding-Only
StreamingLLM
100%
10%
15.0
21.5
24.4
16.9
15.0
18.6
H2O
100%
10%
27.1
-
-
-
-
-
SnapKV
100%
10%
75.6
76.8
72.9
75.0
67.7
73.6
Table 2: RULER Benchmark Results on LLaMA-3.1-8B-Instruct.
Figure 6: Decoupling Analysis: Computation vs. Memory Budget.
Decay ( λ )
LongBench Avg.
Δ
Interpretation
0.50
47.41
-1.20
Too aggressive decay
0.80
48.35
-0.26
Robust Zone
0.90 (Ours)
48.61
Ref
Optimal trade-off
0.95
48.42
-0.19
Robust Zone
1.00
48.03
-0.58
No decay (flat history)
Table 3: Sensitivity analysis of the decay factor λ on LongBench (LLaMA-3.1-8B, 10% KV budget).