KagamiKV: Pareto-Inverted 1-Bit Residual KV Compression for Looped Dense Language Models up to 368 Effective Layers
Recurrent middle-layer looping scales the effective computational depth of a language model at test time without enlarging its parameter count. While depth-invariant speculative tree decoding recently broke the per-token latency wall of looped Dense models up to 208 layers (Hirai, 2026; DOI: 10.5281/zenodo.24731793), preserving exact autoregressive causality across T recurrent passes still imposes linear per-loop KV-cache growth—exhausting consumer GPU memory on long contexts and extreme depths. We introduce KagamiKV (from Japanese kagami, "mirror"), a calibration-free, Pass-0-anchored 1-bit residual KV compressor in randomized Walsh-Hadamard space requiring only 36 B/vec (d=256) or 20 B/vec (d=128) per extra loop pass—3.78x (3.60x) smaller than independent 4-bit rotated KV (YSKN-KV4) and 14.2x (12.8x) smaller than FP16. Our theory and NVIDIA RTX 5090 (32 GB) silicon experiments establish four core contributions: Closed-Form Pareto Inversion Theorem: Whenever relative cross-pass residual energy rho < rho* = D_4 / D_1 ≈ 2.61%, 1-bit residual coding beats independent 4-bit quantization in BOTH reconstruction MSE and memory simultaneously. Composed with 3:1 GDN-Attention hybridization, total 100K x T=10 KV+GDN drops to 2.96 GiB (26.8x smaller than pure-Attention FP16). Single-Pass Fused CUDA Silicon Verification (Looped-Qwen3.8-27B, 3.50 bpw): Cross-pass residual energy stays rho_K = 0.42%–0.71% and rho_V = 0.60%–1.16% with zero drift up to OOD T=8 (176L). Fused CUDA kernels empirically beat 4-bit independent KV under 100%-quantized (local=0) stress (thinking |ΔNLL|: 0.00862 → 0.00779, Top-1: 99.28% → 99.44%, loop-sensitive MAE: 0.0643 → 0.0551) and compress live 128K x T=10 (208L) engine VRAM delta from 24.05 to 20.79 GiB (-64.4% extra caches) at 65.1 tok/s with 100% exact speculative parity. Three-Architecture Causal Proof & Pareto-Aware Co-Design: Independently self-retrofitting a frozen pure-Attention Dense model (Qwen3-0.6B, 28L, 4.29M adapter params trained in <90s) with a lightweight residual penalty (lambda_rho = 0.2) halves rho_K to 1.21%–1.90% at zero quality tax and beats 4-bit independent KV live on OOD GSM8K perplexity (6.562 vs. 6.745 at T=4; 6.569 vs. 6.715 at T=8) and WikiText-2 Top-1 (91.22% vs. 91.15%). Conversely, a native end-to-end looped MoE boundary control (Inkling-2 Mini, 128 experts / top-8) exhibits rho_K = 17.2%–25.6% and rho_V = 35.9%–55.8% >> 2.61% driven by 31.7%–44.4% per-layer top-8 expert switching (3.0x hidden residual snowball even at 0.05x damped gates) and a period-3 limit cycle, confirming the opposite regime where 4-bit independent KV dominates. Extreme OOD Reasoning up to T=20 (368 Effective Layers) on Full 30-Problem AIME 2025 (600 total runs): Lifting a 16K think cap to 64K propels T=12 (240L) from 21/30 (70.0%) to 29/30 (96.7%, 29/29 = 100.0% stopped precision) in 21.48 GiB peak VRAM (91.2 tok/s aggregate, 118.9 tok/s median), while T=20 (368L) fits in 22.89 GiB (58.7 tok/s, tau=5.65) before OOD adapter degradation lowers accuracy to 22/30 (73.3%).
Authors
- Akito Hirai (ORCID: https://orcid.org/0009-0006-0161-3249)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-03
- DOI
- https://doi.org/10.5281/zenodo.24782561
- Primary Topic
- Advanced Neural Network Applications
- Type
- preprint