Transformer-FSQ: Discrete Latents for Extreme KV-Cache Compression
Organizations: School of Informatics The University of Edinburgh · School of Engineering The University of Edinburgh
Abstract
Private, personalised language models must run on local consumer devices, where large, frontier models cannot fit, and retaining long contexts is non-trivial. Sequential memory---the key-value (KV) cache---grows linearly with context length, quickly dwarfing the model itself: for Qwen3-1.7B-Base, 200,000 retained entries require 21 GiB, 6.6 times more than the model weights. Yet the KV-cache compression methods we measured fail beyond moderate compression ratios. We introduce Transformer-FSQ, addressing extreme KV-cache compression by replacing standard key and value projections with a finite scalar quantisation bottleneck. Our cache stores a packed vector of discrete integer codes per token, with no per-token quantisation metadata. Converting a pretrained transformer trains only these projections on 0.25 tokens per original parameter. We evaluate Transformer-FSQ against five baseline families on models from 0.6B to 8B parameters. On long-context retrieval (RULER), from 12 to 97.5 Transformer-FSQ is the most accurate method we evaluate, across scales. A fused Triton kernel decodes directly from the integer codes; with baselines given their authors' kernels where available, it decodes at (95% interval --) the throughput of native SDPA attention on the uncompressed Qwen3-8B-Base at and at . Extreme KV-cache compression is therefore a practical way to extend how much context a fixed device can hold.
Figures & tables
| Method | Family | Cache contents per token | Trained | Deepest | Max tokens (16 GiB, ) |
|---|---|---|---|---|---|
| PyramidKV | token eviction | full-precision KV of kept tokens | no | 552k | |
| KIVI | scalar quantisation | 2-bit KV, full-precision window | no | 684k | |
| VecInfer | vector quantisation | codebook indices, window, sinks | no | 592k | |
| Palu | low-rank projection | quantised low-rank SVD latent | yes | 1.42M | |
| TransMLA | latent attention | latent, fp16 rotary key | yes | 542k | |
| Transformer- FSQ (ours) | finite scalar quantisation | bit-packed integer code | yes | 2.21M |
| Method | Training | Cache | Width | B/tok | RULER |
| Nominal budget: B per token per layer ( compression) | |||||
| Transformer-FSQ (ours) | Discrete (STE, ) | 4-bit implicit grid | 288 | 144 | |
| Continuous latent | Continuous (bf16) | 16-bit float | 72 | 144 | |
| Latent + post-hoc FSQ | Continuous (bf16) | 4-bit post-hoc FSQ | 288 | 144 | |
| Latent + post-hoc KIVI | Continuous (bf16) | 4-bit blocks + scales | 288 | 180 | |
| Palu | Low-rank SVD | 4-bit SVD + scales | 144 | 144 | |
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Qwen3-0.6B-Base | Qwen3-1.7B-Base | Qwen3-8B-Base | |
| parameters | |||
| layers | |||
| model width | |||
| query heads | |||
| key-value heads | |||
| head width |
| Qwen3-0.6B / 1.7B-Base | Qwen3-8B-Base | |
| finetuning budgets | ||
| optimiser | AdamW | AdamW |
| peak learning rate | ||
| schedule | linear warm-up over 5% of steps, cosine decay to 5% of peak | |
| weight decay | , constant | , constant |
| data | ClimbMix | ClimbMix |
| Model | |||
|---|---|---|---|
| Qwen3-0.6B-Base | 0.19 ; 0.15–0.25 | 0.56 ; 0.44–0.78 | 2.59 ; 1.47–5.14 |
| Qwen3-1.7B-Base | – | – | 7.32 ; 5.57–9.19 |
| Qwen3-8B-Base | – | – | 138.34 (34.6 h) ; 108.88–158.72 |
| FSQ | PyramidKV | Total ratio | B/tok/layer | Score half-CI | Seeds |
| – | – | 4096 | 1 | ||
| – | 512 | 3 | |||
| – | 256 | 3 | |||
| – | 128 | 3 | |||
| – | 42 | 3 | |||
| 256 | 1 |
| Compression / quantisation | Width | Bytes | RULER |
|---|---|---|---|
| Nominal budget: 144 B/token/layer (28.4 ) | |||
| Continuous latent | 72 | 144 | |
| Latent + post-hoc FSQ | 288 | 144 | |
| Transformer-FSQ (ours) | 288 | 144 | |
| Latent + trained min–max 4-bit | 224 | 140 | |
| Latent + post-hoc KIVI | 288 | 180 | |
| Cache | B/token/layer | Ratio | RULER ( ) |
|---|---|---|---|
| FSQ, 4 levels | 144 | 28 | |
| FSQ, 16 levels | 144 | 28 | |
| FSQ, 256 levels | 144 | 28 | |
| FSQ, 4 levels | 80 | 51 | |
| FSQ, 16 levels | 80 | 51 | |
| FSQ, 256 levels | 80 | 51 |
| Method | seeds | niah_ single_1 | niah_ single_2 | niah_ single_3 | niah_ multikey_1 | niah_ multikey_2 | niah_ multikey_3 | niah_ multivalue | niah_ multiquery | vt | cwe | fwe | qa_ 1 | qa_ 2 | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Uncompressed | 1 | 1.00 | 0.96 | 0.98 | 0.90 | 0.82 | 0.42 | 0.83 | 0.88 | 0.80 | 0.30 | 0.51 | 0.62 | 0.30 | 0.72 |
| Transformer-FSQ (2.0 ) | 3 | 1.00 | 0.92 | 0.97 | 0.66 | 0.41 | 0.03 | 0.67 | 0.53 | 0.71 | 0.34 | 0.42 | 0.47 | 0.23 | 0.57 |
| Transformer-FSQ (4.0 ) | 3 | 1.00 | 0.89 | 0.97 | 0.69 | 0.43 | 0.03 | 0.68 | 0.54 | 0.61 | 0.31 | 0.42 | 0.53 | 0.25 | 0.57 |
| Transformer-FSQ (8.0 ) | 3 | 1.00 | 0.87 | 0.97 | 0.68 | 0.33 | 0.04 | 0.69 | 0.52 | 0.59 | 0.31 | 0.45 | 0.53 | 0.27 | 0.56 |
| Transformer-FSQ (12.0 ) | 3 | 0.99 | 0.85 | 0.66 | 0.40 | 0.11 | 0.01 | 0.33 | 0.41 | 0.18 | 0.31 | 0.24 | 0.43 | 0.17 | 0.39 |
| Transformer-FSQ (16.0 ) | 3 | 0.99 | 0.69 | 0.61 | 0.26 | 0.03 | 0.00 | 0.29 | 0.27 | 0.18 | 0.22 | 0.21 | 0.31 | 0.15 | 0.32 |
| Method | seeds | niah_ single_1 | niah_ single_2 | niah_ single_3 | niah_ multikey_1 | niah_ multikey_2 | niah_ multikey_3 | niah_ multivalue | niah_ multiquery | vt | cwe | fwe | qa_ 1 | qa_ 2 | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Uncompressed | 1 | 1.00 | 1.00 | 1.00 | 0.98 | 0.90 | 0.62 | 0.97 | 0.98 | 0.62 | 0.36 | 0.68 | 0.60 | 0.32 | 0.77 |
| Transformer-FSQ (2.0 ) | 2 | 1.00 | 1.00 | 1.00 | 0.85 | 0.29 | 0.04 | 0.84 | 0.86 | 0.72 | 0.33 | 0.51 | 0.63 | 0.32 | 0.64 |
| Transformer-FSQ (4.0 ) | 3 | 1.00 | 0.99 | 0.99 | 0.86 | 0.43 | 0.04 | 0.85 | 0.86 | 0.79 | 0.33 | 0.47 | 0.62 | 0.33 | 0.66 |
| Transformer-FSQ (8.0 ) | 3 | 0.99 | 0.84 | 0.97 | 0.64 | 0.09 | 0.01 | 0.72 | 0.63 | 0.49 | 0.40 | 0.33 | 0.43 | 0.21 | 0.52 |
| Transformer-FSQ (12.0 ) | 3 | 0.99 | 0.63 | 0.93 | 0.50 | 0.05 | 0.00 | 0.56 | 0.43 | 0.48 | 0.34 | 0.18 | 0.32 | 0.19 | 0.43 |
| Transformer-FSQ (16.0 ) | 3 | 1.00 | 0.62 | 0.87 | 0.38 | 0.04 | 0.00 | 0.43 | 0.36 | 0.25 | 0.27 | 0.17 | 0.27 | 0.18 | 0.37 |
| Method | seeds | niah_ single_1 | niah_ single_2 | niah_ single_3 | niah_ multikey_1 | niah_ multikey_2 | niah_ multikey_3 | niah_ multivalue | niah_ multiquery | vt | cwe | fwe | qa_ 1 | qa_ 2 | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Uncompressed | 1 | 1.00 | 0.98 | 1.00 | 1.00 | 0.96 | 1.00 | 0.99 | 0.99 | 0.90 | 0.92 | 0.90 | 0.90 | 0.44 | 0.92 |
| Transformer-FSQ (8.0 ) | 1 | 1.00 | 0.96 | 0.96 | 0.82 | 0.24 | 0.04 | 0.84 | 0.78 | 0.60 | 0.70 | 0.85 | 0.62 | 0.22 | 0.66 |
| Transformer-FSQ (12.0 ) | 1 | 1.00 | 1.00 | 1.00 | 0.66 | 0.14 | 0.02 | 0.79 | 0.77 | 0.58 | 0.58 | 0.73 | 0.52 | 0.20 | 0.61 |
| Transformer-FSQ (32.0 ) | 1 | 1.00 | 1.00 | 0.90 | 0.62 | 0.04 | 0.00 | 0.56 | 0.52 | 0.40 | 0.46 | 0.38 | 0.36 | 0.18 | 0.49 |
| Transformer-FSQ (97.5 ) | 1 | 0.96 | 0.74 | 0.30 | 0.20 | 0.00 | 0.00 | 0.17 | 0.14 | 0.00 | 0.07 | 0.15 | 0.14 | 0.14 | 0.23 |
| Transformer-FSQ (409.6 ) | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.06 | 0.00 | 0.00 |
| Method | B/tok | Ratio | seeds | skip | gov_ report | narrative- qa | trec | |
|---|---|---|---|---|---|---|---|---|
| Uncompressed | – | – | 1 | 60 | 0 | 18.2 | 13.0 | 10.0 |
| Compression 1.4 –2.8 | ||||||||
| Transformer-FSQ | 2048 | 2.0 | 3 | 180 | 0 | 17.1 1.3 | 5.3 1.2 | 25.0 5.0 |
| TransMLA | 2048 | 2.0 | 3 | 180 | 0 | 12.7 0.0 | 2.7 0.6 | 16.7 5.8 |
| VecInfer | 1601 § | 2.6 | 1 | 60 | 0 | 18.1 | 8.0 | 10.0 |
| Compression 2.8 –5.7 | ||||||||
| Method | B/tok | Ratio | seeds | skip | gov_ report | narrative- qa | trec | |
|---|---|---|---|---|---|---|---|---|
| Uncompressed | – | – | 1 | 60 | 0 | 17.9 | 12.0 | 40.0 |
| Compression 1.4 –2.8 | ||||||||
| Transformer-FSQ | 2048 | 2.0 | 3 | 180 | 0 | 15.9 0.6 | 8.9 0.9 | 30.0 13.2 |
| TransMLA | 2048 | 2.0 | 3 | 180 | 0 | 14.6 0.1 | 4.1 1.5 | 20.0 5.0 |
| VecInfer | 1601 § | 2.6 | 3 | 180 | 0 | 17.1 0.5 | 10.1 1.6 | 38.3 2.9 |
| Compression 2.8 –5.7 | ||||||||
| Method | B/tok | Ratio | seeds | skip | gov_ report | narrative- qa | trec | |
| Uncompressed | – | – | 1 | 462 | 138 | 16.9 | 17.4 | 63.0 |
| Compression 2.8 –5.7 | ||||||||
| KIVI | 847 § | 4.8 | 1 | 450 | 150 | 15.4 | 23.5 | 58.0 |
| Compression 5.7 –11.3 | ||||||||
| Transformer-FSQ | 512 | 8.0 | 1 | 600 | 0 | 15.0 | 10.8 | 43.5 |
| VecInfer | 721 § | 5.7 | 1 | 450 | 150 | 15.6 | 16.3 | 59.0 |
KV-Cache Compression
Key-value cache compression reduces the memory and bandwidth needed to retain attention states during long-context inference.
See all 285 papers