<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Inference on Costa Life &amp; Tech Lab</title><link>https://n.cqs.es/en/tags/inference/</link><description>Recent content in Inference on Costa Life &amp; Tech Lab</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 02 Jun 2026 06:26:00 +0000</lastBuildDate><atom:link href="https://n.cqs.es/en/tags/inference/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding KV Cache Optimization for LLM Inference</title><link>https://n.cqs.es/en/posts/2026/2026-1-kv-cache/</link><pubDate>Tue, 02 Jun 2026 06:26:00 +0000</pubDate><guid>https://n.cqs.es/en/posts/2026/2026-1-kv-cache/</guid><description>&lt;h2 class="group head-tag" id="-paper-walkthrough">📄 Paper Walkthrough&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#-paper-walkthrough">&lt;/a>&lt;/h2>&lt;p>&lt;strong>KV Cache Optimization Strategies for Scalable and Efficient LLM Inference&lt;/strong>
Yichun Xu, Navjot K. Khaira, Tejinder Singh (Dell Technologies)
arXiv:2603.20397 · March 24, 2026 · 24 pages · 78 references&lt;/p>
&lt;h2 class="group head-tag" id="why-kv-cache-is-a-problem">Why KV cache is a problem&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#why-kv-cache-is-a-problem">&lt;/a>&lt;/h2>&lt;ul>
&lt;li>During autoregressive generation, every new token must &amp;ldquo;see&amp;rdquo; the K/V vectors of all prior tokens.&lt;/li>
&lt;li>Without caching, every step recomputes everything from scratch → O(N²).&lt;/li>
&lt;li>With caching, &lt;strong>KV memory grows linearly with context length&lt;/strong>: &lt;code>KV size = 2·H·D·L·B·N&lt;/code>.&lt;/li>
&lt;li>As context windows stretch from 2K to 100K, 1M, 10M, KV cache consumes all GPU memory, making inference slow, expensive, and impractical.&lt;/li>
&lt;/ul>



 &lt;img src="https://n.cqs.es/images/posts/2026/2026-1-kv-cache_cover.webp" alt="Transformer self-attention with KV cache" loading="lazy" style="width:70%;" />


&lt;h2 class="group head-tag" id="five-technique-categories">Five technique categories&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#five-technique-categories">&lt;/a>&lt;/h2>&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>#&lt;/th>
 &lt;th>Category&lt;/th>
 &lt;th>One-line idea&lt;/th>
 &lt;th>Representative work&lt;/th>
 &lt;th>Typical gain&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>1&lt;/td>
 &lt;td>&lt;strong>Cache Eviction&lt;/strong>&lt;/td>
 &lt;td>Drop unimportant tokens during generation&lt;/td>
 &lt;td>H₂O, SnapKV, Ada-KV&lt;/td>
 &lt;td>~80% memory cut, near-lossless&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>2&lt;/td>
 &lt;td>&lt;strong>Cache Compression&lt;/strong>&lt;/td>
 &lt;td>Quantize KV to 2–4 bit or low-rank projection&lt;/td>
 &lt;td>KIVI, KVQuant, Palu&lt;/td>
 &lt;td>×4–×8 memory, lossless or &amp;lt;2% accuracy drop&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>3&lt;/td>
 &lt;td>&lt;strong>Hybrid Memory&lt;/strong>&lt;/td>
 &lt;td>Move KV to CPU/SSD; keep only hot entries on GPU&lt;/td>
 &lt;td>vLLM/PagedAttention, FlexGen, Oneiros&lt;/td>
 &lt;td>Run huge models on one GPU, ×6 batch, ×3–×33 throughput&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>4&lt;/td>
 &lt;td>&lt;strong>New Attention&lt;/strong>&lt;/td>
 &lt;td>Replace softmax attention: O(N²) → O(N log N)&lt;/td>
 &lt;td>Linear, Log-Linear, Kimi Linear&lt;/td>
 &lt;td>×6.3 throughput, 75% memory cut (Kimi)&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>5&lt;/td>
 &lt;td>&lt;strong>Combination&lt;/strong>&lt;/td>
 &lt;td>Mix the above four&lt;/td>
 &lt;td>RocketKV, KVzip, ShadowKV, TailorKV&lt;/td>
 &lt;td>Best overall; no single technique wins everywhere&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 class="group head-tag" id="seven-deployment-scenarios--recommended-methods">Seven deployment scenarios × recommended methods&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#seven-deployment-scenarios--recommended-methods">&lt;/a>&lt;/h2>&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Scenario&lt;/th>
 &lt;th>Recommended&lt;/th>
 &lt;th>Why&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>Ultra-long context (&amp;gt;1M) single request&lt;/td>
 &lt;td>Eviction + Compression; Kimi Linear&lt;/td>
 &lt;td>Memory is the bottleneck; must shrink the cache&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Minimal model modification&lt;/td>
 &lt;td>Ada-KV, SnapKV, KIVI&lt;/td>
 &lt;td>All fine-tuning-free, plug-and-play&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>High-throughput datacenter&lt;/td>
 &lt;td>PagedAttention/vLLM, Oneiros, ShadowKV&lt;/td>
 &lt;td>Large batches, lossless, multi-tenant&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Edge / memory-limited devices&lt;/td>
 &lt;td>InfiniPot, TailorKV&lt;/td>
 &lt;td>8B/128K on a 24GB GPU&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Multi-turn conversations&lt;/td>
 &lt;td>RocketKV-MT, KVzip, ShadowKV&lt;/td>
 &lt;td>Cannot permanently drop tokens like H₂O&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Prefill-heavy (long prompts)&lt;/td>
 &lt;td>NACL, HashEvict, LayerKV, MiniCache&lt;/td>
 &lt;td>Focus on TTFT (time to first token)&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Accuracy-critical reasoning&lt;/td>
 &lt;td>PagedAttention&lt;/td>
 &lt;td>Lossless offload; avoid eviction/compression/linear attention&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 class="group head-tag" id="key-conclusion">Key conclusion&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#key-conclusion">&lt;/a>&lt;/h2>&lt;p>&lt;strong>There is no silver bullet.&lt;/strong>&lt;/p></description></item></channel></rss>