To Cache or Not to Cache: Understanding and Mitigating Safety Incompatibility in Cross-Model KV Cache Reuse
Organizations: National University of Singapore · Ant Group
Abstract
Cross-model KV cache sharing reduces prefill computation by allowing a receiver model to reuse prefix KV states generated by a related sender model. Existing methods optimize such reuse for latency and generation quality, but its safety implications remain unclear. In this work, we systematically evaluate this issue across diverse sender-receiver pairs and reuse configurations. We refer to deviations from the receiver's native safety behavior as safety incompatibility. Our study shows that both the direction and magnitude of safety incompatibility depend on the model pair and reuse configuration, with value reuse causing substantially larger deviations than key reuse across all evaluated pairs. Furthermore, we propose VReparo, a technique that learns per-layer and per-KV-head affine maps offline to align reused sender value tensors with their receiver-native counterparts before decoding. Across two model pairs under full KV reuse and the state-of-the-art selective reuse setting, VReparo reduces the average HarmBench attack success rate (ASR) from 57.28% to 39.21% and the average StrongREJECT score from 0.4215 to 0.2163 upon our benchmarks, while retaining an average Time to First Token (TTFT) reduction of 85.62%.
Figures & tables
| Model | (Sender, Receiver) | HarmBench | StrongREJECT | ||||||
|---|---|---|---|---|---|---|---|---|---|
| SD | SI | SDV | SD | SI | SDV | ||||
| Qwen3-4B | (Base, Instruct) | +10.13 | 13.29 | 3.16 | 16.46 | +.0495 | .0716 | .0221 | .0938 |
| Qwen3-8B | (Base, Instruct) | -2.27 | 0.76 | 3.03 | 3.79 | -.0260 | .0077 | .0337 | .0414 |
| Llama-3.2-3B | (Base, Instruct) | +8.67 | 13.33 | 4.67 | 18.00 | +.0781 | .1009 | .0227 | .1236 |
| Llama-3-8B | (Base, Instruct) | +24.84 | 28.03 | 3.18 | 31.21 | +.2383 | .2387 | .0004 | .2391 |
| Gemma-2-2B | (Base, Instruct) | +20.25 | 20.89 | 0.63 | 21.52 | +.1564 | .1576 | .0012 | .1589 |
| Model / Pair | ASR (%) | Change from Native (pp) | ||||||
|---|---|---|---|---|---|---|---|---|
| Native | K-only | V-only | Full KV | |||||
| (Base, Instruct) | ||||||||
| Qwen3-4B | 156 | 10.90 | 13.46 | 25.64 | 21.15 | +2.56 | +14.74 | +10.26 |
| Qwen3-8B | 129 | 6.98 | 6.98 | 9.30 | 4.65 | 0.00 | +2.33 | -2.33 |
| Llama-3.2-3B | 147 | 8.84 | 7.48 | 28.57 | 17.01 | -1.36 | +19.73 | +8.16 |
| Llama-3-8B | 138 | 5.80 | 18.12 | 57.25 | 28.99 | +12.32 | +51.45 | +23.19 |
| Model | Config. | Condition | HarmBench | StrongREJECT | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| SD | SI | SDV | SD | SI | SDV | |||||
| LoRI-D | Full KV | Reuse | 50.39 | 54.33 | 3.94 | 58.27 | 0.5212 | 0.5337 | 0.0125 | 0.5462 |
| VReparo | 34.96 | 38.90 | 3.94 | 42.83 | 0.2746 | 0.2940 | 0.0194 | 0.3134 | ||
| DroidSpeak | Reuse | 53.54 | 56.69 | 3.15 | 59.84 | 0.5140 | 0.5205 | 0.0065 | 0.5270 | |
| VReparo | 31.34 | 34.96 | 3.62 | 38.58 | 0.2703 | 0.2846 | 0.0143 | 0.2989 | ||
| Llama-3-8B | Full KV | Reuse | 27.56 | 30.71 | 3.15 | 33.86 | 0.2398 | 0.2416 | 0.0018 | 0.2434 |
| Model | Configuration | TTFT (ms) | Speedup | Generation (ms/token) | |||
|---|---|---|---|---|---|---|---|
| Native | Reuse | VReparo | Reuse | VReparo | |||
| LoRI-D | Full KV | 1,355.84 | 54.71 | 88.98 | 51.15 | 51.15 | |
| DroidSpeak | 1,344.16 | 201.69 | 299.11 | 51.15 | 51.14 | ||
| Llama-3-8B | Full KV | 1,350.37 | 54.62 | 88.80 | 51.08 | 51.07 | |
| DroidSpeak | 1,347.80 | 201.59 | 298.40 | 51.04 | 51.03 | ||
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | (Sender, Receiver) | ASR (%) | Safety incompatibility | |||||
|---|---|---|---|---|---|---|---|---|
| SD | SI | SDV | ||||||
| Qwen3-4B | (Base, Instruct) | 158/159 | 10.76 | 20.89 | +10.13 | 13.29 | 3.16 | 16.46 |
| Qwen3-8B | (Base, Instruct) | 132/159 | 6.82 | 4.55 | -2.27 | 0.76 | 3.03 | 3.79 |
| Llama-3.2-3B | (Base, Instruct) | 150/159 | 8.67 | 17.33 | +8.67 | 13.33 | 4.67 | 18.00 |
| Llama-3-8B | (Base, Instruct) | 157/159 | 6.37 | 31.21 | +24.84 | 28.03 | 3.18 | 31.21 |
| Gemma-2-2B | (Base, Instruct) | 158/159 | 1.27 | 21.52 | +20.25 | 20.89 | 0.63 | 21.52 |
| Model | (Sender, Receiver) | Average score | Safety incompatibility | |||||
|---|---|---|---|---|---|---|---|---|
| Native | Reuse | SD | SI | SDV | ||||
| Qwen3-4B | (Base, Instruct) | 306/313 | .0614 | .1109 | +.0495 | .0716 | .0221 | .0938 |
| Qwen3-8B | (Base, Instruct) | 296/313 | .0447 | .0186 | -.0260 | .0077 | .0337 | .0414 |
| Llama-3.2-3B | (Base, Instruct) | 259/313 | .0391 | .1173 | +.0781 | .1009 | .0227 | .1236 |
| Llama-3-8B | (Base, Instruct) | 311/313 | .0094 | .2477 | +.2383 | .2387 | .0004 | .2391 |
| Gemma-2-2B | (Base, Instruct) | 313/313 | .0094 | .1658 | +.1564 | .1576 | .0012 | .1589 |
| Unsafe change | Safe change | Max subtype change | Eligible | |
| LoRI-D Full KV, | ||||
| 0.1 | 2.0 | -21.6 | 0.0 | Yes |
| 0.25 | 4.5 | -21.6 | 0.0 | Yes |
| 0.5 | 18.0 | -21.2 | 0.0 | Yes |
| 1.0 | 51.0 | -13.6 | 12.0 | Yes |
| LoRI-D DroidSpeak, | ||||
| Model pair | Reuse | Prompt | Prefix | Suffix |
|---|---|---|---|---|
| LoRI-D | Full KV | 1,833/7,262.20/7,530 | — | — |
| DroidSpeak | 1,833/7,261.30/7,529 | 7,210.04 | 42/51.26/80 | |
| Llama-3-8B | Full KV | 1,814/7,243.20/7,511 | — | — |
| DroidSpeak | 1,814/7,242.30/7,510 | 7,191.04 | 42/51.26/80 |
| Config. | HotpotQA | 2Wiki | MultiField | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Native | Reuse | VReparo | Native | Reuse | VReparo | Native | Reuse | VReparo | |
| LoRI-D | |||||||||
| Full KV | 28.90 | 22.48 | 21.13 | 27.85 | 25.19 | 22.03 | 50.71 | 48.71 | 46.42 |
| DroidSpeak | 27.36 | 27.90 | 28.92 | 27.85 | 27.40 | 26.99 | 50.75 | 51.38 | 49.55 |
| Llama-3-8B | |||||||||
| Full KV | 49.64 | 9.64 | 11.54 | 34.27 | 10.60 | 11.59 | 44.45 | 13.28 | 13.50 |
| Model | Condition | Full KV reuse | DroidSpeak | ||||
|---|---|---|---|---|---|---|---|
| ASR | Mean | Refusal | ASR | Mean | Refusal | ||
| LoRI-D | Native | 29.13 | 0.1219 | 11.0 | 29.13 | 0.1213 | 11.0 |
| Reuse | 79.53 | 0.6431 | 4.0 | 82.68 | 0.6353 | 4.5 | |
| VReparo | 64.09 | 0.3966 | 12.6 | 60.47 | 0.3916 | 10.8 | |
| Llama-3-8B | Native | 7.09 | 0.0107 | 10.0 | 7.09 | 0.0108 | 9.5 |
| Reuse | 34.65 | 0.2505 | 12.5 | 32.28 | 0.1569 | 8.5 | |
| Model | Config. | Seed | HB | SR | F1 | Refusal | |
|---|---|---|---|---|---|---|---|
| LoRI-D | Full KV | 0 | 1 | 44.09 | 0.3149 | 20.05 | 12.5 |
| 1 | 1 | 40.94 | 0.3105 | 20.37 | 13.0 | ||
| 2 | 1 | 44.09 | 0.3156 | 20.25 | 13.0 | ||
| 3 | 1 | 42.52 | 0.3094 | 20.59 | 12.5 | ||
| 4 | 1 | 42.52 | 0.3163 | 19.94 | 12.0 | ||
| DroidSpeak | 0 | 1 | 40.16 | 0.3121 | 28.84 | 10.5 |
KV-Cache Reuse
Key-value (KV) cache reuse lets language models reuse previously computed attention states to cut repeated prefill work and serving latency.
See all 73 papers