SparPR: Runtime KV-Cache Recovery for Resource-Constrained LLM Inference on Consumer Hardware
Organizations: Southwest Jiaotong University, Chengdu, China · Wuhan Institute of Technology, Wuhan, China · Southwest Petroleum University, Chengdu, China
Abstract
Running large language models (LLMs) on consumer hardware is bottlenecked by the key-value (KV) cache, which grows with every decoded token and quickly exhausts the memory and bandwidth of a single consumer GPU. We present SparPR (Sparse Partial Recomputation), a runtime KV-cache recovery mechanism that does not modify model weights and requires no offline training. SparPR couples three online decisions: Query-Aware key-block selection scores historical blocks against the current query; dynamic budget control estimates per-block copy and recompute costs to decide how many blocks to retain; and on-demand local recomputation with cost-aware fallback merges retained blocks into continuous spans and switches between sparse recomputation and full recovery according to a runtime cost comparison. Implemented on FlexGen/FlexLLMGen, SparPR is evaluated on a single consumer laptop (RTX 3070 Ti 8GB, Ryzen 9 6900HX, 16GB RAM). It cuts end-to-end latency by 31%, 52%, and 63% at 1k, 2k, and 4k prompt tokens respectively, with 1.4x-2.7x higher throughput, and completes an 8k-token workload in 44 minutes where the FlexGen baseline times out. Under a fixed cache budget, SparPR retains a Needle Accuracy that stays well above StreamingLLM and H2O at every keep ratio, and ablation studies confirm that the three mechanisms act jointly.
Figures & tables
| Prompt | FlexGen lat. | FlexGen thr. | SparPR lat. | SparPR thr. | Lat. reduction |
|---|---|---|---|---|---|
| 1k | 1064 | .466 | 737 | .673 | 31% |
| 2k | 2101 | .236 | 1009 | .491 | 52% |
| 4k | 4174 | .119 | 1553 | .319 | 63% |
| 8k | timeout | — | 2641 | .187 | — |
| Method | Keep ratio | 2k | 4k | 8k |
|---|---|---|---|---|
| StreamingLLM | 50% | .445 | .467 | .485 |
| 40% | .291 | .333 | .345 | |
| 30% | .153 | .197 | .208 | |
| 20% | .020 | .051 | .070 | |
| 10% | .020 | .020 | .020 | |
| 5% | .020 | .020 | .020 |
| Floor | Avg. keep | Throughput | Needle acc. | Sparse cost (ms) |
|---|---|---|---|---|
| 1.00 | 100.0% | 0.482 | 0.993 | 952.33 |
| 0.90 | 90.0% | 0.532 | 0.987 | 891.67 |
| 0.80 | 80.0% | 0.588 | 0.983 | 821.33 |
| 0.75 | 75.5% | 0.642 | 0.973 | 761.67 |
| 0.70 | 72.6% | 0.681 | 0.963 | 712.33 |
| 0.65 | 69.7% | 0.728 | 0.947 | 671.67 |
| Threshold | Throughput | Needle acc. | Bypass count |
|---|---|---|---|
| 0.72 | 0.520 | 0.985 | 12.00 |
| 0.74 | 0.560 | 0.983 | 10.00 |
| 0.76 | 0.610 | 0.980 | 8.00 |
| 0.78 | 0.650 | 0.977 | 6.00 |
| 0.80 | 0.680 | 0.971 | 5.00 |
| 0.85 | 0.700 | 0.962 | 3.00 |
| Method | Latency (s) | Throughput | Needle acc. |
|---|---|---|---|
| FlexGen | 991.33 | 0.50 | 0.983 |
| Quest-only | 845.33 | 0.59 | 0.777 |
| w/o Budget | 838.67 | 0.60 | 0.963 |
| w/o Span Merge | 936.67 | 0.53 | 0.973 |
| w/o Bypass | 812.33 | 0.62 | 0.917 |
| SparPR-full | 756.67 | 0.66 | 0.957 |
| Method | Avg. keep | Bypass | Blocks skip | Recompute ok | Sparse cost (ms) |
|---|---|---|---|---|---|
| FlexGen | 100.0% | 0.00 | 0.00 | 0.00 | 952.33 |
| Quest-only | 58.7% | 0.00 | 726.67 | 3.00 | 805.67 |
| w/o Budget | 85.0% | 3.33 | 266.33 | 4.33 | 818.33 |
| w/o Span Merge | 73.5% | 16.33 | 468.33 | 8.67 | 1085.33 |
| w/o Bypass | 73.8% | 0.00 | 462.67 | 12.33 | 821.67 |
| SparPR-full | 73.2% | 5.67 | 473.33 | 9.33 | 728.33 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,090 papers