RelaxKV: Recomputation Guided by the Query with Sparse Context Attention for Efficient KV Cache Reuse
Organizations: Shanghai Jiao Tong University · Institute of Artificial Intelligence, China Telecom (TeleAI) · State University of New York at Buffalo
Abstract
Cross-request KV caching reduces the prefill cost of Retrieval-Augmented Generation (RAG), but conventional prefix caching severely limits cache reuse across requests. Position-Independent Caching (PIC) removes this constraint by reusing independent chunks, but their KV states miss cross-chunk interactions. Existing methods selectively recompute token states to recover these missing interactions, but primarily allocate the recomputation budget to selecting which states to recompute, while fixing the recomputation context to the full causal prefix. We introduce RelaxKV, which formulates selective cache repair as a joint allocation problem over repair targets and recomputation context. Guided by the user query, RelaxKV identifies layer-specific repair targets and restricts their recomputation to a query-relevant context, reducing attention computation. Across four decoder models, RelaxKV at a 15% anchor ratio improves aggregate LongBench performance over ProphetKV on all models. On Qwen3-14B, RelaxKV provides a stronger quality-TTFT trade-off than ProphetKV across a 5%-30% anchor-ratio sweep, and achieves the best selective results on RULER-MV and LV-Eval at 16K and 32K context lengths. Controlled ablations further demonstrate the importance of recomputation context selection.
Figures & tables
| Qwen3-14B | ||||||||
|---|---|---|---|---|---|---|---|---|
| Method | WQA | TQA | HQA | NQA | MQue | PR-en | PR-zh | LB Avg |
| Full Recompute | 8.50 | 88.41 | 54.95 | 24.15 | 25.57 | 68.00 | 100.00 | 52.80 |
| Full Reuse | 7.22 | 66.60 | 28.01 | 12.45 | 5.47 | 24.00 | 72.14 | 30.84 |
| CacheBlend | 8.46 | 85.11 | 42.57 | 21.57 | 20.57 | 66.00 | 77.00 | 45.90 |
| EPIC | 8.52 | 87.23 | 47.63 | 23.31 | 21.11 | 53.00 | 88.00 | 46.97 |
| KVShare | 7.46 | 86.47 | 33.46 | 13.64 | 7.03 | 36.50 | 69.04 | 36.23 |
| Method | RULER-MV | LV-Eval | ||||
| 4K | 8K | 16K | 32K | 16K | 32K | |
| Full Recompute | 100.00 | 100.00 | 96.67 | 95.83 | 32.37 | 23.27 |
| Full Reuse | 52.00 | 41.17 | 38.67 | 13.83 | 0.64 | 0.29 |
| CacheBlend | 69.33 | 55.50 | 41.50 | 20.33 | 1.66 | 0.74 |
| EPIC | 57.17 | 49.00 | 52.17 | 71.33 | 14.37 | 10.11 |
| KVShare | 53.67 | 47.17 | 44.33 | 24.00 | 0.98 | 0.38 |
| Variant Context Source Scope Set size Global Sparse Across-Layer Mean Shared Layerwise Sparse Per-Layer Score At Each Layer RelaxKV .15 Anchor union Shared | Variant MuSiQue RULER 32K LV-Eval 16K LV-Eval 32K Global Sparse 34.81 / 5.97 95.00 / 31.87 27.32 / 25.44 25.35 / 78.99 Layerwise Sparse 31.78 / 5.89 85.00 / 31.86 18.18 / 25.48 21.76 / 79.02 RelaxKV .15 38.08 / 5.84 95.00 / 31.72 28.71 / 25.50 25.40 / 78.39 |
| (a) Context Set Components | (b) Quality / recomputation latency (s) |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Configuration | Active Repair Targets | Recomputation Context | Role |
|---|---|---|---|
| RelaxKV | Main method | ||
| RelaxKV G | Global | Matched-target diagnostic control | |
| Full-Prefix Control | Full causal prefix | Full-prefix quality–cost control | |
| Global Sparse | Global Top- | Global context construction | |
| Layerwise Sparse | Layerwise Top- | Layerwise context construction | |
| Global Repair Target Sweep | Global | Global target capacity |
| MuSiQue | RULER-MV 32K | LV-Eval 16K | LV-Eval 32K | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Variant | Recomputation Context | F1 | Recomp. (s) | Score | Recomp. (s) | F1 | Recomp. (s) | F1 | Recomp. (s) |
| Full-Prefix Control | Full causal prefix | 39.63 | 10.11 | 96.00 | 55.05 | 29.32 | 38.78 | 23.32 | 115.97 |
| RelaxKV .20 | 39.01 | 8.51 | 95.00 | 42.30 | 28.87 | 32.88 | 23.86 | 104.45 | |
| Chunk size | Recompute | Reuse | CacheBlend | EPIC | KVShare | ProphetKV | RelaxKV G .20 | RelaxKV .15 |
|---|---|---|---|---|---|---|---|---|
| 64 | 41.89 | 4.45 | 5.54 | 22.54 | 6.40 | 26.77 | 24.94 | 32.66 |
| 128 | 41.89 | 5.27 | 7.33 | 25.49 | 7.81 | 31.75 | 30.08 | 34.54 |
| 256 | 41.89 | 7.81 | 9.64 | 30.49 | 10.46 | 33.97 | 31.62 | 36.39 |
| 512 | 41.89 | 12.62 | 13.64 | 30.19 | 13.41 | 35.57 | 36.28 | 38.08 |
| 1024 | 41.89 | 18.46 | 22.47 | 34.05 | 19.00 | 39.27 | 37.62 | 38.93 |
| Repair Target Ratio | RULER | MuSiQue | LB Avg |
|---|---|---|---|
| 0.2 | 361.58 | 267.86 | 57.84 |
| 0.3 | 486.23 | 332.68 | 57.24 |
| 0.4 | 609.55 | 396.31 | 57.57 |
| 0.5 | 753.35 | 458.32 | 57.37 |
| 0.6 | 871.97 | 539.33 | 58.06 |
| 0.7 | 941.26 | 608.62 | 58.10 |
| Repair Target | RULER Ratio | MuSiQue Ratio | WQA | TQA | HQA | NQA | MQue | PR-en | PR-zh | Avg |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.2 | .200/.651 | .200/.704 | 45.86 | 90.80 | 48.62 | 25.30 | 25.40 | 74.50 | 94.43 | 57.84 |
| 0.3 | .300/.651 | .300/.704 | 44.96 | 90.30 | 47.61 | 24.90 | 25.02 | 75.50 | 92.38 | 57.24 |
| 0.4 | .400/.651 | .400/.704 | 45.14 | 90.30 | 48.57 | 25.37 | 25.71 | 76.00 | 91.88 | 57.57 |
| 0.5 | .500/.651 | .500/.704 | 45.56 | 91.13 | 48.48 | 24.51 | 25.48 | 76.00 | 90.46 | 57.37 |
| 0.6 | .600/.651 | .600/.704 | 46.40 | 91.46 | 49.29 | 25.86 | 25.99 | 75.50 | 91.90 | 58.06 |
| 0.7 | .651/.651 | .694/.704 | 45.70 | 91.46 | 48.07 | 26.19 | 28.13 | 76.00 | 91.13 | 58.10 |