
If you're building or optimizing long-context LLM inference, this breaks down how the newest models actually shrink KV cache and attention costs — with comparative coverage of Gemma 4, DeepSeek V4, ZAYA1, and Laguna plus from-scratch code you can adapt.
“For the smallest E2B model, this results in a 2.7 GB saving (at bfloat16 precision) in long 128K contexts, as shown below.”
“The DeepSeek V4 paper reports that, at a 1M-token context length, DeepSeek V4-Pro uses only 27% of the single-token inference FLOPs and 10% of the KV cache size compared with DeepSeek V3.2, which uses MLA and DeepSeek Sparse Attention (DSA).”
“While it was possible to implement a basic transformer block in perhaps 50-100 lines of PyTorch code, these tweaks (esp. around the attention variants) probably 10x the code complexity.”
“The moral of the story, I guess, is to keep learning, one architecture at a time :).”
Checking sign-in…
Loading comments…