<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on yapingyang</title><link>https://yapingyang.github.io/posts/</link><description>Recent content in Posts on yapingyang</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 01 Aug 2026 16:54:12 -0400</lastBuildDate><atom:link href="https://yapingyang.github.io/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Attention, KV Cache, and Prompt Caching Explained From First Principles</title><link>https://yapingyang.github.io/posts/attention-kv-cache-and-prompt-caching-explained-from-first-principles/</link><pubDate>Sat, 01 Aug 2026 16:54:12 -0400</pubDate><guid>https://yapingyang.github.io/posts/attention-kv-cache-and-prompt-caching-explained-from-first-principles/</guid><description>&lt;h2 id="what-is-an-attention-mechanism-and-what-does-it-solve"&gt;What Is an Attention Mechanism, and What Does It Solve?&lt;/h2&gt; &lt;p&gt;A large language model cannot store the word &amp;ldquo;cat&amp;rdquo;, only numbers. So every word has to become a list of numbers, which we&amp;rsquo;ll call a vector, looked up from a big table. But here&amp;rsquo;s the catch, that lookup is context-free, meaning &amp;ldquo;it&amp;rdquo; in the sentence &amp;ldquo;the cat eats because it was hungry&amp;rdquo; has the same vector representation &amp;ldquo;it&amp;rdquo; gets in every other sentence. On its own, it knows nothing about the cat.&lt;/p&gt;</description></item></channel></rss>