KV-Lingo: Learning KV-Cache Translators with Distillation
Organizations: Apple
Abstract
Large language models represent context with a key-value (KV) cache. Caches are model-specific: for the same text, models with different architectures or weights produce incompatible representations. This makes it costly to switch models over a shared context: although the context has already been processed by one model, the incoming model must process it again to build its own cache. We introduce KV-Lingo, a method for translating the KV cache of a source model into one that can be read by a target model. KV-Lingo consists of a collection of linear maps, typically one per layer of the target model, that are applied independently on all tokens' key and value representations. We train these maps using distillation, minimising the divergence between the target model's predictions from its native cache and those from the translated cache. We consider several model pairs spanning multiple sizes and architectures, training one translator per pair on a generic text corpus. The resulting translators preserve strong downstream performance in both small-to-large and large-to-small transfers. Since a switch then costs a linear map and a single decoding step instead of a prefill, replacing re-prefill with cache translation reduces the time to first token after a model switch by 9.6x already on a 64-token prompt for Qwen models on an Apple M3 Ultra, and by up to 29x at 32k context length on an H100. These gains make KV-Lingo particularly useful for dynamic model routing: a context can be processed by one model and handed off to another only when needed, without re-prefilling the shared prefix. We finally show that KV-Lingo can be used for seamless model switching, staying close to re-prefill across repeated switches in our multi-turn evaluations.
Figures & tables
Appendix figures & tables69 assets
Supplementary material from the paper’s appendix.
Appendix
| Pair | side | nonlin. extra | |||
| Qwen3 8B/4B | K | ||||
| V | |||||
| Qwen3 1.7B/0.6B | K | ||||
| V | |||||
| from scratch 1.7B/0.6B | K | ||||
| V |
| , layer average | ||||
| Pair | Dir. | side | no bias | affine |
| Qwen3 8B/4B | K | |||
| V | ||||
| K | ||||
| V | ||||
| Qwen3 1.7B/0.6B | K | |||
| Model | effective rank (first mid last) | top-1 variance fraction (first last) |
| Qwen3-1.7B, trained | ||
| Qwen3-1.7B, random init | ||
| Qwen3-8B, trained | ||
| Qwen3-8B, random init | ||
| from-scratch 1.7B, trained |
| Benchmark | Ability | Prefix | Reasoning (budget) | Metric | |
| Nemotron chat | LM | – k | held-out | off/on ( ) | cont. PPL, KL |
| MMLU-Pro | knowledge MC | k | off/on ( k/ k) | accuracy (macro) | |
| ARC-Challenge | science MC | k | off/on ( k/ k) | accuracy | |
| GSM8K | arithmetic | k | on ( k) | EM flexible | |
| IFEval | constraints | k | off ( k) | prompt/instr. acc. | |
| CoQA | grounded QA | k | off ( ) | F1, gold-in-ans. |
| head-mixing | head-wise | ||||||||
| Pair | Direction | , depth | , selected | ||||||
| Qwen3-0.6B/1.7B | |||||||||
| Qwen3-0.6B/1.7B | |||||||||
| Qwen3-4B/8B | |||||||||
| Qwen3-4B/8B | |||||||||
| Qwen3-0.6B/8B | |||||||||
| shape-preserving Qwen3 | cross-layer Qwen3 | Gemma-3 | Gemma-4 | |||||
| Benchmark | seed sd | eval se | seed sd | eval se | seed sd | eval se | seed sd | eval se |
| MMLU-Pro | ||||||||
| ARC-C | ||||||||
| GSM8K | — | — | ||||||
| IFEval | — | — | ||||||
| CoQA | — | — | ||||||
| Pair | Direction | Assignment | seed | 3-seed mean | seed | seed |
| Qwen3-0.6B/8B | depth | |||||
| Qwen3-0.6B/8B | greedy | |||||
| Qwen3-0.6B/8B | depth | |||||
| Qwen3-0.6B/8B | greedy | |||||
| Qwen3-1.7B/4B | depth | |||||
| Qwen3-1.7B/4B | greedy |
| native | translated | |||||||
| closed | KV-Lingo | KV-Lingo | KV-Lingo | MLP | ||||
| Benchmark | small | large | form | H-M, KL | H-M, mixed loss | head-wise | head-wise | |
| Qwen3-0.6B/1.7B | MMLU-Pro | |||||||
| ARC-C | ||||||||
| IFEval | ||||||||
| CoQA | ||||||||
| native | translated | |||||||
| closed | KV-Lingo | KV-Lingo | KV-Lingo | MLP | ||||
| Benchmark | small | large | form | H-M, KL | H-M, mixed loss | head-wise | head-wise | |
| Qwen3-0.6B/1.7B | MMLU-Pro | |||||||
| ARC-C | ||||||||
| IFEval | ||||||||
| CoQA | ||||||||
| native | closed form | self-distilled | ||||
| Benchmark | small | large | depth | depth | ||
| , Qwen3-8B Qwen3-0.6B | ||||||
| MMLU-Pro | ||||||
| ARC-C | ||||||
| RULER | ||||||
| LongBench-v2 | — | — | — | — | ||
| reasoning-off | reasoning-on | |||||||
| Context | small | large | depth | small | large | depth | ||
| , Qwen3-8B Qwen3-0.6B | ||||||||
| k | ||||||||
| k | ||||||||
| k | ||||||||
| k | ||||||||
| native | closed form | self-distilled | ||||
| Cell | small | large | depth | depth | ||
| Qwen3-8B Qwen3-0.6B | ||||||
| Qwen3-4B Qwen3-1.7B | ||||||
| Qwen3-0.6B Qwen3-8B | ||||||
| Qwen3-1.7B Qwen3-4B | ||||||
| native | translated, assignment | |||||
| Benchmark | small | large | ||||
| , Qwen3-8B Qwen3-0.6B | ||||||
| MMLU-Pro | ||||||
| ARC-C | ||||||
| RULER | ||||||
| LongMemEval | ||||||
| native | closed form | self-distilled | ||||
| Benchmark | small | large | depth | greedy | depth | greedy |
| , Gemma-3-4B/12B-it | ||||||
| MMLU-Pro | ||||||
| ARC-C | ||||||
| GSM8K | ||||||
| CoQA | ||||||
| native | depth | greedy | |||||
| Benchmark | small | large | |||||
| , Gemma-3-4B/12B-it | |||||||
| MMLU-Pro | |||||||
| ARC-C | |||||||
| GSM8K | |||||||
| CoQA | |||||||
| native | closed form | self-distilled | ||||
| Benchmark | small | large | depth | greedy | depth | greedy |
| , Gemma-4-E2B/E4B-it | ||||||
| MMLU-Pro | ||||||
| ARC-C | ||||||
| XQuAD | ||||||
| MT-Bench-101 | ||||||
| native | translated | |||
| Benchmark | small | large | self-distilled | |
| MMLU-Pro | ||||
| ARC-C | ||||
| RepLiQA | ||||
| LongMemEval | ||||
| GSM8K | ||||
| native | translated | ||||
| Benchmark | small | large | closed form | KV-Lingo | |
| head-mixing | head-mixing | ||||
| MMLU-Pro | |||||
| ARC-C | |||||
| XQuAD | |||||
| CoQA | |||||
| continuation KL | accuracy own native | ||||||||
| closed form | self-distilled | MMLU-Pro | ARC-C | ||||||
| Recovery | Dir. | latent | K/V | latent | K/V | latent | K/V | latent | K/V |
| k | |||||||||
| k | |||||||||
| k | |||||||||
| k | |||||||||
| (target 1.7B) | (target 0.6B) | |||||
| ARC-C | MMLU-Pro | compute | ARC-C | MMLU-Pro | compute | |
| Target, own cache | ||||||
| Source alone | — | — | ||||
| DroidSpeak, verbatim ( ) | ||||||
| DroidSpeak, profiler | ||||||
| ( ) | ( ) | |||||
| ARC-C | MMLU-Pro | ARC-C | MMLU-Pro | |
| reasoning-off | reasoning-on | |||||||
| own cache | translated | own cache | translated | |||||
| Benchmark | 4B | MoE | 4B MoE | MoE 4B | 4B | MoE | 4B MoE | MoE 4B |
| MMLU-Pro | ||||||||
| ARC-C | ||||||||
| GSM8K | ||||||||
| IFEval | ||||||||
| held-out KL at step | |||||||
| Translator | Parameters | Learning rate | Time | ||||
| Qwen3-4B Qwen3-30B-A3B | |||||||
| linear | M | h | |||||
| h | |||||||
| h | |||||||
| linear MLP | B | h | |||||
| Prompt tokens | |||||
| Qwen3-4B prefill (ms) | |||||
| Qwen3-30B-A3B prefill (ms) | |||||
| translation, fp32 (ms) | |||||
| translation, bf16 (ms) | |||||
| Qwen3-4B decoding (tokens/s) | |||||
| Qwen3-30B-A3B decoding (tokens/s) |
| pre- -norm | post- -norm | |||||
| Source target | MMLU-Pro | ARC-C | MMLU-Pro | ARC-C | ||
| Qwen3-1.7B 0.6B | ||||||
| Qwen3-0.6B 1.7B | ||||||
| Qwen3-8B 4B | ||||||
| Qwen3-4B 8B | ||||||
| fitting norm | off-the-shelf KL | after stage 2 |
| Frobenius (uniform) | ||
| sink | ||
| sink | ||
| sink | ||
| sink | ||
| sink |
| evaluation | cells | post- -norm worse in | mean |
| RULER, reasoning-off ( – k) | |||
| RULER, reasoning-on ( – k) | |||
| LongMemEval, reasoning-on, four rungs | |||
| LongMemEval, reasoning-on, multi-turn at k | |||
| LongBench-v2, reasoning-off | |||
| RepLiQA, reasoning-on, judged accuracy and token-F1 |
| native | translated | |||
| Benchmark | small | large | pre- -norm | post-RoPE |
| , Qwen3-0.6B/1.7B | ||||
| MMLU-Pro | ||||
| ARC-C | ||||
| GSM8K | ||||
| CoQA | ||||
| native | closed form | KV-Lingo | mixed | |||||
| Benchmark | small | large | whole | context | whole | context | whole | context |
| , Qwen3- B/ B | ||||||||
| RULER, k | ||||||||
| RULER, k | ||||||||
| RULER, k | ||||||||
| RULER, k | ||||||||
| native | closed form | KV-Lingo | |||||
| Benchmark | small | large | text | prompt | trace | prompt | trace |
| MMLU-Pro | |||||||
| ARC-C | |||||||
| GSM8K | |||||||
| native | translated | |||||
| Benchmark | small | large | KV-Lingo | head-wise MLP | head-wise MLP | |
| BoolQ | ||||||
| HellaSwag | ||||||
| PIQA | ||||||
| ARC-E | ||||||
| KV-Lingo (ours) | head-wise MLP | ||||||
| Corpus | native PPL | closed form | CE | self-distilled | |||
| Nemotron | |||||||
| WikiText | |||||||
| Nemotron | |||||||
| WikiText | |||||||
| native | translated | |||||
| Benchmark | small | large | closed form | KV-Lingo | ||
| Qwen3 B/ B | ARC-C | |||||
| SQuAD-v1 | ||||||
| BoolQ | ||||||
| WinoGrande | ||||||
| ARC-C | ||||||
| Nemotron | WikiText | Code | Books | arXiv | ||
| Qwen3 B/ B | ||||||
| Qwen3 B/ B | ||||||
| validation KL | BoolQ | ||||||
| Pair | Direction | split | joint | Nemotron | WikiText | split | joint |
| B/ B | |||||||
| B/ B | |||||||
| into the smaller model | into the larger model | |||||
| translate | step | re-prefill | translate | step | re-prefill | |
| Qwen3-0.6B/1.7B | ||||||
| Prompt tokens | k | k | k | k | k |
| Qwen3-0.6B | / | / | / | / | / |
| Qwen3-1.7B | / | / | / | / | / |
| Qwen3-4B | / | / | / | / | / |
| Qwen3-8B | / | / | / | / | / |
| Gemma-3-4B | / | / | / | / | / |
| Gemma-3-12B | / | / | / | / | / |
| decoding throughput | peak memory (GB) | ||||
| context | batch | full (tokens/s) | narrowed | narrowed translator | full narrowed translator |
| k | – | – | |||
| k | – | – | – | ||
| k | – | – | |||
| k | – | – | – | ||
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,101 papers