Transformers PR halves KV cache for looped layers: 8.76GB to 4.38GB at 262K tokens
art_zucker · x · 2026-11-25
Hugging Face Transformers engineer ArthurZucker opened PR #51161 adding a lastloop KV cache mode for Inkling-2-Mini's looped layers. The model loops 12 of its 24 layers three times; under the default perloop mode each pass writes its own KV cache (48 caches total). With lastloop, only the final pass writes the real caches while earlier passes read through a read-only view, cutting this to 24 and decoupling cache growth from pass count.
- Memory: at 262K tokens, single-sequence KV cache drops from 8.76GB to 4.38GB (BF16); combined with 8-bit quantization it could reach 2.19GB — roughly the same saving as 8-bit KV quantization alone, raising the question of which preserves accuracy better.
- Implementation reuses dory's peek-without-write reader logic, adapted because inkling's loop layers also own convolution states, which stay pass-local in both modes.
- Caveat: earlier passes now attend to different cached keys/values; short tests may look identical but long-context reasoning and agentic tasks may behave differently.
More from Infra
- Fireworks AI CEO and Jensen Huang outline vision of specialized super agents on open models — lqiao · 2026-11-25
- Alperovitch jabs at Jensen's chip logic: why are all major US customers building their own? — GaryMarcus · 2026-11-25
- Sakana AI's 30B Namazu Small beats 4x-larger Nemotron 3 Super on 25-benchmark average — SakanaAILabs · 2026-11-25
- OceanBase launches lakehouse AI data platform OceanLake, open-sources OceanSeek engine — 量子位 · 2026-11-25
- M5 Max vs RTX 5090 Laptop in PyTorch Training: 4x Slower at Twice the Price — julianharris · 2026-11-25
- Unsloth Desktop merges Windows x64/ARM64 into one installer, adds winget and brew — danielhanchen · 2026-11-25