<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Inference on k4i's blog</title><link>https://k4i.top/tags/inference/</link><description>Recent content in Inference on k4i's blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>sky_io@outlook.com (K4i)</managingEditor><webMaster>sky_io@outlook.com (K4i)</webMaster><copyright>All content is subject to the license of &lt;a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank"&gt;CC BY-NC-SA 4.0&lt;/a&gt; .</copyright><lastBuildDate>Mon, 20 Apr 2026 12:00:00 +0800</lastBuildDate><atom:link href="https://k4i.top/tags/inference/index.xml" rel="self" type="application/rss+xml"/><item><title>Why KV Cache Works in LLM Inference</title><link>https://k4i.top/posts/kv-cache/</link><pubDate>Mon, 20 Apr 2026 12:00:00 +0800</pubDate><author>sky_io@outlook.com (K4i)</author><atom:modified>Wed, 22 Apr 2026 01:27:12 +0800</atom:modified><guid>https://k4i.top/posts/kv-cache/</guid><description>&lt;h2 id="introduction"&gt;introduction&lt;/h2&gt;
&lt;p&gt;large language models generate text &lt;strong&gt;autoregressively&lt;/strong&gt; — one token at a time, each new token conditioned on all previous tokens. this sequential nature creates a fundamental opportunity for optimization: most of the computation at each step is &lt;em&gt;redundant&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;the &lt;strong&gt;KV cache&lt;/strong&gt; is the technique that exploits this redundancy. by storing the key and value vectors from previous decoding steps, we avoid re-computing them, turning an \(O(n^2)\) per-step cost into \(O(n)\) — at the price of extra memory.&lt;/p&gt;</description><dc:creator>K4i</dc:creator><media:content url="https://k4i.top//images/posts/kv-cache/cover.png" medium="image"><media:title type="html">featured image</media:title></media:content><category>llm</category><category>inference</category><category>kv-cache</category><category>transformer</category><category>optimization</category><category>AI</category></item></channel></rss>