<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Vizuara’s Substack]]></title><description><![CDATA[My personal Substack]]></description><link>https://vizuara.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!D3Nd!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png</url><title>Vizuara’s Substack</title><link>https://vizuara.substack.com</link></image><generator>Substack</generator><lastBuildDate>Wed, 04 Nov 2026 08:22:07 GMT</lastBuildDate><atom:link href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Ffeed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Vizuara AI]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[vizuara@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[vizuara@substack.com]]></itunes:email><itunes:name><![CDATA[Vizuara AI]]></itunes:name></itunes:owner><itunes:author><![CDATA[Vizuara AI]]></itunes:author><googleplay:owner><![CDATA[vizuara@substack.com]]></googleplay:owner><googleplay:email><![CDATA[vizuara@substack.com]]></googleplay:email><googleplay:author><![CDATA[Vizuara AI]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[JEV : What a Model Built for Decisions Rather Than Text Would Have to Look Like]]></title><description><![CDATA[Most of what we use AI for in production is a judgment/decision, not a sentence. Jev is a model built on that assumption trying to optimize prediction calibration, speed while reducing the compute.]]></description><link>https://vizuara.substack.com/p/jev-what-a-model-built-for-decisions</link><guid isPermaLink="false">https://vizuara.substack.com/p/jev-what-a-model-built-for-decisions</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 05 Oct 2026 03:30:59 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GBi3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>Table of contents</strong></h1><ol><li><p><em>Introduction</em></p></li><li><p><em>The semantics of language generation</em></p></li><li><p><em>The two systems, and a third</em></p></li><li><p><em>A generalized, constrained decision model</em></p></li><li><p><em>The Ideal Case</em></p></li><li><p><em>What is Jev?</em></p></li><li><p><em>Methodology</em></p><ol><li><p><em>A problem, and an open-source solution to it</em></p></li><li><p><em>Architecture: the encoder was always the right tool</em></p></li><li><p><em>Data: outcomes, not labels</em></p></li><li><p><em>Training: what the objective actually asks for</em></p></li><li><p><em>This is a calibration metric used as a loss</em></p></li><li><p><em>RLCD: Reinforcement Learning for Calibrated Decisions</em></p></li><li><p><em>RLCD against RLHF and RLVR</em></p></li></ol></li><li><p><em>Hands-on Jev</em></p></li><li><p><em>Results</em></p></li><li><p><em>Thoughts</em></p></li><li><p><em>Conclusion</em></p></li></ol><h1>1. Introduction</h1><p>Using a modern LLM to do a predictive task is harder than it should be, and the difficulty is structural rather than incidental. You want a label, a score, or a decision your code can branch on, and what you have is a system engineered to produce text for a human to read, so you coerce it; you ask for JSON in the prompt, constrain the decoding grammar, parse the result, and add a retry for when it comes back malformed anyway. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GBi3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GBi3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 424w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 848w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 1272w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GBi3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png" width="500" height="727" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:727,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GBi3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 424w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 848w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 1272w, https://substackcdn.com/image/fetch/$s_!GBi3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb2808b1-cf03-4196-ada2-51fa90c2b3ec_500x727.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Three problems follow:</p><ul><li><p>The estimates are uncertain in a way you cannot inspect, because a confidence number produced by a text generator was never trained to correspond to how often the model is actually right. </p></li><li><p>Hallucination in a decision setting means a label outside your schema or a confident answer the context does not support. </p></li><li><p>And cost is architectural, since autoregressive models emit one token at a time, each conditioned on the last, so a decision that is logically a single choice gets paid for as a sequence and the latency cannot be bought away with more hardware.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ZuR8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZuR8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 424w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 848w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 1272w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ZuR8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png" width="1456" height="719" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:719,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZuR8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 424w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 848w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 1272w, https://substackcdn.com/image/fetch/$s_!ZuR8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f05d61-6176-4d06-9a6b-9ab4b3031d62_1664x822.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What makes this worth dwelling on is that predictive tasks are not a niche corner of what we do. Routing a ticket, scoring a lead, flagging a transaction, judging whether a tool call is safe to run; the overwhelming majority of AI inside real software is making a judgment rather than writing something, and in almost every case we are using generation as a proxy for prediction. It works, which is why nobody has pushed on it, but proxies have a way of becoming invisible until somebody removes one.</p><p>That is what TypeSafe did in September with <strong>Jev</strong>, a model that does not generate text at all; you hand it context and typed questions defined in your code, and it returns choices, scores and calibrated probabilities directly, with nothing to parse. They call it the first <strong>System One model</strong>, after Kahneman&#8217;s fast intuitive mode of thought as against the slow deliberate System Two that chat models are built for. One caveat before we start, because it shapes what this article can be: there is no paper. TypeSafe spent two years in stealth and announced a new architecture, a new sampler and a new training algorithm while publishing essentially none of it, so instead of deriving somebody&#8217;s method from their description, we will ask what a model of this kind would have to look like built from first principles, and then hold that against what has actually been published.</p><p><em>(Usual caveat: the information in this article is upper bounded by my own grasp of the topic, my patience for typing for hours, and a writing medium that still refuses to support inline LaTeX. Please re-visit everything you read here, and since there is no paper to point you to this time, go read the docs and form your own view.)</em></p><div><hr></div><h1><strong>2. The semantics of language generation</strong></h1><p>Before we can say what a decision model should look like, we need to be precise about what we are asking a language model to do when we use one for prediction, and the cleanest way in is through an analogy most readers will already have strong feelings about.</p><h3><strong>2.1 Strongly typed, loosely typed</strong></h3><p>In a strongly typed language, you declare what a function returns and the compiler checks it before anything runs; a mismatch is caught at build time, and by the time the program executes, an entire class of error has been eliminated. In a loosely typed one, the same mismatch is discovered at runtime, which is to say in production, by a user. The argument for the former has never really been about aesthetics, it is that the contract is verified before the cost of being wrong is incurred.</p><p>Now look at how we currently get structured output from an LLM. You describe the shape you want in a prompt, the model generates a string, you parse it, and you discover whether the contract held. That is runtime checking in the worst sense, because the thing being checked is not even deterministic; the same prompt can honour the schema on one call and invent a category on the next. Structured output and constrained decoding tighten this considerably, but they tighten it by validating the string as it is produced rather than by removing the string from the problem.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Enb8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Enb8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 424w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 848w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 1272w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Enb8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png" width="1456" height="624" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:624,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Enb8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 424w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 848w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 1272w, https://substackcdn.com/image/fetch/$s_!Enb8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a824257-20e0-4c4a-9cd2-3520e7f7c0f4_1758x753.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The same three-way choice, declared two ways. In the top row the contract is a sentence and the check happens after the fact; in the bottom row the contract is a type and the invalid answer has nowhere to come from.</em></p><p>The thing worth noticing is that a typed question defined in your code is checkable in a way a prompt never is. If the answer space is an enum with three members, the return type is one of three members, and that is true before the model runs, not after it has spoken. That is the actual difference between the two paradigms, and the rest of this section is about why it costs so much to get there through generation.</p><h3><strong>2.2 How much of a sentence is actually information?</strong></h3><p>Take a sentence that encodes a decision, something like &#8220;Based on the transaction history, this appears to be a duplicate charge, and therefore the refund policy supports approving it.&#8221; How much of that is the decision?</p><p>The decision is roughly two bits. Duplicate or not, approve or not. Everything else is scaffolding; <em>based on, appears to be, and therefore, supports</em>. Those words are doing real grammatical work, they make the sentence a sentence, but they carry almost no information about the answer, and crucially they are highly predictable given what came before. Once a model has committed to &#8220;and there-&#8221;, the continuation &#8220;-fore&#8221; is nearly certain.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cTWv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cTWv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 424w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 848w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 1272w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cTWv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png" width="1456" height="689" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:689,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cTWv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 424w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 848w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 1272w, https://substackcdn.com/image/fetch/$s_!cTWv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89250eca-7d3f-4655-8513-c4c594254cae_1768x837.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Illustrative per-token surprisal for the sentence above. The information is concentrated in two positions; every other forward pass is spent emitting grammar.</em></p><p>We have met this idea before, in the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fbyte-latent-transformers-patches">Byte Latent Transformers article</a>, where the whole patching mechanism was built on exactly this observation; sequences of low-entropy bytes get grouped together because they are cheap and predictable, while high-entropy points are where the model should spend its attention. BLT used entropy to allocate compute within the input. The same lens applied to the output says something uncomfortable.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;9e0b60c7-4f59-4475-be95-7536554dc9f3&quot;,&quot;caption&quot;:&quot;Recently Meta released an intriguing architecture for combining byte level tokenization and transformers at scale, which inherently not only is a better modelling choice but also opens up a multitude of potential direction for research. Let's dive into the proposed idea, but before that, let's warm up with some why? questions.&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Byte Latent Transformers : Patches Scale Better Than Tokens&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null},{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-12-20T06:40:12.775Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4787f8e-660e-492e-8e86-ae8ad92b0439_1045x674.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/byte-latent-transformers-patches&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:153304556,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:7,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>If we write the information content of a generated sequence as the sum of per-token surprisals,</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H(y)  =  &#8722; &#931;_{i=1..|y|}  log P( y_i | y_{<i}, x )&quot;,&quot;id&quot;:&quot;UMVWZUNEUX&quot;}" data-component-name="LatexBlockToDOM"></div><p>then for a decision expressed in prose, the overwhelming majority of that sum comes from a handful of positions and the rest contributes almost nothing. But an autoregressive model does not know that in advance, and more importantly it cannot act on it even if it did, because every token requires a forward pass regardless of how predictable it was. <strong>You pay uniformly for a signal that is distributed extremely unevenly.</strong> A decision worth two bits costs you forty forward passes, thirty-eight of which are spent emitting grammar.</p><p>And those passes are sequential, which is the part that no amount of hardware fixes. Each token is conditioned on the last, so the latency floor is the length of the output, not the size of your cluster.</p><h3><strong>2.3 Generation as constrained optimization</strong></h3><p>Let us make this precise, because the optimization framing is where the difference becomes structural rather than merely wasteful.</p><p>Unconstrained generation searches over all sequences the vocabulary can produce:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y*  =  argmax \\quad y &#8712; V*  of  P( y | x )&quot;,&quot;id&quot;:&quot;XVRODZVBDB&quot;}" data-component-name="LatexBlockToDOM"></div><p style="text-align: center;"></p><p>where V* is every finite string over the vocabulary, an unimaginably large space of which the overwhelming majority is nonsense. The model&#8217;s job is to concentrate probability mass on the thin sliver that is fluent and relevant, and it does this remarkably well, which is the entire achievement of language modelling.</p><p>Structured output narrows the feasible set to the strings that satisfy a grammar:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y*  =  argmax \\quad y &#8712; L  of  P( y | x ),      L &#8834; V*&quot;,&quot;id&quot;:&quot;WRKRCYXLPW&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is a genuine improvement and it is why constrained decoding works. But read the mechanism carefully; at each step you compute a distribution over the full vocabulary and then mask out the tokens that would violate the grammar. The search space has been restricted, the <em>computation</em> has not. You are still taking |y| sequential passes, still evaluating all of V at each one, and still doing it to arrive at an answer that was, all along, one of three options.</p><p>Now write what we actually wanted:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;a*  =  argmax \\ over\\ a &#8712; A\\  of\\  P( a | x ),      |A|\\ small\\ and\\ known&quot;,&quot;id&quot;:&quot;DFVBWOZBNB&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WHkG%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WHkG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 424w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 848w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 1272w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WHkG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png" width="1311" height="729" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:729,&quot;width&quot;:1311,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WHkG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 424w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 848w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 1272w, https://substackcdn.com/image/fetch/$s_!WHkG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ca807d9-a2c6-404c-a4c2-1485171bd3a0_1311x729.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Three nested feasible sets. Constrained decoding moves you from the outer box to the middle one; a decision model operates natively in the inner one.</em></p><p>The feasible set is no longer a subset of string space, it is a finite answer set defined in your code; A might have two members or two hundred, and Jev caps it at 255. And this changes the problem qualitatively rather than quantitatively, because when the answer set is small and enumerable you do not need to search it one token at a time. You can evaluate the whole distribution over A in a single pass, which is precisely what removes both the sequential latency and the uniform cost on uninformative tokens.</p><p>That is the gap this article is about. Constrained decoding projects a generation problem onto the feasible set after the fact. What we are describing optimizes over the feasible set natively, and a model built that way is a different object from a language model wearing a grammar.</p><p>But having established the shape of the difference, we are left with two questions that the mathematics does not answer. The first is practical: <em>which</em> real problems actually have this shape, because |A| being small and known is a property of the task rather than something you can impose on an arbitrary one, and it would be useful to have a way of recognizing those tasks on sight. The second is about trust: if the model returns a distribution over A rather than a sentence, we are going to make decisions based on those numbers, and we need to know what the numbers mean before we build anything on top of them. The next section gives us vocabulary for both.</p><div><hr></div><h1>3. The two systems, and a third</h1><p>Two things need naming before we can look at the model itself, and they answer the two questions we just left open. The first is a frame for recognizing which problems belong in this category at all, borrowed from psychology and used here somewhat loosely. The second is the property that decides whether the output can be trusted, which is considerably more technical and which I think is the single most important idea in this article.</p><h3><strong>3.1 System One and System Two</strong></h3><p>The name comes from Kahneman, who split human cognition into two modes in <em>Thinking, Fast and Slow</em>. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RsJI%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RsJI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RsJI%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg" width="302" height="464.61538461538464" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1000,&quot;width&quot;:650,&quot;resizeWidth&quot;:302,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Thinking, Fast and Slow : Kahneman, Daniel: Amazon.in: Books&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Thinking, Fast and Slow : Kahneman, Daniel: Amazon.in: Books" title="Thinking, Fast and Slow : Kahneman, Daniel: Amazon.in: Books" srcset="https://substackcdn.com/image/fetch/$s_!RsJI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RsJI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2523c7-1dc6-4f8e-be2f-71781d5a115a_650x1000.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>System 1 is fast, automatic and effortless; it is what recognizes a face, reads a word without deciding to, senses that a room feels tense, or knows a sentence is ungrammatical before you could say why. System 2 is slow, deliberate and expensive; it is what multiplies seventeen by twenty-four, compares two mortgage offers, or follows an argument through four steps to check whether it holds.</p><p>The useful part of the distinction is not speed, though, it is <strong>structure</strong>, and this is where the section connects back to what we built in Section 2. System 1 is not a faster System 2 working on the same problem; it is a different operation on a differently shaped problem, a match against an answer space that is already known rather than a search through a space that has to be constructed. Which is exactly the distinction we drew in optimization terms, because searching over V* for a fluent sequence and selecting from a known A are not the same problem at different speeds, they are different problems. <strong>A System 1 task is one whose feasible set is small, enumerable and fixed in advance.</strong> That is the whole of it, and it is why the two framings are really one framing; Kahneman&#8217;s vocabulary describes in cognitive terms what the nested-sets diagram describes in mathematical ones.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Oecz%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Oecz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 424w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 848w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 1272w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Oecz%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png" width="1407" height="729" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:729,&quot;width&quot;:1407,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Oecz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 424w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 848w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 1272w, https://substackcdn.com/image/fetch/$s_!Oecz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59ea8aa8-fecf-4d43-8e4c-96fbe2098118_1407x729.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The same distinction twice. Kahneman&#8217;s vocabulary describes in cognitive terms what the nested-sets diagram describes in mathematical ones.</em></p><p>Today&#8217;s chat models are System 2 machines by design and correctly so. They are built to work through novel problems, construct chains of reasoning, and produce answers nobody enumerated beforehand, with a human reading the output. That is a genuine achievement and the right tool for an enormous number of tasks.</p><p>But it is the wrong tool for ticket routing, and now we can say why precisely rather than observing that it feels slow. <strong>Ticket routing is a System 1 problem being solved by a System 2 machine.</strong> The answer space is three teams, known in advance, enumerable; there is nothing to search and nothing to construct, and what is needed is a match against candidates we already hold. Instead we deploy a machine that builds a sentence one token at a time in order to tell us which of the three it picked.</p><p>I should flag that the metaphor is marketing as much as it is science. Kahneman&#8217;s dual-process account is a description of human cognition still under dispute among psychologists rather than an architectural specification, and nothing about Jev literally implements System 1. What the name usefully captures is the shape of the problem being targeted; bounded, enumerable, pattern-matched, answers known ahead of time. Read as a claim about the task rather than the mechanism, it holds up well.</p><h3><strong>3.2 A hypothesis: System Three</strong></h3><p>Here is where I want to speculate slightly, because the two-system framing has an obvious hole once you start building with it.</p><p>If some of your decisions are System 1 and some are System 2, something has to decide which is which. That dispatcher is not doing either kind of work; it is not pattern-matching an answer and it is not reasoning through a novel problem, it is deciding what kind of problem it is looking at and routing accordingly. Call it <strong>System Three</strong>, and note that this is not quite as invented as it sounds, since Stanovich&#8217;s tripartite model of cognition already splits Kahneman&#8217;s System 2 into an algorithmic mind that executes and a reflective mind that decides what is worth executing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PMJd%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PMJd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 424w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 848w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 1272w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PMJd%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png" width="1456" height="780" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:780,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PMJd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 424w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 848w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 1272w, https://substackcdn.com/image/fetch/$s_!PMJd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbebeaf16-61fb-496d-825b-c2203ce3f633_1535x822.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The dispatcher nobody names. It is not doing either kind of work; it is deciding which kind of work the request needs, and that judgment is itself bounded and enumerable.</em></p><p>The reason this matters practically is that every agent harness already has a System Three and nobody calls it that. Something decides whether a user request needs the fast model or the expensive one. Something decides whether a tool call is risky enough to interrupt and ask about. Something decides whether the current answer is good enough to return or needs another loop. Those are all metacognitive decisions, made constantly, and until recently they were made either by hand-written heuristics or by burning a full reasoning-model call to ask.</p><p>And the interesting thing, which we will see concretely in the hands-on section, is that a System One model turns out to be a very good System Three. Deciding which model should handle this request is itself a bounded, enumerable, pattern-matched judgment; the answer space is your list of models, the state is the request, and the decision wants to be fast because it sits on the critical path of every single call. So you end up with a System One model whose job is to decide when System Two is needed, which is a slightly recursive arrangement but a sensible one.</p><p>I offer this as a frame rather than a claim. TypeSafe does not use the term and nothing in their material depends on it. But I find it clarifies why this category of model is interesting beyond cost; it is not only that some decisions get cheaper, it is that the orchestration of expensive reasoning becomes something you can afford to do well.</p><h3><strong>3.3 Calibration, which is the load-bearing word</strong></h3><p>Now the property everything rests on, and the one most likely to be skimmed because it sounds like a technicality.</p><p>Any classifier can emit a number between zero and one; a softmax guarantees they sum to one and tells you nothing whatsoever about whether they mean anything. <strong>Calibration</strong> is the much stronger property that the numbers correspond to observed frequencies, so that among all the cases where the model says 0.8 it is right about 80% of the time. If it is right 95% of the time the model is underconfident, and if it is right 60% of the time it is overconfident, and in both cases the number is lying to you even though the ranking may be perfectly good.</p><p>We went through this properly in the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa-primer-on-uncertainty-and-calibration">uncertainty and calibration primer</a>, including why modern networks tend to be badly overconfident and what a reliability diagram actually shows, so I will not rebuild the machinery here.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;2beb264e-c418-4a43-ad9c-2458fcbcd166&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A Primer on Uncertainty and Calibration in Deep Learning&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-06-02T04:05:06.398Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!Ltzw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d9bf56-da44-44cb-8d21-35031efcee86_800x450.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/a-primer-on-uncertainty-and-calibration&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:164710543,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:4,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>What I want to add is why it matters <em>more</em> in this setting than in the ones we discussed there. In a conventional classifier the probability is usually decoration; you take the argmax and move on, and whether 0.8 really meant 80% rarely changes what the system does. In a decision model the probability is the <strong>control surface</strong>. You are going to write code that acts automatically above 0.9, escalates to a human below 0.6, and calls a reasoning model in between, and every one of those thresholds is meaningless unless the number means what it says. An uncalibrated model with excellent accuracy will route confidently wrong cases straight past your human review, because it was confidently wrong about precisely the cases the threshold existed to catch.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j-Uh%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j-Uh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 424w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 848w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 1272w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j-Uh%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png" width="1245" height="878" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:878,&quot;width&quot;:1245,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j-Uh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 424w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 848w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 1272w, https://substackcdn.com/image/fetch/$s_!j-Uh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dd0754b-dbc4-4a08-87cd-2e2b9d0f2c2e_1245x878.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>A reliability diagram. The shaded area is the distance between what the model claims and what it delivers, and the threshold is where your code stops asking anyone.</em></p><p>This is also why TypeSafe&#8217;s training algorithm is called Reinforcement Learning for <em>Calibrated</em> Decisions rather than something about accuracy. The claim is not merely that the answers are good, it is that the uncertainty attached to them is honest, and those are separate properties that can be optimized separately.</p><p>One caveat the docs are admirably direct about, and which is easy to misread. Calibration is measured <strong>across groups of predictions</strong>, never within one. A well-calibrated 0.8 tells you that cases like this one are right about eighty percent of the time; it does not tell you that this particular answer is eighty percent correct, because this particular answer is either right or wrong and there is no eighty about it. The distinction sounds pedantic until somebody builds a system that treats a single confidence score as a per-case guarantee, which is exactly the mistake the property invites.</p><p>So we now have both pieces. A <strong>System One task</strong> is one whose answer space is small, enumerable and fixed in advance, which is Section 2&#8217;s feasible set stated in cognitive rather than mathematical terms. And <strong>calibration</strong> is what makes the returned distribution usable as a control surface rather than decoration, which is what we need if code is going to act on it without a human reading the output first.</p><p>Which raises the obvious question, and it is the one the next section is about. If a model is going to serve <em>every</em> task of this shape rather than being trained for one of them, what exactly is that model? It cannot be a classifier in the usual sense, because a classifier&#8217;s labels are baked in at training time and we have just said the answer space arrives at call time. So what is it?</p><div><hr></div><h1><strong>4. A generalized, constrained decision model</strong></h1><h3><strong>4.1 The generalized classifier</strong></h3><p>The answer begins with an observation that is obvious in hindsight and that I had never quite put together until I started reading about this.</p><p>Imagine you have trained three models; one that detects spam, one that flags fraudulent transactions, and one that tags named entities in text. These are different tasks in different domains with different label sets, and in the normal course of things they are three codebases, three training runs, three deployments and three sets of eval infrastructure.</p><p>Now ask what they actually have in common, because the answer is not what you might first assume. It is not the architecture; one might be a fine-tuned BERT, another gradient-boosted trees over engineered features, another a sequence tagger with a CRF on top. It is not the data either, in the sense of subject matter, since an email and a card transaction and a sentence of news copy share nothing at all.</p><p>What they share is the <strong>shape</strong> of the problem. Each takes some context and returns a member of a known, finite set. Spam or not. Fraudulent or not. Person, organization, location, or none of them. The domains differ wildly and the structure is identical, and the thing we have been doing for fifteen years is building a new model for each domain while rebuilding that identical structure every time.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nw9U%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nw9U!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 424w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 848w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 1272w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nw9U%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png" width="1456" height="719" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:719,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nw9U!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 424w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 848w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 1272w, https://substackcdn.com/image/fetch/$s_!nw9U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fffce0af1-63b4-4ab8-84ed-56079cabc765_1664x822.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Three unrelated domains, three unrelated architectures, and an identical problem shape underneath all of them.</em></p><p>Which suggests an inversion. If the structure is what is constant, then instead of fixing the data and varying the model, <strong>fix the model and vary the structure</strong>. One model that understands natural language well enough to make a judgment about anything, into which you inject the answer space at call time rather than at training time. The spam classifier becomes a question with two options, the fraud detector becomes a question with two options and some transaction records as context, the entity tagger becomes a question with four options asked once per span.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21LdLS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LdLS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 424w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 848w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 1272w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21LdLS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png" width="1456" height="617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:617,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LdLS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 424w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 848w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 1272w, https://substackcdn.com/image/fetch/$s_!LdLS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F176266d3-945f-49fd-8a53-e622adbe426c_1503x637.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The inversion. Rather than training a model per label set, the label set arrives with the request.</em></p><p>That is what Jev is, and it is worth saying plainly before we complicate it: <strong>a generalized classifier whose label set you supply at inference time.</strong> Everything else in this section is about why that is harder than it sounds and what you get when it works.</p><h3><strong>4.2 Why not just use an LLM for this?</strong></h3><p>The obvious objection is that we already have models which understand language well enough to make these judgments, and we have been using them for exactly this. So what is actually wrong?</p><p>It helps to think about it in terms of entropy, since that is the language we used in Section 2 and it makes the mismatch precise.</p><p>An autoregressive language model places a distribution over sequences, and the entropy of that distribution is enormous. At each step it is choosing among a vocabulary of perhaps a hundred thousand tokens, and over a sequence of length n the space has size |V|&#8319;. The model&#8217;s entire job is to concentrate probability onto the vanishingly small fraction of that space which is fluent and relevant, and it is extraordinarily good at this, which is the whole achievement of language modelling.</p><p>A decision has an entropy of at most log|A|. For a three-way routing choice that is about 1.6 bits. For a yes-or-no question it is one bit.</p><p style="text-align: center;"><em>H(decision)  &#8804;  log&#8322; |A|        versus        H(sequence)  ~  n &#183; log&#8322; |V|</em></p><p>So when we use an LLM for a decision, we take a machine built to navigate an astronomically large space and point it at a problem whose answer space has three members. The model does not know the space is small. It is still computing a full distribution over its vocabulary at every step, still spending its capacity on the question of what word plausibly comes next, and the fact that only 1.6 bits of the output actually matter is information available to us and not to it.</p><p>There is a second mismatch that is subtler and, I think, more damaging. <strong>The probability of a token is not the probability of a decision.</strong> When a model emits the token &#8220;billing&#8221; with probability 0.87, that number is the likelihood of that token appearing at that position in text, conditioned on everything before it. It is not the model&#8217;s belief that billing is the right team. Those two quantities are correlated, often quite strongly, and they are not the same thing, and nothing in next-token-prediction training ever asks them to be. This is why extracting confidence from an LLM&#8217;s logits gives you something that behaves roughly like confidence while failing exactly the calibration test from Section 3.</p><p>So the answer to &#8220;why not just use an LLM&#8221; is that you can, and people do, and it works adequately. But you are paying for an enormous search you do not need, and the uncertainty you get back is a byproduct of a different objective rather than an estimate of what you actually asked.</p><h3><strong>4.3 Where the tokens go</strong></h3><p>The cost consequence is worth seeing laid out, because it is not uniform across the three parts of an LLM call.</p><p>A chat-model request has an input, possibly some reasoning, and an output. The input is usually the largest in raw token count, but it is also the cheapest per token, it is processed in parallel rather than sequentially, and it is frequently cached. Reasoning tokens and output tokens are where the cost and latency actually live, and they are priced accordingly; on current frontier models output tokens cost several times what input tokens do, precisely because each one requires its own forward pass that cannot be batched with the others.</p><p>Now look at what happens to that profile when the output is a choice rather than a sentence.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-BD8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-BD8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 424w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 848w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-BD8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png" width="1456" height="789" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:789,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-BD8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 424w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 848w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!-BD8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14c6663f-a4d6-42ba-86a0-fc2166187f0f_1961x1062.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Illustrative rather than measured. The input does not shrink and should not, since the context is what grounds the decision; what collapses is the expensive end.</em></p><p>The input does not shrink, and should not, because the context is what grounds the decision and you want to give it everything relevant. Reasoning may or may not be present depending on whether the task needs it. But the output collapses from a sentence to a value, and since the output is the expensive end, the economics change shape rather than merely scaling down.</p><p>I want to be careful here, because there is a sloppy version of this claim going around that says output cost goes to zero. It does not. A choice still has to be produced, there is still computation behind it, and TypeSafe still charges for tokens. What is true is that the output becomes <strong>insignificant relative to the input</strong>, which is a different and more defensible statement. We will return to this in the Thoughts, because the gap between &#8220;free&#8221; and &#8220;negligible&#8221; matters more than it sounds.</p><h3><strong>4.4 What this unlocks, practically</strong></h3><p>Abstractly, cheap calibrated decisions sound like an infrastructure improvement. Concretely they change what is worth building, and the clearest examples are in the places where volume has always been the obstacle.</p><p>Take customer interaction at scale. A sales team with fifty thousand inbound leads cannot afford to have a frontier model read each one and judge intent, fit and urgency, so they use keyword rules and a scoring heuristic that everybody knows is crude and nobody can justify improving because the model calls would cost more than the leads are worth. Drop the per-decision cost by two orders of magnitude and the calculation inverts; now you can ask six questions of every lead, and more importantly you can ask them <em>again</em> whenever the context changes rather than scoring once at capture.</p><p>The same pattern appears anywhere a judgment currently happens either rarely or crudely because it was too expensive to do properly. Content moderation on every message rather than on a sample. Support ticket triage on arrival rather than after a queue delay. Marketing segmentation recomputed per interaction rather than nightly. Routing every agent request to an appropriately sized model rather than sending everything to the largest one.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dXC3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dXC3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 424w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 848w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 1272w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dXC3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png" width="1456" height="863" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:863,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dXC3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 424w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 848w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 1272w, https://substackcdn.com/image/fetch/$s_!dXC3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa3d7271-ba2b-4328-bce4-2f49c8d9f96b_1503x891.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The band in the middle is the article&#8217;s practical claim: a set of judgments that were always desirable and never affordable.</em></p><p>And this is where the naming becomes relevant, because Jev is named after William Stanley Jevons, who observed that making a resource cheaper to use does not reduce consumption of it but increases it. If TypeSafe is right about the cost curve, the interesting consequence is not that your existing classification bill falls by 99%. It is that decisions become cheap enough to put in a hundred places where nobody would currently consider putting one, and the aggregate load goes <em>up</em>. That is a claim about the shape of what gets built, not about anyone&#8217;s invoice, and I will come back to it at the end.</p><div><hr></div><h1><strong>5. The Ideal Case</strong></h1><p>That said and given our understanding of pre-requisits; imagine if we could specify the model we want, here is what we would ask for.</p><ol><li><p><strong>It reads like a language model.</strong> Messy human text, a ticket with typos, a log excerpt, three transaction records and a paragraph of policy, understood the way a competent colleague would understand it on first reading.</p></li><li><p><strong>It answers like a function.</strong> I declare the answer space in my own code, and that declaration is a contract; if I say the answer is one of three things, a fourth has nowhere to come from. No parsing, no validation, no retry.</p></li><li><p><strong>The probability means something.</strong> Not a softmax, not a confidence the model generated because I asked for one. A number I can threshold; when it says 0.9 across a thousand cases, roughly nine hundred are right.</p></li><li><p><strong>Many questions, one price.</strong> Real decisions decompose into several independent judgments about the same context. Asking five should cost about what asking one costs, because nothing about the second depends on the first.</p></li><li><p><strong>Latency set by the model, not the answer.</strong> An autoregressive model&#8217;s floor is how long the output is. A model evaluating a known set in one pass has a floor set by its own size. The second is low enough to sit inside a request a user is waiting on.</p></li><li><p><strong>Pay for reading, not for replying.</strong> Charge me properly for the context, which is the whole point, and nominally for an answer carrying two bits. Otherwise the economics steer me towards asking fewer questions than I should.</p></li><li><p><strong>Grounded in what I gave it.</strong> If the context does not support a conclusion, that should show up in the number rather than being filled in from training. A judgment drawing on knowledge I cannot see is one I cannot audit.</p></li></ol><h3><strong>The tension</strong></h3><p>Read that list back and there is a contradiction sitting in it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212nPY%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F13076344-e419-4376-8483-9c4e64446510_1503x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2nPY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 424w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 848w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 1272w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212nPY%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F13076344-e419-4376-8483-9c4e64446510_1503x729.png" width="1456" height="706" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/13076344-e419-4376-8483-9c4e64446510_1503x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:706,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2nPY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 424w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 848w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 1272w, https://substackcdn.com/image/fetch/$s_!2nPY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13076344-e419-4376-8483-9c4e64446510_1503x729.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>One requirement and six, pulling against each other. Everything in Sections 6 and 7 is about how that gets resolved.</em></p><p>Point 1 wants deep language understanding, and we know exactly one way to get that: pretrain something enormous on text. Points 2 through 7 want behaviour that pretraining does not give you and in places works against. The thing that understands language is an autoregressive generator, and an autoregressive generator is slow, untyped, and produces token probabilities rather than decision probabilities.</p><p>So the specification is for something that is <strong>a language model on the way in and a classifier on the way out</strong>. Not an LLM with a grammar bolted on, which keeps all the sequential cost. Not a classifier with better features, which has its labels welded in and no real understanding of what it reads.</p><h3><strong>What we are giving up</strong></h3><p><strong>No explanation.</strong> A model returning a value has nowhere to put a reason. When an answer looks wrong you have the context, the question and the number, and nothing else.</p><p><strong>No surprises.</strong> The answer space is fixed before the model runs. If the right answer is not in the set, you get the nearest one with whatever confidence it has, not a warning that the set was wrong.</p><p>Neither is fixed by a better model. They are the price of the shape, and the shape is what we came for.</p><div><hr></div><h1><strong>6. What is Jev?</strong></h1><h3><strong>6.1 The answer to the tension</strong></h3><p>Section 5 ended on a contradiction: the specification needs a language model on the way in and a classifier on the way out, and those are two different machines.</p><p>Jev&#8217;s answer, as far as anyone outside TypeSafe can tell, is to keep the first and discard the second half of what usually comes with it. It understands language the way a pretrained model does and it does not generate. You send it a <strong>state</strong>, the context the judgment is about, together with one or more <strong>questions</strong> defined in your code, and it returns typed values with probabilities. No prose, no code, no rationale, nothing to parse.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uMF-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uMF-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 424w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 848w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 1272w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uMF-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png" width="1456" height="643" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:643,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uMF-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 424w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 848w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 1272w, https://substackcdn.com/image/fetch/$s_!uMF-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16b73218-26fe-4a7b-954c-b50ee2dbb5dd_1546x683.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Two inputs, one pass, a typed answer. Nothing in the path emits a token.</em></p><p>The crucial word is <strong>non-autoregressive</strong>. Jev does not emit tokens one at a time conditioned on the last, which is what collapses the latency floor from the length of the answer to the size of the model. That single architectural fact is doing most of the work behind points 2, 5 and 6 on our list.</p><p>TypeSafe calls this a System One model and Jev is the first public one. How it is built, they have not said.</p><h3><strong>6.2 Three primitives</strong></h3><p>The answer space is declared through one of three question types.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MomH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MomH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 424w, https://substackcdn.com/image/fetch/$s_!MomH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 848w, https://substackcdn.com/image/fetch/$s_!MomH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 1272w, https://substackcdn.com/image/fetch/$s_!MomH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MomH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png" width="1456" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MomH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 424w, https://substackcdn.com/image/fetch/$s_!MomH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 848w, https://substackcdn.com/image/fetch/$s_!MomH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 1272w, https://substackcdn.com/image/fetch/$s_!MomH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdadb9d38-9fbb-4760-b8fb-bf1a14e9e37f_1849x797.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Choice returns a distribution over your options; Score returns a continuous value between ordered levels; Noul returns the probability that a statement is true.</em></p><p><strong>Choice</strong> selects one option from a set, returning a probability for every option plus a confidence. Up to 255 members.</p><p><strong>Score</strong> rates the state against ordered levels, and because the levels have a direction the model returns a continuous value between them; 1.4 on a zero-to-two frustration scale rather than a forced bucket.</p><p><strong>Noul</strong> answers yes or no and returns the probability that the statement is true. TypeSafe&#8217;s own coinage, and the one you reach for most.</p><p>The design philosophy is <strong>decomposition</strong>. Rather than one large question requiring the model to weigh several things at once, you ask several small ones and combine them in code: <em>was a refund requested</em>, <em>does the evidence suggest a duplicate charge</em>, <em>does the policy permit it</em>. Judgment in the model, policy in your repository.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pfvn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pfvn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 424w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 848w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 1272w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pfvn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png" width="1456" height="661" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pfvn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 424w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 848w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 1272w, https://substackcdn.com/image/fetch/$s_!pfvn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb50cfd95-774b-49f1-9f3e-09ab9025a52c_1503x682.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The model is asked what it can judge; the rules about what to do with those judgments stay in code you can read and change.</em></p><p>And because the questions are independent they are evaluated <strong>in parallel in a single pass</strong>, so a fourth question barely moves the latency. That is point 4 satisfied directly.</p><h3><strong>6.3 Where it meets the spec, and where it does not</strong></h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pZrF%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pZrF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 424w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 848w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 1272w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pZrF%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png" width="1129" height="666" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:666,&quot;width&quot;:1129,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:138720,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/218752133?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pZrF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 424w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 848w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 1272w, https://substackcdn.com/image/fetch/$s_!pZrF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3d56664-59ef-408d-a0c8-aa20a8c83af0_1129x666.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Three of the seven are vendor claims rather than verified properties, and the third is the one I would most want independent evidence for, since calibration is what the whole control-surface argument rests on.</p><h3><strong>6.4 The numbers, and how to read them</strong></h3><p>TypeSafe reports 70&#8211;500 ms end to end, 40&#8211;200&#215; faster than frontier models on this class of query, and headline figures of 193.6&#215; faster and 444.6&#215; cheaper. Context is 64k tokens per request, with state plus the longest question fitting inside 32k.</p><p>Treat these as vendor claims. They are comparisons the vendor chose against baselines the vendor selected, on a task shape the vendor defined. That does not make them wrong; it makes them unverified. The independent evaluations in Section 8 are more useful precisely because nobody involved had a stake in the result.</p><h3><strong>6.5 What it is not</strong></h3><p><strong>It does not write.</strong> No prose, no code, no explanations. A complement to a generative model, not a replacement.</p><p><strong>It is not a drop-in LLM replacement.</strong> It handles the classification work we currently route to chat models, and nothing else.</p><p><strong>It is hosted and proprietary.</strong> Not fine-tuned on your data, not self-hostable, reachable through one endpoint. A different kind of dependency from a classifier you trained yourself, and worth noticing before cheap decisions make it tempting to put one in a hundred places.</p><p><strong>And the method is undisclosed.</strong> Two years in stealth produced a new architecture, a new sampler and a new training algorithm, none of which has been published. The next section is about what can be inferred anyway.</p><div><hr></div><h1><strong>7. Methodology</strong></h1><h3><strong>7.1 A problem, and an open-source solution to it</strong></h3><p>Everything so far has described what Jev does. This section is about how, and it runs into the wall I flagged in the introduction: TypeSafe has published nothing. Two years in stealth, a new architecture, a new sampler and a new training algorithm, all undisclosed.</p><p>Fortunately the category did not stay closed for long. <strong>Laya</strong>, from Convai Innovations, is an open-weight System One model released under Apache 2.0 with the same three primitives, the same single-pass evaluation, and the same training approach. It is 421M parameters, runs locally in about a gigabyte, and the weights, export scripts and training configuration are all public.</p><p>So for the rest of this section I will describe Laya and treat it as evidence about the category. The two models are not the same and I will be clear about which claims come from where, but the architectural questions, how do you get a language model to answer like a classifier and how do you train a probability to be honest, have public answers now, and those answers are almost certainly close to what TypeSafe is doing.</p><h3><strong>7.2 Architecture: the encoder was always the right tool</strong></h3><p>The answer to Section 5&#8217;s tension turns out to be slightly embarrassing in hindsight, which is that we already had the architecture and stopped using it.</p><p>Laya is a <strong>bidirectional encoder</strong> with a decision head on top. The English checkpoint is ModernBERT-large; the multilingual one is mmBERT-based, covering 100+ languages. That is the BERT lineage, not the GPT lineage, and the distinction is exactly what matters here.</p><p>An autoregressive decoder reads left to right because it has to; it is predicting the next token and must not see the future. An encoder has no such constraint. Every token attends to every other token in both directions, the whole input is processed at once, and what comes out is a representation of the entire state rather than a prediction about what follows it. For understanding a thing, that is strictly better. For generating text, it is useless.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-l-2%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-l-2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 424w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 848w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 1272w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-l-2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png" width="1456" height="836" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:836,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-l-2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 424w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 848w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 1272w, https://substackcdn.com/image/fetch/$s_!-l-2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf70aeb-05a0-411d-bb7d-23a4623e1e96_1545x887.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The same sentence under two attention patterns. The triangle is why generation is sequential; the full square is why a decision is not.</em></p><p>And it is not only Laya. GLiNER2.5-Decide, an open 340M model from Fastino, uses <strong>DeBERTa-v3-large</strong> as its encoder and exposes the same call-time label sets in a single forward pass. Two independent teams reaching independently for the same architecture family is stronger evidence for the argument above than either one alone. The encoder was the right tool, and the only reason it stopped being obvious is that the field spent five years optimizing for generation.</p><p>Which is why the field moved on. Once generation became the goal the decoder won, and encoders became what you reached for when you had a specific classification task and some labelled data.</p><p><strong>But we are not generating.</strong> We want a representation of the state good enough to answer questions about it, and a bidirectional encoder is the right machine for that and always was. The novelty is not the encoder; it is what sits on top.</p><p>The decision head takes the encoder&#8217;s representation together with the question&#8217;s answer space and produces a distribution over the options. One forward pass, no decode loop, and because the questions are independent given the representation, all of them are answered from the same pass. That is where the latency goes: Laya reports 32.8 ms p50 for a routed question against Jev&#8217;s 236&#8211;276 ms, and both are a different order of magnitude from a chat model&#8217;s one to three seconds.</p><h3><strong>7.3 Data: outcomes, not labels</strong></h3><p>Before the training objective, a word about what it needs to consume, because this is the part nobody discusses and it is harder than it looks.</p><p>The encoder pretraining is unremarkable and public. ModernBERT and mmBERT are trained the way encoders have always been trained, on large text corpora with masked-language-modelling objectives, and Laya inherits that lineage rather than inventing anything.</p><p>The decision stage is where it gets interesting. <strong>A proper scoring rule needs outcomes, not labels</strong>, and those are different objects.</p><p>A labelled dataset says <em>this ticket belongs to billing</em>. An outcome dataset says <em>this ticket was routed to billing, and that turned out to be correct</em>. The first is an annotator&#8217;s judgment; the second is what happened. For training a classifier the distinction barely matters, but for training a calibrated classifier it is the whole thing, because calibration is a claim about frequencies in the world and you can only learn it from the world&#8217;s frequencies.</p><p>Which creates a sourcing problem. Annotated corpora are abundant and outcome-resolved decision logs are not; they live inside companies, they are domain-specific, and they are rarely collected with this use in mind. How either lab assembled enough of them is unstated. Laya ships three checkpoints, English, multilingual, and one tuned for enterprise decisions like customer-service routing, which at least tells you the shape of what they targeted, and Convai&#8217;s evaluation uses a 2,000-decision benchmark of their own construction.</p><p>For Jev we know nothing at all. No data description, no mixture, no scale, and no indication of whether the outcomes were collected, simulated, or derived from labels by some procedure they have not described.</p><p>I flag this not as a complaint but because it bears on the zero-shot question in 7.8. If calibration is learned from outcome distributions, then how well it transfers to your distribution depends on how much your decisions resemble the ones it was trained on, and neither lab has given you the information to judge that.</p><h3><strong>7.4 Training: what the objective actually asks for</strong></h3><p><strong>Start with what ordinary supervised learning asks for.</strong></p><p>Train a classifier the standard way and your objective is cross-entropy against a hard label; the target is 1 for the correct class and 0 for everything else. Read that literally and notice what it is telling the model: <em>you should have said one hundred percent</em>. Every training example, without exception, pushes towards maximal certainty, and the only thing restraining it is that it cannot be certain about everything at once.</p><p>So the model learns to be right, and it learns that confidence is rewarded. What it never learns is when to be unsure, because nothing in the objective ever asks. There is no example whose label says &#8220;this one is genuinely a coin flip, please output 0.5&#8221;. The gradient points at 1.0 every time.</p><p>That is the root of the overconfidence we documented in the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa-primer-on-uncertainty-and-calibration">calibration primer</a>, and it is why the usual remedy is post-hoc, temperature scaling, fitting one parameter on a validation set to squash the probabilities after training is already done. A patch applied to a model optimized for the wrong thing.</p><p><strong>Now the alternative.</strong> A <strong>scoring rule</strong> assigns a reward to a predicted probability given the outcome that occurred. It is <strong>proper</strong> if the model maximizes expected reward by reporting its true belief, and <strong>strictly proper</strong> if that is the unique maximum:</p><p style="text-align: center;"><em>Brier = (p &#8722; y)&#178;          Log-loss = &#8722; [ y log p + (1&#8722;y) log(1&#8722;p) ]</em></p><p>The difference from cross-entropy is not the formula, log-loss is cross-entropy, it is what you evaluate it against. Supervised training scores you against a hard label on one example. A scoring-rule objective scores you against <strong>observed outcomes across many predictions</strong>, which is the setting where honesty becomes optimal.</p><p><strong>A worked example.</strong> Suppose the model genuinely believes an event has probability 0.7 and is deciding what to report. Over a hundred such cases the event happens about seventy times. Reporting 0.9 costs an expected 0.250, reporting 0.5 also costs 0.250, and reporting the honest 0.7 costs 0.210.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uPeJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uPeJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 424w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 848w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 1272w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uPeJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png" width="1240" height="938" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:938,&quot;width&quot;:1240,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uPeJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 424w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 848w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 1272w, https://substackcdn.com/image/fetch/$s_!uPeJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fba0e6-21e9-4048-898e-6eec21f03e99_1240x938.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Overclaiming and hedging are both punished. The minimum sits exactly at the model&#8217;s true belief and nowhere else.</em></p><p>In general, the expected penalty for reporting q when the truth is p works out to</p><p style="text-align: center;"><em>E[Brier]  =  p(1&#8722;p)  +  (p &#8722; q)&#178;</em></p><p style="text-align: center;"><em>the first term is irreducible, the second is the penalty for lying</em></p><p>a parabola in q with its floor at q = p. The first term is the world&#8217;s own uncertainty, which no report can remove; the second is what you pay for misrepresenting your belief, in either direction.</p><p>So the objective <strong>rewards honesty rather than confidence</strong>. The model cannot improve its score by sounding more certain, which is precisely the lever cross-entropy hands it.</p><h3><strong>7.5 This is a calibration metric used as a loss</strong></h3><p>Worth naming plainly, because if you have read anything on forecast evaluation you will already have recognized it.</p><p>A strictly proper scoring rule is the classical tool for <strong>measuring</strong> calibration, not a new invention. The Brier score has a well-known decomposition:</p><p style="text-align: center;"><em>Brier  =  reliability  &#8722;  resolution  +  uncertainty</em></p><p>Reliability is exactly the gap in the reliability diagram from 3.3, the distance between what you claimed and what happened. Resolution is how much your predictions vary from the base rate, which is to say whether you are telling anyone anything. Uncertainty is a property of the data you cannot touch.</p><p>So the objective is not a novel mechanism. It takes a metric meteorologists have used for sixty years and moves it from the evaluation step to the training step, which is a real contribution but a different kind from the one the name implies.</p><p>And the decomposition surfaces a failure mode that matters. <strong>Optimizing calibration alone admits a degenerate solution</strong>: a model that ignores the input entirely and reports the base rate on every example is perfectly calibrated. If 12% of tickets are urgent, answer 0.12 always, and your reliability is flawless. It is also useless, because the resolution term is zero and you have learned nothing about any particular ticket.</p><p>A strictly proper rule does punish this, since the resolution term enters with a negative sign and the degenerate model forfeits all of it. But it means calibration and accuracy are both being optimized and they are in tension, and a model can trade some of one for the other. Which is the honest reason requirement three in the 6.3 table reads &#8220;claimed&#8221; rather than &#8220;met&#8221;.</p><h3><strong>7.6 RLCD: Reinforcement Learning for Calibrated Decisions</strong></h3><p>We now have both halves of the idea, so let us put the name to them.</p><p><strong>Reinforcement Learning for Calibrated Decisions</strong> is TypeSafe&#8217;s training algorithm and, as far as the open-source work indicates, the same approach Laya uses. Neither lab has published the method, so what follows is the shape of it rather than the details, assembled from what both say about it and from what the mathematics requires.</p><p><strong>The loop.</strong> Write the model as a policy &#960;_&#952; that takes a state x and a question with answer space A, and emits a distribution over the options:</p><p style="text-align: center;"><em>&#960;_&#952;( &#183; | x, A )  =  ( p&#8321;, p&#8322;, &#8230;, p_|A| ),      &#931;_k p_k = 1</em></p><p>The world then resolves the question, giving an outcome y &#8712; A. A strictly proper scoring rule S turns that resolution into a reward, and the objective is the expectation of it:</p><p style="text-align: center;"><em>J(&#952;)  =  E over (x, A, y) of  S( &#960;_&#952;( &#183; | x, A ),  y )</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21D0zx%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D0zx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 424w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 848w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 1272w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21D0zx%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png" width="1456" height="670" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:670,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D0zx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 424w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 848w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 1272w, https://substackcdn.com/image/fetch/$s_!D0zx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e717fd5-7565-4ab3-99cc-4fb8458ced1d_1584x729.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>A policy, an environment, a reward and an update. What is unusual is that the action is a probability and the reward is a scoring rule.</em></p><p>That is reinforcement learning in a fairly literal sense; a policy produces an output, the environment returns a reward, parameters move to increase it. What is unusual is that the action is a probability rather than a token or a move, and the reward is a scoring rule rather than a preference or a check.</p><p><strong>Why it has to be RL rather than supervised fitting.</strong></p><p>This is the part worth slowing down on, because at first glance you could imagine skipping the machinery; just collect outcomes, turn them into soft labels, and do ordinary supervised learning. It does not work, and the reason is instructive.</p><p><em>Imagine you are training a weather forecaster.</em> On Tuesday she says there is a 70% chance of rain. It rains. Was she right?</p><p>You cannot answer that. Not &#8220;you do not have enough information yet&#8221;, the question genuinely has no answer from one day. A 70% forecast is not falsified by rain and not confirmed by it either, because the forecast was never a claim about Tuesday. It was a claim about <em>the class of days that look like Tuesday</em>, and the only way to check it is to collect every day she said 70% and count how many were wet.</p><p>So there is no per-example target. The supervised framing wants to write a loss against some target t(x), and the target does not exist. All you observe is y &#8712; {0, 1}, and regressing probabilities onto hard outcomes is exactly the cross-entropy setup from 7.4 that drives everything towards 1.0.</p><p>The property we actually want is a statement about a group:</p><p style="text-align: center;"><em>E[ y | p_&#952;(x) = q ]  =  q      for every q in [0, 1]</em></p><p>Read it carefully: among all the inputs on which the model says q, the outcome rate should be q. That is a constraint on the distribution of predictions the model produces, not on any individual prediction, and <strong>it depends on the policy&#8217;s own behaviour</strong>. Change the model and you change which inputs land in the q bucket, which changes what the constraint is evaluated over.</p><p>There is a Bayesian way to see the same thing, and it makes the &#8220;one example tells you nothing&#8221; point concrete. Suppose you want to check whether the forecaster&#8217;s 70% claim is honest. Put a prior on the true rain-rate among 70%-days, say a Beta, and update it with each resolved day:</p><p style="text-align: center;"><em>&#952; ~ Beta(&#945;, &#946;),      &#952; | data ~ Beta( &#945; + r,  &#946; + (n &#8722; r) )</em></p><p>where r is how many of those n days were wet. The posterior mean is (&#945; + r) / (&#945; + &#946; + n), and the spread shrinks like 1/&#8730;n.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UiOV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UiOV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 424w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 848w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 1272w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UiOV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png" width="1114" height="836" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:836,&quot;width&quot;:1114,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UiOV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 424w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 848w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 1272w, https://substackcdn.com/image/fetch/$s_!UiOV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F419f95e3-daa2-401f-85a1-f41f905a334b_1114x836.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>After one day the posterior is still almost the prior. The evidence about a probability accumulates across cases and cannot be extracted from one.</em></p><p>After one rainy day the posterior has barely moved; it is consistent with the true rate being anywhere from 0.3 to 0.95. After a few hundred days it has collapsed onto a narrow interval, and now you can say whether 0.7 was honest. And notice that this is what the model is implicitly being asked to do. A calibrated predictor is one whose outputs would survive exactly this test, bucket by bucket, which is why the training signal has to be evaluated over a population of its own predictions rather than per example.</p><p>That is precisely the structure reinforcement learning exists to handle: an objective defined over the distribution your policy induces rather than over fixed targets per input. You cannot get here by relabelling your training set, because the thing you would need to label is a property the model has not yet exhibited.</p><p><em>Another way to see it.</em> Supervised learning asks &#8220;what is the answer to this?&#8221; and marks you against a key. RLCD asks &#8220;how often are you right when you talk like that?&#8221; and marks you against your own track record. The second question is incoherent for one example and perfectly well-posed for ten thousand.</p><p><strong>What the three letters are doing.</strong> Reinforcement, because the signal comes from consequences rather than a supplied answer. Calibrated, because the reward is chosen to make honesty optimal rather than accuracy. Decisions, because the action is a typed choice over a known answer space rather than free-form output.</p><p><strong>And the thing to keep hold of.</strong> Everything in 7.4 and 7.5 was reward design, not algorithm. RLCD&#8217;s contribution is the choice of what to reward, and that choice is a scoring rule from the 1950s. The RL wrapper is how you optimize something defined over a distribution of predictions; the proper scoring rule is why what you converge to is honest. Two separable ideas, and the second is doing the work.</p><h3><strong>7.7 RLCD against RLHF and RLVR</strong></h3><p>With RLCD described, it is worth placing it against the two reinforcement-learning approaches you will already know. All three are distinguished by where the reward comes from.</p><p><strong>RLHF</strong> gets its signal from human preference. A person compares two outputs, a reward model learns to imitate that judgment, and the policy optimizes against the reward model. It works for things only a human can assess, tone, helpfulness, whether an answer is actually useful, and it inherits the annotators&#8217; biases plus the reward model&#8217;s willingness to be gamed.</p><p><strong>RLVR</strong> gets its signal from verification. The answer is checked mechanically; the test passes, the proof checks, the arithmetic is right. Far more reliable than a reward model, and confined to domains where correctness is machine-checkable. We looked at this family in <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fsrl-supervised-reinforcement-learning">SRL</a> and at reward during pretraining in <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Frpt-reinforcement-learning-during">RPT</a>.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;9fac4f78-9c25-409f-98cc-647fe8387600&quot;,&quot;caption&quot;:&quot;Table of contents&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;SRL : Supervised Reinforcement Learning as proxy for guided reasoning&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-11-27T03:30:30.231Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!wd5l!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ffc5d7c-3765-4935-a330-6e41ddedd556_500x500.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/srl-supervised-reinforcement-learning&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:179828419,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:9,&quot;comment_count&quot;:1,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><strong>RLCD</strong> gets its signal from outcomes, scored by a proper rule. Not whether a human liked the answer or whether a checker accepted it, but how well the stated probability matched what actually happened, across many predictions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212sQU%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2sQU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 424w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 848w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 1272w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212sQU%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png" width="1456" height="615" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:615,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2sQU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 424w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 848w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 1272w, https://substackcdn.com/image/fetch/$s_!2sQU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec36a2ae-26ea-44d2-bc44-53b64f5f31a2_1784x753.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>What each family can be asked to optimize, and what it costs you to ask.</em></p><p>The clarifying question is what each can ask for. RLHF can optimize for qualities nobody can define formally. RLVR can optimize for correctness where correctness is decidable. <strong>RLCD can optimize for honest uncertainty</strong>, which neither of the others can express, because neither has a notion of a well-calibrated answer, only of a good one and a right one.</p><div><hr></div><h1><strong>8. Hands-on with first-order system</strong></h1><p>Which is where the theory runs out. We have the architecture, the objective, and the training loop. What none of it tells you is whether the thing is pleasant to use, and a decision model is not something you chat with and evaluate by reading; it is something your code calls a hundred times a second.</p><p>A note on how this section changed while I was writing it. I started out writing against Jev&#8217;s SDK and found myself guessing at method names, because the hosted client is thinly documented and I could not run the thing I was describing. Then, looking for something I could actually execute, I found <strong>GLiNER2.5-Decide</strong>, a 340M open model from Fastino, Apache 2.0, that does the same job locally. It also, on its own benchmark, beats both of the models this article has been about.</p><h3><strong>8.1 State, and how little of it there is</strong></h3><p>Let us see what state is in the open models variant (it is simpler than Jev&#8217;s version): just the text.</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;7d361d07-3560-4a15-8c40-8b6f802a4199&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">text = &#8220;&#8221;&#8220;From: compliance@group.example
Subject: Protocol update &#8212; action required today
Please confirm the new retention rule is applied before Friday&#8217;s audit.&#8221;&#8220;&#8221;</code></pre></div><p>Jev additionally accepts JSON objects and arrays, which genuinely matters when your decision depends on structured records alongside prose; the crash-narrative study and the refund example both need that. GLiNER2.5-Decide takes a string, so structure has to be serialized by you. A real difference, and a point in the hosted model&#8217;s favour.</p><p>The questions are where both converge.</p><h3><strong>8.2 The smallest possible call</strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;16846bc1-ccb1-485a-ade0-07ecfa74490c&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python"># pip install gliner2
from gliner2 import AutoExtractor

model = AutoExtractor.from_pretrained("fastino/GLiNER2.5-Decide")

model.classify_text(
    &#8220;Your mailbox is almost full. Click here in the next hour &#8220;
    &#8220;or we will delete every message.&#8221;,
    {&#8221;label&#8221;: [&#8221;spam&#8221;, &#8220;ham&#8221;]},
)
{&#8221;label&#8221;: &#8220;spam&#8221;}</code></pre></div><p>Four lines, no API key, no network call after the weights are cached, and roughly a gigabyte of model sitting in memory. Three things worth noticing.</p><p><strong>The label set is the second argument.</strong> Not a prompt, not a schema file, not a fine-tuning run; a Python dict, at call time. That is Section 4&#8217;s inversion in its most literal form, since the same loaded model answers a spam question now and a routing question on the next line.</p><p><strong>There is no prompt anywhere.</strong> No instructions, no template, no &#8220;you are a helpful classifier&#8221;. The model was trained to take a label set directly, so the only English in the call is the labels themselves.</p><p><strong>The output is the decision.</strong> A dict your code reads. No parsing, no retry, no JSON mode.</p><h3><strong>8.3 Several decisions at once</strong></h3><p>The decomposition argument from 6.2, made concrete. One text, three heads, one forward pass:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;f2e943ff-039b-4dd8-bd06-61ee5d2f2874&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    text,
    {
        &#8220;intent&#8221;:  [&#8221;fyi&#8221;, &#8220;request&#8221;, &#8220;approval&#8221;, &#8220;complaint&#8221;,
                    &#8220;newsletter&#8221;, &#8220;security_alert&#8221;],
        &#8220;urgency&#8221;: [&#8221;low&#8221;, &#8220;normal&#8221;, &#8220;high&#8221;, &#8220;critical&#8221;],
        &#8220;route&#8221;:   [&#8221;support&#8221;, &#8220;billing&#8221;, &#8220;legal&#8221;, &#8220;security&#8221;,
                    &#8220;finance&#8221;, &#8220;archive&#8221;],
    },
)
{&#8221;intent&#8221;: &#8220;request&#8221;, &#8220;urgency&#8221;: &#8220;high&#8221;, &#8220;route&#8221;: &#8220;legal&#8221;}</code></pre></div><p>Three questions, one pass over the encoder. This is the parallel-evaluation property from 6.2 arriving as something you can time yourself; add a fourth head and the latency barely moves, because the expensive part was reading the text and that happened once.</p><p>And it is the same design discipline. Three small factual judgments, combined by your code, rather than one large question that buries the policy inside the model.</p><h3><strong>8.4 Confidence, which you have to ask for</strong></h3><p>Here is the parameter the model card does not mention and which the whole of 3.3 depends on:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;8267e23a-48aa-4c50-b8b1-ed874b101656&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    text,
    {&#8221;route&#8221;: [&#8221;support&#8221;, &#8220;billing&#8221;, &#8220;legal&#8221;, &#8220;security&#8221;, &#8220;finance&#8221;, &#8220;archive&#8221;]},
    include_confidence=True,
)</code></pre></div><p>It defaults to False, so by default you get a bare label and no probability, which is exactly the thing Section 5&#8217;s requirement three said not to accept. Turn it on and you have a number to threshold:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;55ddffae-f619-419d-9d40-bfde731a1539&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">r = model.classify_text(text, {&#8221;route&#8221;: [...]}, include_confidence=True)
if r[&#8221;route&#8221;][&#8221;confidence&#8221;] &gt; 0.90:
    assign(r[&#8221;route&#8221;][&#8221;label&#8221;])               # act alone
elif r[&#8221;route&#8221;][&#8221;confidence&#8221;] &gt; 0.60:
    assign(r[&#8221;route&#8221;][&#8221;label&#8221;], review=True)  # act, but watch
else:
    escalate_to_reasoning_model()             # ask something expensive</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NkIr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NkIr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 424w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 848w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 1272w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NkIr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png" width="1198" height="729" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:729,&quot;width&quot;:1198,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NkIr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 424w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 848w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 1272w, https://substackcdn.com/image/fetch/$s_!NkIr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa29680-215d-4e3a-ac43-bb1963de4583_1198x729.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>The three-tier pattern from 3.3, now with a parameter that actually returns the number it depends on.</em></p><p>I should flag that I verified include_confidence in the package source but could not run the model to see the exact response shape, so treat the accessor above as the shape to check rather than the shape to trust. The parameter is real; the key names may differ.</p><p>And the Section 9 caveat applies with full force here. A confidence you have not validated on your own data is a number, not a threshold; measure the reliability before you branch on it.</p><h3><strong>8.5 Multi-label, thresholds, and ordinal scales</strong></h3><p>Three variations that cover most of what you will actually need.</p><p><strong>Multi-label</strong>, when several answers apply at once:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;266e1777-d798-46ee-a23f-c5e07ea6aca3&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    &#8220;Battery dies before lunch, but the keyboard and the screen &#8220;
    &#8220;are the best I have used.&#8221;,
    {&#8221;aspects&#8221;: {
        &#8220;labels&#8221;: [&#8221;battery&#8221;, &#8220;keyboard&#8221;, &#8220;screen&#8221;, &#8220;camera&#8221;, &#8220;price&#8221;, &#8220;support&#8221;],
        &#8220;multi_label&#8221;: True,
        &#8220;cls_threshold&#8221;: 0.4,
    }},
)
# {&#8221;aspects&#8221;: [&#8221;battery&#8221;, &#8220;keyboard&#8221;, &#8220;screen&#8221;]}</code></pre></div><p><strong>Ordinal scales</strong>, which are Jev&#8217;s Score primitive done the cheap way; pass the levels as ordinary strings:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;1ffbe1f7-0b1b-4045-a5f1-05708265934d&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    &#8220;Payroll file has to be corrected before the 5pm cutoff &#8220;
    &#8220;or the whole company is paid late.&#8221;,
    {&#8221;urgency&#8221;: [&#8221;0&#8221;, &#8220;1&#8221;, &#8220;2&#8221;, &#8220;3&#8221;, &#8220;4&#8221;, &#8220;5&#8221;]},
)

# {&#8221;urgency&#8221;: &#8220;5&#8221;}</code></pre></div><p>Worth being precise about the difference. Jev&#8217;s Score understands the levels as ordered and returns a continuous value between them, 1.4 on a zero-to-two scale. This returns the nearest level as a string. For most SLA systems that is fine; if you need the interpolation, it is a real gap.</p><p><strong>Labels with descriptions</strong>, for when the name alone is ambiguous:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;5810df74-c773-4ad6-8bb1-0f24e183cd80&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    &#8220;Please reset the card PIN. The new one never arrived &#8220;
    &#8220;and the old one is locked.&#8221;,
    {&#8221;intent&#8221;: {&#8221;labels&#8221;: {
        &#8220;card_pin_change&#8221;: &#8220;The customer wants a new PIN or the current PIN replaced&#8221;,
        &#8220;card_lost&#8221;:       &#8220;The physical card is missing&#8221;,
        &#8220;balance_inquiry&#8221;: &#8220;The customer wants the current balance&#8221;,
    }}},
)</code></pre></div><p>This is where the prompt quietly comes back. A description is a short instruction, and writing good ones is the same skill as writing good instruction strings for a Noul. The typed interface removes the parsing problem completely; it does not remove the specification problem.</p><h3><strong>8.6 A yes/no question over a passage</strong></h3><p>The closest thing to Jev&#8217;s Noul, and the primitive you reach for most:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;bc66e3e7-5e06-4ec1-96de-174c1bf19a2c&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">model.classify_text(
    &#8220;The treaty was signed in Paris in 1992. It entered into force &#8220;
    &#8220;the following year, after the last signatory ratified it.&#8221;,
    {&#8221;answer&#8221;: {
        &#8220;labels&#8221;: [&#8221;yes&#8221;, &#8220;no&#8221;],
        &#8220;prompt&#8221;: &#8220;Did the treaty enter into force in 1992?&#8221;,
    }},
)
# {&#8221;answer&#8221;: &#8220;no&#8221;}</code></pre></div><p>The text is the state, the prompt is the question, and the answer is one bit. No chain of thought, no extracted sentence, no explanation. This is the grounding-check shape, is this claim supported by this passage, which is one of the most common things people currently burn a chat-model call on.</p><h3><strong>8.7 All together</strong></h3><p>The refund case from 6.2, end to end, running locally (no API key required).</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;09df3abb-67be-4fca-9d61-1cf947e60263&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python"># pip install gliner2

from gliner2 import AutoExtractor

model = AutoExtractor.from_pretrained("fastino/GLiNER2.5-Decide")

def handle_ticket(message: str, transactions: list, policy: str) -&gt; str: 

    # ---- 1. the state is a string, so serialize the structure yourself ----
    lines = [f"- {t['id']}: {t['amount']} on {t['ts']}" for t in transactions]
    state = (
        f"{message}\n\n"
        f"Recent transactions:\n" + "\n".join(lines) + "\n\n"
        f"Policy: {policy}"
    )

    # ---- 2. several independent judgments in one forward pass ------------
    r = model.classify_text(
        state,
        {
            "intent":      ["refund_request", "order_status", "cancel_subscription",
                            "login_problem", "bug_report", "speak_to_human", "other"],
            "duplicate":   ["yes", "no"],
            "urgency":     ["0", "1", "2", "3", "4", "5"],
            "needs_human": ["yes", "no"],
            "queue":       ["billing", "technical", "account"],
        },
        include_confidence=True,
    )

    # ---- 3. every business rule lives here, none of it in the model ------
    asked     = r["intent"]["label"] == "refund_request"
    duplicate = r["duplicate"]["label"] == "yes"
    urgency   = int(r["urgency"]["label"])
    queue     = r["queue"]

    if asked and duplicate and queue["confidence"] &gt; 0.80:
      return {"action": "approve_refund"}
    elif urgency &gt;= 4 or r["needs_human"]["label"] == "yes":
      return {"action": "escalate", "priority": "high"}
    else:
      return {"action": "queue_for_review", "suggested": queue["label"]}

    # ---- 4. log probabilities so you can audit calibration later ---------
    log_decision(outcome=outcome, raw=r)
    return outcome

if __name__ == "__main__":
    result = handle_ticket(
        message="I was charged twice for the same order and nobody has replied "
                "in three days. Please refund the duplicate.",
        transactions=[
            {"id": "tx_8821", "amount": "49.00", "ts": "2026-09-14T10:02Z"},
            {"id": "tx_8822", "amount": "49.00", "ts": "2026-09-14T10:03Z"},
        ],
        policy="Duplicate charges within 24h are refundable without review.",
    )
    print(result)
    # output : {'action': 'queue_for_review', 'suggested': 'billing'}</code></pre></div><p>Four things this file demonstrates, and they are the same four regardless of which model sits behind it.</p><p><strong>Step one is where the open model costs you something.</strong> The transactions have to be flattened into prose because the state is a string, and that flattening is a parsing problem you created. Jev&#8217;s JSON state avoids it. This is the clearest practical argument for the hosted model.</p><p><strong>Step two is one forward pass.</strong> Five heads, one read of the text. Writing it as five calls would be five times slower for nothing.</p><p><strong>Step three contains every business rule in the system</strong>, and none of them are in the model. Thresholds, the precedence of escalation over approval, the decision to treat low routing confidence as grounds for review; all readable, testable, and changeable by someone who has never heard of GLiNER.</p><p><strong>Step four is the one people skip.</strong> Logging the probabilities alongside what actually happened is what lets you build the reliability diagram from 3.3 three months from now, and Section 9 will show that you will need it.</p><h3><strong>8.8 What using it actually feels like</strong></h3><p>Three observations from writing the above.</p><p><strong>Running locally changes the calculus more than I expected.</strong> No API key, no rate limit, no per-call cost, no network hop. The Section 4 argument about cheap decisions unlocking new volume is one thing when a decision costs $0.000004 and another thing entirely when it costs nothing and runs on the machine already doing the work.</p><p><strong>The decomposition discipline is the hard part</strong>, and it is a skill rather than a syntax. The temptation is to ask one big question, something like a single &#8220;decision&#8221; head with approve, deny and escalate as its labels, and the interface will happily let you. That puts the policy back inside the model and you lose the thing you came for.</p><p><strong>And the label names are doing more work than they look like they are.</strong> refund_request versus wants_money_back is a prompt-engineering decision wearing a very small hat. The model reads those strings. You are still choosing words carefully, just fewer of them.</p><div><hr></div><h1><strong>9. Results</strong></h1><h3><strong>9.1 Independent evaluation exists, which is unusual this fast</strong></h3><p>Two months after release there are at least six third-party evaluations of Jev on arXiv, which is more scrutiny than most closed models get in a year. Since the vendor&#8217;s figures are unverifiable, these are what this section rests on.</p><p>The broadest is a benchmark study from Bonn covering <strong>37 datasets and 346,009 requests</strong>, run zero-shot on full evaluation splits with one frozen template per dataset, for <strong>under US$10</strong> in total, which is itself a data point about the cost claim.</p><p><strong>Where it is strong.</strong> Binary sentiment at 96.5% on IMDB and 96.4% on SST-2, language identification at 99.6%, commonsense at 95.5% on HellaSwag, science questions at 98.8% on ARC, and 86.7% on Belebele across 122 languages. Intent routing reaches 89.5% on CLINC150 with 151 options in a single Choice.</p><p><strong>Against open-weight models</strong> scored on identical requests through their exact option probabilities, Jev beats Qwen3.8-27B on 27 of 37 datasets and Gemma-4-E4B on all 37. Worth noting what that comparison is: a hosted commercial model against a 27.8B and an 8B open model, and the margins are real but not enormous.</p><p>There is a third data point, and it is awkward for both models this article has been about. <strong>GLiNER2.5-Decide</strong>, an open 340M encoder, reports <strong>60.2%</strong> exact-match accuracy on Fastino&#8217;s fast-decisions benchmark, 17 domains with 300 held-out examples each and the same text and candidate labels for every model, against <strong>57.6% for JevK5</strong> and 46.6% for Laya Router. A 340M model beating a hosted commercial one on a public benchmark is a real result, with the usual caveat that the benchmark belongs to the people who won it. Still, the direction is consistent with the Bonn study&#8217;s finding that Jev&#8217;s advantage over well-used open models is in interface and consistency rather than raw accuracy.</p><p><strong>Where it fails.</strong> Emotion at 58.5% on noisy hashtag-derived labels, SST-5 five-way sentiment at 57.9%, GoEmotions macro-F&#8321; of 0.243, and worst of all AGB-DE at F&#8321; 0.204, deciding whether a German consumer-terms clause is void under German law, which the authors rightly describe as requiring domain knowledge rather than a snap judgment. Prompt-injection detection has perfect precision and 50% recall.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-fSu%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-fSu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 424w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 848w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 1272w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-fSu%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png" width="1456" height="841" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:841,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-fSu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 424w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 848w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 1272w, https://substackcdn.com/image/fetch/$s_!-fSu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa1ecd75-f492-4e55-8e3a-a812a0281e98_1784x1030.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Thirty-one of the 37 datasets, sorted. The right-hand tail is where a snap judgment is the wrong tool.</em></p><h3><strong>9.2 The calibration picture is more complicated than the marketing</strong></h3><p>Here is the finding that matters most, and it cuts both ways.</p><p><strong>Pooled, the calibration is genuinely good.</strong> Across 22 Choice datasets and 279,925 answers, expected calibration error is 0.028. Averaged per dataset, Jev&#8217;s ECE of 0.074 is level with Qwen&#8217;s 0.075 and far better than Gemma&#8217;s 0.184.</p><p><strong>Per dataset, it ranges by two orders of magnitude.</strong> From 0.003 on Language ID and 0.005 on ARC, up to 0.279 on Emotion, 0.264 on AGB-DE and 0.236 on Prompt Injections. The aggregate number is an average over a spread that wide, and your task sits somewhere in it without you knowing where.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DrEE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DrEE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 424w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 848w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DrEE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png" width="1456" height="894" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:894,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DrEE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 424w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 848w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!DrEE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6ee7ec-101d-43aa-bfeb-517e2f0f763d_1632x1002.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Every bar is the same model under the same evaluation harness. The dashed line is the number that gets quoted.</em></p><p><strong>And Noul is weaker than Choice.</strong> Binary probabilities rank well but sit badly relative to a fixed 0.5 threshold; tuning the threshold on training data raises micro-F&#8321; on UNFAIR-ToS from 0.50 to 0.75. The same pattern appears in moderation: AUROC 0.989 on ToxicChat toxicity and 0.982 on prompt injection, with mediocre decisions at 0.5. The model knows which cases are more likely true; it does not know where to put the line.</p><h3><strong>9.3 Three domain studies agree</strong></h3><p><strong>Crash narratives.</strong> A 27-question schema over 499,500 Texas police narratives, 195,857 coded by jev-1.13.0 at 3,673 mean input tokens and 0.20 s median latency. Against 2,416 blinded human judgments: F&#8321; 0.908, with precision 0.902 and recall 0.915. One frontier model gains 0.059; the other is statistically indistinguishable. Raw probabilities overstate prevalence; recalibrated on those judgments, out-of-fold calibration error falls to 0.0069 with slope 0.97. The authors&#8217; conclusion is that calibration varies by model rather than by paradigm, so each model must be audited.</p><p><strong>Radiology.</strong> Jev judging factual agreement between generated and physician-written reports. Raw ECE 0.1235, Brier 0.1269, AUROC 0.8858. After isotonic calibration on a held-out half, ECE falls to 0.0077, a sixteen-fold improvement. On controlled errors it reaches AUROC 0.977 for detecting a reversed finding. The recommendation is explicit: recalibrate per task before thresholding.</p><p><strong>Medicine.</strong> The least flattering, and preliminary. ECE from 0.063 on MetaMedQA to 0.141 on PubMedQA. At a 0.9 threshold, accuracy is 75.9% at 17.3% coverage, meaning roughly one in four of its most confident answers was wrong.</p><p>A human-activity-recognition study adds the blunt version: fast and inexpensive to query, but its probabilities are not reliably calibrated for recognition.</p><h3><strong>9.4 The pattern</strong></h3><p>Six studies, one consistent finding. <strong>Calibration out of the box is decent on average and unreliable per task, and post-hoc recalibration fixes it dramatically.</strong> Every study that tried it reports a large gain from modest labelled data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rizC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rizC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 424w, https://substackcdn.com/image/fetch/$s_!rizC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 848w, https://substackcdn.com/image/fetch/$s_!rizC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 1272w, https://substackcdn.com/image/fetch/$s_!rizC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rizC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png" width="1138" height="799" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:799,&quot;width&quot;:1138,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rizC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 424w, https://substackcdn.com/image/fetch/$s_!rizC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 848w, https://substackcdn.com/image/fetch/$s_!rizC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 1272w, https://substackcdn.com/image/fetch/$s_!rizC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb3d2e61-467f-4c2f-ae9e-e1193b1701ee_1138x799.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>A few thousand resolved outcomes from your own distribution, and an isotonic fit, closes most of the gap.</em></p><p>Practitioners report the same from the other direction; <a href="iframe.php?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_yD790y_gq4">this walkthrough</a> makes the point that the outputs are not always calibrated and a confidently wrong answer is entirely possible. The marketing line that the model &#8220;never hallucinates&#8221; is true only in the narrow sense that it cannot emit a category you did not define. A wrong answer at 0.95 confidence is the same problem wearing a type signature.</p><p>Which lands awkwardly against Section 7. The argument for RLCD was that calibration should be trained in rather than patched on, that temperature scaling is a remedy for a model optimized for the wrong objective. The empirical finding is that you should fit an isotonic map on your own data before trusting a threshold. That does not make RLCD pointless, since starting at 0.1235 beats starting at 0.4, but it qualifies the claim considerably. <strong>Calibration is a property of a model on a distribution, and you are not running it on the distribution it was trained for.</strong></p><h3><strong>9.5 The caveat the benchmarks hide</strong></h3><p>Now the thing most coverage skipped, and the most important practical fact here.</p><p>Laya&#8217;s shipped checkpoints work zero-shot, and on Convai&#8217;s own 2,000-decision benchmark they score <strong>0.362</strong>. Fine-tuned on the target domain, the same model scores <strong>0.766</strong>. Roughly double.</p><p>Read that against Section 4&#8217;s framing. The promise was one model serving every label set without retraining; the measurement says that out of the box, on a broad benchmark, the open model is mediocre, and most of its headline accuracy comes from domain adaptation. Which is a classifier with extra steps.</p><p>Two things soften it. The number is Laya&#8217;s, not Jev&#8217;s, and Jev is considerably larger and hosted, so its zero-shot gap may be much smaller, though TypeSafe explicitly does not fine-tune on customer data, which means whatever zero-shot performance you get is what you have, permanently. And a single aggregate over 2,000 heterogeneous decisions says little about any particular task; a three-way routing problem with well-separated options is not a fine-grained multilingual rubric.</p><p>It also connects straight back to 7.3 in the methodology. If calibration is learned from outcome distributions, zero-shot transfer is a question about how much your decisions resemble the training ones, and nobody has published enough for you to answer that in advance.</p><p>The honest summary: <strong>the category&#8217;s zero-shot generality is the least-evidenced of its claims</strong>, and it is the first thing I would test on my own data rather than take on trust.</p><h3><strong>9.6 What we still do not know about Jev</strong></h3><p>Laya tells us what the category looks like. It does not tell us what TypeSafe built.</p><p>Unknown: the architecture beyond non-autoregressive, the model size, the training data, the sampler they describe as novel, the specifics of their RLCD implementation, and any reliability data for the calibration claim. The 193.6&#215; and 444.6&#215; figures are vendor comparisons against vendor-chosen baselines.</p><p>What we can say is that an open 421M encoder reaches roughly 33 ms with competitive calibration using published techniques, which makes TypeSafe&#8217;s claims plausible in kind if not in magnitude. That is weaker than reading their paper, and considerably better than what we had two months ago.</p><div><hr></div><h1><strong>10. Thoughts</strong></h1><p><strong>1. Jevons was the right name, and more right than intended.</strong></p><p>Jevons observed that making a resource cheaper increases total consumption. If a decision costs 400&#215; less, the consequence is not that your bill falls 99.75%, it is that you start making decisions where nobody currently makes one. The benchmark study is the proof: 346,009 decisions for under ten dollars.</p><p>Which is fine until the second-order version. A system making a million calibrated judgments a minute is one whose behaviour is set by a million small thresholds that nobody reviewed individually. The cost curve is the easy part; the governance of a hundred thousand confidence thresholds is the part nobody has thought about.</p><p><strong>2. The speedup numbers are measured against the most expensive possible baseline.</strong></p><p>&#8220;40&#8211;200&#215; faster&#8221; and &#8220;193.6&#215; faster&#8221; are comparisons against frontier models, the Opus 5.5 and GPT-5.6 class, large models with reasoning paths behind a hosted API. Of course a 400 ms typed decision beats a multi-second reasoning call by two orders of magnitude; that baseline was never the right tool.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hd1o%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hd1o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 424w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 848w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 1272w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hd1o%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png" width="1456" height="721" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:721,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hd1o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 424w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 848w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 1272w, https://substackcdn.com/image/fetch/$s_!hd1o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76a69dd-d5a3-4541-9eef-4915d3a0aa75_1687x835.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>Approximate, and the point is the ratio rather than any one number. Against the right baseline the gap is real but ordinary.</em></p><p>Compare against what a sensible engineer would actually reach for, GPT-OSS, or Qwen or Gemma at a few billion parameters doing constrained decoding on a short classification, and the gap compresses to roughly 2&#8211;3&#215;. The Bonn study is instructive here: it scores Qwen3.8-27B and Gemma-4-E4B on identical requests via a single forward pass over option tokens, which is the right way to use an LLM for this, and Jev&#8217;s advantage is in accuracy and interface rather than orders of magnitude of latency.</p><p>The sharpest version comes from the open side. Laya is a 421M encoder running locally at 32.8 ms, against Jev&#8217;s 236&#8211;276 ms. <strong>The open model is 7.8&#215; faster than the thing whose headline figure is 193.6&#215;</strong>, which tells you most of that number was about the baseline rather than the method.</p><p>The architecture argument still holds; non-autoregressive single-pass evaluation genuinely removes the sequential floor. It is the magnitude that is a marketing artifact.</p><p><strong>3. Output tokens are priced at zero, which is not the same as costing nothing.</strong></p><p>TypeSafe charges US$0.042 per million input tokens and nothing for output. So in billing terms the output genuinely is free.</p><p>But that is a pricing decision rather than a statement about physics. Producing the answer still costs compute; it is bundled into the input price, which TypeSafe can afford to do precisely because the output is two bits rather than a paragraph. And if reasoning is involved it is charged normally, so &#8220;free output&#8221; describes the choice, not the deliberation that might precede it.</p><p>The interesting consequence is the incentive it creates. With input dominant and output free, the economics push you to send <strong>more context</strong>, which is the opposite of the instinct everyone developed optimizing chat prompts. The crash-narrative study runs 3,673 input tokens per decision without comment.</p><p><strong>4. Grounding reduces hallucination and relocates the failure.</strong></p><p>The model cannot invent a category outside your answer space, which removes a whole class of failure. That is real.</p><p>But it does not remove being wrong, it concentrates it. One in four of the medicine benchmark&#8217;s most confident answers was incorrect; the model was not hallucinating, it was selecting the wrong option from a valid set with high confidence. And a bare value with no rationale leaves nothing to inspect. A chat model that reasons its way to a wrong answer at least leaves a trail.</p><p>So the choice becomes a <strong>single point of failure</strong> in a way prose is not. The mitigation is the decomposition discipline from 8.6, several small questions whose answers can disagree, rather than one large one that cannot.</p><p><strong>5. Is this a step toward AGI?</strong></p><p>No, and the framing is wrong in an interesting way. This is not a weaker general intelligence, it is a parallel branch on a simpler assumption: that most decisions do not require general intelligence. Routing a ticket needs no world model.</p><p>Where it touches the deeper argument is on representations. LeCun&#8217;s position, which we went through in the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Flejepa-provable-and-scalable-self">LeJEPA article</a>, is that intelligence is largely about representations good enough to support prediction, and a System One model is precisely a bet that a good representation plus a bounded answer space is all most tasks need.</p><p><strong>6. The thing I would actually watch.</strong></p><p>Not speed, which will be matched. Not cost, which will fall. Whether <strong>calibrated uncertainty becomes a standard thing to expect from a model</strong>.</p><p>We have spent three years building on outputs whose confidence means nothing, compensating with evals and guardrails and human review. If the number becomes trustworthy enough to branch on, that changes what software can safely delegate far more than another order of magnitude on latency would.</p><p>The evidence says we are partway: calibrated on average, unreliable per task, fixable with modest labelled data. A real capability with a real caveat.</p><div><hr></div><h1><strong>11. Conclusion</strong></h1><p>We talked about Jev, and specifically about the gap it is trying to close; most of what we use AI for in production is a judgment rather than a piece of writing, and we have been making those judgments with a text generator because that is what was available.</p><p>The route out was noticing that this is not a rough edge but a category error. A sentence encoding a decision is mostly grammar, so you pay forty sequential forward passes for two bits; constrained decoding narrows the search space without touching the computation; and the probability you get back is the likelihood of a token appearing at a position, which is not the model&#8217;s belief about the answer and was never trained to be.</p><p>That turned the question from how do we parse the output into what shape should a decision model be, and the answer has a contradiction in it. It has to read like a language model and answer like a function, and the thing that reads like a language model is an autoregressive generator, which is slow, untyped, and gives you token probabilities. The resolution is slightly embarrassing in hindsight: we already had the architecture. A bidirectional encoder was always the right machine for understanding a fixed input, and we stopped reaching for it when generation became the goal.</p><p>Calibration was the harder half. Cross-entropy against hard labels tells a model it should have said one hundred percent, every time, which is why modern networks are confidently wrong. A strictly proper scoring rule asks a different question, how often are you right when you talk like that, and has a unique optimum at the model&#8217;s honest belief. That is a metric from the 1950s moved from the evaluation step to the training step, wrapped in reinforcement learning because calibration is a property of a distribution of predictions rather than of any single one.</p><p>The empirical case is more mixed than the marketing. Thirty-seven datasets, 346,009 decisions for under ten dollars, beating a 27B open model on most of them. Speed real but smaller than advertised, since 193.6&#215; was measured against a frontier model and an open 421M encoder runs 7.8&#215; faster than Jev itself. And calibration pooled at 0.028 while ranging from 0.003 to 0.279 across tasks, which is decent on average and unreliable where it matters.</p><p>What strikes me most is how little here is new. The encoder is BERT&#8217;s architecture, the Brier score is from 1950, proper scoring rules have been the standard tool for evaluating forecasts for sixty years. The contribution is noticing that a decision is not a short piece of text, and everything else follows from taking that seriously.</p><p>Whether Jev specifically becomes standard I have no idea. The durable part is the claim underneath it: that a model can tell you how much to trust it, in a number you can act on. We have spent three years building on outputs whose confidence means nothing, and if that changes, it changes what software can safely delegate more than any amount of latency ever would.</p><p>This marks the end of our walk through System One models, and with this we conclude.</p><p><strong>References:</strong></p><p>TypeSafe docs: https://docs.typesafe.ai</p><p>Laya, open weights: <a href="iframe.php?url=https%3A%2F%2Fhuggingface.co%2Fconvaiinnovations%2Flaya">https://huggingface.co/convaiinnovations/laya</a></p><p>Benchmark study: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2609.37647">https://arxiv.org/abs/2609.37647</a></p><p>Crash narratives at scale: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2609.24052">https://arxiv.org/abs/2609.24052</a></p><p>Radiology factuality: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2609.27607">https://arxiv.org/abs/2609.27607</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That&#8217;s all for today. Follow me on LinkedIn and Substack for more such posts, till then happy Learning. Bye &#128075;</p>]]></content:encoded></item><item><title><![CDATA[LeJEPA: Provable and Scalable Self-Supervised Learning Without the Heuristics]]></title><description><![CDATA[Every anti-collapse trick in SSL was found, not derived. LeJEPA asks what distribution embeddings should follow, proves there is exactly one answer, and skips the rest of the machinery.]]></description><link>https://vizuara.substack.com/p/lejepa-provable-and-scalable-self</link><guid isPermaLink="false">https://vizuara.substack.com/p/lejepa-provable-and-scalable-self</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 07 Sep 2026 03:31:46 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217uC5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><span>Table of contents</span></h2><ol><li><p><em><span>Introduction</span></em></p></li><li><p><em><span>What a JEPA actually is</span></em></p><ol><li><p><em><span>What is a world model?</span></em></p></li><li><p><em><span>Why predict in representation space?</span></em></p></li></ol></li><li><p><em><span>Connecting probability with optimization</span></em></p></li><li><p><em><span>The heuristics zoo, and what &#8220;under-specified&#8221; really means</span></em></p><ol><li><p><em><span>Two perspective of SSL tasks</span></em></p></li><li><p><em>Various methods (<span>Negative samples, Stop-gradients, Whitening, etc.)</span></em></p></li></ol></li><li><p><em><span>The Ideal Case</span></em></p></li><li><p><em><span>Methodology</span></em></p><ol><li><p><em><span>Finding Q: why the isotropic Gaussian?</span></em></p></li><li><p><em><span>Finding D: measuring the distance to a Gaussian</span></em></p></li></ol></li><li><p><em><span>SIGReg in code</span></em></p></li><li><p><em><span>Results &amp; Outcomes</span></em></p></li><li><p><em><span>Thoughts</span></em></p></li><li><p><em><span>Conclusion</span></em></p></li></ol><div><hr></div><h1>Introduction</h1><p>I have been a fan of self-supervised learning for a very long time, and at this point I don&#8217;t think that qualifies as a niche taste anymore. If you look underneath almost anything that has worked in deep learning recently, you will find some version of SSL doing the actual work, and it tends to fall into one of two camps. Next-token prediction in LLMs and most of what we do with time series are learning a <em>temporal</em> world; what follows what, and how state evolves along an axis we cannot run backwards. The DINO family, masked image modelling, contrastive image-text pairs are learning a <em>spatial</em> world; what belongs with what, and how structure holds together across a scene that is all present at once. The supervision never really went away in either case, it just stopped coming from a human and started coming from the structure of the data itself. We had been writing multiple articles on SSL and respective methodologies; in case if you want to brush up some more details: </p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;a973b792-beed-4a9a-87e2-2bf6dc7871ce&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A Primer on Self-supervised Learning&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-07-14T03:59:10.278Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!v873!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca21028-57fa-4ced-a461-916dd4bf4075_648x435.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/a-primer-on-self-supervised-learning&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:167795587,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:9,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;d5cca6b8-f462-4256-8be4-0bcadb72930e&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;DINOv3: The Vision Foundation Model&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-10-06T03:30:26.174Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!hBnA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f144d7-73fb-43e5-ad8e-c06e2d2d5fca_500x559.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/dinov3-bridging-the-representational&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:175286136,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:14,&quot;comment_count&quot;:2,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>The interesting question then is no longer whether SSL works, we have more than enough evidence for that. It is what exactly we are asking a model to do when we train it this way, and among all the SSL families, JEPA has committed to the sharpest answer by deriving the model from the combination of spatial and temporal which is a video. A video is temporal structure laid over spatial structure, and if your input space is video, then the thing you are actually trying to learn is neither the layout of a frame nor the ordering of frames, but the <em>dynamics</em> that carry one into the next. The way JEPA goes after this is by predicting in <strong>representation space</strong> rather than in pixel space, which frees the model to discard whatever it cannot predict instead of wasting capacity reconstructing it. That single shift does most of the heavy lifting here, and it is worth unpacking properly, which we will do in the next section.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217uC5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7uC5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 424w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 848w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 1272w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217uC5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png" width="424" height="424" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:500,&quot;resizeWidth&quot;:424,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7uC5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 424w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 848w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 1272w, https://substackcdn.com/image/fetch/$s_!7uC5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0bf6359-ff2d-4ed1-b2bf-37a0bb81d5c4_500x500.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There is a framing of all this that I keep coming back to, and it comes from Yann&#8217;s <a href="iframe.php?url=https%3A%2F%2Fyoutu.be%2F8u2s64ZtmiA">lecture at NYU</a>. SSL, in his telling, is not really a learning trick at all; it is an optimization problem with constraints, and the constraints are where the entire inductive bias of the method lives. The prediction task on its own is trivially solvable, because a model that maps every input to the same constant vector predicts perfectly and learns absolutely nothing in the process. Hence the constraint is not some detail bolted onto the objective for stability, it is closer to being the objective itself, and everything we discuss in this article follows from taking that seriously.</p><p>Which is exactly where things get uncomfortable. If the constraint is carrying all of the inductive bias, then we should have some principled theory of which constraint to use, and we simply don&#8217;t. What we have instead is an accumulated pile of mechanisms that were found empirically and kept because they happened to work; negative samples (SimCLR, MoCo), teacher&#8211;student networks with hand-tuned EMA schedules (BYOL, DINO), stop-gradients (SimSiam), feature whitening (Barlow Twins, W-MSE), and explicit variance-covariance penalties (VICReg). Every one of these prevents the model from cheating, and not one of them was derived from a statement about what the embeddings ought to look like, largely because no such statement existed to derive from.</p><p>LeJEPA is an attempt to finally write that statement down. Balestriero and LeCun ask which distribution the embeddings <em>should</em> follow in order to be useful for downstream tasks that nobody has seen yet, prove that there is exactly one such distribution, construct a penalty term that enforces it, and then delete the rest of the machinery; no stop-gradient, no teacher&#8211;student, no schedulers, one hyperparameter. The route they take to get there is genuinely lovely, involving an isotropy argument that falls straight out of plain bias-variance, a theorem that lets you read a high-dimensional distribution entirely off its one-dimensional shadows, and a statistical hypothesis test repurposed as a loss function.</p><p>As always, we will build this from the <em>why</em> forward, so that by the end the objective stops looking like a proposal someone made and starts looking like the only thing that could have been written.</p><p><em>(Usual caveat: the information in this article is upper bounded by my own grasp of the topic, my patience for typing for hours, and a writing medium that still refuses to support inline LaTeX. Please re-visit everything you read here, and go read the paper.)</em></p><div><hr></div><h1><span>2. What a JEPA actually is?</span></h1><p><em><span>Let us start by understanding the claim which JEPA starts with, i.e. it being a world model.</span></em></p><h3><strong><span>2.1 What is a world model?</span></strong></h3><p><span>The phrase gets used loosely enough to have lost most of its meaning, so let me pin down the version that matters here.</span></p><p><span>A world model is an internal representation of how things work that is good enough to run forward. Not a recording of what happened, a mechanism for anticipating what happens next. You have one. It is why you flinch before the ball hits you, why a wobbling glass makes you reach out, and why you can read half a sentence and know roughly where it is going. None of that involves retrieving a stored instance; it involves running a model of the situation slightly ahead of the situation itself.</span></p><p><span>Three properties matter, and each one turns out to be a design constraint.</span></p><ol><li><p><strong><span>It predicts, so it must be usable in the forward direction.</span></strong><span> A representation that describes the present beautifully but supports no inference about the next moment is a description, not a model. The test is always whether you can push it forward and get something useful.</span></p></li><li><p><strong><span>It is abstract, so it discards.</span></strong><span> The version of the falling cup that lets you predict the outcome contains gravity, brittleness and height. It does not contain the reflection on the ceramic. Detail that does not affect what happens next is not merely unnecessary, it is actively in the way; a model cluttered with it is harder to run and easier to confuse.</span></p></li><li><p><strong><span>It is reusable, so it is not built per task.</span></strong><span> The same intuitions about objects and support and momentum serve you when catching a ball, stacking dishes and judging whether a shelf will hold. You did not learn a separate model for each. That reuse is exactly what &#8220;foundation model&#8221; is meant to name; one representation, many tasks, none of them known when the representation was learned.</span></p></li></ol><p><span>It is worth seeing where this sits in the larger picture, because LeCun&#8217;s proposal for autonomous machine intelligence is considerably bigger than a world model alone.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dsde%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dsde!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 424w, https://substackcdn.com/image/fetch/$s_!dsde!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 848w, https://substackcdn.com/image/fetch/$s_!dsde!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 1272w, https://substackcdn.com/image/fetch/$s_!dsde!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dsde%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png" width="593" height="333.5625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:675,&quot;width&quot;:1200,&quot;resizeWidth&quot;:593,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dsde!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 424w, https://substackcdn.com/image/fetch/$s_!dsde!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 848w, https://substackcdn.com/image/fetch/$s_!dsde!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 1272w, https://substackcdn.com/image/fetch/$s_!dsde!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbe933b-102e-4eba-aa94-9d79af40f6da_1200x675.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>LeCun&#8217;s proposed architecture for autonomous machine intelligence. The world model is one module among several.</span></em></p><p><span>Reading the diagram: </span><strong><span>perception</span></strong><span> turns percepts into a representation of the current state. The </span><strong><span>world model</span></strong><span> takes that state, plus an imagined action, and predicts the state that would follow, which is what lets the system evaluate a plan without executing it. The </span><strong><span>actor</span></strong><span> proposes actions, the </span><strong><span>cost</span></strong><span> and </span><strong><span>critic</span></strong><span> modules score the predicted outcomes, </span><strong><span>short-term memory</span></strong><span> holds the trajectory being considered, and the </span><strong><span>configurator</span></strong><span> adjusts the other modules for whatever task is at hand.</span></p><p><span>The point I want to draw from this is a limiting one. JEPA is a proposal for how to train the green box, and nothing else. There is no actor here, no cost module, no planning loop; the architecture around it is a research programme rather than something anyone has built. So when we talk about world models in this article we mean the representation-learning half specifically, and questions about what you would do with one, planning, control, action-conditioning, are outside what LeJEPA addresses.</span></p><p><span>Which is why the paper&#8217;s framing matters. If the world model is the piece everything else depends on, then getting its representation right is not one optimization problem among many, it is the one that determines whether the rest of the architecture has anything to work with.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217J2t%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7J2t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 424w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 848w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 1272w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217J2t%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png" width="579" height="257.6868131868132" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:648,&quot;width&quot;:1456,&quot;resizeWidth&quot;:579,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7J2t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 424w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 848w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 1272w, https://substackcdn.com/image/fetch/$s_!7J2t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec237317-b1de-4e31-86ef-21b50a6d532f_1664x741.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The same scene under three objectives. Only the third keeps what determines the outcome and lets the rest go.</span></em></p><p><strong><span>Why prediction is the natural way to learn one</span></strong></p><p><span>Here is the part that makes this more than philosophy. If you want a model with those properties and you have no labels, prediction is the only training signal available that produces them for free.</span></p><p><span>To predict what comes next you must represent what determines what comes next. There is no shortcut; a model that ignores the causal structure cannot anticipate it. So the prediction task does not merely test the world model, it </span><em><span>forces</span></em><span> one into existence, and the pressure to be abstract comes along automatically, because carrying unpredictable detail costs capacity and buys nothing.</span></p><p><span>This is the argument for self-supervision at its strongest, and it explains why the field keeps returning to it across modalities that otherwise share nothing. Next-token prediction, next-frame prediction and masked-patch prediction are the same bet: that predicting is how you are forced to understand.</span></p><p><strong><span>Where JEPA fits</span></strong></p><p><span>JEPA is a specific and, I think, correct answer to the question of where the prediction should happen.</span></p><p><span>Everything above says predict. Nothing above says predict in pixel space, and that turns out to be the crucial degree of freedom. Reconstruct the next frame and you are graded on the reflection on the ceramic, which forces exactly the detail-hoarding that the second property said to avoid. Predict in representation space and the model is free to discard whatever it cannot anticipate, which is what the same property demanded.</span></p><p><span>So JEPA&#8217;s claim is narrow but load-bearing: </span><strong><span>predict, but predict abstractly, and let the abstraction be learned rather than specified.</span></strong><span> The rest of this section is what that looks like when written down.</span></p><h3><strong><span>2.2 The setup</span></strong></h3><p><span>The architecture itself is deliberately plain, and it helps to see it as four steps before we complicate it:</span></p><ol><li><p><span>Take </span><strong><span>two views</span></strong><span> of the same underlying thing.</span></p></li><li><p><span>Push both through an </span><strong><span>encoder</span></strong><span> Enc(&#183;), which lands them in some embedding space R^K.</span></p></li><li><p><span>Ask a small </span><strong><span>predictor</span></strong><span> Pred(&#183;) to produce one of those embeddings from the other, where one is used at all.</span></p></li><li><p><span>Measure how far it missed, and backpropagate.</span></p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Dyur%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Dyur!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Dyur%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg" width="593" height="314.7841666666667" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1200,&quot;resizeWidth&quot;:593,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;JEPA: Joint Embedding Predictive Architecture Explained&quot;,&quot;title&quot;:&quot;JEPA: Joint Embedding Predictive Architecture Explained&quot;,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="JEPA: Joint Embedding Predictive Architecture Explained" title="JEPA: Joint Embedding Predictive Architecture Explained" srcset="https://substackcdn.com/image/fetch/$s_!Dyur!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Dyur!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5867b5bb-cf5c-4dfe-81f0-10fcba8aae58_1200x637.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Everything interesting is hiding in that first step, because what counts as &#8220;two views of the same thing&#8221; is entirely up to you. If your data is video then time gives you views for free, and view one is frame </span><em><span>t</span></em><span> while view two is frame </span><em><span>t+1</span></em><span>, which means you are effectively asking the model where the world is going next. If your data is images then you have to manufacture views instead of finding them, so you take two random crops of the same photo, or a masked patch and the context around it, or the same image under two different colour jitters, and you ask the model what belongs with what. The machinery downstream is completely identical in both cases and only the view-generator changes, which is why I will mostly just say &#8220;two views&#8221; from here on and stay agnostic about where they came from.</span></p><h3><strong><span>2.3 Why predict in representation space?</span></strong></h3><p><span>We asserted this in 2.1 and it is worth earning properly, because the cleanest way to see it is to write the two objectives next to each other.</span></p><p><span>Reconstruction, which is what autoencoders and masked image models do, predicts back into the input space:</span></p><p style="text-align: center;"><em><span>L_recon(&#952;) = E [ &#8214; Dec(Enc(x&#771;)) &#8722; x &#8214;&#178; ],    x &#8712; R^D</span></em></p><p><span>whereas JEPA predicts into the embedding space instead:</span></p><p style="text-align: center;"><em><span>L_pred(&#952;) = E [ &#8214; Pred(Enc(x_v)) &#8722; Enc(x_v&#8242;) &#8214;&#178; ],    Enc(x) &#8712; R^K</span></em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lwLU%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lwLU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 424w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 848w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 1272w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lwLU%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png" width="1456" height="957" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:957,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lwLU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 424w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 848w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 1272w, https://substackcdn.com/image/fetch/$s_!lwLU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8318feea-6584-4f7a-938a-f72bfeb4f57b_1883x1238.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The same two encoders, two different places to put the target. Moving it from pixel space to representation space is the entire architectural claim.</span></em></p><p><span>The difference between these two lines looks almost cosmetic, and it is anything but, because it changes three things at once.</span></p><p><span>The first is that </span><strong><span>unpredictable detail becomes free to throw away</span></strong><span>, which is the world-model property from 2.1 arriving as a loss function. Under reconstruction every pixel of the missing patch contributes to your loss, so the model is actively penalized for failing to predict things that are not predictable in principle; the position of each leaf on a tree, the grain of the sensor noise, the exact texture of gravel. A real fraction of model capacity ends up going into hallucinating plausible detail, which is a genuine skill but not the one you were trying to teach.</span></p><p><span>Suppose I nudge a cup off the edge of a table and ask what happens next; you will say without hesitation that it falls, hits the floor and probably breaks. What you will not do is give me the coordinates of each ceramic shard, and if I insisted you would rightly say the question is unreasonable, not because your understanding is poor but because that information does not yet exist in any form your prediction could access. Your grasp of the dynamics is excellent and your ability to reproduce the pixels is nil. Reconstruction grades you on the second; JEPA grades you on the first.</span></p><p><span>The second consequence is subtler and matters more than it first appears: </span><strong><span>the target is no longer fixed</span></strong><span>. In reconstruction, x is handed to you by the dataset and cannot move no matter what the optimizer does, whereas in JEPA the target Enc(x_v&#8242;) is itself a function of &#952;, so both sides of the loss shift every time you take a step.</span></p><p><span>Which leads directly to the third, namely that </span><strong><span>this is exactly where the trouble begins</span></strong><span>. A fixed target makes collapse structurally impossible, because there is no way to cheat your way into reproducing a photograph you have never seen. A learnable target makes collapse the single easiest thing the optimizer can do, and it will find that shortcut unless you stop it. Hence JEPA needs anti-collapse machinery for a structural reason that autoencoders never had, and that is not a flaw so much as the price of the freedom we bought in the first consequence.</span></p><p><span>One aside about the predictor network, since it will come back later. Its stated job is to absorb whatever systematic difference exists between the two views before the comparison, and that is well-motivated when the views really are asymmetric in information content, for instance when you condition the prediction on an observed robot action so that there is an actual transformation to be learnt. It stands on much shakier ground when the views are symmetric, in which case it looks less like a modelling choice and more like a device for breaking an inconvenient symmetry. Hold that thought; it turns out LeJEPA does not need one at all.</span></p><h3><strong><span>2.4 The definition, and the crack running through it</span></strong></h3><p><span>The paper states the JEPA criterion compactly, and the shape of the statement matters as much as its content:</span></p><p><strong><span>Enc(x_{t+1}) is predictable from Enc(x_t), for all n and t, and Enc(&#183;) is not degenerate.</span></strong></p><p><span>It is worth reading twice, because it is two clauses joined by an &#8220;and&#8221;, and those clauses are not remotely the same kind of object.</span></p><p><span>The first is a loss function, specifically the L_pred we wrote above; you can put it on paper, differentiate it, and hand it to an optimizer with no ambiguity about what you are asking for. The second is an English sentence. &#8220;Not degenerate&#8221; is a property everyone agrees they want and nobody has specified, which means it has no gradient, no closed form, and nothing you can minimize, so in practice it gets silently translated into whichever mechanism happened to fix the last failure someone observed. That crack between a clause you can compute and a clause you can only gesture at is, in a very real sense, the entire subject of this article.</span></p><h3><strong><span>2.5 Writing the whole thing as one objective</span></strong></h3><p><span>Let us now push both clauses into a single equation, because doing that makes the missing piece impossible to ignore.</span></p><p><span>The general form of constrained optimization is something we built up from scratch in the </span><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fregularization-what-why-and-how-part"><span>regularization article</span></a><span>, and the shape of it is that you want to minimize an objective while respecting a constraint,</span></p><p style="text-align: center;"><em><span>min_&#952;  f(&#952;)    subject to    g(&#952;) &#8804; 0</span></em></p><p><span>which you then fold into a single expression by attaching the constraint to the objective through a multiplier:</span></p><p style="text-align: center;"><em><span>L(&#952;) = f(&#952;) + &#945; &#183; g(&#952;)</span></em></p><p style="text-align: center;"><em><span>[EMBED: Regularization : What? Why? and How? (Part -1)]</span></em></p><p><span>Mapping JEPA onto that gives us the skeleton that the rest of this article exists to fill in, with the predictive term playing the role of the objective and the anti-degeneracy requirement playing the role of the constraint:</span></p><p style="text-align: center;"><em><span>L_JEPA(&#952; ; X)  =  L_pred(&#952; ; X)  +  &#945; &#183; L_constraint(&#952;)</span></em></p><p style="text-align: center;"><em><span>where L_pred is f(&#952;), i.e. clause one, and L_constraint is g(&#952;), i.e. clause two.</span></em></p><p><span>Three things fall out of this, and together they set up everything that follows.</span></p><p><span>The first is that </span><strong><span>f is settled while g is not</span></strong><span>, since every JEPA variant in the literature agrees almost exactly on the predictive term, and every disagreement between them, without exception, turns out to be a disagreement about g. The second is that </span><strong><span>every existing method is really an unwritten g in disguise</span></strong><span>, because stop-gradients, EMA teachers, whitening layers, negative samples and VICReg&#8217;s variance-covariance penalties are all mechanisms that behave like constraints without ever having been stated as one, and several of them are not even in the loss at all but are instead surgery performed directly on the gradient flow. The third is that </span><strong><span>&#945; cannot exist until g does</span></strong><span>, which is worth noticing because a single principled trade-off parameter is only available to you once the thing being traded off has an actual form; if your constraint is a collection of architectural interventions then there is nothing to put a coefficient on, and you are left tuning schedules instead.</span></p><p><span>All of which lets us state the paper&#8217;s contribution in one line, before we have looked at a single piece of its machinery: </span><strong><span>LeJEPA is a specific, derived choice of g</span></strong><span>, and everything from Section 6 onwards is the derivation of it.</span></p><h3><strong><span>2.6 What &#8220;degenerate&#8221; actually looks like</span></strong></h3><p><span>Since g exists to prevent degeneracy, we should be concrete about what it is preventing, and there are two versions of the failure with the second being considerably more dangerous than the first.</span></p><p><strong><span>Complete collapse</span></strong><span> is the blunt version, where the encoder simply maps every input to the same constant vector:</span></p><p style="text-align: center;"><em><span>Enc(x) = c   &#8704;x    &#10233;    L_pred(&#952;) = 0</span></em></p><p><span>Both embeddings are then identical, the predictor happily learns the identity function, the loss drops to zero, and the model has learnt precisely nothing. This is the failure mode we flagged in the introduction and it is the easy one to deal with, because it is loud in the loss curve and obvious the moment you look at the embeddings.</span></p><p><strong><span>Dimensional collapse</span></strong><span> is the version that actually ruins your week. Here the encoder does not push everything to a single point, but it does confine everything to a low-dimensional subspace of the embedding space, so that if we write &#931; = Cov(Enc(x)) with eigenvalues &#955;&#8321; &#8805; &#8230; &#8805; &#955;_K, what we observe is</span></p><p style="text-align: center;"><em><span>&#955;_k &#8776; 0  for all k &gt; r,    where  r &#8810; K</span></em></p><p><span>meaning your representation is nominally 1024-dimensional while the model is genuinely using perhaps thirty of those directions and the remaining several hundred carry essentially no variance at all. What makes this so much worse than complete collapse is that nothing in your training run will tell you it is happening; the prediction loss looks entirely healthy, distinct views really are being mapped to distinguishable embeddings, the model genuinely is solving the task you set it, and you typically discover the problem much later when a linear probe underperforms for reasons you cannot localize to anything in particular.</span></p><p><span>It is also worth noticing that this is not a binary condition in the way complete collapse is. Dimensional collapse is a spectrum, every trained model sits somewhere along it, and the honest question is never whether your model has collapsed but rather how much of the embedding space you paid for is doing real work. Which hands us a considerably sharper question than the vague one we started this section with, because if what we actually care about is how variance gets distributed across the directions of the embedding space, then the thing we should be asking is: </span><strong><span>what is the right distribution of variance across those directions?</span></strong></p><p><span>Hold onto that, because it turns out to have a precise answer, and pinning that answer down is the whole of Section 6.</span></p><div><hr></div><h1><span>3. Connecting probability with optimization</span></h1><p><span>We closed the last section with an objective of the form f(&#952;) + &#945;&#183;g(&#952;), and I asked you to take on trust that this is the natural shape for a JEPA to take. That was slightly unfair, because written that way the constraint term looks like something we bolted on because we needed it. So before we go hunting for the right g, it is worth showing that this shape is not a convenience at all; it drops out of probability theory on its own, and once you see where it comes from, the presence of a constraint term stops being a design decision and becomes something you could not avoid even if you wanted to.</span></p><h3><strong><span>3.1 Starting from Bayes</span></strong></h3><p><span>Start from the most familiar statement in probability:</span></p><p style="text-align: center;"><em><span>P(A | B) = P(B | A) &#183; P(A) / P(B)</span></em></p><p><span>Nothing controversial here, it is a rearrangement of the definition of conditional probability, and A and B are just labels. That last part matters more than it usually gets credit for, because it means we get to decide what goes in those slots depending on what we are actually trying to learn.</span></p><p><span>In our setting there are two objects in play; the data X that we observed, and the parameters &#952; of the model we are fitting. Putting those in gives us</span></p><p style="text-align: center;"><em><span>P(&#952; | X) = P(X | &#952;) &#183; P(&#952;) / P(X)</span></em></p><p><span>and each piece here has a job. P(&#952;|X) is the posterior, the thing we are trying to maximize, and it asks how plausible a particular set of parameters is given the data we have. P(X|&#952;) is the likelihood, which asks how probable our observed data would be under a given setting of the parameters. P(&#952;) is the prior over parameters, what we believed about reasonable models before seeing anything. And P(X) is the evidence, which is a normalization term.</span></p><p><span>We can drop the evidence immediately, and it is worth being precise about why. P(X) does not contain &#952; anywhere, so its gradient with respect to &#952; is exactly zero, which means it shifts the value of the objective without ever changing where the optimum sits. It is not being neglected as small, it genuinely has no say in the answer.</span></p><h3><strong><span>3.2 Taking logs</span></strong></h3><p><span>The remaining expression is a product, which is awkward to optimize; gradients through products get messy and probabilities underflow the moment you multiply enough of them together. Since log is monotonic, whatever maximizes a quantity also maximizes its log, so we lose nothing by taking logs and gain a sum:</span></p><p style="text-align: center;"><em><span>log P(&#952; | X) = log P(X | &#952;) + log P(&#952;)</span></em></p><p><span>And there it is. The objective we want, on the left, is the sum of a fit term and a prior term, and nobody put that second term there deliberately; it fell out of Bayes and there is no version of this equation that does not contain it.</span></p><p><span>That second term is one you have used your whole career, usually without calling it a prior. Put a Gaussian prior on the weights and &#8722;log P(&#952;) becomes a squared penalty on their magnitude, which is weight decay. Put a Laplace prior on them and you get L1. The entire discussion we had in the </span><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fregularization-what-why-and-how-part"><span>regularization article</span></a><span> about penalizing large weights and constraining model complexity was, underneath the geometry, an argument about how to choose P(&#952;).</span></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;4ff6d370-d7ff-4141-b020-9126c0d5e43b&quot;,&quot;caption&quot;:&quot;What would have been your approach towards regularization if you were the person who actually came up with it? Are you unable to connect different concepts which we generally see while learning about Regularization? Maybe due to the isolative way we learn about this or the lack of general tools you need to crack this up. If you are a discoverer by heart&#8230;&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Regularization : What? Why? and How? (Part -1)&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null},{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-12-16T04:40:22.360Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!BaWo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7598540-b90f-47ed-b100-62323bb82171_1104x976.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/regularization-what-why-and-how-part&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:153134991,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:8,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><h3><strong><span>3.3 Where LeCun&#8217;s framing changes the picture</span></strong></h3><p><span>So far this is standard, and it gets us a constraint on the </span><em><span>parameters</span></em><span>. But the thing we care about in self-supervised learning is not really the weights, it is the representation, and this is where LeCun&#8217;s way of setting the problem up becomes useful.</span></p><p><span>The move is to stop treating the representation as an intermediate quantity that happens to appear inside the network, and start treating it as part of what we are inferring. Instead of asking about &#952; alone, we ask about the pair:</span></p><p style="text-align: center;"><em><span>P([&#952;, Z] | X) = P(X | [&#952;, Z]) &#183; P([&#952;, Z]) / P(X)</span></em></p><p><span>Same equation, same evidence term dropping out for the same reason, same logs:</span></p><p style="text-align: center;"><em><span>log P([&#952;, Z] | X) = log P(X | [&#952;, Z]) + log P([&#952;, Z])</span></em></p><p><span>I should be upfront that there is a modelling stance hidden in this substitution rather than a derivation. In a JEPA the encoder is deterministic, so Z = Enc(X; &#952;) is fully determined once you fix &#952; and X, and treating Z as something to be inferred alongside &#952; is a choice we are making rather than something the mathematics forces on us. But it is the right choice, and it is more or less the whole of LeCun&#8217;s position; the representation is the object of interest and the weights are merely how we happen to parameterize it. If that is what you believe, then the representation belongs in the objective, and Bayes has no objection to putting it there.</span></p><p><span>Now flip the sign, so that we are minimizing a loss like everywhere else in this article rather than maximizing a probability. Negating the log posterior gives us</span></p><p style="text-align: center;"><em><span>&#8722;log P([&#952;, Z] | X) = &#8722;log P(X | [&#952;, Z]) &#8722; log P([&#952;, Z]) + log P(X)</span></em></p><p><span>and since log P(X) contains neither &#952; nor Z, it shifts the value without moving the optimum, so it survives in the equation but disappears from the minimization:</span></p><p style="text-align: center;"><em><span>argmin over (&#952;, Z) of [ &#8722;log P([&#952;, Z] | X) ]  =  argmin over (&#952;, Z) of [ &#8722;log P(X | [&#952;, Z]) &#8722; log P([&#952;, Z]) ]</span></em></p><p style="text-align: center;"><em><span>where the first term is f(&#183;), the fit, and the second is g(&#183;), the prior.</span></em></p><p><span>Finally we attach a coefficient, because in practice we do not want the fit and the prior weighted equally. This last step deserves an honest label, since the moment &#945; appears we are no longer computing a posterior and the equality would be a lie; what we are doing is </span><em><span>defining</span></em><span> a training objective that is inspired by one:</span></p><p style="text-align: center;"><em><span>L(&#952;, Z ; X)  &#8796;  &#8722;log P(X | [&#952;, Z])  +  &#945; &#183; ( &#8722;log P([&#952;, Z]) )</span></em></p><p style="text-align: center;"><em><span>with the semicolon separating what we optimize over, &#952; and Z, from what the loss is conditioned on, X.</span></em></p><p style="text-align: center;"><em><span>min over (&#952;, Z) of  L(&#952;, Z ; X)</span></em></p><p><span>which is exactly the f + &#945;g we wrote down at the end of Section 2, now arrived at rather than asserted. Setting &#945; to one recovers exact Bayesian inference; anything else is a deliberate statement about how seriously we take the prior relative to the data, and that knob is the same Lagrange multiplier that appeared in the regularization article when a hard threshold got softened into a penalty.</span></p><h3><strong><span>3.4 What lives inside the joint prior</span></strong></h3><p><span>The interesting term is P([&#952;, Z]), and the reason it is interesting is that it is a joint prior over both objects at once. It is not a prior on weights with a representation term stapled on; it is a single statement of belief about what a good (parameters, representation) pair looks like, and that gives us more room than we are used to having.</span></p><p><span>There are three kinds of belief you can express in there.</span></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w79z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 424w, https://substackcdn.com/image/fetch/$s_!w79z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 848w, https://substackcdn.com/image/fetch/$s_!w79z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 1272w, https://substackcdn.com/image/fetch/$s_!w79z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21w79z%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png" width="601" height="217.0476758045292" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:606,&quot;width&quot;:1678,&quot;resizeWidth&quot;:601,&quot;bytes&quot;:96185,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!w79z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 424w, https://substackcdn.com/image/fetch/$s_!w79z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 848w, https://substackcdn.com/image/fetch/$s_!w79z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 1272w, https://substackcdn.com/image/fetch/$s_!w79z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35c86bac-43c2-4052-ac7e-de4d295584ee_1678x606.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p style="text-align: center;"><em><span>The joint prior gives three distinct places to put a belief. Almost all classical work sits in the leftmost panel; every SSL constraint we are about to look at sits in the middle one.</span></em></p><p><span>You can place belief </span><strong><span>on &#952; alone</span></strong><span>, which is classical regularization and is what almost all of the literature has historically done. Weight decay, L1, spectral norms, anything that says a good model has small or well-behaved parameters. This constrains the machine.</span></p><p><span>You can place belief </span><strong><span>on Z alone</span></strong><span>, which is far less explored and is where this entire article is heading. Statements like &#8220;the representation should not collapse&#8221;, &#8220;the representation should use its dimensions evenly&#8221;, &#8220;the representation should follow some particular distribution&#8221;. This constrains what the machine produces, which is a genuinely different thing to constrain.</span></p><p><span>Or you can place belief </span><strong><span>on the coupling between them</span></strong><span>, which is the part that only exists because we kept the prior joint. Anything that says a certain kind of representation should only arise from a certain kind of parameterization lives here, and it is largely unexplored territory.</span></p><p><span>One detail about the Z part is worth pausing on, because it explains something that confuses people the first time they implement any of this. A belief about the representation is almost never a belief about an individual embedding vector; it is a belief about the </span><em><span>distribution</span></em><span> of embeddings that the encoder induces across the data. Collapse is not a property any single vector can have. A lone embedding sitting at the origin is unremarkable, and it is only when every embedding sits at the origin that anything has gone wrong. Hence any term in this slot has to be computed over a population rather than per-sample, which is precisely why every anti-collapse mechanism in the literature operates on a batch and why none of them can be written as a per-example loss.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nS1A%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nS1A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 424w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 848w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 1272w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nS1A%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png" width="1456" height="513" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:513,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nS1A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 424w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 848w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 1272w, https://substackcdn.com/image/fetch/$s_!nS1A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F896b7dba-ee0b-4df2-9502-c7a534dd2b58_1664x586.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The orange point is the same embedding in all three panels. Nothing about it tells you whether the representation has collapsed; only the cloud around it does.</span></em></p><h3><strong><span>3.5 Why the constraint carries the inductive bias</span></strong></h3><p><span>Now Yann&#8217;s framing from the introduction stops being a slogan and becomes something you can point at in the equation.</span></p><p><span>Recall from Section 2 that the fit term is trivially satisfiable. A constant encoder drives the predictive loss to zero and learns nothing, which in the language we have just built means f(&#183;) does not determine the solution; there is an enormous family of (&#952;, Z) that optimize it perfectly and they differ wildly in how useful they are. The fit term tells you which solutions are </span><em><span>admissible</span></em><span>. It says nothing about which one you should end up at.</span></p><p><span>The prior term is what chooses. Which means whatever you put in that slot is not a safety mechanism protecting your training run, it is the thing that decides what your model actually learns. Two JEPAs with identical predictive losses and different priors are not two implementations of one idea with different stability characteristics; they are different learning algorithms that will converge to genuinely different representations.</span></p><p><span>That is an uncomfortable thought when you set it next to the list from the introduction, because none of those methods wrote their prior down. Stop-gradients, EMA teachers, whitening layers, negative samples, variance-covariance penalties; every one of them is an attempt to express a belief about Z without ever stating what that belief is, and several of them are not even in the loss but are instead surgery performed directly on the gradient flow. We have been choosing the most important part of the objective by trial and error, and then describing the result as a stability trick.</span></p><p><span>That is the gap LeJEPA walks into. Its claim is that the Z part of this prior has a correct form, that the form can be derived rather than guessed, and that once written down properly it makes every mechanism that was approximating it unnecessary. The next two sections look at what those mechanisms actually are and where each one falls short, and then we can go looking for the answer.</span></p><div><hr></div><h1><span>4. The heuristics zoo, and what &#8220;under-specified&#8221; really means</span></h1><p><span>We now have a slot in the objective that needs filling, and we have the observation that every existing method is filling it without saying so. It is worth going through those methods properly, not to catalogue them but to ask the same question of each one; what belief about Z is this mechanism trying to express, and where does the expression fall short? Because the pattern that emerges is remarkably consistent, and it is what tells us what we should be asking for in the first place.</span></p><p><span>Most of these mechanisms we have met before, since I went through the contrastive, clustering and distillation families in some detail in the </span><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa-primer-on-self-supervised-learning"><span>SSL primer</span></a><span>; what I want to do here is different, which is to re-read each of them through the lens we just built and ask what belief each one is really trying to express.</span></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;19e3b843-1bc6-43a8-a34c-d8db46ddf670&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A Primer on Self-supervised Learning&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-07-14T03:59:10.278Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!v873!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca21028-57fa-4ced-a461-916dd4bf4075_648x435.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/a-primer-on-self-supervised-learning&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:167795587,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:9,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><span>It helps to keep the base form from the last section in view while we do this, because every method below is an answer to the question of what g should be, and a few of the answers turn out to be that there isn&#8217;t one:</span></p><p style="text-align: center;"><em><span>L(&#952;, Z ; X)  =  f(&#952;, Z ; X)  +  &#945; &#183; g(&#952;, Z),      where  g(&#952;, Z) = &#8722;log P([&#952;, Z])</span></em></p><h3><strong><span>4.1 Two perspective of SSL tasks</span></strong></h3><p><span>Before going mechanism by mechanism, it is worth borrowing the taxonomy LeCun uses in the same lecture series, because it explains why the zoo has the shape it does rather than being an arbitrary collection of tricks.</span></p><p><span>The framing is energy-based. Define some scalar E(x) that is low for configurations the model considers plausible and high for the ones it does not; for our purposes E measures how compatible two views are under the current encoder, so low energy means &#8220;these belong together&#8221;. Training then has exactly one job, which is to push energy down on the data.</span></p><p><span>And here is the difficulty that generates everything else. Pushing energy down on the data is trivially easy. A model that assigns low energy to </span><em><span>everything</span></em><span> achieves it perfectly, and that is the same statement as collapse written in a different notation; a flat energy surface and a constant encoder are the same failure. So the entire problem of self-supervised learning is not making energy low where it should be, it is making energy </span><strong><span>high everywhere else</span></strong><span>.</span></p><p><span>There are exactly two ways to do that, and every method we are about to look at is one or the other.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216UB9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6UB9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 424w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 848w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 1272w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216UB9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png" width="657" height="282.9251373626374" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:627,&quot;width&quot;:1456,&quot;resizeWidth&quot;:657,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6UB9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 424w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 848w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 1272w, https://substackcdn.com/image/fetch/$s_!6UB9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc64aa0c1-9317-4dbd-ad11-bc6536c6981f_1766x761.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Orange points are the data. Both families end up with energy that is high away from the data; they differ entirely in how they get there.</span></em></p><p><strong><span>Contrastive methods push the energy up explicitly.</span></strong><span> You pick some points, you increase their energy, and the surface acquires shape because you carved it. The variants differ only in how the points get chosen; you can push up </span><em><span>everywhere</span></em><span> at once, which is maximum likelihood and which needs either a tractable partition function or a variational approximation because &#8220;everywhere&#8221; is an integral over the whole space. You can push up at </span><em><span>chosen locations</span></em><span>, which covers most of what we actually use, including metric learning and siamese networks, noise contrastive estimation, contrastive divergence, and, viewed from the right angle, the discriminator in a GAN. Or you can train a function that </span><em><span>maps off-manifold points back onto the manifold</span></em><span>, which is what denoising autoencoders do and what masked models like BERT do, where the corrupted input is the high-energy point and the reconstruction is the push back down.</span></p><p><strong><span>Regularized and architectural methods limit the volume of low-energy space instead.</span></strong><span> Nobody is pushed up anywhere. Instead you arrange matters so that there is only so much low energy to go around, and the model is forced to spend it where the data actually is. These come in variants too. You can build the machine so the low-energy region is </span><em><span>bounded by construction</span></em><span>; PCA has a fixed number of components, K-means a fixed number of centroids, a normalizing flow is volume-preserving by design, and in none of these is there a term in the loss doing the work, since the architecture simply makes the failure unreachable. You can add a </span><em><span>regularization term that measures the volume of low-energy space</span></em><span> and penalizes it, which is sparse coding, sparse autoencoders, VAEs with their KL term, and VQ-VAE with its finite codebook. You can make the output as </span><em><span>insensitive as possible</span></em><span> to the latent, which is what contracting and saturating autoencoders do by penalizing the Jacobian. Or you can shape the surface </span><em><span>locally</span></em><span>, minimizing the gradient and maximizing the curvature around data points, which is score matching.</span></p><p><strong><span>Mapping this back onto our equation</span></strong></p><p><span>Now read both families through the objective from Section 3, because the taxonomy predicts exactly what we are about to find.</span></p><p><span>Contrastive methods put the push-up directly into g, and we will see this concretely in a moment when InfoNCE splits apart; the denominator is a sum over chosen points whose energy is being raised, and it is a real term with a real value. The trouble is that the sum has to run over the points you chose, so the cost scales with how many you need, and in high dimension the number needed to meaningfully shape a surface grows uncomfortably. That is not an implementation detail you can optimize away, it is intrinsic to the decision to push up pointwise in a large space.</span></p><p><span>Architectural methods have no g at all, which is precisely the g &#8801; 0 we are going to keep running into. The constraint has been moved out of the objective and into the shape of the model or the behaviour of the optimizer, where it cannot be inspected, weighted, or ported to a new setting.</span></p><p><span>Regularization-term methods are the interesting branch, because they keep the constraint in the loss without paying the pointwise cost. Rather than raising energy at specific locations, they make a statement about the </span><em><span>distribution</span></em><span> of low energy as a whole, which is a global claim rather than a pointwise one, and that is why it can be cheap. It is also exactly the slot we identified at the end of Section 3.</span></p><p><span>Which tells us where this article is going. </span><strong><span>LeJEPA lives in the regularization branch</span></strong><span>, and it inherits the obvious question that the branch has never answered properly; if your term is supposed to measure something about the distribution of the representation, what exactly should it measure? Sparse coding says the representation should be sparse. VAEs say it should look like a chosen prior, which is closer to the mark than anything else on this list and we will come back to it. VICReg says its covariance should be the identity. All three are guesses.</span></p><p><span>The rest of this section walks through the guesses and where each one falls short, and then we go looking for a derivation instead.</span></p><h3><strong><span>4.2 Negative samples</span></strong></h3><p><span>The oldest answer, and in some ways still the most honest, is to simply tell the model that different things should not land in the same place. Contrastive methods like SimCLR and MoCo pull the two views of an image together while explicitly pushing every other image in the batch away, which turns the anti-collapse requirement into something you can write down; a collapsed encoder maps everything to one point, so if you penalize proximity between unrelated samples then collapse is directly and heavily punished.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QW-G%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QW-G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 424w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 848w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 1272w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QW-G%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png" width="427" height="258.06356736242884" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1054,&quot;resizeWidth&quot;:427,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QW-G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 424w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 848w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 1272w, https://substackcdn.com/image/fetch/$s_!QW-G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0917cbfa-658d-4e79-930d-fe5a6229d8fe_1054x637.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The positive pair is pulled together while every other sample in the batch is pushed away, which is where the quadratic cost comes from.</span></em></p><p><span>Contrastive learning does something rather elegant on our equation, in that f and g are both hiding inside a single expression. Expand the InfoNCE loss and they separate cleanly:</span></p><p style="text-align: center;"><em><span>L_InfoNCE = &#8722;log [ exp(sim(z, z&#8314;)/&#964;) / &#931;_j exp(sim(z, z_j)/&#964;) ]</span></em></p><p style="text-align: center;"><em><span>= &#8722; sim(z, z&#8314;)/&#964;   +   log &#931;_j exp( sim(z, z_j)/&#964; )</span></em></p><p style="text-align: center;"><em><span>where the first term is f(&#183;), the fit, and the second is g(&#183;), the constraint.</span></em></p><p><span>The numerator pulls the positive pair together and is the fit term; the denominator sums over every other sample in the batch and is the constraint. So contrastive methods do have a real g, they simply never separated it out and named it. The cost is visible right there in the sum, which runs over the whole batch for every sample and gives us O(B&#178;K).</span></p><p><span>The belief being expressed here is that the representation should spread its mass out rather than concentrate it, and as beliefs go that is entirely reasonable. The trouble is what it costs to say it this way. Every sample has to be compared against every other sample in the batch, which is a quadratic operation, and worse, the quality of the signal depends on how many negatives you have available; too few and the constraint barely bites, so you end up needing enormous batches or an auxiliary memory bank of stored embeddings to make it work at all. You are also, in a subtle way, lying to the model, since two different photographs of the same breed of dog are treated as things that must be pushed apart when they arguably should not be. The constraint is real and statable, it is just expensive and slightly wrong.</span></p><h3><strong><span>4.3 Teacher&#8211;student networks with EMA</span></strong></h3><p><span>BYOL and DINO take an entirely different route, and this is the one I find hardest to justify from first principles. You keep two copies of the network, a student that receives gradients normally and a teacher whose weights are an exponential moving average of the student&#8217;s, and the student is trained to predict the teacher&#8217;s output. The teacher never receives gradients at all; it simply trails behind.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21c-V-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c-V-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 424w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 848w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 1272w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21c-V-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png" width="1456" height="837" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:837,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c-V-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 424w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 848w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 1272w, https://substackcdn.com/image/fetch/$s_!c-V-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33c9c9fe-a0c9-41ff-b235-936c3f0340e6_2046x1176.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Two ways of avoiding collapse without writing anything into the objective. In both cases the constraint lives in the gradient flow rather than in the loss.</span></em></p><p><span>Written against our base form, the objective here is only the fit term, with the target produced by a second, slower parameter set:</span></p><p style="text-align: center;"><em><span>L_BYOL = &#8214; Pred(Enc_&#952;(x_v)) &#8722; Enc_&#958;(x_v&#8242;) &#8214;&#178;,    &#958;_t = &#964; &#958;_{t&#8722;1} + (1&#8722;&#964;) &#952;_t</span></em></p><p style="text-align: center;"><em><span>g(&#183;) &#8801; 0</span></em></p><p><span>There is nothing at all in the constraint slot. The entire anti-collapse behaviour lives in that second expression, which is an update rule rather than a term in the objective, and &#964; is a schedule rather than a trade-off.</span></p><p><span>What belief about Z does this express? I genuinely struggle to answer that, and I do not think the answer exists in a clean form. The mechanism is temporal rather than distributional; because the teacher lags, the target the student chases is always slightly stale, so the collapsed solution is a fixed point the optimizer cannot walk into quickly enough to reach before other structure has formed. Collapse is avoided by making the descent path awkward rather than by making collapse expensive.</span></p><p><span>And it works, extremely well, which is exactly what makes it such a clean illustration of the argument from the previous section. Here is a mechanism carrying an enormous amount of the inductive bias in some of the best vision models we have, and if you ask what property of the representation it guarantees, nobody can tell you. There is no theorem. There is an EMA decay rate that needs to be scheduled by hand, and if you get the schedule wrong the whole thing falls over.</span></p><h3><strong><span>4.4 Stop-gradients</span></strong></h3><p><span>SimSiam pushed this further and showed, somewhat startlingly, that you can drop the EMA teacher entirely and keep the collapse-avoidance, provided you place a stop-gradient on one branch so that gradients only flow through the other.</span></p><p><span>The same situation, made starker:</span></p><p style="text-align: center;"><em><span>g(&#183;) &#8801; 0,     &#8711;&#771;_&#952; L  &#8800;  &#8711;_&#952; L</span></em></p><p><span>The constraint is not so much absent from the objective as the objective is absent from the optimization; we descend a modified gradient for which no corresponding loss exists.</span></p><p><span>I want to flag what has happened here, because it is easy to skate past. A stop-gradient is not a term in the loss. It does not appear in the objective, it has no value, it cannot be traded off against anything. It is an instruction to the autograd engine to discard part of the true gradient, which means the quantity actually being descended is not the gradient of the loss you wrote down. Whatever implicit objective SimSiam is optimizing, it is not L_pred, and there is no expression for it anywhere.</span></p><p><span>In the framing from Section 3 this is not a badly-specified prior; it is not a prior at all. There is nothing in the P([&#952;, Z]) slot, and the constraint has instead been smuggled into the optimizer.</span></p><h3><strong><span>4.5 Whitening</span></strong></h3><p><span>Barlow Twins and W-MSE take the most transparent approach of the lot. If dimensional collapse means the embedding dimensions are redundant and confined to a subspace, then simply require them not to be redundant; drive the cross-correlation matrix between the two views&#8217; embeddings towards the identity, so that each dimension carries its own information and none duplicates another.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212F8r%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2F8r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 424w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 848w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 1272w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212F8r%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png" width="461" height="259.16581818181817" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:773,&quot;width&quot;:1375,&quot;resizeWidth&quot;:461,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2F8r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 424w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 848w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 1272w, https://substackcdn.com/image/fetch/$s_!2F8r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d63b3a-1a64-4504-86b1-245b351f84c6_1375x773.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Barlow Twins drives the cross-correlation matrix towards the identity. The object being optimized is K &#215; K, which is the entire cost problem in one picture.</span></em></p><p><span>This is the first method that puts something explicit into the slot:</span></p><p style="text-align: center;"><em><span>g_BT(Z) = &#931;_i (1 &#8722; C_ii)&#178;  +  &#955; &#931;_{i&#8800;j} C_ij&#178;</span></em></p><p style="text-align: center;"><em><span>where C = cross-corr( Z&#7515;, Z&#7515;&#8242; ) is a K &#215; K matrix.</span></em></p><p><span>A genuine, differentiable, statable term at last. The K &#215; K sitting in the shape of C is exactly the cost problem.</span></p><p><span>This is a real belief about Z, stated in the loss, differentiable, and defensible. The problem is what it costs and how it behaves. Building a correlation matrix over a K-dimensional embedding is a K&#215;K operation, so both memory and compute grow quadratically in the embedding dimension, which is precisely the direction you want to scale. Several variants additionally need matrix inverses or square roots to perform the whitening, and those are numerically delicate in a way that shows up as instability at exactly the moment your model gets large enough to be interesting.</span></p><h3><strong><span>4.6 VICReg, and the thing that is actually wrong</span></strong></h3><p><span>VICReg deserves the most attention here, both because it is the most explicit of the lot and because it will reappear later as a special case of what LeJEPA does.</span></p><p><span>Its loss has three named terms; an invariance term that pulls the two views together, a variance term that forces each embedding dimension to maintain a minimum standard deviation across the batch, and a covariance term that pushes off-diagonal covariances towards zero. Put together, the second and third are a direct instruction about the shape of the embedding distribution; every dimension should carry variance, and no two dimensions should be correlated. Written in the language of Section 3, VICReg says the representation should have roughly identity covariance.</span></p><p><span>That is a genuine, written-down belief about Z, which already puts it ahead of everything above. And it still is not enough, for a reason that has nothing to do with cost.</span></p><p><span>In our notation its constraint term is the most explicit of the lot:</span></p><p style="text-align: center;"><em><span>g_VIC(Z) = &#931;_k max( 0, &#947; &#8722; &#963;_k(Z) )   +   &#931;_{i&#8800;j} [ Cov(Z) ]&#178;_ij</span></em></p><p style="text-align: center;"><em><span>the first sum being the variance term and the second the covariance term.</span></em></p><p><em><strong><span>Identity covariance constrains the first two moments of a distribution and says absolutely nothing about the rest of it.</span></strong></em></p><p><span>And now the failure can be stated precisely rather than merely argued, because both terms depend on Z only through Cov(Z), which means:</span></p><p style="text-align: center;"><em><span>Cov(P) = Cov(Q)   &#10233;   g_VIC(P) = g_VIC(Q)</span></em></p><p><span>That single line is the whole problem. Any two distributions sharing a covariance matrix are completely indistinguishable to this penalty, no matter how different they are in every other respect.</span></p><p><span>This is what &#8220;under-specified&#8221; means, and it is worth being concrete, because the phrase gets used loosely. A criterion is under-specified when a solution can satisfy it completely while remaining degenerate in a way the criterion cannot see. And there are many distributions with mean zero and identity covariance:</span></p><ol><li><p><span>A standard Gaussian has identity covariance.</span></p></li><li><p><span>So does a distribution concentrated on the corners of a hypercube; all mass sitting at &#177;1 in each coordinate, nothing anywhere in between.</span></p></li><li><p><span>So does a heavy-tailed distribution where most embeddings sit near the origin and a handful sit very far away, arranged so the second moments work out.</span></p></li></ol><ol><li><p><span>So does a mixture of a few tight, widely separated clusters.</span></p></li></ol><p><span>Every one of those passes VICReg&#8217;s check with a perfect score. Several of them are terrible representations. A distribution living on hypercube corners has a discrete, spiky structure that any downstream linear probe will struggle with; a heavy-tailed one has most of its samples crowded into a region where they cannot be told apart while its variance budget is spent on outliers. The covariance matrix cannot distinguish any of these from a Gaussian, because covariance is blind to everything above the second moment.</span></p><p><span>So the criterion is satisfied and the model is still bad, and crucially, nothing in your loss curve will indicate this. You have not been told you are wrong, honestly you have been told nothing at all about the thing you failed to constrain.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21beTV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!beTV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 424w, https://substackcdn.com/image/fetch/$s_!beTV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 848w, https://substackcdn.com/image/fetch/$s_!beTV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 1272w, https://substackcdn.com/image/fetch/$s_!beTV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21beTV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png" width="563" height="618.2946428571429" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1599,&quot;width&quot;:1456,&quot;resizeWidth&quot;:563,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!beTV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 424w, https://substackcdn.com/image/fetch/$s_!beTV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 848w, https://substackcdn.com/image/fetch/$s_!beTV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 1272w, https://substackcdn.com/image/fetch/$s_!beTV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9a9f4e9-cd14-4028-ba2b-16231fa9d75a_1526x1676.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Four distributions with identical mean and covariance, computed rather than asserted. Three of them are poor representations, and no covariance-based penalty can tell any of them apart from the first.</span></em></p><h3><strong><span>4.7 The pattern</span></strong></h3><p><span>Setting all five side by side, and specifically setting their g terms side by side, the failures sort themselves into three kinds, and most methods manage to exhibit more than one. Two of the g terms are identically zero, one is O(B&#178;) in the batch, one is O(K&#178;) in the embedding dimension, and the only cheap and well-specified-looking one turns out to be blind to everything above the second moment.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ChrH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ChrH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 424w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 848w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 1272w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ChrH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png" width="1456" height="921" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:921,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ChrH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 424w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 848w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 1272w, https://substackcdn.com/image/fetch/$s_!ChrH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d1397b3-1f5a-45d4-83f6-41dd109bce4a_1664x1053.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The five mechanisms, their constraint terms, and the three ways of falling short.</span></em></p><p><span>The three failure kinds are worth naming, because they are exactly what we will demand the fix avoid:</span></p><ol><li><p><strong><span>Quadratic in something you want to scale.</span></strong><span> Batch size for contrastive methods, embedding dimension for whitening. Both are dimensions you would like to grow, and both are where the cost lands.</span></p></li><li><p><strong><span>Under-specified.</span></strong><span> The criterion can be fully satisfied by a degenerate solution, which is VICReg&#8217;s problem and, in a looser sense, everybody&#8217;s.</span></p></li></ol><ol start="2"><li><p><strong><span>Not in the loss.</span></strong><span> Stop-gradients and EMA schedules are interventions in the training procedure rather than statements in the objective, which means they cannot be reasoned about, traded off, or ported to a new setting without re-tuning from scratch.</span></p></li></ol><p><span>Notice that none of these is a complaint about performance. All of these methods work; several of them produce state-of-the-art representations, and I have written admiringly about models built on them. The complaint is that we cannot say what any of them guarantees, which means we cannot improve them except by trying things, and we cannot know whether we are near the best available answer or nowhere close.</span></p><p><span>Which finally lets us ask the right question. Rather than continuing to patch, what would we actually want from a term in that slot if we could specify it freely? That is the next section.</span></p><div><hr></div><h1><span>5. The Ideal Case</span></h1><p><span>We have spent three sections building a frame and then finding that nothing quite fits in it. Section 3 gave us a slot in the objective and told us what kind of object belongs there; Section 4 went through everything currently occupying that slot and found each occupant wanting. Which puts us in the position I always find most useful at this point in a paper, namely to stop reading it entirely and ask what we would want if we could simply specify it.</span></p><p><span>The nice thing is that Section 4 has already done most of the work, because each failure inverts directly into a requirement. So let us collect those first, then add the one requirement that the failures cannot possibly tell us about, which turns out to matter more than the rest combined.</span></p><h3><strong><span>5.1 What the failures demand</span></strong></h3><p><em><strong><span>One. The constraint must actually exist</span></strong></em><strong><span>.</span></strong><span> It sounds absurd to have to say this, and yet two of the five mechanisms we looked at had g &#8801; 0. Whatever we end up with has to be a term in the loss with a value you can print, a gradient you can inspect, and a coefficient you can turn. Not a schedule, not a second network, not an instruction to the autograd engine.</span></p><p><em><strong><span>Two. It must be fully specified.</span></strong></em><span> This is the VICReg lesson and the most important of the lot. We saw the failure stated exactly; Cov(P) = Cov(Q) implies g(P) = g(Q), which means any two distributions agreeing on their second moments are invisible to each other under the penalty. What we want is the opposite property, that g(P) = g(Q) should force P and Q to genuinely be the same distribution rather than merely agreeing on a couple of summary statistics. Anything constraining finitely many moments fails this by construction.</span></p><p><em><strong><span>Three. It must be linear in both batch size and embedding dimension</span></strong></em><strong><span>.</span></strong><span> Contrastive methods are O(B&#178;K) and whitening is O(BK&#178;), and those are quadratic in precisely the two directions you would like to grow. Any constraint requiring all pairs of samples, or a matrix over all pairs of dimensions, hits a wall exactly when the model becomes interesting.</span></p><p><em><strong><span>Four. One knob</span></strong></em><strong><span>.</span></strong><span> This follows from requirement one rather than standing alone; once the constraint has a form, a single coefficient in front of it is available, and the trade-off becomes a number instead of a tuning ritual. The difference between one hyperparameter and six is not really about convenience, it is about whether you can move the method to a new domain without redoing the search from scratch.</span></p><p><em><strong><span>Five. Bounded, well-behaved gradients.</span></strong></em><span> Stability should come from the shape of the objective rather than from discovering the schedule that avoids the instability. A constraint whose gradients blow up when embeddings wander somewhere unusual will accumulate warmups and clipping and decay curves until you are back where you started.</span></p><h3><strong><span>5.2 A requirement the failures cannot give us</span></strong></h3><p><span>Those five are all defensive. Every one is derived from something that went wrong, which means collectively they describe what a constraint must avoid rather than what it should be. Satisfy only those and you get a cheap, stable, fully-specified penalty that pins the representation to some particular shape, with nothing whatsoever telling you </span><em><span>which</span></em><span> shape.</span></p><p><span>Recall too where the energy framing left us at the end of 4.1. Both families exist to make energy high away from the data, and we concluded that LeJEPA belongs in the regularization branch, which limits the volume of low-energy space rather than pushing up pointwise. But &#8220;limit the volume&#8221; is a statement about how much, not about where or in what shape, and sparse coding, VAEs and VICReg are three different guesses at the missing part. None of the five requirements above can adjudicate between them, because all three are perfectly capable of being cheap, stable and in the loss.</span></p><p><span>So here is the sixth requirement, and it is the one that actually generates an answer rather than filtering candidates:</span></p><p><em><strong><span>Six. The representation should be optimal for downstream tasks we have not seen yet.</span></strong></em></p><p><span>This is easy to nod at and harder to take seriously. The entire premise of self-supervised pretraining is that you do not know what the model will be used for. You train on unlabelled data, freeze the encoder, and later somebody attaches a linear probe for a classification problem you never anticipated, or runs k-NN over the embeddings, or fine-tunes on a small labelled set from a domain you have never seen. At the moment of pretraining the downstream label y does not exist. It is not merely unknown to us, it has not been chosen by anyone.</span></p><p><span>Which makes the question we are really asking a slightly strange one, worth stating carefully:</span></p><p style="text-align: center;"><em><span>which distribution should Z follow to minimize expected risk,</span></em></p><p style="text-align: center;"><em><span>when the task is drawn from a family we cannot observe?</span></em></p><p><span>Notice what has happened over the course of three sections. We started with a defensive question, how do we stop the model from cheating, and by taking the requirements seriously we have arrived at an entirely different one, which is what shape a representation ought to be. The first question has many acceptable answers, which is precisely why the literature contains so many mechanisms. The second question, remarkably, has exactly one.</span></p><h3><strong><span>5.3 What we are really asking for</span></strong></h3><p><span>Putting all six together, the thing we want in that slot is not a penalty at all. It is a </span><strong><span>target distribution</span></strong><span>.</span></p><p><span>That reframing is what the whole article has been building towards, so let me state it plainly. If the constraint must fully specify the distribution rather than a handful of its moments, then it cannot be a list of desirable properties like &#8220;high variance&#8221; or &#8220;low correlation&#8221;. It has to name a distribution Q and measure how far the induced representation distribution p_z sits from it:</span></p><p style="text-align: center;"><em><span>g(&#952;, Z)  =  D( p_z &#8214; Q )</span></em></p><p><span>for some target Q and some notion of distance D. Requirement six then tells us how to choose Q, since it should be whichever distribution minimizes expected risk over unseen tasks. Everything else on the list becomes a constraint on D; it must be linear in K and B, differentiable with bounded gradients, and it has to genuinely distinguish distributions rather than just their moments.</span></p><p><span>Which splits the problem cleanly in two, and that split is the structure of the rest of this article:</span></p><ol><li><p><strong><span>Which Q?</span></strong><span> A question about statistics and downstream risk, and the answer is provable rather than chosen. This is Section 6.</span></p></li><li><p><strong><span>Which D?</span></strong><span> A question about how you compare distributions in high dimension without the cost exploding or the gradients misbehaving. This is Section 7.</span></p></li></ol><p><span>It is worth flagging how unusual this separation is. In most papers the objective and its implementation are tangled together and you cannot discuss one without the other. Here the target and the divergence are genuinely independent design decisions; you could keep LeJEPA&#8217;s Q and swap its D, or the reverse, and both halves would still make sense. That separability is usually a sign the framing is correct.</span></p><p><span>It also explains why VAEs came closest of anything in Section 4. A VAE with a KL term to a Gaussian prior has exactly this shape, a target distribution and a divergence to it. What it lacks is any argument that its particular Q is the right one, since the Gaussian there is chosen for the reparameterization trick and analytic convenience rather than derived from downstream risk, and its D is a KL that needs the latent to be sampled rather than deterministic. The form was right. The justification was missing.</span></p><h3><strong><span>5.4 A note on what we are giving up</span></strong></h3><p><span>Before we go looking for Q, it is worth being honest that requirement six carries a real cost, and the paper is upfront about it.</span></p><p><span>Optimizing for an unknown task means optimizing for the </span><em><span>worst case</span></em><span> over a family of tasks, and a worst-case optimum is by construction not the best answer to any particular one. If you happen to know your downstream application is medical imaging, or document retrieval, or one specific classification problem, then a representation shaped for that task will beat a task-agnostic one. We are deliberately choosing not to bet, and the price of never betting is that you never win big on any single hand.</span></p><p><span>Whether that trade is worthwhile depends entirely on what you are building. For a foundation model, whose whole premise is serving tasks that do not exist yet, it is obviously right. For a system with one known downstream use it may not be, and I will come back to this in the Thoughts section, because I do not think it is as settled as the paper implies.</span></p><p><span>With that noted, let us go and find Q.</span></p><div><hr></div><h1><span>6. Methodolgy : Finding Q (why the isotropic Gaussian?)</span></h1><p><span>This is the section the whole article has been walking towards, so we are going to take it slowly and derive rather than assert. The claim we are chasing is that there is exactly one distribution the embeddings should follow, and it turns out to fall out of two separate arguments that answer two genuinely different questions. People conflate them constantly, so it is worth naming them up front.</span></p><p><span>The first argument asks about the </span><strong><span>shape of the covariance</span></strong><span> and answers </span><em><span>isotropic</span></em><span>. The second asks about </span><strong><span>everything above the second moment</span></strong><span> and answers </span><em><span>Gaussian</span></em><span>. Neither one gets you there alone, and the gap between them is precisely where VICReg lives.</span></p><h3><strong><span>6.1 Setting up a question that can actually be answered</span></strong></h3><p><span>We cannot minimize risk on a task we have not seen. That is not a technical obstacle, it is a logical one; there is no y, so there is no risk to minimize. What we can do is minimize risk over a whole family of possible tasks, and specifically over the worst member of that family, which is what requirement six was really asking for.</span></p><p><span>Before we can compare candidate distributions we need to fix what is held constant, otherwise the question is ill-posed. Consider what happens if we do not: take any embedding distribution and multiply every vector by a thousand. Every downstream probe becomes trivially better conditioned, the effective noise shrinks relative to the signal, and we have learnt nothing except that bigger numbers are easier to fit. So we constrain the total variance,</span></p><p style="text-align: center;"><em><span>tr( Cov(Z) )  =  &#931;_k &#955;_k  =  &#954;</span></em></p><p><span>and hold &#954; fixed throughout. Now the question becomes sharp and non-trivial. We have a fixed budget of variance, and the only question is </span><strong><span>how to distribute it</span></strong><span>. Every candidate distribution below has the same total energy; they differ only in geometry.</span></p><p><span>Notice this is already an interesting reframing. We are not asking how much information the representation should carry, we are asking how it should be arranged.</span></p><h3><strong><span>6.2 Linear probing gives us isotropy</span></strong></h3><p><span>Start with the most common way anybody evaluates a frozen encoder, which is to fit a linear probe on top of it. The probe solves ridge regression:</span></p><p style="text-align: center;"><em><span>&#946;&#770; = argmin over &#946; of   &#8214; y &#8722; Z&#946; &#8214;&#178;  +  &#955; &#8214;&#946;&#8214;&#178;</span></em></p><p><span>I want to pause on this equation for a second, because we have met it before. This is exactly the objective we built from scratch in the </span><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fregularization-what-why-and-how-part"><span>regularization article</span></a><span>, fit term plus L2 penalty, with &#955; the Lagrange multiplier that emerged when a hard constraint on the weights got softened into a penalty. That article was about what regularization does to a model. This section is about what it does to your </span><em><span>evaluation</span></em><span>, and the two turn out to be the same mathematics pointed in different directions.</span></p><p style="text-align: center;"><em><span>[EMBED: Regularization : What? Why? and How? (Part -1)]</span></em></p><p><span>The solution is standard:</span></p><p style="text-align: center;"><em><span>&#946;&#770; = ( Z&#7488;Z + &#955;I )&#8315;&#185; Z&#7488; y</span></em></p><p><span>Now, why are we looking at this at all? Because &#946;&#770; is an estimator, and estimators have bias and variance, and both of those turn out to depend on the geometry of Z in a way we can compute. If we can show that anisotropy hurts both, we are done with the first half of the argument.</span></p><p><strong><span>Step 1: what the bias looks like</span></strong></p><p><span>Assume the task is genuinely linear in the embedding, so y = Z&#946;* + &#949; with E[&#949;] = 0 and &#946;* the true parameters, and take Z to be mean-centred. Then</span></p><p style="text-align: center;"><em><span>E[&#946;&#770;] = ( Z&#7488;Z + &#955;I )&#8315;&#185; Z&#7488;Z &#946;*</span></em></p><p><span>and the bias is the difference between that and the truth:</span></p><p style="text-align: center;"><em><span>Bias = [ ( Z&#7488;Z + &#955;I )&#8315;&#185; Z&#7488;Z &#8722; I ] &#946;*</span></em></p><p><span>This is opaque as written, so let us do the thing that always helps with expressions full of matrix inverses, which is to move into the eigenbasis. Write the empirical second moment as Z&#7488;Z &#8776; N&#183;&#931; where &#931; = Cov(Z), and eigendecompose &#931; = U&#923;U&#7488; with eigenvalues &#955;&#8321; &#8230; &#955;_K. In that basis everything becomes diagonal and the whole expression collapses to a per-coordinate statement:</span></p><p style="text-align: center;"><em><span>Bias_k  =  [ N&#955;_k / (N&#955;_k + &#955;) &#8722; 1 ] &#946;*_k  =  &#8722; s_k &#183; &#946;*_k ,     s_k = &#955; / (N&#955;_k + &#955;)</span></em></p><p><strong><span>This is the whole thing, so let us read it carefully.</span></strong><span> Each coordinate of the estimate is shrunk towards zero by a factor s_k that depends only on that coordinate&#8217;s eigenvalue. When &#955;_k is large the denominator is large, s_k &#8776; 0, and that coordinate is recovered faithfully. When &#955;_k is small s_k &#8776; 1, and that coordinate is shrunk almost to nothing regardless of what the true &#946;*_k was.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M7dm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M7dm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 424w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 848w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 1272w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M7dm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png" width="457" height="287.38811728395063" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:815,&quot;width&quot;:1296,&quot;resizeWidth&quot;:457,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!M7dm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 424w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 848w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 1272w, https://substackcdn.com/image/fetch/$s_!M7dm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5e6b1b8-ed3b-4d5b-8c2d-485bcef7bc5d_1296x815.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The shrinkage factor as a function of a direction&#8217;s eigenvalue. Directions carrying little variance are erased from the estimate entirely, whatever the task needed from them.</span></em></p><p><span>So the ridge penalty is not shrinking your estimate uniformly. It shrinks hardest along the directions where your representation has the least variance, which is a completely reasonable thing for it to do, since those are the directions where the data tells you least, and it is catastrophic if the task happens to depend on one of them.</span></p><p><strong><span>Step 2: taking the worst case</span></strong></p><p><span>Squaring and summing gives the total squared bias:</span></p><p style="text-align: center;"><em><span>&#8214;Bias&#8214;&#178; = &#931;_k ( &#955; / (N&#955;_k + &#955;) )&#178; &#183; &#946;*&#178;_k</span></em></p><p><span>Now we invoke requirement six. We do not know &#946;*, and we are not allowed to assume anything about it, so we ask what the worst task of a given size looks like. Fix &#8214;&#946;*&#8214; and let an adversary point it wherever it does most damage; obviously it points along the coordinate with the largest shrinkage, which is the one with the </span><strong><span>smallest</span></strong><span> eigenvalue:</span></p><p style="text-align: center;"><em><span>max over &#8214;&#946;*&#8214; = c  of  &#8214;Bias&#8214;&#178;  =  ( &#955; / (N&#955;_min + &#955;) )&#178; &#183; c&#178;</span></em></p><p><span>And now the optimization writes itself. Minimizing the worst-case bias means maximizing &#955;_min, subject to the eigenvalues summing to &#954;. There is no cleverness required here; if you have a fixed total to distribute and you want to make the smallest share as large as possible, you split it evenly:</span></p><p style="text-align: center;"><em><span>max &#955;_min  subject to  &#931; &#955;_k = &#954;    &#10233;    &#955;&#8321; = &#955;&#8322; = &#8230; = &#955;_K = &#954;/K</span></em></p><p><strong><span>Which is isotropy.</span></strong><span> Not chosen, not preferred; forced, by the combination of a fixed variance budget and a refusal to assume anything about the downstream task.</span></p><p><strong><span>Step 3: the variance says the same thing</span></strong></p><p><span>Bias was one half of it. For the variance, set &#955; = 0 so the algebra stays clean, and use the standard result for OLS:</span></p><p style="text-align: center;"><em><span>Var(&#946;&#770;) = &#963;&#178; ( Z&#7488;Z )&#8315;&#185; = (&#963;&#178;/N) &#931;&#8315;&#185;</span></em></p><p><span>Total estimator variance is the trace, which in the eigenbasis is just a sum of reciprocals:</span></p><p style="text-align: center;"><em><span>tr( Var(&#946;&#770;) ) = (&#963;&#178;/N) &#183; &#931;_k 1/&#955;_k</span></em></p><p><span>Minimize that subject to &#931;&#955;_k = &#954;. Lagrange gives</span></p><p style="text-align: center;"><em><span>&#8706;/&#8706;&#955;_k [ &#931;_j 1/&#955;_j + &#956; &#931;_j &#955;_j ] = &#8722; 1/&#955;_k&#178; + &#956; = 0    &#10233;    &#955;_k = 1/&#8730;&#956;  for every k</span></em></p><p><span>which is the same value for every k, so once again all eigenvalues equal and once again </span><strong><span>isotropy</span></strong><span>.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cXme%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cXme!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 424w, https://substackcdn.com/image/fetch/$s_!cXme!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 848w, https://substackcdn.com/image/fetch/$s_!cXme!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 1272w, https://substackcdn.com/image/fetch/$s_!cXme!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cXme%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png" width="529" height="421.0927197802198" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1159,&quot;width&quot;:1456,&quot;resizeWidth&quot;:529,&quot;bytes&quot;:1032598,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cXme!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 424w, https://substackcdn.com/image/fetch/$s_!cXme!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 848w, https://substackcdn.com/image/fetch/$s_!cXme!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 1272w, https://substackcdn.com/image/fetch/$s_!cXme!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7546f1e-0b4e-43b9-8c14-ed3db59e6630_1728x1376.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>Each line is a linear probe fitted to a different resample of the same distribution. The anisotropic embedding has the same total variance and a far less stable estimator.</em></figcaption></figure></div><p><span>There is something worth staring at in that sum of reciprocals, though, because it is doing more than delivering the same answer twice. As any &#955;_k &#8594; 0, the sum diverges. Not degrades, </span><em><span>diverges</span></em><span>. And a &#955;_k heading towards zero is precisely the dimensional collapse we defined back in Section 2. So this expression is telling us that dimensional collapse does not merely waste capacity, it sends the variance of every downstream estimator to infinity. The failure mode we started the article worrying about and the geometry we are now deriving are the same phenomenon seen from two angles.</span></p><h3><strong><span>6.3 Why isotropy is not enough</span></strong></h3><p><span>We now have a result, and it is a real one; the covariance should be a scaled identity. It is also, unfortunately, exactly the result VICReg already had.</span></p><p><span>Look back at the four distributions from Section 4.6. All four have identity covariance, so all four are perfectly isotropic, so all four are equally optimal by everything we have derived so far. Three of them are terrible representations.</span></p><p><span>The reason our argument cannot see the difference is structural rather than accidental. A linear probe interacts with the embedding only through Z&#7488;Z, which is to say only through the second moment. Anything the second moment cannot see, a linear probe cannot see either, and so no amount of care in the linear analysis will ever tell us about the shape of the distribution beyond its covariance.</span></p><p><span>Hence if we want to constrain the rest of the distribution, we need a probe that actually depends on the rest of the distribution. Which is not a contrivance, incidentally; k-NN and kernel probes are standard ways to evaluate frozen encoders, arguably more common than linear probes in retrieval settings. So let us redo the analysis with one of those and see what falls out.</span></p><h3><strong><span>6.4 Nonlinear probing gives us Gaussian</span></strong></h3><p><span>Take a radius-based k-NN probe, which predicts by averaging the labels of everything inside a ball:</span></p><p style="text-align: center;"><em><span>&#375;(q) = ( 1 / |N_r&#8320;(q)| ) &#183; &#931;_{n &#8712; N_r&#8320;(q)} y_n ,     N_r&#8320;(q) = { n : &#8214;z_n &#8722; q&#8214; &#8804; r&#8320; }</span></em></p><p><span>The key difference from before: this estimator depends on which points happen to be nearby, and that is a statement about the local density of the embedding distribution rather than about its global second moment. That is exactly the sensitivity we were missing.</span></p><p><strong><span>Step 1: where the bias comes from</span></strong></p><p><span>Let g(z) = E[y | z] be the true regression function. The bias of the probe at a query point q is</span></p><p style="text-align: center;"><em><span>Bias(q) = E[ g(z) | z &#8712; N_r&#8320;(q) ] &#8722; g(q)</span></em></p><p><span>that is, the difference between the average of g over the neighbourhood and its value at the centre. Taylor expand g about q:</span></p><p style="text-align: center;"><em><span>g(z) = g(q) + &#8711;g(q)&#7488; (z&#8722;q) + &#189; (z&#8722;q)&#7488; H (z&#8722;q) + &#8230;</span></em></p><p><span>Now here is the crucial observation, and it is worth thinking about before we compute anything. </span><strong><span>If the points in the neighbourhood were distributed symmetrically about q, the linear term would average to exactly zero.</span></strong><span> For every point displaced in one direction there would be a matching point displaced the other way, and &#8711;g would contribute nothing to the bias. The neighbourhood average would be unbiased to first order and only the curvature term would survive.</span></p><p><span>So the linear term only survives when the neighbourhood is </span><strong><span>lopsided</span></strong><span>, that is, when there are systematically more points on one side of q than the other. And a systematic imbalance of points across a small ball is exactly what it means for the density to have a gradient there.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21_0Qz%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_0Qz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 424w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 848w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 1272w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21_0Qz%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png" width="579" height="386.5614545454545" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:918,&quot;width&quot;:1375,&quot;resizeWidth&quot;:579,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_0Qz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 424w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 848w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 1272w, https://substackcdn.com/image/fetch/$s_!_0Qz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F738b7fda-c5cb-4481-80cf-7b60c9c7af22_1375x918.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Left, a flat density: the neighbours sit symmetrically about the query and their displacements cancel. Right, a density gradient: the ball fills unevenly and the average is pulled towards the dense side.</span></em></p><p><strong><span>Step 2: making that precise</span></strong></p><p><span>Expand the density around q in the same way, using &#8711;p = p &#183; &#8711;log p:</span></p><p style="text-align: center;"><em><span>p(z) &#8776; p(q) &#183; ( 1 + &#8711;log p(q)&#7488; (z&#8722;q) + &#8230; )</span></em></p><p><span>Taking the density-weighted expectation of the displacement over the ball, and using the standard fact that for a uniform ball of radius r&#8320; in R^K we have E[(z&#8722;q)(z&#8722;q)&#7488;] = r&#8320;&#178;/(K+2) &#183; I:</span></p><p style="text-align: center;"><em><span>E[ (z&#8722;q) | z &#8712; N_r&#8320;(q) ]  &#8776;  ( r&#8320;&#178; / (K+2) ) &#183; &#8711;log p(q)</span></em></p><p><span>So the displacement does not average away. It averages to something proportional to the log-density gradient, and the bias picks up a term</span></p><p style="text-align: center;"><em><span>Bias(q)  &#8776;  ( r&#8320;&#178; / (K+2) ) &#183; &#8711;log p(q)&#7488; &#8711;g(q)   +   ( a second O(r&#8320;&#178;) term from the curvature H )</span></em></p><p><span>Read that plainly: </span><strong><span>the probe is biased in proportion to how fast the density is changing.</span></strong><span> In a region where embeddings pile up on one side, the neighbourhood average is pulled towards that side, and the prediction inherits the pull.</span></p><p><strong><span>Step 3: integrating over all query points and all tasks</span></strong></p><p><span>Square the bias and integrate over the distribution of query points. The &#8711;g factor depends on the task, which we do not know, so we treat it as an unknown of bounded size and absorb it into a constant &#964;_g. What is left is:</span></p><p style="text-align: center;"><em><span>ISB  &#8733;  ( r&#8320;&#8308; / (K+2)&#178; ) &#183; &#964;_g&#178; &#183; J(p) ,     J(p) = &#8747; &#8214;&#8711;log p(z)&#8214;&#178; p(z) dz</span></em></p><p><span>That integral has a name. J(p) is the </span><strong><span>Fisher information</span></strong><span> of the distribution with respect to location, and it measures how sharply the density varies relative to its own magnitude. A density with steep gradients, spikes, sharp edges or isolated clusters has large J(p). A smooth, gently-varying density has small J(p).</span></p><p><span>Everything else in that expression is fixed by the setup; the radius, the dimension, the unknown task. </span><strong><span>The only thing we control is J(p), and it is the only thing left to minimize.</span></strong></p><p><strong><span>Step 4: which distribution minimizes Fisher information?</span></strong></p><p><span>We now have a clean, self-contained mathematical question with nothing to do with machine learning:</span></p><p style="text-align: center;"><em><span>min over p of  J(p)    subject to    Cov(p) = &#931;</span></em></p><p><span>And it has a classical answer. For any distribution with covariance &#931;,</span></p><p style="text-align: center;"><em><span>J(p)  &#8805;  tr( &#931;&#8315;&#185; ) ,     with equality if and only if  p = N(0, &#931;)</span></em></p><p><strong><span>The Gaussian is the unique minimizer.</span></strong><span> Not the best among the ones we tried, not optimal under extra assumptions; unique, given the covariance constraint.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214WPp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4WPp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 424w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 848w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 1272w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214WPp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png" width="503" height="305.4699570815451" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:849,&quot;width&quot;:1398,&quot;resizeWidth&quot;:503,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4WPp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 424w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 848w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 1272w, https://substackcdn.com/image/fetch/$s_!4WPp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d828ec7-f1e0-4702-8978-6d6694ac09f3_1398x849.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>The four distributions from Section 4.6, evaluated by numerical integration. Covariance could not tell them apart at all; Fisher information separates them by nearly three orders of magnitude, and only the Gaussian attains the bound.</span></em></p><p><span>Combine that with 6.2, which told us &#931; must be a scaled identity, and the answer is fully pinned down:</span></p><p style="text-align: center;"><em><span>Q  =  N( 0, &#963;&#178; I_K )</span></em></p><p><span>Every degree of freedom in the choice of target distribution has now been used up. The shape of the covariance came from the linear probe, and everything above the second moment came from the nonlinear one.</span></p><h3><strong><span>6.5 Why this is the right answer from two directions</span></strong></h3><p><span>I find a result more convincing when a second, unrelated argument arrives at the same place, and here one does.</span></p><p><span>Ask a different question: given a fixed variance budget, which distribution assumes the </span><em><span>least</span></em><span> about anything? That is the maximum entropy question, and its answer under a covariance constraint is famously the Gaussian. So the distribution that minimizes Fisher information and the distribution that maximizes entropy, under the same constraint, are the same distribution.</span></p><p><span>That coincidence is not a coincidence, and it has a clean interpretation. Both quantities are measuring structure. Entropy asks how much structure the distribution has, Fisher information asks how sharply that structure varies, and under a variance budget the flattest, least committed, most spread-out option optimizes both.</span></p><p><span>Which finally gives us the intuition to carry away from this whole section. </span><strong><span>You are building a searchlight before you know where you will need to look.</span></strong><span> Any asymmetry in the beam is a bet about where the target will be. Isotropy is the decision not to bet on direction; Gaussianity is the decision not to bet on location within a direction, by refusing to concentrate mass anywhere in particular. The two theorems in this section are the two halves of declining to gamble, and requirement six was the statement that we are not in a position to gamble at all.</span></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!63yD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 424w, https://substackcdn.com/image/fetch/$s_!63yD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 848w, https://substackcdn.com/image/fetch/$s_!63yD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 1272w, https://substackcdn.com/image/fetch/$s_!63yD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2163yD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png" width="625" height="226.64835164835165" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:528,&quot;width&quot;:1456,&quot;resizeWidth&quot;:625,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!63yD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 424w, https://substackcdn.com/image/fetch/$s_!63yD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 848w, https://substackcdn.com/image/fetch/$s_!63yD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 1272w, https://substackcdn.com/image/fetch/$s_!63yD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9e59bca-f7bb-400e-afca-a8164ad35ec7_2004x727.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p style="text-align: center;"><em><span>Three ways to spend a fixed illumination budget. The first two are excellent if the tasks land where you guessed and useless otherwise; only the third makes no assumption at all.</span></em></p><p><span>It also retroactively explains the four distributions from Section 4.6. The hypercube corners and the cluster mixture both make an enormous bet, namely that the downstream task cares about exactly those four regions and nothing in between; if it does they are excellent, and if it does not they are useless. The heavy-tailed distribution bets everything on the centre. Only the Gaussian bets nothing, and that is precisely why it wins the worst case.</span></p><h3><strong><span>6.6 Where this leaves the objective</span></strong></h3><p><span>We came into this section with a target-shaped hole:</span></p><p style="text-align: center;"><em><span>g(&#952;, Z)  =  D( p_z &#8214; Q )</span></em></p><p><span>and we can now fill in half of it:</span></p><p style="text-align: center;"><em><span>g(&#952;, Z)  =  D( p_z &#8214; N(0, &#963;&#178; I) )</span></em></p><p><span>which, plugged back into the objective from Section 3, gives us the shape of LeJEPA:</span></p><p style="text-align: center;"><em><span>L(&#952;, Z ; X)  =  L_pred(&#952; ; X)  +  &#945; &#183; D( p_z &#8214; N(0, &#963;&#178; I) )</span></em></p><p><span>One thing remains, and it is not a small thing. We have to actually compute D, which means measuring the distance between an empirical distribution of a few hundred embedding vectors and a Gaussian, in a space of a thousand dimensions, differentiably, cheaply, and with bounded gradients. That is a genuinely hard problem and it is where most of the paper&#8217;s engineering lives.</span></p><p><span>That is Section 7.</span></p><div><hr></div><h1><span>7. Methodology : Finding D (measuring the distance to a Gaussian)</span></h1><p><span>We know what we want the embedding distribution to be. Now we have to write down something differentiable that says how far we are from it, and this turns out to be considerably harder than it sounds.</span></p><p><span>Here is the problem in its concrete form. Your batch gives you maybe 256 embedding vectors sitting in 1024 dimensions. From that you have to produce a single scalar saying how un-Gaussian this cloud of points is, differentiate it, and do so cheaply enough to run on every step of training. Anyone who has tried to estimate a density in a thousand dimensions from a few hundred samples will already be uncomfortable, and they should be; that problem is genuinely hopeless. So the interesting question is how the paper avoids having to solve it.</span></p><h3><strong><span>7.1 Distribution matching as a hypothesis test</span></strong></h3><p><span>The usual instinct here is to reach for a divergence. KL, Wasserstein, MMD, pick one, minimize it. The paper does something different, and the reframing is the first good idea in this section.</span></p><p><span>Rather than asking how far apart two distributions are, ask a statistician&#8217;s question:</span></p><p style="text-align: center;"><em><span>H&#8320; :  p_z = Q      versus      H&#8321; :  p_z &#8800; Q</span></em></p><p><span>This is a hypothesis test. You compute a test statistic T from your samples, which is a single number summarizing how much evidence the data provides against the null, and if it exceeds a critical value you reject. Statisticians have been designing these for a century and they come with properties that divergence estimators generally do not; known null distributions, provable consistency, and a clear notion of what the statistic is measuring.</span></p><p><span>Then comes the move that makes it useful to us. </span><strong><span>The test statistic is already a scalar function of the embeddings, so just use it as the loss.</span></strong></p><p style="text-align: center;"><em><span>g(&#952;, Z)  =  T( { f_&#952;(x_n) } )</span></em></p><p><span>Minimizing T is minimizing the evidence against the null, which is to say training the encoder until a statistician could no longer distinguish its embeddings from Gaussian samples. That is a much more precise statement of intent than &#8220;penalize the covariance&#8221;, and it is exactly the &#8220;fully specified&#8221; requirement from Section 5 restated in a form you can compute.</span></p><p><span>It also gives us something no other method in Section 4 could offer, which is a scale for the number. A test statistic can be compared against a critical value, so you can ask whether your representation is </span><em><span>acceptably</span></em><span> Gaussian at some significance level rather than just noting the penalty went down.</span></p><h3><strong><span>7.2 The obstacle: high dimension</span></strong></h3><p><span>Unfortunately, multivariate normality tests are not cheap. Mardia&#8217;s test needs third and fourth moment tensors, Henze&#8211;Zirkler needs all pairwise distances, and essentially every classical option is at least quadratic in sample count and often far worse in dimension. Worse than the cost is the sample complexity; to say anything reliable about the shape of a density in K dimensions you need a number of samples that grows exponentially in K. With 256 samples in 1024 dimensions, the empirical distribution is not an approximation to p_z, it is 256 isolated points in a space so large that they are all effectively equidistant from one another.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21btpf%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!btpf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 424w, https://substackcdn.com/image/fetch/$s_!btpf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 848w, https://substackcdn.com/image/fetch/$s_!btpf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 1272w, https://substackcdn.com/image/fetch/$s_!btpf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21btpf%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png" width="479" height="315.0791007493755" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:790,&quot;width&quot;:1201,&quot;resizeWidth&quot;:479,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!btpf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 424w, https://substackcdn.com/image/fetch/$s_!btpf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 848w, https://substackcdn.com/image/fetch/$s_!btpf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 1272w, https://substackcdn.com/image/fetch/$s_!btpf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a474e6e-e03f-4304-83a8-aececa2db419_1201x790.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em><span>Estimating a density directly needs sample counts that grow exponentially with dimension; a univariate test on each slice needs a fixed number regardless of K.</span></em></p><p><span>So a direct test is not merely expensive, it is statistically meaningless at the batch sizes we can afford. We need a way of not looking at the high-dimensional density at all.</span></p><h3><strong><span>7.3 Sketching: reading a distribution off its shadows</span></strong></h3><p><span>The escape is a theorem from 1936, and it is the most elegant thing in the paper.</span></p><p><strong><span>Cram&#233;r&#8211;Wold.</span></strong><span> For two random vectors X, Y in R^K:</span></p><p style="text-align: center;"><em><span>&#10216;a, X&#10217; &#8796;&#7496; &#10216;a, Y&#10217;  for every unit vector a      &#10234;      X &#8796;&#7496; Y</span></em></p><p><span>In words: if every one-dimensional projection of two distributions matches, the distributions themselves match. Nothing is lost by only ever looking at shadows, provided you look from every angle. The paper proves a hyperspherical variant of this (Lemma 3) restricted to unit-norm directions, which is what we actually sample.</span></p><p><span>Take a moment with how strong that is. A distribution over a thousand dimensions is an enormously complicated object, and this says it is completely determined by a family of one-dimensional distributions, each of which is a thing you can plot on a line and reason about with century-old statistics.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21W-wd%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W-wd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 424w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 848w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21W-wd%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png" width="1456" height="634" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:634,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:903908,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!W-wd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 424w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 848w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!W-wd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c287f98-d424-4959-aeae-a1be49c26c49_2674x1164.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>The procedure follows immediately. Sample M unit directions, project the batch onto each, run a cheap univariate normality test per direction, and aggregate. Theorem 2 in the paper establishes that taking the worst direction gives a valid test, with the right level under the null and power tending to one under the alternative:</span></p><p style="text-align: center;"><em><span>T_A(Z)  =  max over a &#8712; A  of  T( { a&#7488; z_n } )</span></em></p><p><span>And then the paper immediately does something else. The actual SIGReg definition averages over directions rather than maximizing:</span></p><p style="text-align: center;"><em><span>SIGReg(A, Z)  =  (1 / |A|) &#183; &#931;_{a &#8712; A}  T( { a&#7488; z_n } )</span></em></p><p><span>The stated reason is worth dwelling on, because it is a good illustration of the difference between a statistic and a loss. The maximum is the correct </span><em><span>test</span></em><span>, since you reject the null if any direction provides evidence against it. But as an objective it produces a sparse gradient; only the single worst direction receives any signal on each step, and the other M&#8722;1 projections contribute nothing. Averaging spreads the gradient across every direction at once, and since we are optimizing rather than deciding, that is the behaviour we want. The theory justifies the max; the implementation uses the mean.</span></p><p><strong><span>Why this beats the curse of dimensionality</span></strong></p><p><span>This deserves care, because the argument is not the naive one. You might hope that since each univariate test needs a sample size independent of K, everything is fine. But the real question is different: if we only constrain M directions, what happens along all the directions we did not sample?</span></p><p><span>The paper answers with smoothness. If the embedding density lies in a Sobolev space H^&#945;, then satisfying the test exactly on M directions bounds the expected discrepancy over </span><em><span>all</span></em><span> directions:</span></p><p style="text-align: center;"><em><span>E_a &#8747; | &#966;_a(t) &#8722; &#966;_N(t) |&#178; dt   &#8804;   C(K, &#945;) &#183; |A|^(&#8722;2&#945; / (K&#8722;1)) &#183; (&#8214; &#183; &#8214;_{H^&#945;})</span></em></p><p><span>The exponent is what matters. The bound decays as |A| grows, and it decays </span><strong><span>faster when &#945; is larger</span></strong><span>, meaning smoother embedding densities are constrained more effectively by the same number of directions. The paper&#8217;s conclusion is that |A| = O(K) directions suffice for an &#949;-approximation when &#945; is large, and it argues that deep networks produce naturally smooth densities, both from the architecture and from the implicit and explicit regularizers already in play. Since the target itself is a smooth isotropic Gaussian, &#945; grows quickly during training, which makes the bound tighten as you converge.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YdZX%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YdZX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 424w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 848w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YdZX%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png" width="475" height="384.9587912087912" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1180,&quot;width&quot;:1456,&quot;resizeWidth&quot;:475,&quot;bytes&quot;:1746841,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YdZX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 424w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 848w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!YdZX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbee6f05b-fa9c-4887-94f1-eb63dcc1e96d_1648x1336.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>There is a second argument, and it is the one I find more persuasive because it is almost free. SGD resamples the directions at every step. So while any single minibatch constrains only M directions, the cumulative number of directions applied over training grows linearly with the number of steps. The paper reports that |A| as small as 16, resampled every step, comfortably outperforms a fixed set of thousands held constant throughout training.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21q34H%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q34H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 424w, https://substackcdn.com/image/fetch/$s_!q34H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 848w, https://substackcdn.com/image/fetch/$s_!q34H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!q34H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21q34H%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png" width="541" height="488.2951289398281" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1260,&quot;width&quot;:1396,&quot;resizeWidth&quot;:541,&quot;bytes&quot;:255214,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q34H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 424w, https://substackcdn.com/image/fetch/$s_!q34H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 848w, https://substackcdn.com/image/fetch/$s_!q34H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!q34H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe13fe2a2-97d6-4818-b5cc-78a55559519f_1396x1260.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>So the curse is beaten twice over; once by smoothness, which says a modest M constrains the whole sphere, and once by resampling, which says the effective M is the number you draw times the number of steps you take.</span></p><p><strong><span>A fortunate interaction with Section 6</span></strong></p><p><span>Something quietly convenient happens here. Slicing requires knowing the projected target distribution for each direction a. For a general target that is its own computation, potentially different for every direction. But our target is the isotropic Gaussian, and for z ~ N(0, &#963;&#178;I) with &#8214;a&#8214; = 1:</span></p><p style="text-align: center;"><em><span>a&#7488; z  ~  N(0, &#963;&#178;)     for every a</span></em></p><p><strong><span>Every projection of an isotropic Gaussian is the same univariate Gaussian.</span></strong></p><p><span>So there is nothing to compute per direction; the target is one fixed 1-D distribution and every one of the M tests compares against it. Back in Section 5 I claimed Q and D were independent design decisions. They are, in the sense that you could swap either, but they are not indifferent to each other, and the Q that the risk argument forced on us happens to be the one that makes slicing essentially free.</span></p><h3><strong><span>7.4 Choosing the univariate test</span></strong></h3><p><span>We have reduced everything to: given N real numbers, how Gaussian are they? The paper works through three families and rules out two of them.</span></p><p><strong><span>Option one: moments</span></strong></p><p><span>Take the Jarque&#8211;Bera test, which compares skewness and kurtosis, and extend it with the first two moments to get a standard-Gaussian test rather than a Gaussian-of-any-mean-and-variance test. This is moment matching over the first four moments, and moment matching is a respectable tool.</span></p><p><span>Two problems, and the paper formalizes both. The first is identifiability. Theorem 3 states that minimizing a weighted sum of squared differences over any </span><em><span>finite</span></em><span> number of moments does not imply the distributions are equal:</span></p><p style="text-align: center;"><em><span>&#931;_{k=1..K}  c_k ( m_k(P) &#8722; m_k(Q) )&#178;  =  0     does not imply    P = Q</span></em></p><p><span>Which is precisely VICReg&#8217;s failure from Section 4, generalized. The obvious response is to use more moments. Which runs into the second problem: gradient norms scale as O(k) and the variance of Monte Carlo gradient estimates grows as O(k&#178; m_{2(k&#8722;1)}) for the k-th moment, because moments are polynomial in the data and raising values to a power of k explodes quickly. The paper&#8217;s phrasing is that stability and identifiability cannot be achieved simultaneously with moments, and that is the whole objection.</span></p><p><strong><span>Option two: the empirical CDF</span></strong></p><p><span>Cram&#233;r&#8211;von Mises, Anderson&#8211;Darling, Watson. These compare the empirical CDF against the target and are properly consistent, so unlike moments they are not under-specified. The problem is mechanical. All of them require sorting, and sorting breaks the embarrassingly parallel nature of SGD, particularly across multiple GPUs where synchronization is needed. Sorting and order statistics are also non-differentiable, so gradient-based optimization needs a relaxation, and every available relaxation introduces its own hyper-parameters, which defeats the entire motivation. The paper also excludes Kolmogorov&#8211;Smirnov specifically because its &#8467;&#8734; norm produces sparse gradients, and reports Shapiro&#8211;Wilk as unstable in practice.</span></p><p><strong><span>Option three: characteristic functions</span></strong></p><p><span>The empirical characteristic function is the Fourier transform of the density, estimated as a simple average:</span></p><p style="text-align: center;"><em><span>&#966;&#770;_X(t)  =  (1/n) &#931;_j  e^{i t X_j}</span></em></p><p><span>Three properties make this the right choice. It is </span><strong><span>identifiable</span></strong><span>, since the map from distribution to characteristic function is a bijection, so a test built on &#966; encodes the whole distribution rather than a summary. It is </span><strong><span>differentiable</span></strong><span>, with no sorting anywhere. And it is </span><strong><span>distributed-friendly</span></strong><span>, because an average over samples composes across devices via a single all-reduce.</span></p><p><span>The Epps&#8211;Pulley test compares the two in weighted &#8467;&#178; norm:</span></p><p style="text-align: center;"><em><span>EP  =  N &#8747; | &#966;&#770;_X(t) &#8722; &#966;(t) |&#178; w(t) dt</span></em></p><p><span>with the weight function typically Gaussian, w(t) = e^{&#8722;t&#178;/&#963;&#178;}, and &#963; commonly set to 1.</span></p><p><span>The boundedness is where this becomes decisive, and the paper proves it as Theorem 4:</span></p><p style="text-align: center;"><em><span>| &#8706;EP / &#8706;z_i |  &#8804;  4&#963;&#178; / N ,      | &#8706;&#178;EP / &#8706;z_i&#178; |  &#8804;  C &#8730;&#960; &#963;&#179; / (2N)</span></em></p><p><span>Both the gradient and the curvature are bounded by constants depending only on the batch size and the weight bandwidth &#963;, and on nothing about the data. Compare that to moments, where the gradient of the k-th moment grows like |x|^{k&#8722;1} and a single drifting embedding can dominate everything. Chain rule then gives a stable bound on the gradient with respect to &#952;. </span><strong><span>Stability here is a property of the function rather than something tuned in</span></strong><span>, which is requirement five from Section 5 met by construction.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21COZ5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!COZ5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 424w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 848w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 1272w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21COZ5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png" width="1456" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:331270,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!COZ5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 424w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 848w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 1272w, https://substackcdn.com/image/fetch/$s_!COZ5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6163feba-96e8-4bdd-9b3c-8693812288d4_2036x644.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>One honest detail the paper is upfront about. Using minibatches introduces a bias in the estimator, quantified in Theorem 6:</span></p><p style="text-align: center;"><em><span>E[ L&#770;_n(&#952;) ]  =  L(&#952;)  +  (1/N) &#8747; w_s(t) ( 1 &#8722; |&#966;_P(t)|&#178; ) dt</span></em></p><p><span>So both the loss and its gradient carry an explicit O(1/N) bias. The authors report this as minimal in practice even at batch sizes as small as 16, and note that U-statistic debiasing or sample splitting would remove it, neither of which they pursue.</span></p><h3><strong><span>7.5 Putting SIGReg together</span></strong></h3><p><span>Assembling everything, SIGReg draws M unit directions, projects the batch onto each, computes the Epps&#8211;Pulley statistic of each projection against N(0, 1), and averages:</span></p><p style="text-align: center;"><em><span>SIGReg(A, Z)  =  (1 / |A|) &#931;_{a &#8712; A}  EP( { a&#7488; z_n } )</span></em></p><p><span>The integral inside EP is estimated by quadrature. The paper finds the simple trapezoidal rule sufficient with as few as 17 knots, and exploits the symmetry of the integrand to double the effective number of knots for free.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21idfe%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!idfe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 424w, https://substackcdn.com/image/fetch/$s_!idfe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 848w, https://substackcdn.com/image/fetch/$s_!idfe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 1272w, https://substackcdn.com/image/fetch/$s_!idfe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21idfe%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png" width="1456" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:238092,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!idfe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 424w, https://substackcdn.com/image/fetch/$s_!idfe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 848w, https://substackcdn.com/image/fetch/$s_!idfe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 1272w, https://substackcdn.com/image/fetch/$s_!idfe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22ae67e2-757e-4a0e-898b-b6ac0a9a5d6f_2036x644.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Check it against the Section 5 requirements. It is a term in the loss with a value and a gradient, so requirement one holds. It is built on characteristic functions, which are identifiable, so requirement two holds. Its cost is linear in minibatch size, so requirement three holds. It sits behind a single coefficient, so requirement four holds. Its gradients and curvature are bounded by Theorem 4, so requirement five holds. And its target came from the risk argument in Section 6, so requirement six holds.</span></p><p><span>Six for six, which is the first time anything in this article has managed that.</span></p><p><strong><span>Why it distributes so well</span></strong></p><p><span>The only quantity crossing between devices is the empirical characteristic function, which is an average over samples. Averages compose; each device computes its partial mean and one all-reduce combines them. Nothing depends on gathering the embeddings themselves. Contrastive methods, by contrast, need negatives from across the batch and therefore must move embeddings between devices, which is a far larger and more awkward transfer.</span></p><p><strong><span>VICReg falls out as a special case</span></strong></p><p><span>A satisfying way to close, and the mechanism is simpler than I expected. It is not an approximation or a limit of the Epps&#8211;Pulley statistic; it is a different choice of T. Substitute</span></p><p style="text-align: center;"><em><span>T( { x_n } )  =  mean( { x_n } )&#178;  +  ( std( { x_n } ) &#8722; 1 )&#178;</span></em></p><p><span>into SIGReg, keep everything else, and in the limit of many slices you recover VICReg. The paper proves in Appendix B.14 that this enforces exactly E[Z] = 0 and Cov(Z) = I; the argument is a neat one, showing that if every unit direction has zero mean and unit variance in projection then the mean vector must vanish and the covariance must be the identity, by testing the standard basis vectors and then their pairwise sums.</span></p><p><span>So VICReg is LeJEPA with a degenerate statistical test, and by Theorem 3 that test is exactly the kind that admits shortcut solutions. The paper is blunt about it, advocating strongly against the setting for that reason.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fZfr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fZfr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 424w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 848w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 1272w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fZfr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png" width="1456" height="605" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:605,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:483791,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fZfr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 424w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 848w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 1272w, https://substackcdn.com/image/fetch/$s_!fZfr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9115c329-3e48-46c3-b27b-dd6b2640c0eb_2016x838.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><span>7.6 What actually gets trained</span></h3><p><span>Before moving on, it is worth saying plainly that </span><strong><span>the objective is the paper</span></strong><span>. Everything we have built over the last four sections, the joint prior, the isotropic Gaussian target, the sliced characteristic-function test, is the contribution. What follows is scaffolding, and the paper treats it that way too; there is no clever architecture here, no novel augmentation scheme, no training trick. That is rather the point. If the objective is right, the rest should be boring.</span></p><h4><span>The encoder is arbitrary.</span></h4><p><span>f_&#952; appears nowhere in the derivation except as the thing producing Z, so LeJEPA imposes no architectural requirement whatsoever. The paper pretrains roughly 50 architectures from 8 families, taking every model in timm under 20M parameters, and all of them learn useful representations. A method carrying architectural anti-collapse machinery inherits assumptions about the architecture; a constraint stated purely on the output distribution does not care what produced it.</span></p><h4><span>No predictor.</span></h4><p><span>This is stronger than &#8220;optional&#8221;. Prior work established that predictors in image JEPAs, absent genuinely asymmetric views, exist primarily to prevent collapse, and removing them collapses the encoder to chance level. With SIGReg in place the paper removes both the predictor and the teacher&#8211;student architecture without collapse, and recommends training without a predictor. A teacher&#8211;student setup still gives ViTs a small boost, but as stochastic weight averaging rather than as a collapse guard.</span></p><h4><span>No register tokens.</span></h4><p><span>Recent vision models need register tokens to avoid training instabilities. The paper&#8217;s position is that those instabilities come from poorly conditioned objectives, and LeJEPA is stable with or without them.</span></p><h4><span>Views follow the DINO setup.</span></h4><p><span>Eight views total, two global at 224&#215;224 and six local at 96&#215;96. Nothing exotic, and the configuration common in prior work transfers directly.</span></p><h4><span>Training data.</span></h4><p><span>ImageNet-10, ImageNet-100 and ImageNet-1k for the main runs, and the in-domain experiments pretrain directly on the target corpus, including Galaxy10 (11,000 samples, 10 classes), Food101, Flowers102, CIFAR-10 and CIFAR-100. Worth noticing what is absent: no curated billion-image collection and no data-filtering pipeline, which is a meaningful contrast given that recent progress in this area has come substantially from data curation rather than from objectives.</span></p><h4><span>The recommended settings.</span></h4><p><span>Unusually for this kind of article, I can just list them, because there are so few: &#955; = 0.05, two global and six local views, batch size at least 128, 1024 slices, 17 quadrature knots over an integration domain of [&#8722;5, 5], AdamW with standard linear warmup and cosine annealing on the learning rate and no scheduler on weight decay. The ablations show none of these choices is delicate; the paper&#8217;s own summary is that while some settings slightly improve performance, none of them leads to catastrophic collapse.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214fbc%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4fbc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 424w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 848w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 1272w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214fbc%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png" width="1456" height="871" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:871,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4fbc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 424w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 848w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 1272w, https://substackcdn.com/image/fetch/$s_!4fbc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F987a3bda-5a7f-4838-bfb2-de3c57a80f29_7536x4508.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><strong><span>7.7 The complete objective</span></strong></h3><p><span>Two pieces remain to be written down properly, and the first is more interesting than it looks.</span></p><p><strong><span>The prediction loss.</span></strong></p><p><span>The natural way to write &#8220;all views should agree&#8221; is as an average over all pairs of views:</span></p><p style="text-align: center;"><em><span>L_pred  =  (1/V_g) &#931;_{v=1..V_g}  (1/V) &#931;_{v&#8242;=1..V}  &#8214; z_{n,v} &#8722; z_{n,v&#8242;} &#8214;&#178;</span></em></p><p><span>which looks like it costs V_g &#215; V comparisons. It does not. The paper shows (Appendix B.6) that this collapses exactly into a distance-to-the-mean:</span></p><p style="text-align: center;"><em><span>L_pred  =  (1/V) &#931;_{v&#8242;=1..V}  &#8214; &#956;_n &#8722; z_{n,v&#8242;} &#8214;&#178; ,      &#956;_n = (1/V_g) &#931;_{v=1..V_g}  z_{n,v}</span></em></p><p><span>The algebra is a pleasant little identity; expanding the squared norms, the cross terms reorganize into the mean and the pairwise structure disappears. So every view predicts the average of the global views, and the cost is linear in the number of views rather than quadratic. There is no predictor network anywhere in this expression.</span></p><p><strong><span>The total loss.</span></strong></p><p><span>The two terms combine as a convex combination rather than an unbounded penalty:</span></p><p style="text-align: center;"><em><span>L_LeJEPA  =  &#955; &#183; (1/V) &#931;_v SIGReg( { z_{n,v} } )   +   (1 &#8722; &#955;) &#183; (1/B) &#931;_n L_pred( { z_{n,v} } )</span></em></p><p style="text-align: center;"><em><span>with &#955; = 0.05 recommended as a robust default.</span></em></p><p><span>Note that SIGReg is applied per view and then averaged, rather than to all views pooled together. And note the shape of the combination: &#955; sits in [0, 1] and trades the two terms against each other directly, which is a slightly different object from the Lagrange multiplier we derived in Section 3. The Bayesian derivation still tells you why there are exactly two terms and what each one is; the convex form is the practical parameterization, and it has the pleasant property that &#955; is bounded and interpretable rather than needing a scale search.</span></p><p><span>That is the whole method. One predictive term, one constraint term, one hyperparameter. No teacher, no stop-gradient, no predictor, no schedule, no whitening, no negatives, no register tokens.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JFKS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JFKS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 424w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 848w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 1272w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JFKS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png" width="1456" height="1043" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1043,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1123957,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JFKS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 424w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 848w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 1272w, https://substackcdn.com/image/fetch/$s_!JFKS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390123e6-c2a5-4d08-a00e-fcb893a50b93_1898x1360.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>It is worth pausing on how much of that objective we derived rather than read. The form came from Bayes in Section 3, the target came from downstream risk in Section 6, and the divergence came from the requirements list in Section 5 plus a theorem from 1936. The only genuinely free choices left are &#955;, the number of slices, and the quadrature grid, and of those only &#955; meaningfully changes what the model learns.</span></p><p><span>Next, what this looks like as code.</span></p><div><hr></div><h1><span>8. SIGReg in code</span></h1><p><span>The paper gives its implementation in full, and it is short enough to walk through line by line. What follows is Algorithm 1 from the paper, split into pieces, with Algorithm 2 for the full loss at the end.</span></p><h3><strong><span>8.1 The signature</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;149d57be-a680-4963-84f8-d2321cca6730&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">def SIGReg(x, global_step, num_slices=256):
    # x is an (N, K) tensor of embeddings
    dev = dict(device=x.device)</code></pre></div><p><span>Everything the constraint needs is in that first argument plus a step counter. No teacher weights, no momentum buffer, no queue of past embeddings, no temperature schedule. The global_step is not used for annealing anything; it is a random seed, and the next fragment explains why.</span></p><h3><strong><span>8.2 Directions</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;ee012d06-e9ce-4b46-8c0b-9acbb18f6cd1&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">g = torch.Generator(**dev)
g.manual_seed(global_step)
proj_shape = (x.size(1), num_slices)
A = torch.randn(proj_shape, generator=g, **dev)
A /= A.norm(p=2, dim=0)</code></pre></div><p><span>Gaussian samples, normalized to the unit sphere. That is the standard way to draw uniformly from a sphere, and it is genuinely just randn; the paper discusses low-discrepancy sequences in its appendix but notes they do not change the asymptotic bounds, and the shipped implementation does not use them.</span></p><p><span>The seeding is the detail worth noticing. Every device seeds its generator with the same global_step, so every device draws the </span><em><span>same</span></em><span> directions on the same step without any communication. And because the seed advances every step, the directions are resampled continuously, which is exactly the compounding-coverage effect from 7.3. One line buys both distributed consistency and the escape from the curse of dimensionality.</span></p><h3><strong><span>8.3 Projection</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;26a31e63-9327-4c6e-bef6-aa8ce0d8dc74&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">x_t = (x @ A).unsqueeze(2) * t              # (N, M, T)</code></pre></div><p><span>The projection itself is x @ A, taking an (N, K) batch to (N, M). </span><strong><span>After this, K never appears again.</span></strong><span> Everything downstream is one-dimensional statistics on M columns. The unsqueeze and multiply broadcast each projected scalar against the integration grid, giving an (N, M, T) tensor which is the largest thing this function allocates, and which is linear in all three of its dimensions.</span></p><h3><strong><span>8.4 The integration grid</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;d5171356-f035-4f14-90ff-8e042ab1da62&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">t = torch.linspace(-5, 5, 17, **dev)
exp_f = torch.exp(-0.5 * t**2)</code></pre></div><p><span>Seventeen points spanning [&#8722;5, 5]. The exp_f term does double duty; it is both the characteristic function of the standard Gaussian, e^{&#8722;t&#178;/2}, which is our target, and the Gaussian window used to weight the integrand. That the two coincide is a convenience of targeting a Gaussian.</span></p><p><span>Seventeen knots sounds coarse for a numerical integral. The ablation shows the choice barely matters, and the reason is instructive: the characteristic function is accurate near zero, so the moments of the distribution are well characterized even over a modest integration range.</span></p><h3><strong><span>8.5 The empirical characteristic function</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;e6638ecf-3346-49e9-b2eb-466b8ce44e99&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">ecf = (1j * x_t).exp().mean(0)
ecf = all_reduce(ecf, op=&#8221;AVG&#8221;)</code></pre></div><p><span>The first line is the empirical characteristic function, computed as a complex exponential averaged over the batch, collapsing (N, M, T) to (M, T). Using complex tensors directly keeps the real and imaginary parts together, and both carry information; the real part sees deviations that are symmetric about the mean, the imaginary part sees asymmetric ones.</span></p><p><span>The second line is the entire distributed story. An empirical characteristic function is a mean over samples, and means compose across shards, so one all-reduce of an (M, T) array, a few thousand complex numbers, gives exactly the result you would have obtained on a single device. Nothing depends on N, K, or the device count. This is why the paper can claim fifty lines.</span></p><h3><strong><span>8.6 Comparing to the target</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;bae6d8c8-ad8c-4fd8-a8e8-de989f7695fe&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">err = (ecf - exp_f).abs().square().mul(exp_f)
N = x.size(0) * world_size
T = torch.trapz(err, t, dim=1) * N
return T</code></pre></div><p><span>The weighted squared discrepancy, integrated over frequency by the trapezoidal rule and scaled by the global batch size. Note that N is the </span><em><span>total</span></em><span> across devices, not the local batch, which matters because the Epps&#8211;Pulley statistic is defined with that scaling.</span></p><p><span>This is also where boundedness becomes visible as code. ecf is an average of complex exponentials, so its magnitude is at most one no matter what the embeddings do; an embedding sitting at 10&#8310; contributes a point on the unit circle, exactly like every other embedding. Put a kurtosis penalty in the same position and that embedding contributes 10&#178;&#8308;. </span><strong><span>No single input can dominate this statistic</span></strong><span>, which is Theorem 4 arriving as an operational fact.</span></p><p><span>One thing this function does not do is take a maximum. The return value is a per-direction vector, and the averaging happens in the caller. As we saw in 7.3, that is deliberate.</span></p><h3><strong><span>8.7 The full loss</span></strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;26eedc17-b7ad-46ef-bfa0-021b31bffc35&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">def LeJEPA(global_views, all_views, lambd):
    g_emb = forward(torch.cat(global_views))
    a_emb = forward(torch.cat(all_views))
    centers = g_emb.view(-1, bs, K).mean(0)
    a_emb = a_emb.view(-1, bs, K)
    sim = (centers - a_emb).square().mean()
    sigreg = mean(SIGReg(emb, global_step) for emb in a_emb)

    return (1 - lambd) * sim + lambd * sigreg</code></pre></div><p><span>Eight lines. The centers variable is &#956; from 7.7, the mean of the global-view embeddings, and sim is every view&#8217;s squared distance to it, which is the collapsed all-pairs loss. There is no predictor and no second network; forward is called twice on the same encoder. For non-ViT architectures the paper simply sets global_views = all_views and the local-view machinery disappears.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216FHD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6FHD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 424w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 848w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 1272w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216FHD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png" width="493" height="520.4980079681275" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1060,&quot;width&quot;:1004,&quot;resizeWidth&quot;:493,&quot;bytes&quot;:298225,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6FHD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 424w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 848w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 1272w, https://substackcdn.com/image/fetch/$s_!6FHD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a2e3988-b23d-4ed4-ab29-15e17cd70080_1004x1060.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>SIGReg is applied per view and averaged, and the two terms combine convexly through &#955;. That is the entire training step, minus the optimizer.</span></p><h3><strong><span>8.8 Complexity, totalled</span></strong></h3><p><span>The paper states the implementation is O(N) in both time and memory with respect to the minibatch size, and reports wall-clock timings. Reading the operations directly: the projection is O(NKM), the characteristic function is O(NMT), and the reduction is O(MT), giving</span></p><p style="text-align: center;"><em><span>O( N . M ( K + T ) )</span></em></p><p><span>linear in batch size, linear in embedding dimension, linear in slices. To put numbers on it, at N = 512, M = 512 and 16 integration points the forward-backward pass costs about 0.47 ms on a V100, and holding N fixed while raising M from 512 to 8192 takes it only to about 0.67 ms. Against an encoder forward pass, this is a rounding error.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210IQ1%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0IQ1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 424w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 848w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 1272w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210IQ1%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png" width="1456" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:225334,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0IQ1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 424w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 848w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 1272w, https://substackcdn.com/image/fetch/$s_!0IQ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff71f0a78-18d7-4726-9cc7-ae78ce13eeb0_2788x920.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h1><span>9. Results &amp; Outcomes</span></h1><p><span>A derivation can be elegant and still lose to a pile of heuristics that somebody tuned for two years, so what follows is the empirical case. The paper&#8217;s validation spans more than ten datasets and over sixty architectures at scales approaching two billion parameters. I have grouped the findings into five, roughly in order of how much each one surprised me.</span></p><h3><strong><span>9.1 Stability across hyper-parameters and architectures</span></strong></h3><p><span>LeJEPA trains stably across every hyper-parameter the authors varied and across roughly 50 architectures from 8 families, using a single value of &#955;.</span></p><p><span>The architecture sweep is the cleanest demonstration. The authors took every model in the timm library under 20M parameters, 50 of them spanning ConvNeXt, EfficientNet, Inception, LeViT, MaxViT, MaxxViT, ResNet and ViT, pretrained each on ImageNet-10 with the same recipe, and evaluated with a frozen backbone. All 50 land between </span><strong><span>91.5% and 95% top-1</span></strong><span>, which is a remarkably narrow band for a set of models that different. The paper&#8217;s practical note is that architectures which do well under supervision also do well here, so ResNets and ViTs are the sensible starting point over specialized designs like EfficientNet.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vUvE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vUvE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 424w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 848w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vUvE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png" width="1456" height="654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:654,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:586198,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vUvE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 424w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 848w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!vUvE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9776e93d-b86a-4b26-9514-00c8d596ffe3_2778x1248.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>On hyper-parameters, the headline is that nothing is delicate. Varying &#955; across two orders of magnitude on ImageNet-100 with a ResNet-50 leaves performance stable, with the optimum drifting slightly upward as the number of views increases. On ImageNet-1k with a ViT-Large/14, the ablations cover the Epps&#8211;Pulley integration domain, the number of quadrature points, the number of slices, batch size, projector dimension and register tokens. The paper&#8217;s own summary is the right one to quote in spirit: while some settings slightly improve performance, </span><strong><span>none of the choices leads to a catastrophic collapse</span></strong><span>.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ibHD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ibHD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 424w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 848w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ibHD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png" width="507" height="471.9460370994941" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1104,&quot;width&quot;:1186,&quot;resizeWidth&quot;:507,&quot;bytes&quot;:213838,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ibHD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 424w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 848w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!ibHD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbda096bc-0f50-4b5f-a5e9-7e1f1a37be09_1186x1104.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Two details worth pulling out. Competitive performance holds at batch sizes as small as 128 on ImageNet-1k, which suggests noticeably lower memory requirements than methods needing large batches for negatives. And the number of slices has only a modest effect, with 512 already competitive and 1024 recommended.</span></p><p><span>The removal results are the ones that most directly vindicate the theory. Prior work established that predictors in image JEPAs and teacher&#8211;student architectures exist primarily to prevent collapse, and that removing them yields encoders at chance level. With SIGReg in place the paper removes both and trains fine. A teacher&#8211;student setup still helps ViTs slightly, but as stochastic weight averaging rather than as a collapse guard. Register tokens, introduced elsewhere to stabilize vision transformers, turn out to be unnecessary too, and the paper&#8217;s read is that those instabilities were symptoms of poorly conditioned objectives rather than facts about the architecture.</span></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SJe4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 424w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 848w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 1272w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SJe4%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png" width="1456" height="332" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:332,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151255,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SJe4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 424w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 848w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 1272w, https://substackcdn.com/image/fetch/$s_!SJe4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e1d076d-8048-45a9-b0ae-fe7ededf865c_2310x526.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><h3><strong><span>9.2 The training loss predicts downstream accuracy</span></strong></h3><p><span>LeJEPA&#8217;s training loss correlates with downstream linear-probe accuracy at roughly </span><strong><span>85% Spearman</span></strong><span> out of the box, rising to nearly </span><strong><span>99%</span></strong><span> under a simple rescaling, which makes it usable for label-free model selection.</span></p><p><span>This is the result I did not expect, and the most practically useful one in the paper. Ordinarily an SSL pretraining loss tells you almost nothing about representation quality; a contrastive loss can fall steadily while the representation quietly loses rank, which is exactly the dimensional collapse from Section 2 and is invisible in the curve. The paper notes that in recent JEPA models the training loss may not even decrease monotonically. So the standard workflow is to checkpoint, freeze, fit a probe on labelled data and read the accuracy, meaning every model-selection decision inside a supposedly unsupervised procedure secretly requires labels.</span></p><p><span>The rescaling is worth stating because it is so simple. Correlate the loss divided by a power of the trade-off parameter:</span></p><p style="text-align: center;"><em><span>C(&#945;)  =  &#961;_s ( train_loss / &#955;^&#945; ,  test_accuracy )</span></em></p><p><span>At &#945; = 0 you recover the plain training loss, already strongly correlated. At &#945; &#8776; 0.4 the correlation reaches nearly 99% across multiple datasets and architectures, with the individual curves running from 0.60 to 0.95 on ResNet-18 with Flowers102, and 0.90 to 0.98 on ViT-S/8 with ImageNet-10. The entire set of points is collected across variation in learning rate, weight decay, epoch count and &#955;, so this is not a within-run artifact.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kGQC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kGQC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 424w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 848w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 1272w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kGQC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png" width="1456" height="516" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:516,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:846823,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kGQC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 424w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 848w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 1272w, https://substackcdn.com/image/fetch/$s_!kGQC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08e794bd-c3fd-4101-afa4-c8a9bf881d6b_2382x844.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217fKD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7fKD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 424w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 848w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 1272w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217fKD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png" width="379" height="287.14183123877916" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:844,&quot;width&quot;:1114,&quot;resizeWidth&quot;:379,&quot;bytes&quot;:266997,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7fKD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 424w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 848w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 1272w, https://substackcdn.com/image/fetch/$s_!7fKD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb14357bc-1c05-4fd0-a5aa-07f4e9a8b6e0_1114x844.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Why does LeJEPA behave differently? The answer follows from Section 6, and it is worth stating because the paper reports the observation more than it explains it. The SIGReg term is not a proxy for downstream performance, it is a direct estimate of the quantity the theory says </span><em><span>governs</span></em><span> downstream performance. If the isotropic Gaussian argument is correct, the loss ought to predict the probe. That it empirically does, at 99% correlation, is the strongest available evidence that the argument describes something real rather than merely being internally consistent.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gF9G%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gF9G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 424w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 848w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 1272w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gF9G%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png" width="1456" height="745" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:745,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:694374,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gF9G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 424w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 848w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 1272w, https://substackcdn.com/image/fetch/$s_!gF9G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2701b745-5a27-47e1-b8d7-e206946001b4_2338x1196.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>There is a nice secondary observation in the loss plane. Different values of &#955; trace out trade-off fronts between the two terms that produce similar downstream accuracy, and those fronts are linear and point towards the lower-left corner. Which is to say the two terms are not fighting each other in any complicated way; you want both small, and &#955; decides how you get there.</span></p><h3><strong><span>9.3 In-domain pretraining outperforms frontier transfer</span></strong></h3><p><span>On Galaxy10, LeJEPA pretrained directly on the target data with a small backbone outperforms DINOv2 and DINOv3 transferred from natural images, across every data regime from one sample per class to the full set, under both frozen-backbone linear probing and full finetuning.</span></p><p><span>The setup deserves stating because it is deliberately unflattering to LeJEPA. Galaxy10 is a galaxy-morphology task with </span><strong><span>11,000 training samples across 10 classes</span></strong><span>, visually and statistically remote from natural images. The paper pretrains a variety of backbones on it for 400 epochs using default hyper-parameters, no tuning, and compares against DINOv2 (trained on LVD-142M) and DINOv3 (trained on LVD-1.7B).</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gVE4%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gVE4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 424w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 848w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 1272w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gVE4%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png" width="1456" height="640" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/69156f35-633a-4847-a384-bcf55925f732_2380x1046.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:640,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:465233,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gVE4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 424w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 848w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 1272w, https://substackcdn.com/image/fetch/$s_!gVE4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69156f35-633a-4847-a384-bcf55925f732_2380x1046.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Reading the frozen-backbone column, which is where representation quality shows most directly: LeJEPA ResNet-34 reaches 78.17 against DINOv3&#8217;s 71.38 and DINOv2&#8217;s 67.62 on the full set, and the gap holds at every sample count down to one per class. Under full finetuning the same ResNet-34 reaches 83.28 against 81.60 and 78.34. A 21M-parameter model trained from scratch on eleven thousand images beats a model pretrained on 1.7 billion.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DM_v%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DM_v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 424w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 848w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 1272w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DM_v%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png" width="1456" height="877" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:877,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:215809,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DM_v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 424w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 848w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 1272w, https://substackcdn.com/image/fetch/$s_!DM_v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0a98e19b-d2c8-4300-8c84-ca8cdb81a61a_1558x938.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>The effect is not confined to astronomy. Across six datasets the paper shows in-domain LeJEPA competitive or better, including Flowers102 with only </span><strong><span>1,020 training samples</span></strong><span>, where a ResNeXt-26 reaches 82.19 from scratch. The one place frontier transfer still wins comfortably is where you would expect it to, on natural-image datasets like CIFAR and ImageNet-10 where I-JEPA pretrained on ImageNet-22k has an enormous head start.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21D2XN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D2XN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 424w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 848w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 1272w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21D2XN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png" width="1456" height="418" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:418,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:205909,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D2XN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 424w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 848w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 1272w, https://substackcdn.com/image/fetch/$s_!D2XN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3cfdbf7c-20b1-42a9-9ead-98e0d382f291_1866x536.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Why this matters beyond the leaderboard: the received wisdom is that in-domain SSL on a small dataset is not worth attempting, because you cannot out-train a foundation model pretrained on a billion curated images, so you transfer and finetune instead. That wisdom formed when SSL required careful per-dataset tuning and collapsed if you got it wrong, which made in-domain pretraining an expensive gamble on a dataset too small to justify it. Take away the tuning and the gamble disappears, which suggests the received wisdom was partly an artifact of the methods rather than a fact about the data.</span></p><h3><strong><span>9.4 Scaling across data and models</span></strong></h3><p><span>On ImageNet-1k, LeJEPA reaches </span><strong><span>77.1% online linear probe with a ViT-Large (0.3B)</span></strong><span> and </span><strong><span>78.5% with a ConvNeXtV2-Huge (0.6B)</span></strong><span>, and transfers better than I-JEPA while using a smaller model and a third of the training schedule.</span></p><p><span>The transfer comparison is the more informative one. Against I-JEPA with a ViT-Huge (0.6B), across eight datasets spanning textures, objects and fine-grained categories, LeJEPA ViT-L (0.3B) averages 79.48 to I-JEPA&#8217;s 78.50 in the all-shot setting, while training for </span><strong><span>100 epochs against I-JEPA&#8217;s 300</span></strong><span>. That is roughly a threefold reduction in training cost with a model half the size, and the margins are widest exactly where you would hope, on fine-grained tasks; DTD 78.30 against 73.32, Food101 82.05 against 81.02, Flowers102 91.21 against 86.47.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mWhP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mWhP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 424w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 848w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 1272w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mWhP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png" width="1456" height="789" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:789,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:492014,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mWhP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 424w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 848w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 1272w, https://substackcdn.com/image/fetch/$s_!mWhP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836282a-9707-4abe-a581-d86e0b375ebd_2426x1314.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>On the largest run, a ViT-gigantic at 1.8B parameters trains with a smooth, stable loss curve and no special handling, which the authors attribute directly to the bounded-gradient guarantee from Theorem 4.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hFAe%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hFAe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 424w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 848w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 1272w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hFAe%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png" width="1456" height="494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:306619,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hFAe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 424w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 848w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 1272w, https://substackcdn.com/image/fetch/$s_!hFAe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6df71721-487d-47d1-8661-500ecda90ae5_2262x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>Worth framing carefully, because this is easy to over- or under-sell. These are not state-of-the-art numbers in absolute terms; heavily tuned DINOv2 and DINOv3 systems reach higher on ImageNet. What they are is competitive numbers produced by an objective with one hyper-parameter and no heuristics, at a fraction of the training budget. The useful comparison is not whether 78.5% wins the benchmark, but how much was given up by deleting the teacher, the predictor, the stop-gradient, the schedulers, the whitening and the register tokens, and the answer appears to be less than one would expect.</span></p><h3><strong><span>9.5 Emergent semantic structure</span></strong></h3><p><span>PCA of last-layer features from an ImageNet-1k pretrained LeJEPA ViT-Large shows clear object&#8211;background separation, and thresholding the attention maps yields object segmentation and tracking across video frames without any segmentation supervision.</span></p><p><span>Projecting the first three principal components to RGB gives images in which warm colours consistently pick out foreground objects and cool colours pick out background and foliage. This is the DINO-style qualitative check, and LeJEPA passes it.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21y4bK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y4bK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 424w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 848w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 1272w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21y4bK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png" width="437" height="434.02721088435374" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1168,&quot;width&quot;:1176,&quot;resizeWidth&quot;:437,&quot;bytes&quot;:2081128,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!y4bK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 424w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 848w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 1272w, https://substackcdn.com/image/fetch/$s_!y4bK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c20c1fe-5cbe-47bd-b8b1-4d0714f97b25_1176x1168.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>The video result goes further than I expected. Thresholding the self-attention of the [CLS] token produces binary masks that track salient objects across frames with reasonable temporal coherence, again with no segmentation labels anywhere in training.</span></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TO-2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 424w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 848w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 1272w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21TO-2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png" width="1456" height="315" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:315,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:710066,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/214459483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TO-2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 424w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 848w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 1272w, https://substackcdn.com/image/fetch/$s_!TO-2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31c9b7cc-ac20-4d55-8243-39d06db3c1ff_2440x528.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><span>This is soft evidence and I would not lean on it hard, but it is a good consistency check. Nothing in SIGReg mentions semantics; the constraint only says the embedding cloud should be an isotropic Gaussian. Semantic organization appearing along the principal directions anyway is what you would hope for if the predictive term is doing its job and the constraint is genuinely neutral about </span><em><span>what</span></em><span> gets represented, caring only about how the mass is arranged. The authors&#8217; framing is that a stability-focused objective does not sacrifice semantic richness, and on this evidence that holds.</span></p><h3><strong><span>9.6 Limitations of the evidence</span></strong></h3><p><span>Three things the results do not establish, which are worth stating plainly.</span></p><ol><li><p><strong><span>Vision only.</span></strong><span> Every experiment is on images. The Section 6 theory makes no reference to modality, since the risk argument concerns probes and distributions rather than pixels, so there is no principled barrier to audio, text or time series. Nobody has demonstrated it, and &#8220;should transfer&#8221; has a poor track record here.</span></p></li><li><p><strong><span>No matched-compute comparison against the strongest baselines.</span></strong><span> The I-JEPA comparison is careful and favourable, but DINOv2 and DINOv3 are compared only in the in-domain setting where they are transferring rather than training in-domain. The experiment that would settle the general question is DINOv3&#8217;s exact data, architecture and compute with only the objective swapped, and nobody has run it.</span></p></li><li><p><strong><span>&#8220;One hyper-parameter&#8221; is generous.</span></strong><span> True of the objective, and it excludes learning rate, weight decay, batch size, augmentation policy and architecture, all of which still require choosing; the paper cross-validates learning rate and weight decay in its architecture sweep. The accurate claim is that LeJEPA eliminates the hyper-parameters specific to preventing collapse, which is a real reduction but not a single knob in total.</span></p></li></ol><p><span>What I will like to point out is that the limitation I expected to find is not there as I assumed the number of slices would be an underexamined knob hiding a lot of sensitivity, since it controls how well the Cram&#233;r&#8211;Wold approximation holds. The paper ablates it directly, bounds it theoretically, and shows that resampling makes small values work.</span></p><div><hr></div><h1><span>10. Thoughts</span></h1><p><strong><span>1. The heuristics were never wrong, they were unnamed.</span></strong></p><p><span>Every mechanism from Section 4 was groping towards a constraint on the embedding distribution without stating what it was. VICReg got the second moments, whitening got the correlation structure, negatives got the spread. All three are shadows of &#8220;be isotropic Gaussian&#8221; seen from different angles. The field was doing empirical science on an objective nobody had written down, and each heuristic was a partial measurement of the same object.</span></p><p><strong><span>2. The loss does not predict performance, it measures it.</span></strong></p><p><span>The 99% correlation is under-sold in the paper. Operationally it means architecture search, hyper-parameter selection and early stopping without touching a label, which removes the most annoying dependency in the pretraining workflow. But the reason matters more: SIGReg estimates the quantity that provably bounds downstream risk. If that framing is right, any objective built on a proven risk bound should behave this way, and the loss-tells-you-nothing era was a symptom of under-specified objectives rather than a fact about self-supervision.</span></p><p><strong><span>3. Gaussianize once, or Gaussianize always?</span></strong></p><p><span>In </span><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fturboquant-online-vector-quantization"><span>TurboQuant</span></a><span> the central move was a Hadamard rotation applied to KV-cache vectors so that, by CLT, their coordinates become approximately Gaussian, because a known distribution lets you precompute an optimal Lloyd-Max codebook. The whole method manufactures Gaussianity at inference because the model did not provide it. </span></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;abb88511-8ab4-4ac7-afc6-2a305dbd9a2f&quot;,&quot;caption&quot;:&quot;Table of contents&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-04-06T03:30:57.588Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!C2Ya!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/turboquant-online-vector-quantization&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:193180973,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:23,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><span>LeJEPA trains the representation to be Gaussian in the first place. So: </span><strong><span>if you train with SIGReg, do you still need the rotation?</span></strong><span> A model whose hidden states are natively isotropic Gaussian is already in the distribution Lloyd-Max wants; skip the Hadamard, skip the online scale estimation, quantize directly.</span></p><p><span>Both papers want the same target for the same reason and arrive from opposite ends, one post-hoc because it cannot change the model, one during training because it can. Both lean on random one-dimensional projections to make a high-dimensional problem tractable; TurboQuant to preserve inner products under sign quantization, LeJEPA to test distributional fit. The same tool pointed in opposite directions.</span></p><p><strong><span>4. Isotropic is right only if you are genuinely not betting.</span></strong></p><p><span>The isotropic Gaussian is optimal for </span><em><span>worst-case</span></em><span> risk over an unknown task family, which is exactly right for a foundation model and not obviously right when you know a lot about your downstream use. There, worst-case optimality means declining to use information you have. SIGReg does not care what Q is; the machinery works for any target whose one-dimensional projections you can write down. A task-informed, deliberately anisotropic Q is the most immediately actionable gap I can see.</span></p><p><strong><span>5. What happens in language?</span></strong></p><p><span>Every experiment is vision and the theory is modality-agnostic, so text is the obvious move. I suspect it is harder than it looks: LLM embeddings are famously anisotropic, the cone effect, and there is an argument that the anisotropy encodes real structure about token frequency rather than being pathology. Forcing isotropy might destroy something the model was using. Or the cone is dimensional collapse we have been rationalizing for years because we had no principled reason to object. Section 6 gives us that reason now.</span></p><p><strong><span>6. The contribution is the question.</span></strong></p><p><span>The contribution is not SIGReg, and not the isotropic Gaussian result either. It is asking </span><em><span>what distribution should the embeddings follow</span></em><span>, which nobody had posed in that form. Once asked, the answer is a fairly standard exercise in bias-variance and Fisher information, and the implementation is a statistical test from 1983 wrapped in a theorem from 1936. None of the pieces is new; the framing is. Worth remembering when reading papers for techniques to borrow, since the technique here is a fifty-line function, but the thing worth stealing is the habit of asking what the correct answer would look like before going to find one.</span></p><div><hr></div><h1>11. Conclusion</h1><p>We talked about self-supervised learning, and specifically about the part of it nobody could justify. Stop-gradients, EMA teachers, whitening, negatives, register tokens; all found by trial and error, all kept because they prevented collapse.</p><p>The route out was taking Yann&#8217;s framing seriously. If SSL is constrained optimization, the constraint is not a safety mechanism, it is the thing that decides what the model learns. Bayes made that precise in Section 3, giving a joint prior with two slots &#8212; one for parameters, which is classical regularization, and one for the representation, where every anti-collapse mechanism had been operating without saying so.</p><p>That turned the question from <em>how do we stop the model cheating</em> into <em>what shape should a representation be</em>, and the second has exactly one answer. A linear probe forces isotropy, since a variance budget spread unevenly always leaves some task badly served. A nonlinear probe forces Gaussianity, since neighbourhood-averaging probes are biased in proportion to Fisher information, which the Gaussian uniquely minimizes. Isotropy declines to bet on direction, Gaussianity declines to bet on location.</p><p>Enforcing it was harder. Density estimation in a thousand dimensions from a few hundred samples is hopeless, and the escape was Cram&#233;r&#8211;Wold: a distribution is determined by its one-dimensional shadows. Project onto random directions, run a characteristic-function test on each, average. The result is fully specified, bounded in gradient by construction, linear in everything you want to scale, and about twenty lines of PyTorch. Then delete the machinery, because none of it does anything the constraint does not.</p><p>The empirical case holds. Fifty architectures on one hyper-parameter. A loss predicting downstream accuracy at 99%, so model selection without labels. Eleven thousand galaxy images beating a model pretrained on 1.7 billion.</p><p>What strikes me most is how little here is new. Epps&#8211;Pulley is from 1983, Cram&#233;r&#8211;Wold from 1936, Fisher information older still. The contribution is a question nobody had asked in that form, and everything else follows from asking it properly.</p><p>Whether SIGReg becomes standard I have no idea. The durable part is the move underneath it: when something in your pipeline works and you cannot say what it guarantees, that is not a trick you have found, it is a specification you have not written.</p><p><strong>References:</strong><br>LeJEPA paper: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2511.08544">https://arxiv.org/pdf/2511.08544</a><br>Code: <a href="iframe.php?url=https%3A%2F%2Fgithub.com%2Frbalestr-lab%2Flejepa">https://github.com/rbalestr-lab/lejepa</a><br>Yann's NYU lecture: </p><div id="youtube2-8u2s64ZtmiA" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;8u2s64ZtmiA&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="iframe.php?url=https%3A%2F%2Fwww.youtube-nocookie.com%2Fembed%2F8u2s64ZtmiA%3Frel%3D0%26amp%3Bautoplay%3D0%26amp%3Bshowinfo%3D0%26amp%3Benablejsapi%3D0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><span>That's all for today.</span><br><span>Follow me on </span><a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a><span> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</span></p>]]></content:encoded></item><item><title><![CDATA[Speculative Decoding: Theory and Implementation in vLLM]]></title><description><![CDATA[From why LLM generation is slow to a working EAGLE3 implementation in vLLM: the theory, the economics, the method families, and an honest benchmark where speculation did not pay off]]></description><link>https://vizuara.substack.com/p/speculative-decoding-theory-and-implementation</link><guid isPermaLink="false">https://vizuara.substack.com/p/speculative-decoding-theory-and-implementation</guid><dc:creator><![CDATA[Mayank Pratap Singh]]></dc:creator><pubDate>Mon, 06 Jul 2026 04:16:55 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EyEo%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EyEo%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EyEo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 424w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 848w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 1272w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EyEo%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif" width="960" height="540" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/adc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:540,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:432115,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EyEo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 424w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 848w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 1272w, https://substackcdn.com/image/fetch/$s_!EyEo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadc64081-e1b4-4828-ae80-f61f5197154d_960x540.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Large language models are slow when they generate text, and the reason catches most people off guard. It is not that the math is hard. The problem is that the model has to read its entire multi-hundred-gigabyte brain out of memory once for every single word, and it cannot start the next word until the current one is finished. Speculative decoding is the trick that breaks this one-word-at-a-time barrier, and it does so without changing the model&#8217;s output at all.</p><p>This post builds the idea up from the ground, then puts it into production. I start with why generation is slow, work out the core &#8220;guess-and-verify&#8221; mechanism, prove it is mathematically exact, dig into the economics that decide how much speedup you actually get, walk the method families (n-gram lookup, Medusa, EAGLE), and finish <em>by actually deploying EAGLE3 on vLLM</em> and reading the speedup off a real GPU.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>Table of Contents</h1><p><strong>1. Why generation is slow</strong></p><p><strong>2. The core idea: draft, then verify</strong></p><p><strong>3. Why it&#8217;s exact: the correctness guarantee</strong></p><p><strong>4. The economics: alpha, tau, and K</strong></p><p><strong>5. System realities and limitations</strong></p><p><strong>6. The landscape of methods</strong></p><p><strong>7. Putting it in production: EAGLE3 on vLLM</strong></p><p><strong>8. Takeaways</strong></p><p><strong>9. What I didn&#8217;t cover</strong></p><p>Code Repo</p><p><a href="iframe.php?url=https%3A%2F%2Fgithub.com%2FMayankpratapsingh022%2FLLM-Inference-Playbook">https://github.com/Mayankpratapsingh022/LLM-Inference-Playbook</a></p><blockquote><p>Speculative decoding makes a large model generate <strong>2&#8211;3&#215; faster</strong> while producing the <strong>exact same text</strong> it would have written anyway. It is close to a free lunch, paid for with spare compute the GPU was already wasting, but it is a <strong>bet</strong>, and Section 7 shows a real run where it did not pay off.</p></blockquote><h1><strong>1. Why generation is slow</strong></h1><h2><strong>1.1 Generation happens one token at a time</strong></h2><p>An LLM generates text <strong>autoregressively</strong>: it predicts one token, appends it to the input, and runs the whole model again for the next one. There is no shortcut here. Each new word literally depends on the one before it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yr4V%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yr4V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 424w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 848w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 1272w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yr4V%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png" width="1476" height="1085" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1085,&quot;width&quot;:1476,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132393,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3836b009-e69c-47be-8f65-fec2721ff3cc_1476x1278.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yr4V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 424w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 848w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 1272w, https://substackcdn.com/image/fetch/$s_!yr4V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3606a4a5-6e0c-4919-81ab-daf712811632_1476x1085.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 1: In autoregressive decoding, the large model predicts only the next word, which is then appended to the context. The model runs again to predict the subsequent word, and this process repeats many times to generate the complete sequence.</em></p><p>Notice what this costs. To produce the phrase &#8220;a small red,&#8221; the giant model runs <strong>three separate times</strong>. To write a 500-token answer, it runs 500 times, strictly in order. Every run is a full forward pass through every layer of the network.</p><h2><strong>1.2 Training is parallel, inference is sequential</strong></h2><p>This sequential bottleneck is unique to <em>generation</em>. During training, the model already knows the whole target sentence, so it can score every position at once in a single parallel forward pass. During inference, the future words do not exist yet, so the model is stuck in a step-by-step loop.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QSX-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QSX-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 424w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 848w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 1272w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QSX-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png" width="1515" height="1698" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1698,&quot;width&quot;:1515,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:174607,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6120f27-f4bb-422e-ad28-268d1ef2a98b_1515x1997.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QSX-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 424w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 848w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 1272w, https://substackcdn.com/image/fetch/$s_!QSX-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39dedb1d-103d-4d87-9e03-eaa72ebf617f_1515x1698.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 2: A comparison of Transformer processing modes during training and inference. During training (Panel A), the full sentence is known, enabling the model to score multiple positions simultaneously in a single parallel forward pass. In contrast, during inference (Panel B), future words are missing, forcing the system into a sequential, step-by-step generation loop where each new token must be predicted one at a time.</em></p><p>The transformer is perfectly capable of massive parallelism. We just cannot use it at generation time, because we are missing the very thing we are trying to produce.</p><h2><strong>1.3 The autoregressive barrier</strong></h2><p>Here is another way to see the problem. At any moment, the model has a valid <strong>KV cache</strong> for everything it has already written (the past), and a complete <strong>blind spot</strong> for everything it has not (the future). It can generate exactly one token to push the boundary forward, and only then can it look one step further.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21udPe%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!udPe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 424w, https://substackcdn.com/image/fetch/$s_!udPe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 848w, https://substackcdn.com/image/fetch/$s_!udPe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 1272w, https://substackcdn.com/image/fetch/$s_!udPe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21udPe%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png" width="1443" height="667" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:667,&quot;width&quot;:1443,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81405,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03dd34e6-8135-46c4-9caa-7a6fcab83f8f_1443x906.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!udPe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 424w, https://substackcdn.com/image/fetch/$s_!udPe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 848w, https://substackcdn.com/image/fetch/$s_!udPe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 1272w, https://substackcdn.com/image/fetch/$s_!udPe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a58e778-dee3-4092-8981-d7b624b0ccd3_1443x667.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 3: An illustration of the autoregressive barrier during LLM inference. Because the model cannot see future words, it uses past context to actively generate the immediate next token, and must complete this step before moving to the next slot. Speculative decoding attempts to bypass this strict sequential bottleneck by filling the future unknown slots with rapid guesses.</em></p><p>That last sentence is the whole thesis of this post in one line:</p><div class="pullquote"><p> what if we could fill those blind-spot slots with cheap guesses, and then check them all at once?</p></div><h2><strong>1.4 The real culprit is memory bandwidth, not compute</strong></h2><p>Here is the part that trips people up. Each generation step is slow not because the GPU is busy doing math. It is slow because the GPU has to physically stream the model&#8217;s <em>entire</em> set of weights, every single parameter, out of high-bandwidth memory (HBM) and into the compute cores, and it does this for every token it produces.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yQ4f%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yQ4f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 424w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 848w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yQ4f%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png" width="1599" height="2176" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2176,&quot;width&quot;:1599,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:320441,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6938abf4-ffc3-4a29-8e87-88c82d470c7b_1599x2451.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yQ4f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 424w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 848w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ4f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b2ff9f8-d482-44a4-af04-47b81b8dfd87_1599x2176.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 4: Key system observations highlight the inefficiencies of autoregressive decoding, noting that every new word necessitates another full pass through the large model. Because the same massive weights are repeatedly loaded, each additional word incurs another computationally expensive step, ultimately causing long answers to generate slowly.</em></p><p>For a 70B-parameter model, that is roughly <strong>140 GB read from memory per token</strong>. Three tokens means moving <strong>420 GB</strong>. The arithmetic units, meanwhile, sit mostly idle. They finish long before the next batch of weights even shows up. This is what people mean when they say generation is <strong>memory-bandwidth bound</strong>.</p><p>This one fact is the foundation of everything that follows:</p><div class="pullquote"><p><em><span>Generation is </span><strong>memory-bound</strong><span>, not compute-bound. The GPU's math units sit starving while they wait on weights. That means there is </span><strong>spare compute to burn</strong><span>, if only we could feed it more tokens at once.</span></em></p></div><p>And we can feed it more tokens at once. Remember Figure 4, Panel A: verifying many tokens in parallel costs almost the same as generating a single one, because either way you pay to load the weights exactly once. That asymmetry, where one weight-load can check many tokens, is the gap speculative decoding pries open.</p><h1><strong>2. The core idea: draft, then verify</strong></h1><h2><strong>2.1 A small model guesses, a large model checks</strong></h2><p>Speculative decoding adds a second, much smaller <strong>draft model</strong> (<em><span>M</span><sub><span>q</span></sub></em><span>&#8203;</span>) alongside the big <strong>target model</strong> (<em><span>M</span><sub><span>p</span></sub></em><span>&#8203;</span>). The draft model is cheap to run, so it can rattle off several guesses for the next few tokens very quickly. The target model then verifies all of those guesses in a single parallel pass, the same pass that in normal decoding would have produced just one token.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zZ7q%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zZ7q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 424w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 848w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 1272w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zZ7q%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png" width="1416" height="1475" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1475,&quot;width&quot;:1416,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:198795,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Facdd4ebc-9935-4fcd-bd20-60c2de60422c_1416x1713.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zZ7q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 424w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 848w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 1272w, https://substackcdn.com/image/fetch/$s_!zZ7q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F409b5223-a049-434c-ae3d-b6d5676fd272_1416x1475.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 5: In the speculative decoding pipeline, a small model (</em><span>M</span><sub><span>q</span></sub><span>&#8203;</span><em>) rapidly guesses future tokens while a large model (</em><span>M</span><sub><span>p&#8203;</span></sub><em>) verifies those guesses in parallel. Correct guesses are committed to the KV Cache, and rejected ones are corrected to preserve </em><span>M</span><sub><span>p&#8203;</span></sub><em>'s exact distribution.</em></p><p><span>The draft model produces </span><em><span>K</span></em><span> candidate tokens in roughly </span><em><span>4&#215;T</span><sub><span>fast</span></sub><span>&#8203;</span></em><span> (its drafting latency). Then the target model spends one expensive pass, </span><em><span>T</span><sub><span>slow</span></sub></em><span>&#8203;, confirming the whole batch instead of producing a single token. When the guesses are good, you get several tokens for the price of one big step.</span></p><h2><strong>2.2 Verification accepts a prefix, then corrects</strong></h2><p>How does verification decide what to keep? The target model scores the drafted sequence left to right and accepts tokens <strong>until the first mismatch</strong>. Everything before the mismatch is committed. The mismatched token is replaced with the target model&#8217;s own correct token. Everything after it is thrown away.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211Bqf%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1Bqf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 424w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 848w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 1272w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211Bqf%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png" width="1512" height="816" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:816,&quot;width&quot;:1512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fedcd3184-96e2-49ee-b2ba-d27c976fee63_1512x1077.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1Bqf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 424w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 848w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 1272w, https://substackcdn.com/image/fetch/$s_!1Bqf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc41c6f1e-5f11-4671-bda8-8647a14ef6f6_1512x816.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 6: The token verification process. The target model evaluates the drafted sequence sequentially from left to right. It successfully verifies and accepts "a" and "small". However, upon rejecting the token "blue", all subsequent guesses in the drafted sequence are automatically discarded.</em></p><p>This "first mismatch wins" rule is what keeps the output identical to plain decoding. The moment a guess strays from what the big model would have said, we stop trusting the draft and hand control back to the target. And notice the worst case: even if every single guess is wrong, the verification pass still hands back one correct token (the corrected one), so we never do worse than plain autoregressive decoding.</p><h2><strong>2.3 The speedup, in numbers</strong></h2><p>Let me put concrete costs on it. Say one big-model pass costs 100 units and one draft pass costs 10. </p><p>Standard decoding of five tokens is five serial big passes: <span>5&#215;100=500</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211vOv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1vOv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 424w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 848w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 1272w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211vOv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png" width="1646" height="1825" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1825,&quot;width&quot;:1646,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:176596,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa863500a-e32f-4b94-ae9f-fc70d6b7ef1d_1659x2328.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1vOv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 424w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 848w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 1272w, https://substackcdn.com/image/fetch/$s_!1vOv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7efa7626-663d-42e4-8975-f3224f2fc40a_1646x1825.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 7: Cost comparison and best-case performance of speculative decoding versus standard autoregressive decoding. Standard decoding requires paying for five large, sequential passes to generate five tokens, resulting in a baseline cost of 500. Conversely, speculative decoding employs a computationally cheap draft model to guess five words simultaneously. In an ideal scenario where the draft model guesses all words correctly, the target model verifies the entire block once in parallel, which reduces the total operational cost from 500 to 150.</em></p><p>In the best case, speculative decoding pays for five cheap draft guesses plus one verification pass: (5&#215;10)+100=150. Same five tokens, less than a third of the cost. The catch, which the rest of this post is really about, is that this best case only shows up when the draft model guesses well. How often it does is the whole game.</p><h1><strong>3. Why it&#8217;s exact: the correctness guarantee</strong></h1><p>The most important property of speculative decoding is that it is <strong>not an approximation</strong>. The text you get out is drawn from <em>exactly</em> the same probability distribution as if the target model had generated every token itself. This is what separates it from lossy tricks like just using a smaller model directly.</p><p>The mechanism is a clever twist on <strong>rejection sampling</strong>, introduced for this setting by <strong><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2211.17192">Leviathan et al. (2023)</a></strong> and <strong><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2302.01318">Chen et al. (2023)</a></strong>. Let <em><span>q(x)</span></em> be the draft model&#8217;s probability for a proposed token <em><span>x</span></em>, and <em><span>p</span></em><span>(</span><em><span>x</span></em><span>)</span> the target model&#8217;s probability for that same token. We accept the draft token with probability:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\text{accept}} = \\min\\!\\left(1,\\ \\frac{p(x)}{q(x)}\\right)&quot;,&quot;id&quot;:&quot;LLEPQYVYEQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Read it intuitively. If the target likes the token at least as much as the draft did (<span>p&#8805;q</span>), we keep it outright. If the target likes it less, we keep it only proportionally, and sometimes reject it, so we do not over-represent tokens the draft was too eager about.</p><p>When a token <em>is</em> rejected, we do not just resample blindly. We sample the replacement from the <strong>normalized residual distribution</strong>, which fills in exactly the probability mass the acceptance step left out:</p><p><span>Together, the accept rule and the residual-resample rule provably rebuild the target distribution </span><em><span>p</span></em><span>, token for token. The draft model only ever affects speed. It never affects what actually gets written.</span></p><div class="pullquote"><p><em><span>The draft model is a </span><strong>guesser, not a decider</strong><span>. Rejection sampling guarantees the final text matches the target model's distribution exactly. A wrong guess costs you time, never correctness.</span></em></p></div><h1><strong>4. The economics: alpha, tau, and K</strong></h1><p>Speculative decoding is only as good as its guesses. Three quantities decide how much real speedup you see: the <strong>acceptance rate</strong> <em><span>&#945;</span></em>, the <strong>expected accepted tokens per round</strong> <em><span>&#964;</span></em>, and the <strong>lookahead budget</strong> <em><span>K</span></em>.</p><h2><strong>4.1 Alpha (&#945;): how often guesses are accepted</strong></h2><p><strong>Alpha</strong> is the probability that any given drafted token survives verification. It is the single most important efficiency number, because rejected tokens are wasted work.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hduJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hduJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 424w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 848w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 1272w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hduJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png" width="1422" height="984" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:984,&quot;width&quot;:1422,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:118801,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81658932-8307-4ce3-9ed0-62374ba28623_1422x1320.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hduJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 424w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 848w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 1272w, https://substackcdn.com/image/fetch/$s_!hduJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd8d28e0-244f-49c6-ae25-f7e563be3026_1422x984.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Figure 8: The Role of Alpha (&#945;) in Speculative Execution. Alpha serves as the fundamental efficiency metric in speculative decoding, quantifying the rate at which the target model accepts drafted tokens. High &#945; values indicate strong distribution alignment and yield significant inference acceleration. Conversely, low &#945; values reflect computational waste, as misaligned draft tokens trigger early rejections and serial fallbacks.</p><p><span>When </span><em><span>&#945;</span></em><span> is high, the draft and target models "think alike," long runs of guesses get accepted, and you approach that ideal 150-cost case. When </span><em><span>&#945;</span></em><span> is low, you reject early and often, and most of your drafting effort goes in the bin.</span></p><h2><strong>4.2 Tau (&#964;): expected tokens per verification</strong></h2><p>So how many tokens do you actually commit per round, on average? If each of the <em><span>K</span></em> drafted tokens is independently accepted with probability <em><span>&#945;</span></em>, the expected number of accepted tokens per round is a geometric series:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tau = \\frac{1 - \\alpha^{\\,K+1}}{1 - \\alpha}&quot;,&quot;id&quot;:&quot;BNCDVMZAXO&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tIYX%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tIYX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 424w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 848w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 1272w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tIYX%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png" width="1659" height="834" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:834,&quot;width&quot;:1659,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:123699,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64f33fc0-994c-4caa-93a3-b8956a22c249_1659x1071.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tIYX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 424w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 848w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 1272w, https://substackcdn.com/image/fetch/$s_!tIYX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6e98c7d-3835-42e4-9a3c-45d92f8e2bbb_1659x834.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 9: With <span>K=5</span> as the lookahead budget for the number of draft tokens proposed during each validation step, the variable <span>&#945;</span> defines the independent probability that a draft token matches the target distribution, which determines <span>&#964;</span>, the estimated average of accepted tokens per round. Achieving a larger <span>&#964;</span> is beneficial because it reduces the frequency of costly target-model runs, directly lowering system latency.</em></p><p>The numbers tell the story. A weak drafter (<em><span>&#945;</span></em><span>=0.30</span>) commits only about 1.43 tokens per expensive pass, barely better than plain decoding. A strong drafter (<em><span>&#945;</span></em><span>=0.85</span>) commits about 4.15 tokens per pass, and that is where the real speedups come from. Acceptance compounds across slots, which is why the bars decay from left to right. To get slot 5 right, slots 1 through 4 all have to be right first.</p><h2><strong>4.3 Lookahead K (&#947;): how far to guess</strong></h2><p><em><span>K</span></em> (sometimes written <em><span>&#947;</span></em>) is how many tokens the draft model proposes before each verification. It is a balance, not a &#8220;bigger is better&#8221; dial.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p3rP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p3rP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 424w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 848w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 1272w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p3rP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png" width="1665" height="780" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:780,&quot;width&quot;:1665,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124263,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbde855f-5619-4368-8bf7-adb302cd0585_1665x978.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!p3rP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 424w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 848w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 1272w, https://substackcdn.com/image/fetch/$s_!p3rP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27e6ad31-62a3-495f-a676-66b60a95d41a_1665x780.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 10: The parameter <span>K</span> determines the number of tokens drafted per step. A value too small limits speedup, while a value too large wastes compute on discarded tokens. To maximize efficiency, optimal systems dynamically tune <span>K</span> based on the token acceptance rate.</em></p><p><span>If </span><em><span>K</span></em><span> is too small, you verify too often and leave easy speedup unclaimed. If </span><em><span>K</span></em><span> is too large, you draft far past the first inevitable mismatch and burn compute on tokens you will only throw away. The sweet spot depends on </span><em><span>&#945;</span></em><span>: confident drafters can afford a deeper lookahead.</span></p><h2><strong>4.4 Adaptive K: tune the lookahead to the text</strong></h2><p>Since the ideal <em><span>K</span></em> depends on how predictable the upcoming text is, good systems do not fix it. They use an <strong>adaptive controller</strong> that reads the local difficulty of the stream, usually through the entropy <em><span>H</span></em><span>(</span><em><span>x</span></em><span>)</span> of the model&#8217;s distribution, and sets the lookahead to match.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;K_{\\text{opt}} = \\mathrm{clamp}\\big(f(H(x)),\\ K_{\\min},\\ K_{\\max}\\big)&quot;,&quot;id&quot;:&quot;ZDCIHHGBAF&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wV6K%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wV6K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 424w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 848w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 1272w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wV6K%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png" width="1224" height="687" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:687,&quot;width&quot;:1224,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81569,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b6615ac-eea0-4bc8-8e27-0de620a353be_1224x864.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wV6K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 424w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 848w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 1272w, https://substackcdn.com/image/fetch/$s_!wV6K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c1ed7b-9efc-4855-b644-cac7fbea1505_1224x687.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 11: Dynamic lookahead overcomes the limitations of a static K budget by adjusting draft length based on textual confidence, allowing farther drafts for easy text and shorter drafts for hard text, to minimize wasted compute and memory bandwidth.</em></p><p>On boilerplate or highly predictable text ("in the logs we found a critical error in the system"), the controller drafts far ahead, because the guesses will mostly be accepted. On genuinely uncertain text ("therefore the proof&#8230;"), it drafts cautiously, because deep guessing would just produce garbage to discard.</p><h1><strong>5. System realities and limitations</strong></h1><p>Speculative decoding looks like a clean win on paper. In a real serving system it comes with sharp edges worth knowing about before you reach for it.</p><h2><strong>5.1 The two models run in lockstep</strong></h2><p>The draft and target models do not work at the same time. They take turns. While the draft model is busy proposing, the expensive target model sits <strong>idle</strong>. While the target verifies, the draft model sits <strong>idle</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IZAh%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IZAh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 424w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 848w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 1272w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IZAh%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png" width="1456" height="651" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:651,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:85546,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IZAh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 424w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 848w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 1272w, https://substackcdn.com/image/fetch/$s_!IZAh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcabe059d-af89-43f3-9d87-cf024b6aa12e_1509x675.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 12: Speculative decoding's sequential workflow. In Phase 1, the large, expensive target model sits idle while the draft model generates its guesses one by one. In Phase 2, the bigger issue, drafting stops entirely while the draft model waits for the slow target model to finish its verification.</em></p><p>This back-and-forth is why naive implementations sometimes fall short of their theoretical speedup. There is real "bubble" time where one of the two models is doing nothing at all. </p><h2><strong>5.2 It only helps when the GPU has spare compute</strong></h2><p>Remember that the whole trick leans on <strong>spare compute</strong> (Section 1.4). That spare capacity exists at low batch sizes, when one or a few requests leave the GPU&#8217;s math units idle. At high batch sizes, many requests already saturate the GPU, and speculation&#8217;s extra drafting work just <em>steals</em> memory bandwidth away from useful generation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RAn-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RAn-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 424w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 848w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 1272w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RAn-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png" width="1626" height="953" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:953,&quot;width&quot;:1626,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:119105,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a7264b-d2ce-4d8e-905b-93dfce1b4561_1626x1191.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RAn-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 424w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 848w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 1272w, https://substackcdn.com/image/fetch/$s_!RAn-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef1188e6-ab3b-4092-8359-c51476c4bda2_1626x953.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 13: Because speculative decoding only reduces latency when GPUs have spare compute, and actively steals memory bandwidth under high load, modern serving engines dynamically toggle the feature based on real-time queue depth to maximize overall system throughput.</em></p><p>This is why production serving stacks treat speculation as a <strong>latency optimization for light load</strong>, switching it off automatically when the queue fills up and the system flips into throughput-maximizing mode.</p><h2><strong>5.3 Limitation 1: the tokenizers must match</strong></h2><p>Because verification compares the draft&#8217;s token against the target&#8217;s token, both models have to speak the <strong>exact same vocabulary</strong>. A draft model that splits &#8220;active&#8221; into <code>[act]</code> and <code>[-ive]</code> cannot be checked against a target that emits a single <code>[active]</code> token. The two sequences would never line up.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21K1IW%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K1IW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 424w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 848w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 1272w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21K1IW%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png" width="864" height="456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:456,&quot;width&quot;:864,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27447,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K1IW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 424w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 848w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 1272w, https://substackcdn.com/image/fetch/$s_!K1IW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbc8cf55-c328-4a02-8bff-24f15f5308fb_864x456.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 14: Limitation 1, tokenizer identity. The draft and target models must share an identical tokenizer and vocabulary; otherwise their token sequences cannot be aligned during verification.</em></p><p><span>In practice this means your draft model is usually a smaller member of the </span><em>same model family</em><span> as the target (say, a 7B drafting for a 70B with a shared tokenizer), which limits your options.</span></p><h2><strong>5.4 Limitation 2: you pay for a second model in VRAM</strong></h2><p>Speculative decoding puts two models on the GPU at once. The draft model is small, but it is not free, and the memory it takes up is memory you cannot hand to the KV cache or to bigger batches.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dUQC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dUQC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 424w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 848w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 1272w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dUQC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png" width="723" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:723,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27830,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dUQC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 424w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 848w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 1272w, https://substackcdn.com/image/fetch/$s_!dUQC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6bf4b1d-253e-4718-a838-0b2acb490c60_723x408.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 15: Limitation 2, dual-model VRAM overhead. Co-locating both models in VRAM (for example ~14 GB for a 7B draft plus ~140 GB for a 70B target) severely reduces the capacity left for KV caches and high batch sizes.</em></p><h2><strong>5.5 Limitation 3: rejection triggers a serial fallback</strong></h2><p>When a drafted token is rejected, every guess after it gets discarded and the system falls back to generating that step the slow way. On hard text, rejections come often, so you keep re-drafting and re-verifying, and the speedup for that step evaporates.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AJpv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AJpv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 424w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 848w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 1272w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AJpv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png" width="1080" height="711" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/deec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:711,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47372,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AJpv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 424w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 848w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 1272w, https://substackcdn.com/image/fetch/$s_!AJpv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeec9c1d-cfe5-4350-bce4-0d499fa58c8a_1080x711.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 16: Limitation 3, distribution alignment and the rejection loop. When the draft and target distributions diverge, proposals get rejected and discarded, and the system falls back to a serial re-drafting loop that erases the speedup for that step.</em></p><p><span>All three limitations point back to the same truth: speculative decoding is a </span><strong>bet</strong><span>. It pays off handsomely when the draft is well-aligned and the GPU has room to spare, and it quietly costs you when those conditions fail.</span></p><h1><strong>6. The landscape of methods</strong></h1><p>&#8220;Speculative decoding&#8221; is now a <em>family</em> of techniques, not a single algorithm. They differ mainly in <strong>where the draft tokens come from</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tdei%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tdei!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 424w, https://substackcdn.com/image/fetch/$s_!tdei!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 848w, https://substackcdn.com/image/fetch/$s_!tdei!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 1272w, https://substackcdn.com/image/fetch/$s_!tdei!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tdei%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png" width="1456" height="879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:879,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:123075,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tdei!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 424w, https://substackcdn.com/image/fetch/$s_!tdei!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 848w, https://substackcdn.com/image/fetch/$s_!tdei!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 1272w, https://substackcdn.com/image/fetch/$s_!tdei!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9630af9c-d9d7-4f13-866f-7b5eec598153_1596x963.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 17: A timeline of speculative decoding methods, including the separate vanilla draft model, model-free n-gram lookup, and single-model multi-head drafting (Medusa).</em></p><p>I will focus on the three most foundational and widely used approaches:</p><ol><li><p><strong>Vanilla draft-target</strong> (Section 2): two separate models, where the draft proposes and the target verifies. This is the classic formulation.</p></li><li><p><strong>N-gram prompt lookup</strong> (6.1): no draft model at all. The drafts are copied from repeated text in the prompt.</p></li><li><p><strong>Medusa</strong> (6.2): a single model grows extra heads that predict several future tokens at once.</p></li></ol><p><span>The figure also shows </span><strong>Eagle</strong><span> (feature-level tree drafting), </span><strong>self-speculation</strong><span> (drafting by skipping the target's own middle layers), and </span><strong>streaming overlap</strong><span> (pipelining draft and verify). I introduce the core idea behind </span><strong>EAGLE</strong><span> in 6.3, because it is the method that now dominates production serving; its tree-based refinements (EAGLE-2/EAGLE-3), self-speculation, and streaming overlap are more advanced and belong to a future post.</span></p><h2><strong>6.1 Deep dive: n-gram prompt lookup</strong></h2><p>The simplest drafter is <strong>no model at all</strong>. In a lot of real tasks (summarization, document Q&amp;A, code editing, retrieval-augmented generation) the output copies long spans verbatim from the input. <strong><a href="iframe.php?url=https%3A%2F%2Fgithub.com%2Fapoorvumang%2Fprompt-lookup-decoding">Prompt Lookup Decoding</a></strong> (Saxena, 2023) takes advantage of this directly.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lUh0%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lUh0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 424w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 848w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 1272w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lUh0%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png" width="1456" height="1088" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1088,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:83162,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lUh0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 424w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 848w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 1272w, https://substackcdn.com/image/fetch/$s_!lUh0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87070b82-9610-426f-b7d1-3f042644464d_1578x1179.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 18: N-gram prompt lookup. Instead of a neural drafter, the system scans the past context for a repeat of the most recent n-gram suffix and proposes the tokens that followed it last time. The target model verifies these guesses in a single pass. This is model-free and adds zero VRAM, but its hit rate falls on creative, non-repetitive text.</em></p><p>The mechanism is just <strong>string matching</strong>:</p><ol><li><p>Take the last few generated tokens (the active n-gram suffix, say <code>if key in</code>).</p></li><li><p><strong>Scan backward</strong> through the prompt and prior output for an earlier occurrence of that same n-gram.</p></li><li><p>If you find one, propose the tokens that followed it last time (<code>cache: return</code>) as the draft.</p></li><li><p>Verify those proposals with the target model exactly as before.</p></li></ol><p><span>Because no neural network is involved in drafting, this approach uses </span><strong>zero extra VRAM</strong><span>, which sidesteps Limitation 2 completely, and it works with any decoder model out of the box. The trade-off is that its hit rate is only as good as the repetition in your text. It shines on structured, input-grounded generation (2&#8211;4&#215; speedups are common) and does almost nothing for open-ended creative writing.</span></p><h2><strong>6.2 Deep dive: Medusa</strong></h2><p><strong><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2401.10774">Medusa</a></strong> (Cai et al., 2024) takes a different route. Instead of a <em>separate</em> draft model, it bolts <strong>extra decoding heads</strong> onto the target model itself. One backbone pass produces several future-token predictions at once, and they all get verified together. No second model, no separate tokenizer to babysit.</p><h3><strong>Multiple heads predict multiple positions</strong></h3><p>A normal LLM has one &#8220;LM head&#8221; that predicts the very next token (position +1). Medusa adds extra heads on top: head 1 predicts position +2, head 2 predicts +3, head 3 predicts +4. All of them read from the <strong>same backbone hidden state</strong>, computed in a single forward pass.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21_5gP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_5gP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 424w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 848w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 1272w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21_5gP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png" width="1044" height="549" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:549,&quot;width&quot;:1044,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44182,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_5gP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 424w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 848w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 1272w, https://substackcdn.com/image/fetch/$s_!_5gP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf99fac2-7b93-4d11-928c-0ff1f5957cfb_1044x549.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 19: Medusa augments a model with extra decoding heads. After the backbone runs once, the original LM head predicts the next position while each added Medusa head predicts a position further out, and each head keeps its top-2 candidates.</em></p><p><span>Because each head keeps its </span><strong>top-2</strong><span> candidates, the heads together describe many possible continuations, not just one. That branching is handled by a tree.</span></p><h3><strong>Tree attention verifies many candidates at once</strong></h3><p>With each head offering 2 candidates, the continuations form a small <strong>tree</strong>. Two heads give <span>2&#215;2=4</span> candidate paths, and a third head would give 8. Medusa packs all these paths into a single sequence and uses a specially shaped <strong>tree attention mask</strong>, so each candidate token only attends to its own ancestors. The branches stay logically separate even though they ride through one shared forward pass.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gUbr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gUbr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 424w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 848w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 1272w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gUbr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png" width="1456" height="624" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:624,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33230,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gUbr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 424w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 848w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 1272w, https://substackcdn.com/image/fetch/$s_!gUbr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dcf598d-612b-4580-9b74-7953cf40101c_1464x627.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 20: Medusa&#8217;s candidate tree and tree-attention mask. The top-2 outputs of each head combine into multiple candidate paths (top-2 &#215; top-2 = 4, or 8 with a third head). The attention mask ensures each row attends only to its ancestors and itself, so independent branches do not contaminate each other.</em></p><p><span>Here is the payoff. All of these candidate paths get checked in </span><strong>one backbone pass</strong><span>. The target verifies the whole tree at once and commits the longest path that survives, and that committed path immediately seeds the next tree.</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21LX_Y%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LX_Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 424w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 848w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 1272w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21LX_Y%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png" width="744" height="633" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6c792ad8-f667-420a-984b-95e6641194a5_744x633.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:633,&quot;width&quot;:744,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34724,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LX_Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 424w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 848w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 1272w, https://substackcdn.com/image/fetch/$s_!LX_Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c792ad8-f667-420a-984b-95e6641194a5_744x633.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 21: A single backbone pass with tree attention verifies every candidate path at once. Here the path "returned &#183; the &#183; cached" is accepted, 3 tokens committed in one pass, and it seeds the next round's tree.</em></p><h3><strong>Two training recipes: Medusa-1 vs Medusa-2</strong></h3><p>How you train those heads decides the trade-off between quality and speed.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215jaT%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5jaT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 424w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 848w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 1272w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215jaT%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png" width="1456" height="1098" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1098,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:113092,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5jaT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 424w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 848w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 1272w, https://substackcdn.com/image/fetch/$s_!5jaT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c114036-114c-4a1c-9782-370a5790af60_1587x1197.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 22: Medusa's two training procedures. In Medusa-1 the backbone is frozen and only the heads are trained, so accepted tokens match the original model exactly (lossless). In Medusa-2 the backbone is fine-tuned alongside the heads using a careful recipe (a combined loss, split learning rates, and warming up the heads first), which yields more accurate heads and higher speedup while keeping quality intact.</em></p><ul><li><p><strong>Medusa-1</strong> freezes the backbone and trains only the heads. Since the backbone is never touched, the verified output is <strong>lossless</strong>, identical to the original model. It is cheap to train (one GPU) and a safe default.</p></li><li><p><strong>Medusa-2</strong> fine-tunes the backbone and heads together. This makes the heads more accurate, so more tokens are accepted per step, but it risks degrading the base model, which is why it needs the careful recipe shown above.</p></li></ul><p>The lever that connects training to speed is simple:</p><p><strong>better heads &#8594; more tokens accepted per step &#8594; higher speedup</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216RIV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6RIV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 424w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 848w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 1272w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216RIV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png" width="1456" height="1126" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1126,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:112817,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6RIV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 424w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 848w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 1272w, https://substackcdn.com/image/fetch/$s_!6RIV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22adaf3e-11d7-4e63-8010-0a3e3b4d111d_1560x1206.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 23: Why Medusa-2 is faster comes down to one lever, head accuracy. More accurate heads get more tokens accepted, which means more tokens per step and higher speedup. Numbers from Cai et al. (2024), Vicuna-7B on MT-Bench, both variants trained on the same ShareGPT data for 2 epochs.</em></p><h2><strong>6.3 EAGLE: drafting features, not tokens</strong></h2><p>Everything so far, vanilla draft-target, n-gram lookup, Medusa, shares one habit: the drafter guesses <strong>raw tokens</strong>, and verification compares those exact tokens against the target&#8217;s. That is fine on predictable text. It falls apart exactly where language is hardest.</p><h3><strong>Why token-level guessing stalls</strong></h3><p>Recall from Section 4 that speedup lives and dies by the acceptance rate <em><span>&#945;</span></em>. The trouble is that <em><span>&#945;</span></em> is not a constant, it collapses in <strong>high-entropy</strong> contexts, the moments where many different next tokens are all reasonable.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hsbC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hsbC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 424w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 848w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 1272w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hsbC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png" width="1456" height="731" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8027f409-cefb-4a43-92b4-084555170b94_1578x792.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:731,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55216,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hsbC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 424w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 848w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 1272w, https://substackcdn.com/image/fetch/$s_!hsbC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8027f409-cefb-4a43-92b4-084555170b94_1578x792.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 24: In a high-entropy context, several next tokens are plausible at once. The target's distribution <span>p</span> favours "the" while the smaller draft's <span>q</span> favours "a". Because verification accepts only up to the first token-level mismatch, this single disagreement rejects the draft early and cuts the accepted prefix short.</em></p><p><span>Look at what happens. The target model spreads its probability </span><em><span>p</span></em><span> across </span><code>returned</code><span>, </span><code>caused</code><span>, </span><code>the</code><span>, and more, landing on </span><strong>"the"</strong><span>. The little draft model, working with a coarser view of the world, puts its mass </span><em><span>q</span></em><span> on </span><strong>"a"</strong><span>. Neither is "wrong", both are grammatical, but the </span><em>exact-token</em><span> verifier does not care about that. The first token-level mismatch ends the accepted run right there.</span></p><p><span>The cost compounds through the same geometry seen in Section 4. If entropy pushes per-token acceptance down to, say, &#945;=0.4, then with a lookahead of </span><em><span>K</span></em><span>=5:</span></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tau = \\frac{1 - \\alpha^{\\,K+1}}{1 - \\alpha} = \\frac{1 - 0.4^{6}}{1 - 0.4} \\approx 1.66&quot;,&quot;id&quot;:&quot;REUNNHJDSS&quot;}" data-component-name="LatexBlockToDOM"></div><p>Barely more than one token committed per expensive verification pass. <strong><span>The more the draft's distribution diverges from the target's, the shorter the accepted prefix, and the smaller the real speedup.</span></strong> Guessing the <em><span>exact word</span></em> is simply too brittle a target when many words are plausible.</p><h3><strong>EAGLE&#8217;s fix: predict the feature, not the word</strong></h3><p><strong><a href="iframe.php?url=https%3A%2F%2Fgithub.com%2FSafeAILab%2FEAGLE">EAGLE</a></strong> (Li et al.) makes one deceptively simple change. Instead of training the drafter to predict the next <strong>token</strong>, it trains a lightweight module to predict the target model&#8217;s next <strong>feature</strong>, the hidden state from the layer just below the LM head. Features are continuous, smooth, and far more predictable than the discrete lottery of exact tokens, so the drafter agrees with the target much more often.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21c3lG%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c3lG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 424w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 848w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 1272w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21c3lG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png" width="1456" height="998" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:998,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:165197,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c3lG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 424w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 848w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 1272w, https://substackcdn.com/image/fetch/$s_!c3lG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbd4d33c-efe7-4fc8-b484-00538a028525_1659x1137.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 25: EAGLE drafts at the feature level. It takes the target's own hidden feature (Layer N&#8722;1 output) plus the embedding of the token that actually followed, concatenates them, and runs a tiny autoregressive head (one FC layer + one decoder layer) to predict the next feature. That predicted feature loops back in as the next input, and is also decoded to a draft token through the frozen target LM head. The target model itself is never modified.</em></p><p>Read the pipeline left to right:</p><ol><li><p><strong>Reuse the target&#8217;s features (left).</strong> The target model is <strong>frozen</strong>. EAGLE taps the hidden state from its second-to-last layer, the &#8220;feature&#8221; that summarises everything the model knows right after the word <code>is</code>. Nothing about the big model changes.</p></li><li><p><strong>Anchor each guess with the real next word (middle).</strong> EAGLE feeds the drafter the feature <em>and</em> the embedding of the token that actually came next (<code>is</code> &#8594; <code>blue</code>). That next word is what tells the drafter <strong>which branch of reality actually happened</strong> (<code>blue</code>, not <code>falling</code>), so its predictions stay grounded instead of drifting.</p></li><li><p><strong>Autoregress on features (right).</strong> A tiny head, one fully-connected layer plus a single decoder layer, takes the concatenation <span>[featis&#8201;;&#8201;emb(blue)] </span>and predicts the <strong>next feature</strong>. That predicted feature loops straight back in as the input for the following step (this is the autoregressive part), and in parallel it is pushed through the <strong>frozen target LM head</strong> to read off an actual draft token (<code>today</code>).</p></li></ol><p><span>Because the drafter learned to imitate the target's own internal trajectory, its proposals line up with what the target would have produced, so acceptance climbs and </span><em><span>&#964;</span></em><span> with it. And crucially, since draft tokens are still decoded through the target's real LM head and verified the usual way, EAGLE keeps the </span><strong>exactness guarantee</strong><span> from Section 3 intact. The feature trick buys speed, never correctness.</span></p><div class="pullquote"><p><em><span>EAGLE stops guessing the </span><strong>exact word</strong><span> and starts predicting the target's own </span><strong>internal feature</strong><span>. Smoother targets are easier to hit, so acceptance &#945; rises, and &#945; is the very quantity that governs speedup.</span></em></p></div><blockquote><p><strong>From theory to deployment.<span> EAGLE's descendant, </span>EAGLE3<span>, is exactly what I deploy in Section 7 of this post, on a real Llama-3.1-8B with vLLM. If you want the flags, benchmarks, and measured numbers, jump to 7.</span></strong></p></blockquote><h2><strong>6.4 The production reality: where the speedup goes</strong></h2><p>The clean <span>1150</span>-vs-<span>500</span> arithmetic from Section 2 is the <em>theoretical</em> story. On a real serving stack, two things bend those numbers: fixed per-step <strong>system overheads</strong>, and the <strong>batch size</strong> the GPU is running at. This section is the honest accounting.</p><h3><strong>Ideal vs measured: the system tax</strong></h3><p>Even in the friendliest case, a single request at batch 1 with every drafted token accepted, you do not get the speedup the token math promises. Real engines pay fixed costs the idealized picture ignores.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EfHv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EfHv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 424w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 848w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 1272w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EfHv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png" width="1456" height="741" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db39dde8-4c20-4259-8700-514430242ad8_1662x846.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:741,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49024,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EfHv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 424w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 848w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 1272w, https://substackcdn.com/image/fetch/$s_!EfHv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb39dde8-4c20-4259-8700-514430242ad8_1662x846.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 26: The gap between the paper speedup and the measured one, at batch 1. The theoretical ideal (left) accepts all four drafted tokens for a 2.5&#215; win. The production timeline (right) inserts real per-step costs, kernel-launch overhead and KV-cache lookups, that the token arithmetic never counted, dragging the effective speedup down to roughly 1.8&#215;. (Illustrative numbers.)</em></p><p><span>The extra blocks on the right, kernel-launch overhead and KV-cache lookup, are the "system tax." They are largely </span><strong>fixed per step</strong><span>, so they do not shrink just because your draft was good. A 2.5&#215; algorithm becomes a 1.8&#215; system. This is why a speedup you can </span><em>prove</em><span> on your own hardware is worth more than any number on a slide.</span></p><div class="pullquote"><p><em><span>The token math sets the </span><strong>ceiling</strong><span>. Fixed per-step overheads, kernel launches, cache lookups, scheduling, set the </span><strong>floor</strong><span>. The speedup you actually ship lives in between, and only a benchmark tells you where.</span></em></p></div><h3><strong>Batch size decides everything</strong></h3><p>Section 5.2 made the claim that speculation only helps when the GPU has spare compute. Here is the mechanism, drawn out across the two regimes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MRvq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MRvq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 424w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 848w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 1272w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MRvq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png" width="1456" height="840" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:840,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:83695,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MRvq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 424w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 848w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 1272w, https://substackcdn.com/image/fetch/$s_!MRvq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddfa4dc1-b9a7-4c8b-9f17-12d9218fd859_1617x933.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 27: The same speculative machinery in two regimes. At batch 1 (latency-bound) the GPU is mostly idle, so the draft model's extra work hides inside that idle time and verification is nearly free, this is where speculation shines. At batch 128 (throughput-bound) the GPU is already saturated, drafting kernels serialize and compete for bandwidth, and the step is held hostage by its slowest request (the straggler effect), leaving effective speedup somewhere between &#8722;5% and +10%.</em></p><p>The two lanes could not be more different:</p><ul><li><p><strong>Lane 1, batch 1 (latency-bound).</strong> The compute engine sits mostly idle waiting on memory. Drafting slots into that idle time for free, and verification overlaps without adding wall-clock. Spare compute is exactly the currency speculation spends, and here it is abundant.</p></li><li><p><strong>Lane 2, batch 128 (throughput-bound).</strong> Now 128 requests already saturate compute and memory bandwidth. Every extra drafting kernel is no longer free, it <em>serializes</em> and steals bandwidth from useful generation. Worse, a batched step only finishes when its <strong>slowest</strong> member finishes, so one request that rejects and re-drafts (the <strong>straggler</strong>) stalls the whole batch. Net effect: anywhere from a small loss to a modest gain.</p></li></ul><p><span>This is precisely why production stacks toggle speculation </span><strong>on at light load and off under saturation</strong><span>, the dynamic switch introduced in Section 5.2.</span></p><h3><strong>Following one decoding step&#8217;s clock</strong></h3><p>One more view makes the batch-size story concrete: take a single full decoding step, call it 100% of its wall-clock time, and watch how that time redistributes as the batch grows.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Y4o7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y4o7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 424w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 848w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Y4o7%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png" width="1456" height="916" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:916,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:91686,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Y4o7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 424w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 848w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!Y4o7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F297cfb18-db7d-4703-9077-078d70ad9ab4_1650x1038.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 28: The composition of one decoding step's wall-clock time at three batch sizes. As the batch grows from 1 to 128, target verification's share climbs (52% &#8594; 63% &#8594; 74%) while the draft model's share shrinks (24% &#8594; 17% &#8594; 10%). (Illustrative numbers.)</em></p><p>The trend is the whole point. At batch 1, the draft forward pass is a real slice of the step (24%), so making it cheap or making its guesses land pays off handsomely. By batch 128, verification dominates (74%) and drafting is a rounding error (10%). <strong><span>As the batch grows, verification eats the step and the draft&#8217;s share collapses, so the headroom speculation can possibly recover shrinks right along with it.</span></strong></p><div class="pullquote"><p><em><span>Speculative decoding is fundamentally a </span><strong>low-load latency optimization</strong><span>. Its win is largest exactly where the GPU has idle compute to burn, and it fades as batching fills that idle time with real work.</span></em></p></div><h1><strong>7. Putting it in production: EAGLE3 on vLLM</strong></h1><p>Everything above was the idea. Now I run it. I deploy the method that won production, <strong>EAGLE3</strong>, on <strong>vLLM</strong>, serving <strong>Llama-3.1-8B</strong> on a single 48 GB GPU, and measure the speedup against a real baseline. Same model, same prompts, one flag flipped.</p><p></p><p><em><strong>This half is also a notebook.<span> Every command below is a runnable cell in the companion </span>vLLM notebook<span>. </span></strong></em></p><p>Code Repo</p><p><a href="iframe.php?url=https%3A%2F%2Fgithub.com%2FMayankpratapsingh022%2FLLM-Inference-Playbook">https://github.com/Mayankpratapsingh022/LLM-Inference-Playbook</a></p><p><em><strong><span>The subsection numbers (7.1, 7.4 and so on) match the notebook, so you can read a part here and run the same thing there. Spin up the pod from 7.2, upload the notebook into the pod's JupyterLab, and step through it cell by cell while you read along. I tried hard to make it as simple as it can possibly be: open it, run each cell, and read the numbers off.</span></strong></em></p><p><span>I use an 8B target on one affordable card so you can reproduce it for about a dollar. Fair warning, and it is the honest point of 7.7: on this small-model, single-GPU setup the speedup did </span><strong>not</strong><span> materialize, and that section explains exactly why.</span></p><h2><strong>7.1 What we are building</strong></h2><p>The experiment is deliberately simple to reason about:</p><ul><li><p><strong>Target model:</strong> <code>meta-llama/Llama-3.1-8B-Instruct</code>.</p></li><li><p><strong>Hardware:</strong> a single 48 GB RunPod GPU (an A40, L40S, RTX 6000 Ada, or A6000). One card is plenty, see the memory note in 7.2.</p></li><li><p><strong>Engine:</strong> <strong>vLLM</strong>, the most widely deployed open inference server.</p></li><li><p><strong>Method:</strong> <strong>EAGLE3</strong>, the current state-of-the-art (7.3 explains why I don&#8217;t bother with the rest).</p></li><li><p><strong>What we toggle:</strong> a <strong>baseline</strong> run with plain autoregressive decoding, then the <em>same</em> model with <strong>EAGLE3</strong> turned on. That&#8217;s the whole A/B.</p></li><li><p><strong>Workload:</strong> chat traffic (ShareGPT-style), which is decode-heavy and the most common production shape.</p></li><li><p><strong>What we measure:</strong> output throughput, acceptance length, latency percentiles, and cost per million tokens.</p></li></ul><h2><strong>7.2 Renting the server on RunPod</strong></h2><p><strong><a href="iframe.php?url=https%3A%2F%2Fwww.runpod.io%2F">RunPod</a></strong> rents GPU pods by the minute, which makes it ideal for a benchmark you will tear down afterward.</p><p>You can use any service, maybe <a href="iframe.php?url=https%3A%2F%2Fmassedcompute.com%2F">Massedcompute</a> or my personal favourite <a href="iframe.php?url=https%3A%2F%2Fmodal.com%2F">Modal</a>.</p><p>Before you start the clock, here is roughly how long the whole experiment takes on a single 48 GB card, running baseline vs EAGLE3 on vLLM. <strong>Plan for about 45 to 60 minutes end to end.</strong> A single 48 GB GPU on RunPod runs about $0.40 to $0.90 per hour, so the whole run costs roughly <strong>$1</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nByC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nByC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 424w, https://substackcdn.com/image/fetch/$s_!nByC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 848w, https://substackcdn.com/image/fetch/$s_!nByC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 1272w, https://substackcdn.com/image/fetch/$s_!nByC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nByC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png" width="2306" height="1269" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1269,&quot;width&quot;:2306,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:319638,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd823388a-9f6c-4d74-869b-ac30de06cf68_2306x1498.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nByC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 424w, https://substackcdn.com/image/fetch/$s_!nByC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 848w, https://substackcdn.com/image/fetch/$s_!nByC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 1272w, https://substackcdn.com/image/fetch/$s_!nByC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4b697e3-0b54-4d57-a2b1-41c5a9c43c11_2306x1269.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><span>The weights download only once and live on the </span><code>/workspace</code><span> persistent volume, so if you come back later that day you skip the ~10-minute download. Your two biggest sources of variance are HuggingFace download speed and whether you benchmark at </span><code>--request-rate inf</code><span> (fast) or a finite rate (slower).</span></p><h3><strong>A memory reality check (read this first)</strong></h3><p>Llama-3.1-8B in <code>bf16</code> is about <strong>16 GB of weights</strong>. Add the KV cache, activations, CUDA graphs, and the small EAGLE3 draft head (only a percent or two of the base model), and the whole thing still sits well under <strong>48 GB</strong>. That means one card does the job, with no tensor parallelism and no quantization to fuss over.</p><p>Any of these single 48 GB GPUs on RunPod work:</p><ul><li><p><strong>A40 (48 GB)</strong> is the cheapest option and the one this guide assumes by default.</p></li><li><p><strong>L40S, RTX 6000 Ada, or A6000 (48 GB)</strong> all work too and are a bit faster; pick whichever is available and affordable.</p></li></ul><div class="pullquote"><p><em><span>8B in </span></em><code>bf16</code><em><span> is a </span><strong>single-GPU</strong><span> job. One 48 GB card holds the weights, the KV cache, and the EAGLE3 head at once, so every command below uses </span></em><code>-tp 1</code><em><span> and no quantization.</span></em></p></div><p><span>The commands in this guide all use </span><code>-tp 1</code><span> (a single card). If you happen to be on a smaller 24 GB GPU like a 4090 or L4, add </span><code>--quantization fp8</code><span> to fit, at a small quality cost.</span></p><h3>Spin up the pod</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nBMR%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nBMR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 424w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 848w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 1272w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nBMR%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif" width="1000" height="563" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:563,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2928734,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nBMR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 424w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 848w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 1272w, https://substackcdn.com/image/fetch/$s_!nBMR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bbfd973-1197-4d07-a7e1-5c27d9392920_1000x563.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>RunPod pod configuration. Pick a single 48 GB card (A40 by default, or L40S / RTX 6000 Ada / A6000) with the GPU count set to 1. Then choose a recent CUDA/PyTorch template, a large enough container disk, a persistent volume for the model weights, and an exposed HTTP port for the inference server.</em></p><ol><li><p>In the RunPod console, go to <strong>Pods &#8594; Deploy</strong>, select a <strong>48 GB GPU</strong> (an <strong>A40</strong> by default, or an L40S / RTX 6000 Ada / A6000), and leave the GPU count at <strong>1</strong>. As the memory check above explains, 8B fits on one card, so there is no tensor parallelism to set up.</p></li><li><p>Choose a recent <strong>PyTorch / CUDA</strong> template (or a vLLM template from the RunPod Hub).</p></li><li><p>Give it a <strong>persistent volume</strong> of ~60 GB mounted at <code>/workspace</code> so the 8B weights survive a restart, and set container disk to ~40 GB.</p></li><li><p>Under <strong>Expose HTTP Ports</strong>, add <code>8000</code> (vLLM&#8217;s default).</p></li><li><p>Deploy, then connect via the <strong>web terminal</strong> or <strong>SSH</strong>.</p></li></ol><h3><strong>One-time setup inside the pod</strong></h3><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;c394d995-5e34-462a-b4e0-14c558af339d&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python"># Hugging Face access (Llama is a gated model, so accept the license on HF first)
pip install -U "huggingface_hub[cli]"
huggingface-cli login   # paste your HF token

# Keep all downloads on the persistent volume
export HF_HOME=/workspace/hf
mkdir -p "$HF_HOME"</code></pre></div><p>Now you are ready to install an engine and serve the model.</p><h2><strong>7.3 Why EAGLE3 is the one to deploy</strong></h2><p>The theory above introduced a whole family of speculative decoding methods. In production today, <strong>EAGLE3</strong> is the default choice, and the others are mostly of historical or niche interest. Here is the honest comparison so you know <em>why</em> we are skipping them rather than just being told to.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21so5_%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!so5_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 424w, https://substackcdn.com/image/fetch/$s_!so5_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 848w, https://substackcdn.com/image/fetch/$s_!so5_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 1272w, https://substackcdn.com/image/fetch/$s_!so5_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21so5_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png" width="2623" height="1175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1175,&quot;width&quot;:2623,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:404610,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8fbbd6a-d894-4c94-8fec-16b10ebe0416_2623x1535.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!so5_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 424w, https://substackcdn.com/image/fetch/$s_!so5_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 848w, https://substackcdn.com/image/fetch/$s_!so5_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 1272w, https://substackcdn.com/image/fetch/$s_!so5_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9fef607c-efda-4b66-af44-43d9aed7cf50_2623x1175.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>EAGLE3</strong><span> wins on every axis that matters in production. It reaches the </span><strong>highest acceptance rates</strong><span>, so you get the most tokens per verification pass. It costs almost </span><strong>no extra VRAM</strong><span>, because it&#8217;s a small head rather than a second model. It has </span><strong>no tokenizer-matching problem</strong><span>. And, best of all for our purposes, </span><strong>pre-trained EAGLE3 heads are published</strong><span> for popular targets including Llama-3.1-8B, so there is nothing to train. Reported speedups reach roughly </span><strong>2.4&#215;</strong><span> on 8B (and up to </span><strong>~4&#215;</strong><span> on larger models) without changing the output.</span></p><h3><strong>What a &#8220;pre-trained EAGLE3 head&#8221; actually is</strong></h3><p>Every command in this guide points at two model names: the <strong>target</strong> I serve, and a <strong>draft head</strong>. It&#8217;s worth being clear about what that second name is, because it looks like a model but behaves very differently.</p><p><span>A draft head is a small checkpoint hosted on Hugging Face, named in the usual </span><code>owner/name</code><span> form.</span></p><p>Three things follow from that name, and they are the whole reason EAGLE3 is easy to deploy:</p><ul><li><p><strong>It is tiny, not a second model.</strong> The head is only a percent or two of the target&#8217;s size. It&#8217;s the <em>guesser</em>, and the engine downloads it and bolts it onto the frozen target for you. That&#8217;s why speculation here costs almost no extra VRAM.</p></li><li><p><strong>It is tied to one specific target.</strong> An EAGLE3 head is trained against a single model and only works with that model, because it learned to predict <em>that</em> model&#8217;s internal features. <code>EAGLE3-LLaMA3.1-Instruct-8B</code> works with Llama-3.1-8B and nothing else. This is exactly why, when this guide moved from a 70B target to 8B, the draft head had to change too.</p></li><li><p><strong>&#8220;Pre-trained&#8221; means you skip the hard part.</strong> Someone already trained this head and published it, so you just reference it by name. If no head existed for your model, you would train one yourself (the <strong><a href="iframe.php?url=https%3A%2F%2Fgithub.com%2FSafeAILab%2FEAGLE">EAGLE</a></strong> repo has recipes), but for Llama-3.1-8B one already ships, so there is nothing to do but point at it.</p></li></ul><div class="pullquote"><p><em><span>I deploy </span><strong>exactly one technique: EAGLE3</strong><span>. It is the current state of the art for production speculative decoding, and pre-trained heads exist for the model I'm using, so there is nothing to train.</span></em></p></div><h3><strong>The workflow I&#8217;ll follow</strong></h3><p>I deploy on vLLM (7.4) and follow one simple loop so the comparison is honest:</p><ol><li><p><strong>Deploy the model </strong><em><strong>without</strong></em><strong> speculation</strong> and benchmark it. This is your <strong>reference</strong>: the plain tokens/sec and latency of the model as-is. (7.4 to deploy, 7.6 to benchmark.)</p></li><li><p><strong>Re-deploy </strong><em><strong>with</strong></em><strong> EAGLE3</strong> and run the <em>identical</em> benchmark. (7.4.)</p></li><li><p><strong>Compare.</strong> The ratio of step-2 throughput to step-1 throughput is your speedup; the acceptance length tells you whether EAGLE3 is actually working. (7.7.)</p></li></ol><div class="pullquote"><p><em><span>The golden rule of this whole page: </span><strong>measure the baseline first.</strong><span> A "2.5&#215; speedup" only means something against a number you actually recorded on </span>your<span> hardware, with the same model, prompts, and benchmark.</span></em></p></div><h2><strong>7.4 vLLM implementation</strong></h2><p>Install vLLM:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;46d36f42-4f7c-4e68-b53a-35dce2050eb0&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">pip install -U vllm</code></pre></div><p>vLLM enables speculation through a single <code>--speculative-config</code> JSON blob (offline, the equivalent <code>speculative_config={...}</code> dict). Everything else about serving stays the same.</p><h3><strong>Baseline (no speculation)</strong></h3><p><span>This is the run every speedup is measured against. </span><strong>Deploy it and benchmark it first</strong><span> (7.6) before you touch EAGLE3.</span></p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;f226379a-0a55-4d52-91e7-d619c93c3e04&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">VLLM_USE_V1=1 vllm serve meta-llama/Llama-3.1-8B-Instruct \
  --seed 42 \
  -tp 1 \
  --gpu-memory-utilization 0.90</code></pre></div><p><span>The server exposes an OpenAI-compatible API at </span></p><p><code>http://localhost:8000/v1</code><span>.</span></p><h3><strong>Turning on EAGLE3</strong></h3><p>Now the same model, same flags, plus one <code>--speculative-config</code>. EAGLE3 attaches a small draft head that reuses the target model&#8217;s internal features:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;b4cb3eae-8149-4e06-8052-92fd018fa4de&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">VLLM_USE_V1=1 vllm serve meta-llama/Llama-3.1-8B-Instruct \
  --seed 42 \
  -tp 1 \
  --speculative-config '{"model": "yuhuili/EAGLE3-LLaMA3.1-Instruct-8B", "num_speculative_tokens": 3, "method": "eagle3"}'</code></pre></div><p>Each field in that JSON maps to a speculative-decoding idea:</p><ul><li><p><code>method: "eagle3"</code> picks the drafting algorithm. It tells vLLM the draft head predicts the target&#8217;s internal <em>features</em> instead of raw tokens (the EAGLE idea from 6.3), which is what pushes acceptance so high.</p></li><li><p><code>model</code> is the pre-trained EAGLE3 draft head, the small network that does the guessing. The target model is never touched.</p></li><li><p><code>num_speculative_tokens: 3</code> is how many tokens the head drafts ahead before the target verifies them. This is the lookahead <code>K</code> from 4, and it is the one dial you actually tune. Bigger is not automatically better: acceptance compounds, so each extra drafted token lands less often. Red Hat measured acceptance dropping off past two or three tokens on 8B (about 45% at 2 drafts, down to 28% at 4), so three is the sweet spot.</p></li></ul><p>vLLM keeps this simple: you set how far to draft with this one number, and it sizes the draft tree (its depth, branching, and per-pass token budget) for you internally.</p><p>Two practical notes:</p><ul><li><p>On a single card there is nothing to shard, so the draft head runs alongside the target on the same GPU. On a multi-GPU box you would add <code>"draft_tensor_parallel_size": 1</code> to keep the tiny head on one card.</p></li><li><p>An alternative draft checkpoint is <code>RedHatAI/Llama-3.1-8B-Instruct-speculator.eagle3</code>.</p></li></ul><p>Benchmark this exactly as you benchmarked the baseline (7.6), then compare.</p><h3><strong>Offline (Python) equivalent</strong></h3><p>If you would rather drive vLLM from Python instead of the server, the same config is a dict:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;677a1feb-aaa8-4176-8805-4bba4ef85d41&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">from vllm import LLM, SamplingParams

llm = LLM(
    model="meta-llama/Llama-3.1-8B-Instruct",
    tensor_parallel_size=1,
    speculative_config={
        "method": "eagle3",
        "model": "yuhuili/EAGLE3-LLaMA3.1-Instruct-8B",
        "num_speculative_tokens": 3,
    },
)

out = llm.generate(
    ["Explain speculative decoding in one paragraph."],
    SamplingParams(temperature=0, max_tokens=256),
)
print(out[0].outputs[0].text)</code></pre></div><div class="callout-block" data-callout="true"><p><em><strong><span>On a smaller 24 GB card (a 4090 or L4), add </span></strong></em><code>quantization="fp8"</code><em><strong><span> (Python) or </span></strong></em><code>--quantization fp8</code><em><strong><span> (CLI) to fit; </span></strong></em><code>-tp 1</code><em><strong><span> stays the same.</span></strong></em></p></div><h3><strong>Smoke test</strong></h3><p>Check the server is answering before you benchmark it:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;90fbc38b-e553-4816-aa81-50f86c120f4c&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import openai

client = openai.Client(base_url="iframe.php?url=http%3A%2F%2F127.0.0.1%3A8000%2Fv1", api_key="None")
resp = client.chat.completions.create(
    model="meta-llama/Llama-3.1-8B-Instruct",
    messages=[{"role": "user", "content": "List 3 countries and their capitals."}],
    temperature=0,
    max_tokens=64,
)
print(resp.choices[0].message.content)</code></pre></div><p>If this returns sensible text, your server is up and you can benchmark it.</p><h2><strong>7.5 How to benchmark it honestly</strong></h2><p>A speedup number means nothing without saying <em>what</em> you measured. Four metrics tell the whole story.</p><ul><li><p><strong>Output throughput (tokens/sec).</strong> The headline. How many tokens the system produces per second under load. This is where EAGLE3 shows up biggest.</p></li></ul><ul><li><p><strong>Acceptance length, </strong><em><strong><span>&#964;</span></strong></em><strong> (and acceptance rate, </strong><em><strong><span>&#945;</span></strong></em><strong>).</strong> From 4: <em><span>&#964;</span></em> is the average number of drafted tokens committed per verification pass, and <em><span>&#945;</span></em> is the per-token acceptance probability. If <em><span>&#964;</span></em> is near 1, speculation is doing nothing; if it is 3&#8211;4, you are winning. <strong>This is the single best diagnostic</strong>, and vLLM reports it.</p></li><li><p><strong>Latency: TTFT and TPOT/ITL.</strong> <em>Time to first token</em> (TTFT) measures responsiveness; <em>time per output token</em> / <em>inter-token latency</em> (TPOT/ITL) measures how fast the stream flows. Report p50 and a tail percentile (vLLM prints p99).</p></li><li><p><strong>Cost per 1M tokens.</strong> The business case. Derived from throughput and the pod&#8217;s hourly price:</p></li></ul><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{cost per 1M tokens} = \\frac{(\\text{pod \\$/hr}) \\times 10^6}{(\\text{tokens/sec}) \\times 3600}&quot;,&quot;id&quot;:&quot;VNTKTOGYVE&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>Why chat?</strong><span> Chat is </span><em>decode-heavy</em><span>: short prompts, long answers. That is exactly the regime where generation is memory-bound and speculation has spare compute to exploit. On prefill-heavy workloads (huge unique prompts, short answers) the win shrinks.</span></p><h2><strong>7.6 Running the benchmark</strong></h2><p>vLLM ships its own load generator. Run the <strong>baseline first</strong>, record the numbers, then re-launch the server with EAGLE3 and re-run the <em>identical</em> benchmark command.</p><h3><strong><a href="iframe.php?url=http%3A%2F%2Flocalhost%3A3000%2Fchapters%2Finference%2Fspeculative-decoding-part-1%23the-load-test">The load test</a></strong></h3><p>Grab the ShareGPT dataset once:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;d20c2d88-0b5b-4af9-a07f-fe6ef250cd89&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">wget https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json \
  -O /workspace/sharegpt.json</code></pre></div><p>With the server running, point the benchmark at it:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;cc83203c-c9d6-4aee-8837-0432f05efea2&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">vllm bench serve \
  --backend vllm \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --endpoint /v1/completions \
  --dataset-name sharegpt \
  --dataset-path /workspace/sharegpt.json \
  --num-prompts 500 \
  --request-rate inf</code></pre></div><p><code>--request-rate inf</code><span> floods the server to measure peak throughput; set a finite rate (e.g. </span><code>--request-rate 8</code><span>) and </span><code>--max-concurrency</code><span> to simulate steady traffic. The summary reports throughput, TTFT, and TPOT; vLLM's server logs/metrics report the </span><strong>acceptance length</strong><span> for the EAGLE3 run.</span></p><div class="callout-block" data-callout="true"><p><em><strong>A trap worth knowing before you read your numbers.<span> </span></strong></em><code>--request-rate inf</code><em><strong><span> fires all 500 prompts at once, so the GPU runs at ~500 concurrent requests, fully saturated. That is the </span>throughput-bound<span> regime, where speculation has no spare compute and can come out </span>slower<span> than baseline. To measure the </span>latency<span> regime, where EAGLE3 actually helps, add </span></strong></em><code>--max-concurrency 1 --temperature 0</code><em><strong><span> (one request at a time, greedy). Our result in 7.7 shows exactly this split.</span></strong></em></p></div><h3><strong>A minimal sanity script (optional)</strong></h3><p>For an intuition check before the heavy tooling, time tokens/sec from a single streamed request:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;60a3a88f-c66e-45af-9b18-7b60f745617e&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import time, openai

client = openai.Client(base_url="iframe.php?url=http%3A%2F%2F127.0.0.1%3A8000%2Fv1", api_key="None")
prompt = "Write a 400-word explanation of how a CPU cache works."

t0 = time.time()
n = 0
stream = client.chat.completions.create(
    model="meta-llama/Llama-3.1-8B-Instruct",
    messages=[{"role": "user", "content": prompt}],
    temperature=0, max_tokens=512, stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        n += 1
dt = time.time() - t0
print(f"{n} tokens in {dt:.2f}s = {n/dt:.1f} tok/s")</code></pre></div><p>Run it against the baseline server, then against the EAGLE3 server. The difference in tok/s is your speedup (or, as 7.7 found, sometimes a slowdown) in one number. Use the real benchmark tools for anything you report.</p><h2><strong>7.7 Results</strong></h2><p>Here are the numbers from an actual run: Llama-3.1-8B on a single 48 GB Ada GPU, baseline vs EAGLE3, same prompts. I am reporting them exactly as they came out, because the honest result is more useful than a flattering one: <strong>on this setup, EAGLE3 was slower in both regimes.</strong> The tables show it, and the acceptance number explains it.</p><p><strong>Table A: Single request (batch 1, greedy </strong><code>temperature=0</code><strong>)</strong>, the latency regime where speculation is <em>supposed</em> to win</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m3Mn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m3Mn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 424w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 848w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 1272w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m3Mn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png" width="1456" height="397" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:397,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63970,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!m3Mn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 424w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 848w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 1272w, https://substackcdn.com/image/fetch/$s_!m3Mn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feedb2752-88b9-40f6-b47c-0c90d08a4f62_1695x462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Table B: Under load (500 prompts, </strong><code>--request-rate inf</code><strong>, ~500 concurrent)</strong><span>, the throughput regime</span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215-wN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5-wN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 424w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 848w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 1272w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215-wN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png" width="1456" height="373" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:373,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62192,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5-wN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 424w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 848w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 1272w, https://substackcdn.com/image/fetch/$s_!5-wN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46ce771-65eb-4342-8b45-bb3049f685e2_1803x462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Table C:</strong> Acceptance (the diagnostic, from the EAGLE3 benchmark)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b987%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b987!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 424w, https://substackcdn.com/image/fetch/$s_!b987!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 848w, https://substackcdn.com/image/fetch/$s_!b987!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 1272w, https://substackcdn.com/image/fetch/$s_!b987!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b987%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png" width="1456" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:64115,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b987!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 424w, https://substackcdn.com/image/fetch/$s_!b987!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 848w, https://substackcdn.com/image/fetch/$s_!b987!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 1272w, https://substackcdn.com/image/fetch/$s_!b987!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10792206-9eb7-4587-9afd-40b16eec9e1c_1623x543.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Table D: Latency under load</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NGiO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 424w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 848w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 1272w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NGiO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png" width="1456" height="345" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db16e134-4445-40e4-9550-aa18519d2faa_1948x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:345,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55763,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/205325757?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NGiO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 424w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 848w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 1272w, https://substackcdn.com/image/fetch/$s_!NGiO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb16e134-4445-40e4-9550-aa18519d2faa_1948x462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><strong>Table C is the whole story.</strong> Acceptance length came out at <strong>1.81</strong>, barely above 1 and nowhere near the 3&#8211;4 you need for a win. When fewer than two of every three drafted tokens survive verification, the cost of drafting and verifying isn&#8217;t paid back, so throughput drops and latency rises. <strong>This is not a bug; it is speculation losing its bet,</strong> and the diagnostic tells you <em>why</em>, not just <em>whether</em>.</p><p>Three things drove acceptance down, and they are worth internalizing because they generalize:</p><ol><li><p><strong>A small target on a fast GPU is the hard case for speculation.</strong> An 8B model already decodes quickly (45 tok/s single-stream here), so the memory-bandwidth headroom that speculation trades compute for is small, and the draft head&#8217;s own forward pass eats most of any gain. EAGLE3&#8217;s economics are far better on <strong>large</strong> targets (70B), where each decode step is expensive and the draft is comparatively cheap. The published ~2.4&#215; for 8B and ~4&#215; for 70B come from bigger, more favorable setups than a single mid-range card.</p></li><li><p><strong>The load benchmark ran non-greedy.</strong> vLLM&#8217;s benchmark no longer forces <code>temperature=0</code>, and stochastic sampling lowers acceptance because the target&#8217;s samples diverge from the draft&#8217;s guesses more often.</p></li><li><p><code>--request-rate inf</code><strong> saturated the GPU.</strong> At ~500 concurrent requests the card is compute-bound, so speculation&#8217;s extra work steals cycles from useful generation (7.8).</p></li></ol><div class="pullquote"><p><em><span>This is what "speculative decoding is a </span><strong>bet</strong><span>" means in practice. Modest acceptance, a small model, and a saturated GPU stacked up, and the bet did not pay. The number that told me in one glance was </span><strong>acceptance length (</strong></em><strong><span>&#964;=1.81</span></strong><em><strong>)</strong><span>. Read it first, always.</span></em></p></div><p><strong>Could I make it win?</strong><span> Probably, but not for free. You would push acceptance up and stay in the latency regime: benchmark with </span><code>--max-concurrency 1 --temperature 0</code><span>, try </span><code>num_speculative_tokens: 2</code><span> (shorter drafts fail less often), and confirm the draft head is actually attached (the acceptance line in the server log). The biggest lever, though, is the target size: run EAGLE3 against a </span><strong>70B</strong><span> model and the same machinery usually comes out well ahead. On an 8B, expect the fight to be close, and sometimes a loss.</span></p><h2><strong>7.8 When speculation helps, and when it hurts</strong></h2><p>EAGLE3 is excellent, but it is still a bet, not a free switch, and 7.7 is proof. From the production literature (Red Hat&#8217;s gpt-oss and EAGLE3 studies, ) plus my own run:</p><p><strong>It helps most when:</strong></p><ul><li><p>The workload is <strong>decode-heavy</strong> (short prompts, long responses), like chat, reasoning, and agents.</p></li><li><p>The <strong>target model is large</strong> (say 70B). Each decode step is expensive, so a cheap draft that lands even half its tokens is a clear win. This is the single biggest factor, and the one my 8B run was missing.</p></li><li><p>Acceptance is <strong>high</strong> (<span>&#964;&#8819;3</span>), which needs a well-matched draft head and, ideally, greedy or low-temperature decoding.</p></li></ul><p><strong>It hurts or does nothing when:</strong></p><ul><li><p>The <strong>target is small and the GPU is fast</strong> (my case): baseline decoding is already quick, so there is little bandwidth headroom to buy back, and the draft&#8217;s own forward pass eats the gain.</p></li><li><p>The GPU is already <strong>compute-saturated</strong> (high concurrency), so speculation&#8217;s extra drafting steals cycles from useful work. Some studies report gains even at ~200 concurrent requests, but my 500-concurrent run lost, so do not assume it, measure it.</p></li><li><p>The workload is <strong>prefill-heavy</strong> (long unique prompts, little cache reuse), because the decode phase is too short to amortize the drafting.</p></li></ul><p>This is why modern serving stacks treat speculation as a <strong>dynamic</strong> feature, on at light/medium load, automatically off when the queue saturates.</p><h1><strong>8. Takeaways</strong></h1><p><strong>The idea:</strong></p><ul><li><p><strong>The problem is memory bandwidth.</strong> Generation is slow because the GPU re-reads the model&#8217;s entire weights for every token, leaving its math units idle.  There is spare compute sitting there unused.</p></li><li><p><strong>The idea is guess-and-verify.</strong> A cheap drafter proposes several tokens, the expensive target verifies them all in one parallel pass, accepting a prefix and correcting the first mismatch.</p></li><li><p><strong>It is exact, not approximate.</strong> Modified rejection sampling (accept with <span>min&#8289;(1,p/q)</span>, resample from the residual) guarantees the output matches the target distribution token for token. The draft only affects speed.</p></li><li><p><strong>The economics come down to </strong><em><strong><span>&#945;</span></strong></em><strong>, </strong><em><strong><span>&#964;</span></strong></em><strong>, and </strong><em><strong><span>K</span></strong></em><strong>.</strong> High acceptance (<em><span>&#945;</span></em>) and well-tuned, adaptive lookahead (<em><span>K</span></em>) push you toward the best-case speedup. Mismatched drafts and a bad <em><span>K</span></em> waste compute.</p></li><li><p><strong>Pick the drafter that fits your text.</strong> Use <strong>n-gram lookup</strong> for repetitive, input-grounded tasks with zero extra VRAM, <strong>Medusa</strong> for a single self-contained model, and <strong>EAGLE</strong> when you want the highest acceptance by drafting features instead of tokens.</p></li><li><p><strong>The real speedup depends on batch size.</strong> Fixed per-step overheads and, above all, GPU saturation erode the paper speedup: speculation is a low-load latency win, and its headroom collapses as verification comes to dominate each step.</p></li></ul><p><strong>The deployment:</strong></p><ul><li><p><strong>In production, deploy one method: EAGLE3.</strong> It ships with pre-trained heads for popular targets (including Llama-3.1-8B), and it is <strong>one flag</strong> in vLLM (<code>--speculative-config</code>), not a rewrite.</p></li><li><p><strong>8B is a single-GPU job.</strong> One 48 GB card runs the target, KV cache, and EAGLE3 head at once, with no tensor parallelism or quantization.</p></li><li><p><strong>Read acceptance length first.</strong> <em><span>&#964;</span></em> tells you whether EAGLE3 is working before throughput does. My run&#8217;s <em><span>&#964;</span></em><span>=1.81</span> predicted the slowdown in one glance.</p></li><li><p><strong>It is conditional, and it can lose.</strong> A small model on a fast, saturated GPU is the hard case, and ours came out slower. The win grows with model size and acceptance. Measure your own A/B before you ship it.</p></li></ul><div class="pullquote"><p><em><span>The lesson under all of it: when a system is bottlenecked on one resource, you can spend a </span><strong>cheap, abundant</strong><span> resource to relieve the </span><strong>expensive, scarce</strong><span> one. Speculative decoding spends idle compute to buy back memory bandwidth. When the draft aligns and the GPU has room, it hands you faster text for free; when it does not, the </span><strong>acceptance length</strong><span> tells you so at a glance.</span></em></p></div><h1><strong>9. What I didn&#8217;t cover</strong></h1><p>This post covered the foundations and a working deployment. Several powerful ideas were mentioned only in passing or left out entirely, worth a look if you want to go deeper:</p><ul><li><p><strong>EAGLE-2 / EAGLE-3: dynamic candidate trees.</strong> Section 6.3 introduced EAGLE&#8217;s core idea, drafting at the <em>hidden-feature</em> level. The refinements build a <em>dynamic</em> candidate tree on top of those features, plus training-time tricks that push acceptance rates (and speedups) well past the vanilla EAGLE drafter.</p></li><li><p><strong>Self-speculation (layer-skipping / early-exit drafting).</strong> Turning the target model into its own drafter by skipping its middle layers, so you get drafts with no second model and no extra VRAM, sidestepping the dual-model cost from 5.4.</p></li><li><p><strong>Streaming / overlapped execution.</strong> Pipelining the draft and verify phases so the two models stop sitting idle in lockstep, closing the &#8220;bubble&#8221; time described in 5.1.</p></li><li><p><strong>Tree-based verification beyond Medusa</strong> (e.g. SpecInfer, Sequoia): smarter token trees, how to shape and size them, and how tree depth trades off against verification cost.</p></li><li><p><strong>Speculation at high batch sizes.</strong> How newer methods keep speculation useful in the throughput-bound regime instead of being toggled off the moment the GPU saturates.</p></li><li><p><strong>Designing and training the draft model.</strong> Distilling and aligning a drafter to maximize the acceptance rate <em><span>&#945;</span></em>, and how draft&#8211;target alignment is actually engineered.</p></li><li><p><strong>Adjacent ways to break the autoregressive barrier</strong>, such as multi-token prediction (MTP), lookahead / Jacobi decoding, and how they relate to classic speculative decoding.</p></li><li><p><strong>Other serving stacks.</strong> How TensorRT-LLM and SGLang implement and auto-tune all of this (SGLang in particular has strong EAGLE3 support once you are on a compatible CUDA build).</p></li></ul><p></p><p>That is where I am going to stop for today. There is clearly more here: dynamic EAGLE trees, self-speculation, streaming overlap, and now this semi-autoregressive line from DeepSeek. Maybe, if there is appetite for it, I will do a Part 2 that actually works through those. But this post is already long, and I would rather end it clean than stretch it thin.</p><p>If you liked the way this one reads, I have more in the same style on the way, and I think you will enjoy those just as much.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;afdab11d-6953-4866-bf51-b5d708699490&quot;,&quot;caption&quot;:&quot;This Blog Covers&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Diffusion Model Visual Breakdown&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-06-23T04:10:50.716Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!VKVq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/diffusion-model-visual-breakdown&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:203080645,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:16,&quot;comment_count&quot;:3,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;04bb3c9d-611c-4167-b2ab-2e1b33186600&quot;,&quot;caption&quot;:&quot;This chapter covers&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Transformers for Video: TimeSformer&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-06-27T04:14:05.185Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!H7oG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/transformers-for-video-timesformer&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:203580686,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:9,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><p><strong>This is Part 1 of a longer run I am planning on LLM inference optimization, with more coming on CUDA, Triton.</strong> </p><p>Alongside the writing, I&#8217;m also building Audio Deep Learning projects and LLM projects, sharing and discussing them on LinkedIn and Twitter. If you&#8217;re someone curious about these topics, I&#8217;d love to connect with you all!</p><p><strong>Mayank Pratap Singh</strong></p><p><strong>LinkedIn</strong><span> : </span><a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fmayankpratapsingh022%2F">www.linkedin.com/in/mayankpratapsingh022</a></p><p><strong>Twitter/X</strong><span> : </span><a href="iframe.php?url=https%3A%2F%2Fx.com%2FMayank_022">x.com/Mayank_022</a><span>.</span></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Nested Learning: The Illusion of Deep Learning Architecture]]></title><description><![CDATA[Rethinking how Memory and architeucture are constructed and coupled together for inference-time learning]]></description><link>https://vizuara.substack.com/p/nested-learning-the-illusion-of-deep</link><guid isPermaLink="false">https://vizuara.substack.com/p/nested-learning-the-illusion-of-deep</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 29 Jun 2026 03:30:29 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Os_a%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>Table of contents</strong></h1><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A71-introduction">Introduction</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A72-how-do-models-learn-beyond-training">How Do Models Learn Beyond Training?</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A73-why-rag-isnt-enough">Why RAG Isn&#8217;t Enough</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A74-why-memory-is-hard">Why Memory is Hard</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A741-the-plasticity-stability-tradeoff">The Plasticity-Stability Tradeoff</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A742-catastrophic-forgetting">Catastrophic Forgetting</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A743-the-write-problem">The Write Problem</a></em></p></li></ol></li><li><p><em>T<a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A75-the-ideal-case">he Ideal Case</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A76-quick-recap-of-titans-architecture">Quick Recap of Titans Architecture</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A77-methodology">Methodolog</a>y</em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A771-the-neural-learning-module-and-the-nested-learning-paradigm">The Neural Learning Module and the Nested Learning Paradigm</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A772-continuum-memory-system-cms">Continuum Memory System (CMS)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A773-self-modifying-titans-and-the-hope-architecture">Self-Modifying Titans and the Hope Architecture</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A774-training-pipeline">Training Pipeline</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A775-inference-time-optimization">Inference-Time Optimization</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A776-muon-and-the-multi-scale-momentum-optimizer-m3">Muon and the Multi-Scale Momentum Optimizer (M3)</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A78-results-and-outcomes">Results and Outcomes</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A79-thoughts">Thoughts</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F23c397ae-b774-4c2e-b0ef-a280e030d5c9%3Fupdated%3D2026-06-27T12%253A24%253A02.359Z%26amp%3BpostPreview%3Dfree%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A710-conclusion">Conclusion</a></em></p></li></ol><div><hr></div><h1>1. Introduction</h1><p>A while back, I wrote about Titans which is Google&#8217;s proposal for a model that could update its own memory during inference, without waiting for a retraining cycle. If you haven&#8217;t read that piece, I&#8217;d strongly recommend starting <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Ftitans-learning-to-memorize-at-test">there</a>, as what follows builds directly on it.</p><p>Titans was a significant result. It demonstrated that the rigid boundary between training and inference; something the field had treated as structurally fixed but it doesn&#8217;t have to be that way. By treating the hidden state of a neural module as a learnable projector rather than a static representation, Titans showed that a model could genuinely update what it knows at test time, not just retrieve from what it was trained on. The three-memory architecture : short-term attention, long-term updatable state, persistent fixed memory was a clean solution to a problem that RNNs, SSMs, and standard transformers had each failed to solve completely.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>But there was a question the original Titans paper left open.</p><p>Titans showed you <em>could</em> learn at test time. What it didn&#8217;t fully answer was how to do this <em>continuously</em> across an ongoing stream of new information, over long horizons, without the memory degrading, overwriting itself, or losing coherence with what came before. A model that updates once at test time is impressive. A model that keeps updating, correctly and efficiently, across thousands of interactions is a much different and harder problem entirely.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Os_a%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Os_a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 424w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 848w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 1272w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Os_a%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png" width="500" height="616" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f69598c4-bbf2-4785-9831-308688e74674_500x616.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:616,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Os_a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 424w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 848w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 1272w, https://substackcdn.com/image/fetch/$s_!Os_a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff69598c4-bbf2-4785-9831-308688e74674_500x616.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2512.24695">paper we are discussing today</a> (also from Google) is the answer to that question. It introduces a framework for continuous inference-time learning a system where the model doesn&#8217;t just adapt to a single query, but genuinely accumulates knowledge across time, deciding what to remember, what to overwrite, and how to integrate new information into reasoning without destroying what already exists. This is done by combining self-modifying sequence model with the continuum memory system for a learning module, called Hope, showing promising results in language modeling, knowledge incorporation and reasoning.</p><p>A lot of jargons? Dont worry; That is what we are unpacking today.</p><div><hr></div><h1>2. How Do Models Learn Beyond Training?</h1><p>Before we get into the architecture, we need to build a precise understanding of what it even means for a model to learn and how much of that learning can happen after the training run ends. This is not a philosophical question. It has direct architectural consequences.</p><h4>2.1 The Spectrum</h4><p>Most discussions treat model learning as a binary, i.e. either the model is training, or it is not; this framing is too coarse/sparse. The more useful way to think about it is as a spectrum, defined by a single axis: <strong>how much is the model allowed to change in response to new information?</strong></p><p>At one extreme, you have a fully frozen model with weights fixed, no updates of any kind, every query answered from a static snapshot of what was learned during pretraining. At the other extreme, you have a fully dynamic model; one that continuously updates its own parameters in real time, integrating every new piece of information as it arrives.</p><p>In between these two poles live three distinct learning regimes, each with a different answer to how much change is permitted and where that change is allowed to happen.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uOTP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uOTP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 424w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 848w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 1272w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uOTP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png" width="2486" height="1359" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1359,&quot;width&quot;:2486,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:291897,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fff80a0f1-dc95-45f6-aa26-0460be7f51a0_2720x1920.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uOTP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 424w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 848w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 1272w, https://substackcdn.com/image/fetch/$s_!uOTP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e43b484-bda2-4d94-8c33-99e82faea674_2486x1359.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">HOPE operates on Inference-time learning block (green)</figcaption></figure></div><h4>2.2 In-Context Learning (Change Without Weight Updates)</h4><p>The softest form of post-training adaptation is in-context learning. The model weights never change. Instead, the model conditions its behaviour on examples, instructions, or information provided directly in the context window; hence, effectively using the attention mechanism as a temporary, ephemeral form of memory.</p><p>Formally, given a context C=(c1&#8203;,c2&#8203;,&#8230;,ck&#8203;) of examples and a query q, in-context learning computes:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(y \\mid q, C) = P(y \\mid q, c_1, c_2, \\ldots, c_k)&quot;,&quot;id&quot;:&quot;ZRBDEWFCHQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The model hasn&#8217;t learned anything in the weight-update sense. It has simply conditioned on more information. The moment the context window is cleared, everything is gone and the model returns to its prior state as if nothing happened.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Ptm3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ptm3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 424w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 848w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 1272w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Ptm3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png" width="483" height="360" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:483,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;All You Need to Know about In-Context Learning | Towards Data Science&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="All You Need to Know about In-Context Learning | Towards Data Science" title="All You Need to Know about In-Context Learning | Towards Data Science" srcset="https://substackcdn.com/image/fetch/$s_!Ptm3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 424w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 848w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 1272w, https://substackcdn.com/image/fetch/$s_!Ptm3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3f6f19-2afd-46a6-9b77-ec1b6a66f33b_483x360.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is powerful as Transformers are remarkably good at in-context learning, and it requires zero infrastructure beyond the model itself. But it has a hard ceiling: the context window. Once k exceeds the maximum sequence length, you cannot fit more information in. The model&#8217;s ability to adapt is bounded by how much it can see at once, not by how much it has experienced over time.</p><p>In-context learning is adaptation without memory. It is stateless across queries and boundless in its forgetting.</p><h4>2.3 Continual Learning (Change Across Time, Without Forgetting)</h4><p>Continual learning asks for something harder. The model should be able to learn from a sequential stream of tasks or data over time hence accumulating knowledge rather than replacing it. Each new piece of information should be integrated without destroying what came before.</p><p>The core challenge is <strong>catastrophic forgetting</strong>; which happens when a neural network is updated on new data via gradient descent, the weight updates that improve performance on the new task systematically degrade performance on old tasks. The gradients don&#8217;t know what the old weights were protecting. They just follow the loss surface of the current objective, overwriting whatever was previously encoded.</p><p>Formally, suppose a model with parameters &#952; is trained sequentially on tasks T1,T2,&#8230;,Tn. After training on Ti&#8203;, the parameters shift from &#952;i&#8722;1&#8203; to &#952;i&#8203;. The catastrophic forgetting problem is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;mathcal{L}_{\\mathcal{T}_j}(\\theta_i) \\gg \\mathcal{L}_{\\mathcal{T}_j}(\\theta_j) \\hspace{1em} \\text{for } j < i&quot;,&quot;id&quot;:&quot;EBKDBQXFKS&quot;}" data-component-name="LatexBlockToDOM"></div><p>Performance on old tasks Tj&#8203; degrades severely after training on new ones. The model is plastic as it learns new things; but it is not stable as it cannot retain old things simultaneously/to a large extent.</p><p>This is the <strong>plasticity-stability tradeoff</strong>, and it is the central unsolved tension in continual learning. A model that updates too readily is plastic but unstable as it learns fast and forgets fast. A model that updates too conservatively is stable but rigid as it retains old knowledge but resists integrating new information. These two requirements pull in opposite directions, and there is no free solution that achieves both simultaneously.</p><h4>2.4 Inference-Time Learning (Change During the Forward Pass)</h4><p>Inference-time learning is the most architecturally radical of the three. The model updates its own parameters <em>during</em> inference, not before, not after, but as part of the forward pass itself. Each query doesn&#8217;t just consume the model&#8217;s knowledge; it potentially modifies it.</p><p>This sounds paradoxical as inference is supposed to be a read operation as you can pass an input forward through fixed weights and get an output. Making it also a write operation where the forward pass updates the very weights it is passing through requires rethinking what a forward pass even means.</p><p>Architecturally, this requires two things. First, a subset of the model&#8217;s parameters must be designated as updatable at inference time (not the full model), which would be prohibitively expensive, but a structured, bounded module whose updates are fast and local. Second, an update rule must be defined that operates at inference speed; not full backpropagation through the entire model, but a lightweight approximation that captures the signal of new information without the cost of a full training step.</p><p>The Titans architecture from the previous article was an early answer to both requirements. The neural memory module which is a small MLP whose weights serve as the memory state can be updated during inference via a self-supervised objective. The update is local, fast, and bounded. It doesn&#8217;t touch the full model. But as noted in the introduction, it handles a single update at test time. What happens when updates need to keep coming?</p><h4>2.5 Three Points on the Same Spectrum</h4><p>These three regimes are not competing paradigms. They are different answers to the same question : how much should a model be allowed to change in response to new information? when placed at different points on a single spectrum; it looks something like this:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xYEE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 424w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 848w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xYEE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png" width="1456" height="178" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:178,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81711,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xYEE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 424w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 848w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xYEE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b4f8fa-bc38-40de-babc-7e4179158b8c_2082x254.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The paper this article covers lives at the inference-time learning end of this spectrum; but it extends it further than Titans did, toward something closer to true continual learning. The model doesn&#8217;t just update once at test time. It keeps updating, across a stream of information, with an explicit mechanism for deciding what to retain and what to overwrite.</p><p>That is the regime the next sections build toward.</p><div><hr></div><h1>3. Why RAG Isn&#8217;t Enough</h1><p>If the spectrum in the previous section is about how much a model is allowed to change, RAG occupies a curious position as it looks like it solves the memory problem, without actually touching the model at all.</p><h4>3.1 What RAG Actually Does</h4><p>Retrieval-Augmented Generation works by treating an external corpus as a lookup table. Given a query <span>q</span>, a retriever selects the top-<span>k</span> most relevant documents D=(d1,d2,&#8230;,dk) from a large external store, and these are concatenated into the model&#8217;s context:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(y \\mid q) \\approx P(y \\mid q, d_1, d_2, \\ldots, d_k)&quot;,&quot;id&quot;:&quot;AKMNQTKDWW&quot;}" data-component-name="LatexBlockToDOM"></div><p>This should look familiar as it is structurally identical to the in-context learning formulation from the previous section. RAG is not a new point on the spectrum. It is in-context learning with an automated retrieval step bolted on front. The model weights never change. The retrieved documents are not learned because they are simply read, once, for this query, and discarded the moment the next query begins.</p><p>This is why RAG feels like memory; but isn&#8217;t. It gives the appearance of a model that &#8220;knows&#8221; things beyond its training data, but the knowing is entirely externally held in a vector database, not in the model itself.</p><h4>3.2 The Structural Limitations</h4><p>Four limitations follow directly from this design.</p><p><strong>Context window bounds.</strong> Retrieved documents still have to fit inside the model&#8217;s context window, alongside the query and the conversation history. As the corpus grows, the retriever has to be more selective; because the value of <span>k</span> stays roughly fixed even as the available information grows without bound.</p><p><strong>Retrieval quality ceiling.</strong> The entire system is bottlenecked by the retriever&#8217;s ability to find the right <span>k</span> documents. If the retriever misses the relevant document because of an imperfect embedding, an ambiguous query, or information that wasn&#8217;t indexed well; then the model never sees it, no matter how capable the model itself is. The generator cannot compensate for what the retriever failed to surface.</p><p><strong>No true integration.</strong> This is the subtlest limitation. Even when retrieval succeeds and the right document is in context, the model is not integrating that information into its world model. It is conditioning on it, for this one forward pass, the way it would condition on any other text in the prompt. The next query starts from zero again; hence, nothing about how the model reasons has changed, only what it was shown changed (abstract context).</p><p><strong>Stateless across queries.</strong> Every query is an independent retrieval-and-generate event. There is no accumulation. If a user mentions an important fact in turn one, and the conversation moves past it in the context window by turn fifty, that fact has to be re-retrieved or it is gone as the model never actually held it in the first place. (arguably memory could be maintained; but it is just another layer of retrieval).</p><h4>3.3 The Deeper Problem : Memory as Storage vs. Memory as Structure</h4><p>These four limitations all trace back to a single design choice: RAG treats memory as something external to the model like a filing cabinet you consult, rather than something that shapes how you think.</p><p>This is worth sitting with, because it is easy to conflate &#8220;has access to information&#8221; with &#8220;remembers&#8221; and they are not the same thing. A filing cabinet gives you access to information. It does not change how you reason about the world. You can look something up, use it for the task at hand, and put it back, completely unchanged by having read it.</p><div id="youtube2-Rvmvt7gscIM" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;Rvmvt7gscIM&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="iframe.php?url=https%3A%2F%2Fwww.youtube-nocookie.com%2Fembed%2FRvmvt7gscIM%3Frel%3D0%26amp%3Bautoplay%3D0%26amp%3Bshowinfo%3D0%26amp%3Benablejsapi%3D0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>Human memory does not work this way, because when you learn something like a fact, a skill, a person&#8217;s name then it does not sit in a separate compartment that you consult on demand. It becomes part of the substrate you think with; hence it changes which associations come to mind, which patterns you notice, which conclusions feel obvious versus surprising.</p><h4>3.4 The Question This Sets Up</h4><p>This reframes the problem we actually need to solve. The question is not <em>&#8220;how do we give a model access to more information than fits in its context window&#8221;</em>; as that is the question RAG answers, reasonably well.</p><p>The question is: what would it mean for a model to actually remember something; basically not retrieve it from an external store and condition on it for one forward pass, but have it genuinely reshape how the model processes every subsequent query, the way a fact you learned last year quietly shapes a judgment you make today, without you consciously retrieving it at all? That is a question about architecture, not retrieval infrastructure.</p><div><hr></div><h1>4. Why Memory is Hard</h1><p>We have established what memory should look like in principle: structure that shapes reasoning, not storage you consult on demand. Now we need to confront why building this is genuinely difficult, not just an engineering inconvenience waiting to be solved with more compute.</p><h4>4.1 The Plasticity-Stability Tradeoff</h4><p>Any system that learns continuously faces a tension between two properties it needs simultaneously.</p><p><strong><mark data-color="#fff2cc" style="background-color: rgb(255, 242, 204); color: rgb(0, 0, 0);">Plasticity</mark></strong><mark data-color="#fff2cc" style="background-color: rgb(255, 242, 204); color: rgb(0, 0, 0);"> is the ability to change in response to new information. A model needs this, or it can never learn anything beyond what it saw during pretraining.</mark></p><p><strong><mark data-color="#fff2cc" style="background-color: rgb(255, 242, 204); color: rgb(0, 0, 0);">Stability</mark></strong><mark data-color="#fff2cc" style="background-color: rgb(255, 242, 204); color: rgb(0, 0, 0);"> is the ability to retain what was already learned. A model needs this too, or every new piece of information would simply erase the last one (remember catastrophic forgetting).</mark></p><p>The problem is that these two properties pull directly against each other. Consider a model with parameters <span>&#952;</span>, currently encoding some knowledge <span>K</span><sub><span>old</span></sub>&#8203;, that receives a new piece of information requiring an update &#916;<span>&#952;</span>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_{\\text{new}} = \\theta_{\\text{old}} + \\Delta\\theta&quot;,&quot;id&quot;:&quot;LRJYMNXLZA&quot;}" data-component-name="LatexBlockToDOM"></div><p>If &#916;<span>&#952;</span> is large enough to fully encode the new information, it is also large enough to overwrite whatever values in &#952;<sub>old</sub> were responsible for <span>K</span><sub><span>old</span></sub>&#8203;. There is no inherent mechanism in this update rule that protects old knowledge while incorporating new knowledge. The same parameters that hold K<sub>old</sub>&#8203;&#8203; are the parameters being modified to hold the new information.</p><p>You can dampen &#916;<span>&#952;</span> to reduce the risk of overwriting. But a smaller &#916;<span>&#952;</span> also means less of the new information actually gets encoded. You have not solved the tradeoff. You have just chosen a different point on it. Push toward plasticity and you risk forgetting. Push toward stability and you risk never learning. There is no parameter setting that gives you both for free.</p><h4>4.2 Catastrophic Forgetting</h4><p>The plasticity-stability tradeoff is the abstract version of the problem. Catastrophic forgetting is what it looks like concretely, in a trained neural network, when gradient descent is the update mechanism.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2184xD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!84xD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 424w, https://substackcdn.com/image/fetch/$s_!84xD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 848w, https://substackcdn.com/image/fetch/$s_!84xD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!84xD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2184xD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png" width="2254" height="1542" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1542,&quot;width&quot;:2254,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:287001,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4fbb3c8-deaf-4152-b678-73ca7b1159fa_2720x2000.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!84xD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 424w, https://substackcdn.com/image/fetch/$s_!84xD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 848w, https://substackcdn.com/image/fetch/$s_!84xD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!84xD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4858b94e-a14d-4d70-bd84-6afc2196a3dd_2254x1542.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">caption...</figcaption></figure></div><p>Suppose a model has been trained on task T<sub>1</sub> and has converged to a region of parameter space <span>&#952;</span><sub><span>1</span></sub>&#8203; that performs well on it. Now it receives new data from task T<sub>2</sub> and is updated via gradient descent:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_2 = \\theta_1 - \\eta \\nabla_\\theta \\mathcal{L}_{\\mathcal{T}_2}(\\theta_1)&quot;,&quot;id&quot;:&quot;DCBPJKIVMP&quot;}" data-component-name="LatexBlockToDOM"></div><p>This update is computed entirely with respect to <span>T</span><sub><span>1</span></sub>&#8203;. The gradient &#8711;<sub><span>&#952;</span></sub>&#8203;L<sub><span>T2</span></sub><span>&#8203;</span>&#8203; has no term, no penalty, no awareness whatsoever of L<sub>T1</sub><span>&#8203;</span>&#8203;. It simply descends the loss surface of the current task. If the region of parameter space that minimizes L<sub><span>T2</span></sub><span>&#8203;</span>&#8203; is far from the region that minimized L<sub><span>T1</span></sub><span>&#8203;</span>&#8203;, the update walks the model directly away from where it needs to be for the old task.</p><p>The result is not gentle decay. It is sudden and severe. Performance on <span>T</span><sub><span>1</span></sub>&#8203; can collapse after just a few gradient steps on <span>T</span><sub><span>2</span></sub>, even though nothing in the training procedure explicitly tried to destroy that knowledge. It is simply a side effect of optimizing for the wrong objective using parameters that were doing double duty.</p><p>This is the mechanism, not just the symptom. Any system that wants to learn continuously without forgetting needs to either protect specific parameters from being overwritten, route new information to a region of parameter space that doesn&#8217;t interfere with old knowledge, or find some other structural way to prevent the gradient from old and new objectives from cancelling each other out.</p><h4>4.3 The Write Problem</h4><p>Even if you solve the forgetting problem, you are left with a second, equally hard question: what is actually worth remembering?</p><p>Not all information that arrives during inference deserves to be written into memory. Some of it is noise. Some of it is redundant with what is already known. Some of it is relevant only to the current query and has no business influencing future reasoning. A memory system that writes everything indiscriminately will fill up fast, with most of its capacity spent on information that didn&#8217;t need to be retained in the first place.</p><p>This is a selection problem, and it is genuinely hard for a structural reason: deciding whether something is worth remembering often requires knowing whether it will be useful in the future, which you cannot know at the moment you encounter it. A fact that seems irrelevant today might be exactly what a future query needs. A fact that seems important today might never come up again.</p><p>A good memory system needs some signal, some proxy, for deciding what to write. This could be based on how surprising the new information is relative to what the model already expects, how often similar information has proven useful in the past, or how confidently the information can be verified. Whatever the signal, the system needs one, because the alternative, writing everything, is not actually a memory system. It is just an ever-growing, ever more diluted version of the context window problem RAG already has.</p><h4>4.4 Where This Leaves Us</h4><p>Put these three problems together and the difficulty of the task comes into focus. You need a system that is plastic enough to integrate genuinely new information, stable enough not to destroy what it already knows, and selective enough not to drown itself in irrelevant updates. None of these three requirements can be solved in isolation. A solution to plasticity that ignores stability gives you catastrophic forgetting. A solution to stability that ignores plasticity gives you a frozen model. A solution to both that ignores selectivity gives you a memory system that degrades under its own weight.</p><p>This is the real shape of the problem the next section&#8217;s ideal case has to grapple with. Not &#8220;can a model update at test time&#8221;, which Titans already showed was possible, but &#8220;can a model update continuously, indefinitely, while staying coherent.&#8221; That is a substantially harder bar to clear.</p><div><hr></div><h1>5. The Ideal Case</h1><p>Let&#8217;s start with an unconstrained dream, the similar way we did for Fast BLT (our previous article).</p><p>The perfect continuously-learning memory system would do four things at once. It would update instantly the moment new information arrives, with no separate training step and no delay. It would never forget anything it had previously learned, no matter how much new information arrived afterward. It would know, automatically, what was worth remembering and what wasn&#8217;t, writing only the information that would matter later. And it would integrate everything it learned into how it reasons, not store it as a separate fact to be consulted, but let it quietly reshape every subsequent inference.</p><p>This is the ideal. Instant plasticity, perfect stability, perfect selectivity, full integration. And it is unachievable, for reasons that go deeper than current engineering limitations.</p><div><hr></div><h4>5.1 Why the Ideal Breaks Down</h4><p>The reason traces directly back to section 4.1. Plasticity and stability are not two independent dials you can both turn to maximum. They are coupled through the same mechanism, the same set of parameters, the same update rule.</p><p>Recall the update equation:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_{\\text{new}} = \\theta_{\\text{old}} + \\Delta\\theta&quot;,&quot;id&quot;:&quot;JHYAYBQUIN&quot;}" data-component-name="LatexBlockToDOM"></div><p>For the system to be instantly and fully plastic, &#916;<span>&#952;</span> must be large enough to fully encode any new piece of information, regardless of how it relates to what is already stored. For the system to be perfectly stable, &#916;<span>&#952;</span> must never perturb the components of <span>&#952;</span><sub><span>old</span></sub>&#8203; that encode previously learned knowledge. These two requirements can only both hold if every new piece of information happens to map onto a completely disjoint region of parameter space from everything learned before it, indefinitely, forever. There is no mechanism that guarantees this. Parameter space is finite. Information is not.</p><p>This is structurally the same kind of impossibility we encountered with the autoregressive dependency chain in the Fast BLT article. There, the constraint was that you cannot compute x<sub><span>t</span></sub>&#8203; before x<sub>t&#8722;1</sub>&#8203; exists, because the dependency is a logical fact about the factorization of the joint distribution, not an engineering limitation. Here, the constraint is that you cannot guarantee perfect plasticity and perfect stability simultaneously, because the parameters doing the remembering are the same parameters being asked to change. It is not a question of better hardware or more compute. It is a property of what it means to update a finite system indefinitely.</p><p>The selectivity requirement compounds this. Even if you could solve plasticity and stability, deciding what is worth remembering requires information about the future that is not available at write time, as we discussed in section 4.3. A perfect selector would need to know, in advance, which pieces of information will matter for queries that haven&#8217;t been asked yet. This is not a hard engineering problem. It is asking for foresight the system structurally cannot have.</p><h4>5.2 The Real Question</h4><p>Given that the ideal is unreachable, the question that matters is not &#8220;how do we build the perfect memory system.&#8221; It is: how close can we get, and what are we willing to give up to get there?</p><p>This reframes the entire design space. Just as Fast BLT was not trying to reach the impossible single-pass generation ideal but instead tracing a speed-quality frontier as close to it as possible, a continuous learning system is not trying to reach perfect plasticity and perfect stability simultaneously. It is trying to trace a frontier between them, recovering as much of both as the architecture allows.</p><p>We can write this formally as a constrained optimization, mirroring the structure from our Fast BLT article. Let <span>P</span> denote plasticity, how readily the system integrates new information, and let <span>S</span> denote stability, how well it retains old information. The achievable frontier is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;S^*(P) = \\max_{\\text{architecture}} \\hspace{0.5em} S \\hspace{1em} \\text{subject to} \\hspace{1em} \\text{plasticity} = P&quot;,&quot;id&quot;:&quot;KEJUPIXNNC&quot;}" data-component-name="LatexBlockToDOM"></div><p>Every architectural choice, how memory is represented, how updates are computed, what gets written and what gets protected, places the system at some point on or below this frontier. The goal of any concrete design is to push as close to the frontier as possible, knowing the frontier itself never touches the ideal corner of perfect P and perfect <span>S</span> simultaneously.</p><h4>5.3 What Determines How Close You Can Get</h4><p>Two things determine where on this frontier a real system can land.</p><p><strong>How the architecture separates what changes from what stays fixed.</strong> If updates are forced to touch the same parameters that encode everything else, plasticity and stability fight directly, as in section 4.1&#8217;s basic update equation. If the architecture instead routes new information into a structurally separate component, one that can change freely without disturbing a more protected store of existing knowledge, the conflict softens considerably. This is the architectural lever.</p><p><strong>How selective the write mechanism is.</strong> A system that filters aggressively, writing only information that clears some bar of novelty or usefulness, makes far better use of its limited capacity for change than one that writes indiscriminately. This does not solve the foresight problem from section 4.3, but a good proxy signal, something correlated with future usefulness even if not a perfect predictor of it, can meaningfully improve where the system sits on the frontier.</p><p>These two levers, architectural separation of memory components, and selective writing, are exactly what the methodology section is going to dig into. The paper&#8217;s answer to &#8220;how close can we get to the ideal&#8221; lives in how it structures the neural language module, how the continuous memory system is organized, and how the self-modifying mechanism decides what to write and what to protect.</p><p>That is where we are headed next.</p><div><hr></div><h1>6. Quick Recap of Titans Architecture</h1><p>If you&#8217;ve read the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Ftitans-learning-to-memorize-at-test">original Titans article</a>, this section will feel familiar.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;f39b4f6a-ee4c-43bd-8eba-8c1268752a48&quot;,&quot;caption&quot;:&quot;Recently I had been following up with the recent advancements in test time tuning/training/optimization. Last week I wrote a comprehensive blog on Transformers^2, explaining how weights could be optimized during test/inference time through a two-step process.&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Titans: Learning to Memorize at Test Time&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null},{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-02-10T12:06:54.184Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!CsA3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb147f0c8-696c-488d-ba8f-2528b77b74b0_750x500.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/titans-learning-to-memorize-at-test&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:156583779,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:3,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>If you haven&#8217;t, here is quick summary you need to follow the rest of this piece.</p><h4>6.1 The Core Idea : Memory as a Neural Module</h4><p>Titans starts from a simple but consequential reframing: instead of treating memory as a fixed-size vector or buffer, treat it as the weights of a small neural network. The hidden state isn&#8217;t a static representation that gets overwritten and decayed the way an RNN&#8217;s hidden state does. It is a projector, a learnable function, with the capacity to encode high-resolution information precisely because it has parameters that can be optimized.</p><p>This single design choice resolves a tension we touched on in section 2. RNNs and SSMs achieve constant space complexity but suffer from lossy compression, since their fixed-size hidden state has to discard information to make room for new input. Transformers achieve high-quality representation through attention but pay for it with quadratic complexity, since every token attends to every other token. Titans&#8217; neural memory module gets the constant space of an RNN while approximating the representational capacity of a much larger system, because the module&#8217;s weights, not just its activations, are doing the work of encoding information.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OLWQ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OLWQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 424w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 848w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 1272w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OLWQ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png" width="1456" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:536184,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OLWQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 424w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 848w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 1272w, https://substackcdn.com/image/fetch/$s_!OLWQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7ae6ad-7007-4d17-9d92-6bc2b06a7c08_2714x860.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>6.2 Three Memories, Three Roles</h4><p>Titans separates memory into three distinct components, each with a different update rule:</p><p><strong>Short-term memory</strong> is standard attention, operating over a limited window of recent tokens. It is precise and high-quality, but quadratic in cost, so it is kept short by design.</p><p><strong>Long-term memory</strong> is the neural module described above. Its weights are updated during inference, via a self-supervised objective, allowing the model to incorporate information from far outside the attention window without paying attention&#8217;s quadratic cost.</p><p><strong>Persistent memory</strong> is also neural, also low-dimensional, but never updated at inference time. It encodes stable, task-general knowledge that should not drift, regardless of what happens during a particular inference session.</p><p>The separation between in-context and in-weights memory follows directly from this structure. In-context memory lives in the attention window, the same mechanism behind standard in-context learning from section 2.2, bounded and ephemeral. In-weights memory lives in the long-term module&#8217;s parameters, persisting across the session and shaped by an actual update rule rather than just conditioning.</p><h4>6.3 The Test-Time Update Mechanism</h4><p>The mechanism that makes long-term memory updatable at inference time is a gradient step, computed on the fly, using a self-supervised objective often referred to as a surprise signal. When the model encounters information that its current memory module predicts poorly, the resulting error drives an update to the memory module&#8217;s weights:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_{\\text{mem}} \\leftarrow \\theta_{\\text{mem}} - \\eta \\nabla_{\\theta_{\\text{mem}}} \\mathcal{L}_{\\text{surprise}}&quot;,&quot;id&quot;:&quot;LXLUMAVIPA&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#8203;This is, structurally, the same update equation we wrote in section 4.1 and 5.1, applied specifically to the long-term memory parameters rather than the full model. The persistent memory and the bulk of the model&#8217;s other weights are left untouched. Only the long-term memory module is plastic at inference time, which is exactly the kind of architectural separation we flagged in section 5.3 as a lever for softening the plasticity-stability tradeoff.</p><h4>6.4 Where Titans Leaves Off?</h4><p>Titans demonstrated something genuinely new: a model can update its own weights mid-inference, using a fast, local, self-supervised signal, without touching the bulk of the network. That is inference-time learning, concretely realized, for the first time at this level of architectural cleanliness.</p><p>But the original paper was largely concerned with a single inference session. It showed the update mechanism works, that it improves long-range understanding, that it can be parallelized for training. What it did not fully address was what happens when the updates don&#8217;t stop. What happens after the hundredth update to the same memory module, the thousandth, across sessions, across days, across a genuinely continuous stream of new information. Does the surprise-driven update rule remain well-behaved indefinitely, or does it start to drift, saturate, or interfere with itself the way the gradient updates in section 4.2 interfered across tasks?</p><p>Titans showed you could learn at test time, but the question this new paper takes on is how to do that continuously, and how to do it efficiently enough that it remains practical at scale. That is exactly where the methodology section picks up.</p><div><hr></div><h1>7. Methodology</h1><p>Now that we have revised Titan and under the capabilites and advancements we need on top of it to realize the idea of a strong continuual learning paradigm; let&#8217;s start with the methdology proposed in paper.</p><h3>7.1 The Neural Learning Module and the Nested Learning Paradigm</h3><p>Before this paper, the natural way to think about a deep network was as a stack of layers, each layer a fixed computational block, with a separate optimizer sitting outside the architecture, adjusting weights via backpropagation. Nested Learning (NL) asks you to discard that picture entirely.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lTzA%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lTzA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 424w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 848w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 1272w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lTzA%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png" width="1456" height="802" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:802,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:484095,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lTzA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 424w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 848w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 1272w, https://substackcdn.com/image/fetch/$s_!lTzA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff82fb003-0058-48b4-be37-386a9e7435dd_1506x830.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h5>The Reframe : Optimizers Are Memory Modules</h5><p>The paper&#8217;s starting observation is unusual: a gradient-based optimizer, the thing that updates a model&#8217;s weights, is itself a kind of memory module. Consider standard SGD with momentum. At every step, it takes the current gradient, combines it with a running average of past gradients, and uses that combination to update the weights:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;m_t = \\beta m_{t-1} + (1 - \\beta) \\nabla_\\theta \\mathcal{L}(\\theta_{t-1})&quot;,&quot;id&quot;:&quot;VABFCCGQGG&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_t = \\theta_{t-1} - \\eta \\, m_t&quot;,&quot;id&quot;:&quot;TJBJASHCMU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Look closely at the first equation. It is an associative memory update. The momentum term m<sub><span>t</span></sub>&#8203; is compressing a stream of gradients, the &#8220;context flow&#8221; of the optimization process, into a fixed-size representation, the same way the long-term memory module in Titans compresses a stream of tokens into its weights. Adam does the same thing with two separate compression terms, one for the gradient mean and one for its variance.</p><p>This is the central reframe of Nested Learning: training a neural network and updating a memory module are not two different things happening at different stages. They are the same operation, an associative memory compressing a context flow, applied at different places in the system and at different speeds.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P81l%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P81l!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 424w, https://substackcdn.com/image/fetch/$s_!P81l!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 848w, https://substackcdn.com/image/fetch/$s_!P81l!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!P81l!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P81l%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png" width="1456" height="663" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:663,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:552232,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P81l!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 424w, https://substackcdn.com/image/fetch/$s_!P81l!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 848w, https://substackcdn.com/image/fetch/$s_!P81l!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!P81l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ec19449-88e7-4fd5-b618-ba7d7437bde6_2556x1164.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h5>Multi-Level Optimization</h5><p>Once you accept that framing, a deep learning model stops looking like a flat stack of layers with one optimizer outside it, and starts looking like a set of nested optimization problems, each with its own context flow, each updating at its own frequency.</p><p>Formally, NL represents a model as a collection of levels &#8467;=1,2,&#8230;,L, where each level has its own parameters <span>&#952;(&#8467;)</span>, its own local objective L(&#8467;), and its own update frequency <span>f(&#8467;)</span>, the rate at which that level&#8217;s parameters are allowed to change:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta^{(\\ell)}_{t+1} = \\theta^{(\\ell)}_t - \\eta^{(\\ell)} \\nabla_{\\theta^{(\\ell)}} \\mathcal{L}^{(\\ell)}\\big(\\theta^{(\\ell)}_t, \\, C^{(\\ell)}_t\\big)&quot;,&quot;id&quot;:&quot;VVTIJKHJFP&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <span>Ct(&#8467;)</span>&#8203; is the context flow that level &#8467; sees at time t, the stream of information it is being asked to compress. Crucially, an outer level&#8217;s parameters can themselves be the thing that defines an inner level&#8217;s context flow or objective, which is why these problems are described as nested rather than merely parallel. The outer loop shapes the conditions under which the inner loop operates; the inner loop&#8217;s behaviour, in turn, contributes to the signal the outer loop optimizes against.</p><p>This single formalism is expressive enough to describe a standard transformer. In a transformer, the attention block has, in this framing, an effectively infinite update frequency, f&#8594;&#8734;, since it recomputes its in-context behaviour fresh on every forward pass with no persistence across calls. The MLP blocks, by contrast, have update frequency <span>f</span>&#8594;0, since their weights are frozen entirely after pretraining and never change again at inference time. The paper&#8217;s striking observation is that the entire spectrum we mapped out in section 2, from in-context learning to continual learning, is really just a description of where on this frequency axis different components of a model happen to sit.</p><h5>Why Nesting? (Navigating Plasticity and Stability Through Frequency)</h5><p>This is where the nested structure earns its purpose. Recall the plasticity-stability tradeoff from section 4.1: a single set of parameters cannot be simultaneously maximally plastic and maximally stable, because the same update that integrates new information is the update that risks overwriting old information.</p><p>Nested Learning&#8217;s answer is not to find a clever update rule that magically achieves both. It is to refuse the premise that there has to be a single set of parameters and a single update rate at all. Instead, the system is decomposed into multiple levels, each with its own frequency, and the tradeoff is resolved not within any single level but across the hierarchy of levels.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XueS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XueS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 424w, https://substackcdn.com/image/fetch/$s_!XueS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 848w, https://substackcdn.com/image/fetch/$s_!XueS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!XueS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XueS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png" width="1456" height="591" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:591,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:870536,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!XueS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 424w, https://substackcdn.com/image/fetch/$s_!XueS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 848w, https://substackcdn.com/image/fetch/$s_!XueS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 1272w, https://substackcdn.com/image/fetch/$s_!XueS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd532e916-e813-467c-8901-9f3101a7b3e8_2870x1164.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A fast inner loop, updating frequently, gives you inference-time adaptability. It can absorb new information immediately, the way the attention mechanism absorbs the current context, or the way Titans&#8217; long-term memory module absorbs a surprising new fact mid-session. Because it updates fast, it is plastic.</p><p>A slow outer loop, updating only during training, gives you stable long-term structure. It changes rarely, and when it does change, it does so based on aggregated signal across enormous amounts of data, not any single new fact. Because it updates slowly, it is stable.</p><p>Neither loop, on its own, solves the tradeoff. But together, they don&#8217;t have to. The fast loop is allowed to be unstable because the slow loop isn&#8217;t relying on it to hold permanent knowledge. The slow loop is allowed to be rigid because the fast loop is handling everything that needs immediate adaptation. The tradeoff from section 4.1 is not eliminated. It is distributed across timescales, with each level responsible only for the part of the tradeoff it is suited to handle.</p><p>This is the structural lever we flagged in section 5.3 as the key to pushing closer to the frontier, separating what changes from what stays fixed. Nested Learning generalizes that separation from Titans&#8217; three discrete memory tiers into a full spectrum of update frequencies, and it is this generalization that the rest of the methodology, the Continuum Memory System and the self-modifying Hope architecture, builds directly on top of.</p><h3>7.2 Continuum Memory System (CMS)</h3><p>The traditional view of memory in a transformer is binary: there is short-term memory, the attention mechanism operating over recent tokens, and long-term memory, the MLP&#8217;s frozen weights encoding everything learned during pretraining. This binary framing maps cleanly onto the two extreme frequencies from section 7.1; which is attention at <span>f</span>&#8594;&#8734;, MLPs at <span>f</span>&#8594;0; hence nothing in between.</p><p>The Continuum Memory System (CMS) discards this binary entirely as Memory is not two discrete tiers. It is a spectrum of frequencies, each responsible for a different timescale of knowledge, each updating at a rate appropriate to what it is storing; hence we want to operate in a continuous space.</p><h4>7.2.1 Memory as a Chain of Frequencies</h4><p>Formally, CMS replaces the single MLP block in a transformer with a chain of kk <span>k</span> MLP blocks:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{MLP}^{(f_1)}(\\cdot), \\text{MLP}^{(f_2)}(\\cdot), \\ldots, \\text{MLP}^{(f_k)}(\\cdot)&quot;,&quot;id&quot;:&quot;ECKZOXCVXZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <span>f1</span>&#8203;&gt;<span>f2</span>&#8203;&gt;&#8943;&gt;<span>fk</span>&#8203; and each block updates at a strictly lower frequency than the one before it. Given input x={x1,&#8230;,xT}, the output of the chain is computed sequentially:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y_t = \\text{MLP}^{(f_k)}\\Big(\\text{MLP}^{(f_{k-1})}\\big(\\cdots \\text{MLP}^{(f_1)}(x_t)\\big)\\Big)&quot;,&quot;id&quot;:&quot;KADUNGRHDW&quot;}" data-component-name="LatexBlockToDOM"></div><p>Each block &#8467; has its own parameters <span>&#952;</span><sup><span>(f&#8467;&#8203;)</span></sup>, updated every <span>C</span><sup><span>(&#8467;)</span> </sup>steps (its chunk size), the number of tokens it processes before incorporating what it has seen into its weights:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uTP3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 424w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 848w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 1272w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uTP3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png" width="1456" height="179" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:179,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104807,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uTP3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 424w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 848w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 1272w, https://substackcdn.com/image/fetch/$s_!uTP3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e03fdb7-99d0-430c-94c1-3ff593127eb9_2878x354.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The block updates in a batch; accumulating gradients over its chunk window and then applying them all at once. Between updates, its parameters are frozen, acting as a static memory for that timescale.</p><p>The standard transformer MLP is a degenerate case of this formulation: <span>k</span>=1, frequency of update zero, chunk size effectively infinite. CMS generalises this into a full spectrum by stacking blocks at different <span>C</span><sup><span>(&#8467;)</span></sup> values &#8212; with the smallest chunk size at the fastest block and the largest at the slowest.</p><h4>7.2.2 What Each Frequency Level Stores</h4><p>This is the key intuition behind CMS: the chunk size <span>C</span><sup><span>(&#8467;)</span></sup> determines the scope of what a block can know about.</p><p>A block with <span>C</span><sup><span>(&#8467;)</span></sup>=1 updates on every single token. It is highly plastic as it responds immediately to every new piece of information; but its parameters reflect only the most recent token&#8217;s context. It is volatile by design. This is the fast, adaptive end of the spectrum.</p><p>A block with <span>C</span><sup><span>(&#8467;)</span></sup>=<span>T</span> represents the entire sequence length and updates only once after processing everything. Its parameters compress the entire context into a single set of weights. It is stable and slow to change, but what it stores is a global summary of everything seen so far. This is the persistent end of the spectrum.</p><p>Between these extremes, blocks at intermediate chunk sizes store knowledge at intermediate timescales. A block with <span>C</span><sup><span>(&#8467;)</span></sup>=128 has seen and integrated 128 tokens&#8217; worth of context before updating its knowledge is local enough to be responsive, global enough to be coherent across a short segment.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Qx5o%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qx5o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 424w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 848w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 1272w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Qx5o%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png" width="2622" height="1578" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1578,&quot;width&quot;:2622,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:360617,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc35a6d86-b8ac-4af3-9bcf-8bb5c32f9bd0_2720x2080.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qx5o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 424w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 848w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 1272w, https://substackcdn.com/image/fetch/$s_!Qx5o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51ed48b4-1e68-4c10-8f65-0d6c20dbc081_2622x1578.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Formally, each block&#8217;s parameters <span>&#952;</span><sup><span>(f&#8467;&#8203;)</span></sup> are a compressed representation of their context window:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta^{(f_\\ell)} \\approx \\arg\\min_{\\theta} \\mathcal{L}\\Big(\\theta; \\{x_t\\}_{t=i-C^{(\\ell)}}^{i}\\Big)&quot;,&quot;id&quot;:&quot;TLMSZUZJVK&quot;}" data-component-name="LatexBlockToDOM"></div><p>This gives CMS a property the binary long-term/short-term model structurally cannot have: <strong>multi-timescale knowledge recovery</strong>. If a fast block forgets something because its chunk window has moved on, the information may still be encoded in a slower block whose window hasn&#8217;t expired yet. Knowledge can be partially recovered from a lower-frequency layer even after the fast layers have moved past it; which is something that is impossible in a system where the only options are ephemeral attention or frozen weights.</p><h4>7.2.3 The Write Mechanism</h4><p>Writing into a CMS block is gradient-based memory update, applied locally within each block&#8217;s chunk window. For a block at frequency <span>f</span><sup><span>&#8467;</span></sup>&#8203; processing chunk i, the write step is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta^{(f_\\ell)}_{i+1} = \\theta^{(f_\\ell)}_i - \\sum_{t=i-C^{(\\ell)}}^{i} \\eta^{(\\ell)}_t \\nabla_{\\theta} \\mathcal{L}(\\theta^{(f_\\ell)}_t; x_t)&quot;,&quot;id&quot;:&quot;EBZFHYZJDR&quot;}" data-component-name="LatexBlockToDOM"></div><p>The gradient here is computed with respect to the block&#8217;s own local objective in language modeling, this is the next-token prediction loss evaluated on the chunk. Each block is, in the Nested Learning framing from section 7.1, an associative memory compressing its own context flow into its parameters. The surprise signal is how much the block&#8217;s current parameters fail to predict the incoming token which drives the update.</p><p>Crucially, this write is <strong>bounded in scope</strong>. The gradient only flows through the current block&#8217;s parameters, not the full model. The plasticity is local. The slower blocks below it are not touched. This is the architectural separation we identified in section 5.3 as the key lever for navigating the plasticity-stability tradeoff as fast blocks are free to be plastic because slow blocks are structurally isolated from their updates.</p><h4>7.2.4 The Read Mechanism</h4><p>Reading from CMS is simply the forward pass through the chain where input flows through MLP<span>(f</span><sub><span>1</span></sub><span>&#8203;)</span> first, then MLP(f<sub>2</sub>), and so on. Each block transforms the representation based on its current parameter state, which encodes whatever it has learned from its chunk history.</p><p>This is fundamentally different from attention-based retrieval. In attention, reading involves computing similarity scores between a query and every key in the context, then retrieving a weighted combination of values. The retrieved content is always a direct function of the current query and the stored keys and values.</p><p>In CMS, reading is a deterministic forward pass through a learned function. There are no explicit keys, no similarity scores, no direct addressing. The block&#8217;s parameters have already compressed the relevant patterns from its context window as the read operation simply evaluates that compression on the current input. It is implicit retrieval rather than explicit lookup.</p><p>The tradeoff is expressivity versus efficiency. Attention retrieval is content-addressable which you can retrieve exactly what you ask for, from anywhere in the context. CMS retrieval is structural as whatever you get is shaped by what the block has learned to encode, which is a compressed summary of the context, not a direct lookup into it. For long-range information that matters across many tokens, CMS&#8217;s compression is more efficient. For precise retrieval of specific earlier tokens, attention remains sharper.</p><h4>7.2.5 Variants : How Levels Connect?</h4><p>CMS is not a single architecture but a family, distinguished by how knowledge flows between frequency levels.</p><p><strong>Nested CMS</strong> is the initial state of block &#8467;+1 is meta-learned from block &#8467;. Each block initializes from a stable learned prior rather than from zero:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta^{(f_{\\ell+1})}_0 = \\arg\\min_\\Phi \\mathbb{E}_{\\mathcal{T} \\sim \\mathcal{C}^{(\\ell)}} \\Big[\\mathcal{L}(\\Theta, \\mathcal{T}; \\Phi)\\Big]&quot;,&quot;id&quot;:&quot;PVNCUZUNME&quot;}" data-component-name="LatexBlockToDOM"></div><p>After each chunk is processed and the block resets, it reinitializes to this meta-learned starting point rather than cold-starting. This gives higher-frequency blocks a stable prior that reflects everything the lower-frequency levels have consolidated into an approximation of how the human brain&#8217;s offline consolidation during sleep replays (in hippocampus) and reorganizes recent memories into longer-term cortical storage.</p><p><strong>Sequential CMS</strong> are blocks that are chained but independent/isolated during initialization. The output of one block feeds into the next, but there is no meta-learning of initial states across levels. This is simpler to implement, but at the cost of the inter-level knowledge transfer that nested CMS provides.</p><p>Both variants contrast sharply with the binary long-term/short-term memory model. There is no hard boundary between ephemeral and persistent memory as only a gradient of update frequencies, each responsible for its own timescale, collectively providing the multi-scale memory management that the plasticity-stability tradeoff requires.</p><h3>7.3 Self-Modifying Titans and the Hope Architecture</h3><p>The Continuum Memory System from section 7.2 solved the representation problem: how to store knowledge across multiple timescales without forcing everything into a binary long-term/short-term split. But it left a second problem untouched: what drives the updates? Every CMS block updates via gradient descent on the next-token prediction loss, which is a fixed, hand-designed update rule. The model learns what to store, but the mechanism by which it stores things is prescribed externally, the same gradient descent formula applied uniformly across every block, at every frequency level.</p><p>The Self-Modifying Learning Module asks a more radical question: what if the model learned its own update rule, rather than having one imposed on it?</p><h4>7.3.1 The Core Idea : Learning to Update</h4><p>Recall from section 7.1 that NL frames a gradient-based optimizer as an associative memory module, something that compresses a context flow (the gradient history) into a fixed representation (the momentum terms or second moments) via gradient descent on a local objective. The update rule itself is therefore just another learned compression, operating at a higher level than the network weights it is updating.</p><p>This observation opens a design space that standard deep learning leaves completely unexplored: if the update rule is a compression, and if more expressive compressions are better, then the update rule itself can be parameterized and learned, in the same way we learn the network weights it applies to.</p><p>The Self-Modifying Learning Module (SMLM) operationalizes this. It is a sequence model that maintains two sets of parameters:</p><ul><li><p><strong>Outer parameters</strong> (&#920;), updated only during training via standard backpropagation on the task loss. These are slow, stable, and encode the model&#8217;s long-run structural knowledge.</p></li><li><p><strong>Inner parameters</strong> (&#981;), updated during inference according to a rule that is itself parameterized by &#920;. These are fast, plastic, and encode the model&#8217;s short-run adaptation to the current context.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-Yt9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-Yt9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 424w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 848w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 1272w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-Yt9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png" width="2352" height="1511" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1511,&quot;width&quot;:2352,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:310886,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a6fda91-b0ce-4f32-b651-ed5f8f0889a3_2720x1760.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-Yt9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 424w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 848w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 1272w, https://substackcdn.com/image/fetch/$s_!-Yt9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb23dc0-835f-47d1-86c9-ca6c154f99b9_2352x1511.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The key property is that the inner update rule is not fixed. It is a function <span>g&#920;</span>&#8203; learned by the outer loop:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\phi_{t+1} = \\phi_t + g_\\Theta(\\phi_t, x_t, \\nabla_\\phi \\mathcal{L}(\\phi_t; x_t))&quot;,&quot;id&quot;:&quot;FRWATJUMDK&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <span>g&#920;</span>&#8203; is a learned function parameterized by the outer weights &#920;, taking the current inner parameters, the current input, and the current gradient as inputs, and outputting a parameter update. The outer loop trains &#920; such that the resulting <span>g&#920;</span>&#8203; produces good inner updates across a distribution of tasks and contexts. The inner loop applies <span>g&#920;</span>&#8203; at inference time to actually adapt &#981;.</p><p>This is what &#8220;learning to modify itself&#8221; means concretely. The model is not just updating its weights at inference time. It is doing so according to an update rule that was itself optimized, end to end, to be a good update rule for this class of problems.</p><h4>7.3.2 How a Self-Modifying Layer Works</h4><p>To make this concrete, consider how a single SMLM layer processes an input sequence x1,x2,&#8230;,xT&#8203;.</p><p>At each step tt t, the layer maintains its current inner parameters &#981;<span>t</span>&#8203;. The forward pass has two components that happen simultaneously.</p><p><strong>The output computation</strong> applies &#981;<span>t</span>&#8203; to the current input:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y_t = f_{\\phi_t}(x_t)&quot;,&quot;id&quot;:&quot;DWOKGCWMLM&quot;}" data-component-name="LatexBlockToDOM"></div><p>This produces the layer&#8217;s output for this token, using whatever the inner parameters currently encode.</p><p><strong>The parameter update</strong> applies the learned update rule to generate new inner parameters for the next step:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\phi_{t+1} = \\phi_t + g_\\Theta\\big(\\phi_t, \\, x_t, \\, \\nabla_{\\phi} \\mathcal{L}(f_{\\phi_t}(x_t), \\, x_t)\\big)&quot;,&quot;id&quot;:&quot;UYEHCCKUDB&quot;}" data-component-name="LatexBlockToDOM"></div><p>The gradient &#8711;<span>&#981;</span>&#8203;L here is computed with respect to a local self-supervised objective, something like predicting the current token given recent context, the same surprise signal from Titans&#8217; memory update in section 6.3. The output <span>y</span><sub><span>t</span></sub>&#8203; and the updated parameters &#981;<span>t+1</span>&#8203; are both produced in the same forward step. The layer has processed the input and updated itself simultaneously.</p><h4>7.3.3 Why This Is Different from Fine-Tuning</h4><p>The comparison to fine-tuning is natural but misleading. Fine-tuning updates a model&#8217;s weights on new data using backpropagation through the full network on a labeled objective, with an externally chosen optimizer running for multiple gradient steps over the full parameter space. It is a process that happens offline, between deployments, not during inference.</p><p>The SMLM update differs on every one of these dimensions.</p><p><strong>Scope.</strong> The inner update touches only &#981;, the inner parameters of this specific layer. The outer parameters &#920; are completely frozen during inference. The rest of the model is not involved. There is no risk of one layer&#8217;s adaptation cascading into unintended changes elsewhere in the network.</p><p><strong>Speed.</strong> The update <span>g&#920;</span>&#8203;(&#8901;) is a single forward pass through a learned function, not iterative gradient descent over multiple steps. It happens in the same computational budget as the forward pass itself.</p><p><strong>The update rule itself.</strong> In fine-tuning, the optimizer is SGD or Adam, chosen by the engineer, fixed, the same for every problem. In the SMLM, the optimizer is <span>g&#920;</span>&#8203;, learned end to end to be a good update rule for this specific class of tasks. This is the deeper difference: the model is not just updating its weights with an external tool. It has internalized the update process as part of its own learned behavior.</p><h4>7.3.4 Gradient Flow Through a Self-Modifying Layer</h4><p>This section requires careful treatment because the gradient flow is non-trivial in a way that matters for how the system is trained.</p><p>In a standard layer, the gradient of the loss with respect to the layer&#8217;s input flows through the layer&#8217;s fixed parameters. One backward pass, one gradient, one update.</p><p>In an SMLM layer, there are two pathways through which gradients flow:</p><p><strong>Pathway 1: Through the output.</strong> The standard path. Given output <span>yt</span>&#8203;=<span>f&#981;t&#8203;</span>&#8203;(x<span>t</span>&#8203;), the outer training loss L<sub>outer</sub>&#8203; backpropagates through <span>y</span><sub><span>t</span></sub>&#8203; to reach &#981;<sub><span>t</span></sub>&#8203; and &#920;:</p><p></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial \\Theta} \\bigg|_{\\text{path 1}} = \\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial y_t} \\cdot \\frac{\\partial y_t}{\\partial \\phi_t} \\cdot \\frac{\\partial \\phi_t}{\\partial \\Theta}&quot;,&quot;id&quot;:&quot;QFDSDSSNAB&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#8203;<strong>Pathway 2: Through the update rule.</strong> The less obvious path. Because &#981;<span>t+1</span>&#8203; depends on &#920; through the learned update rule <span>g&#920;</span>&#8203;, and because <span>y</span><sub><span>t+1</span>&#8203;</sub> depends on &#981;<sub>t+1</sub>&#8203;, the outer loss at step t+1 also flows back through the update rule itself to reach &#920;:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial \\Theta} \\bigg|_{\\text{path 2}} = \\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial y_{t+1}} \\cdot \\frac{\\partial y_{t+1}}{\\partial \\phi_{t+1}} \\cdot \\frac{\\partial \\phi_{t+1}}{\\partial \\Theta}&quot;,&quot;id&quot;:&quot;NJRLTIEAWE&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#8203;where <span>&#8706;&#920;&#8706;&#981;t+1&#8203;</span>&#8203; requires differentiating through <span>g&#920;</span>&#8203;, which itself is a neural network with parameters &#920;. The total gradient on &#920; is the sum across both pathways, and across all timesteps:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial \\Theta} = \\sum_{t=1}^{T} \\left( \\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial \\Theta} \\bigg|_{\\text{path 1}} + \\frac{\\partial \\mathcal{L}_{\\text{outer}}}{\\partial \\Theta} \\bigg|_{\\text{path 2}} \\right)&quot;,&quot;id&quot;:&quot;IWEINOUPIN&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is what makes the outer loop training expensive and why it requires careful implementation. Computing path 2 requires differentiating through the update rule <span>g&#920;</span>&#8203;, which means keeping the computation graph of the inner loop alive during the outer loop backward pass, a memory cost analogous to unrolling an RNN through time.</p><p>In practice, the paper truncates this to avoid the full unrolling cost, computing only a fixed number of inner steps before detaching the gradient, the same truncated backpropagation through time trick used in training recurrent networks. The truncation introduces bias into the outer gradient estimate but keeps the training computationally tractable.</p><h4>7.3.5 Hope : Putting It Together</h4><p>Hope (Higher-Order Parameter Evolution) is the concrete architecture that combines the Self-Modifying Learning Module with the Continuum Memory System into a single, unified sequence model.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m4Jk%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m4Jk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 424w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 848w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 1272w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m4Jk%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png" width="2037" height="1718" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1718,&quot;width&quot;:2037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:233589,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7930178-0c0a-4b11-80cd-d01676a39cd6_2720x1984.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!m4Jk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 424w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 848w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 1272w, https://substackcdn.com/image/fetch/$s_!m4Jk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fbafec1-f4b9-4dd6-8f00-3e1627854e7e_2037x1718.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The architecture replaces the standard transformer block with a Hope block, which consists of:</p><ul><li><p>A standard attention layer handling short-term in-context memory, unchanged from the transformer</p></li><li><p>A CMS chain handling multi-timescale in-weights memory, updating at decreasing frequencies</p></li><li><p>An SMLM layer whose inner update rule is learned rather than fixed, operating on top of the CMS chain&#8217;s output</p></li></ul><p>Each component maps onto a different level of the nested learning hierarchy from section 7.1. Attention operates at infinite frequency, reading the current context with full precision and no persistence. The CMS chain operates at intermediate frequencies, encoding knowledge across windows of increasing length. The SMLM layer operates with a learned update rule that itself evolves during outer loop training, making the entire adaptation mechanism a product of optimization rather than engineering.</p><p>The result is a model where different parts of the parameter space change at different rates, for different reasons, according to rules that were themselves learned. Attention adapts every token, the CMS chain adapts every chunk, and the SMLM layer adapts according to a policy that the outer loop trained specifically to be useful for this task distribution. Each level handles the part of the plasticity-stability tradeoff it is best suited for, and no single level is asked to handle all of it alone.</p><h3>7.4 Training Pipeline</h3><p>Training a model that modifies itself at inference time is not straightforwardly reducible to standard supervised learning. The usual setup is based on fixed parameters, one forward pass, one backward pass, one gradient update and assumes the model being evaluated is the same model (static weight structure) throughout. Hope violates this assumption. The model at step t+1 has different inner parameters than the model at step t, because the forward pass at step t already updated them. Training a system like this requires a careful decomposition of what is being optimized, at what speed, and against what objective.</p><h4>7.4.1 The Two-Loop Training Structure</h4><p>Training Hope decomposes into two nested optimization loops, operating at different timescales and against different objectives. This maps directly onto the NL formalism from section 7.1, but now applied to the training procedure itself rather than just the inference procedure.</p><p>The <strong>inner loop</strong> runs at inference time. Given a sequence of inputs x1,x2,&#8230;,xT, the inner loop applies the learned update rule <span>g&#920;</span>&#8203; to update the inner parameters &#981; at each step:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\phi_{t+1} = \\phi_t + g_\\Theta(\\phi_t, x_t, \\nabla_\\phi \\mathcal{L}_{\\text{inner}}(\\phi_t; x_t))&quot;,&quot;id&quot;:&quot;ZGCITSONRK&quot;}" data-component-name="LatexBlockToDOM"></div><p>The inner loop objective L<sub><span>inner</span></sub>&#8203; is a self-supervised signal, typically next-token prediction on the current chunk, the same surprise-based signal from Titans. This objective is local and computed on the fly. Neither labels are needed nor external supervision is required as the inner loop is entirely self-contained.</p><p>The <strong>outer loop</strong> runs during training. It optimizes the outer parameters &#920; (which include the weights of the learned update rule <span>g&#920;</span>&#8203; and the slow CMS blocks) against a task-level objective L<sub><span>outer</span>&#8203;</sub> computed after the inner loop has already run:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\Theta_{k+1} = \\Theta_k - \\eta_{\\text{outer}} \\nabla_\\Theta \\mathcal{L}_{\\text{outer}}\\big(\\phi_T(\\Theta_k), \\Theta_k; \\mathcal{D}\\big)&quot;,&quot;id&quot;:&quot;GNFYKKLTDI&quot;}" data-component-name="LatexBlockToDOM"></div><p>where &#981;<span>T</span>&#8203;(&#920;<span>k</span>&#8203;) denotes the inner parameters after <span>T</span> steps of inner loop adaptation starting from &#920;<span>k</span>&#8203;. The outer gradient therefore has to propagate back through the inner loop updates, which is what creates the two-pathway gradient structure we described in section 7.3.4.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eWYf%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eWYf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 424w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 848w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 1272w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eWYf%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png" width="2509" height="1924" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1924,&quot;width&quot;:2509,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:355305,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b80b8a1-a44f-4c87-bb54-9c1ab6a0c3a6_2720x2100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!eWYf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 424w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 848w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 1272w, https://substackcdn.com/image/fetch/$s_!eWYf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd73ba695-b33b-488f-8c59-3e69494e8948_2509x1924.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The key asymmetry is that the outer loop is training &#920; to produce a <span>g&#920;</span>&#8203; that makes the inner loop useful, not just to minimize the loss on the current batch. The outer loop is optimizing for a property of the inner loop&#8217;s behavior, not just for a direct prediction objective.</p><h4>7.4.2 The Outer Loop Objective</h4><p>The outer loop objective has to capture what it means for the inner loop to have been useful. A naive choice would be to evaluate the task loss at the very end of the sequence, after all inner loop updates have been applied:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{\\text{outer}}(\\Theta) = \\mathbb{E}_{x \\sim \\mathcal{D}} \\left[ \\mathcal{L}_{\\text{task}}(f_{\\phi_T}(x_T)) \\right]&quot;,&quot;id&quot;:&quot;HIZEUCEBUE&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is valid but myopic as it rewards <span>g&#920;</span>&#8203; only for what the inner loop managed to produce by the final token, giving no signal about the quality of intermediate adaptations. A better objective aggregates the task loss across all timesteps after the first inner update:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{\\text{outer}}(\\Theta) = \\mathbb{E}_{x \\sim \\mathcal{D}} \\left[ \\sum_{t=1}^{T} \\mathcal{L}_{\\text{task}}(f_{\\phi_t}(x_t)) \\right]&quot;,&quot;id&quot;:&quot;JWEVJXCLSD&quot;}" data-component-name="LatexBlockToDOM"></div><p>This rewards the learned update rule for producing good predictions at every step, not just at the end. It means the outer loop is training <span>g&#920;</span>&#8203; to be a good optimizer throughout the sequence, producing useful parameter updates early and consistently, rather than one that only converges to something useful after many steps.</p><p>The outer loop loss is evaluated against the standard language modeling objective on a held-out task distribution, something rich and diverse enough that the learned update rule g&#920;&#8203; has to generalize across contexts rather than overfit to a narrow task.</p><h4>7.4.3 Keeping the Inner Loop Stable</h4><p>The most practically delicate part of training Hope is ensuring the inner loop updates don&#8217;t destabilize during training. Because g<span>&#920;</span>&#8203; is itself being learned, there is no guarantee early in training that the update rule it produces is well-behaved. A poorly initialized <span>g&#920;</span>&#8203; can produce inner updates that send &#981; into a bad region of parameter space, which then produces a garbage outer gradient, which then produces a worse <span>g&#920;</span>&#8203;, which produces even worse inner updates. The training dynamics can spiral.</p><p>Three mechanisms stabilize this.</p><p><strong>Initialization.</strong> The inner parameters &#981; are initialized from the outer parameters &#920; at the start of each sequence. This means the inner loop starts from a known good point, the outer loop&#8217;s current best estimate of a good parameter configuration, rather than from a random initialization. Even if the first few inner updates are poor, the starting point is already reasonable.</p><p><strong>Update magnitude clipping.</strong> The learned update rule <span>g&#920;</span>&#8203; is regularized to produce updates bounded in norm:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;&#8741;\\Theta(\\phi_t, x_t, \\nabla_\\phi \\mathcal{L})\\|_2 \\leq \\delta&quot;,&quot;id&quot;:&quot;SAHJNSBHKL&quot;}" data-component-name="LatexBlockToDOM"></div><p>for a small threshold <span>&#948;</span>. This prevents catastrophically large inner updates, regardless of what the raw output of <span>g&#920;</span>&#8203; would otherwise be. It is a hard constraint, not a soft penalty, so the inner loop cannot escape its stability envelope no matter how badly <span>g&#920;</span>&#8203; misfires early in training.</p><p><strong>Truncated inner unrolling.</strong> As discussed in section 7.3.4, the outer loop gradient propagates back through the inner loop updates. If this unrolling runs for all <span>T</span> inner steps, the computation graph becomes enormous and the gradients become numerically unstable, exploding or vanishing through the long chain of inner updates. The paper truncates the unrolling to a fixed window <span>K</span>&#8810;<span>T</span>, computing outer gradients only through the last K inner steps and treating earlier ones as detached constants. This introduces bias into the outer gradient estimate but keeps the training numerically stable and computationally tractable.</p><h4>7.4.4 Data Ordering and Curriculum</h4><p>In a standard transformer, training data order matters primarily for optimization efficiency. Curriculum learning, where easier examples come earlier, can speed up convergence, but the model&#8217;s final capabilities are largely order-agnostic because every forward pass sees the same fixed weights.</p><p>Hope breaks this. Because the inner loop updates &#981; as it processes a sequence, the order of tokens within a training sequence now affects the state of &#981; at every subsequent position. A sequence where easier, more predictable tokens come first produces a better-initialized &#981; by the time harder tokens arrive. A sequence where difficult tokens come first may send &#981; off in a bad direction before the inner loop has had time to stabilize. This has two practical consequences:</p><p><strong>Within-sequence ordering matters.</strong> Training sequences should be constructed so that each sequence has some internal coherence, so that the inner loop is adapting to a consistent local context rather than a random splice of unrelated documents. Random shuffling of tokens within sequences, standard in many language model training pipelines for deduplication purposes, is harmful here because it destroys the local context structure that the inner loop is trying to adapt to.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CReF%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CReF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 424w, https://substackcdn.com/image/fetch/$s_!CReF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 848w, https://substackcdn.com/image/fetch/$s_!CReF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 1272w, https://substackcdn.com/image/fetch/$s_!CReF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CReF%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png" width="1456" height="692" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:692,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:233598,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CReF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 424w, https://substackcdn.com/image/fetch/$s_!CReF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 848w, https://substackcdn.com/image/fetch/$s_!CReF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 1272w, https://substackcdn.com/image/fetch/$s_!CReF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f4e7995-c80b-484e-b71f-8052cc7773f7_2720x1293.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Cross-sequence curriculum is beneficial.</strong> At the sequence level, there is evidence that presenting simpler, more internally coherent sequences early in training helps <span>g&#920;</span>&#8203; learn a stable update rule before being asked to handle difficult, rapidly-shifting contexts. Once <span>g&#920;</span>&#8203; has learned the basic mechanics of a useful update rule on easier material, it generalizes more reliably to harder sequences where the inner loop has to navigate more complex adaptation trajectories.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eKoD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eKoD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 424w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 848w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eKoD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png" width="1456" height="535" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:535,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:222854,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eKoD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 424w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 848w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!eKoD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a3f7321-7424-4ffe-bb62-52faf63bdc37_2720x1000.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The interaction between data ordering and inner loop behavior is one of the less well-understood aspects of this training paradigm, and it represents one of the open engineering questions that differentiates training Hope from training a standard transformer at scale.</p><h3>7.5 Inference-Time Optimization</h3><p>The self-modifying mechanism described in 7.3 is theoretically clean, but it carries a practical cost that has to be confronted directly: running a gradient update inside every forward pass is expensive, and if that cost is not managed carefully, the latency overhead makes Hope undeployable regardless of how good its memory system is.</p><p>This section is about how the paper brings that cost down to a level that is practical at inference time, what approximations are made to get there, and what the residual overhead looks like relative to a standard transformer.</p><h4>7.5.1 The Raw Cost of an Inner Update</h4><p>Before discussing approximations, it is worth being precise about what the inner loop update actually costs in its full, unapproximated form.</p><p>At each token x<span>t</span>&#8203;, the full inner update requires three things: a forward pass through the inner parameters &#981;<span>t</span>&#8203; to compute <span>f</span><sub><span>&#981;t</span></sub><span>&#8203;</span>&#8203;(x<span>t</span>&#8203;), a backward pass through &#981;<span>t</span>&#8203; to compute the gradient &#8711;&#981;<sub>L</sub>inner(&#981;t;xt), and a forward pass through the learned update rule <span>g&#920;</span>&#8203; to compute the parameter update &#916;&#981;<span>t</span>&#8203;.</p><p>For a standard transformer forward pass with L layers and hidden dimension dd d, the cost is <span>O</span>(Ld<sup><span>2</span></sup>) per token. The full inner update, because it requires an additional backward pass through &#981; and a forward pass through <span>g&#920;</span>&#8203;, adds a constant multiple of this cost per token, so the total per-token cost is <span>O</span>(cLd<sup><span>2</span></sup>) for some c&gt;1 that depends on the size of <span>g&#920;</span>&#8203;.</p><p>For large d and deep <span>g&#920;</span>&#8203;, this multiplier becomes prohibitive. A model that is 3 times more expensive per token than a standard transformer is not a practical inference system, regardless of its quality. The inference-time optimizations are therefore not optional refinements but necessary conditions for Hope to be deployable at all.</p><h4>7.5.2 Approximating the Gradient</h4><p>The most expensive component of the inner update is the backward pass to compute &#8711;<span>&#981;</span>&#8203;L<sub><span>inner</span></sub>&#8203;. Full backpropagation through &#981; costs roughly twice the forward pass through &#981; in FLOPs and requires storing all intermediate activations, which adds memory pressure proportional to the depth of &#981;.</p><p>The paper replaces the full gradient with a lightweight approximation computed directly from the forward pass activations, without a separate backward pass. The key observation is that for the local self-supervised objective used in the inner loop, the gradient signal is dominated by the prediction error at the output layer, and the deeper gradient terms are relatively small in magnitude for well-initialized &#981;.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215bkl%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5bkl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 424w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 848w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 1272w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215bkl%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png" width="1456" height="791" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:791,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:292502,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!5bkl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 424w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 848w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 1272w, https://substackcdn.com/image/fetch/$s_!5bkl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75a80fe-3176-4877-8b26-f1dc1ee86069_2720x1478.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Formally, the full gradient is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\nabla_\\phi \\mathcal{L}_{\\text{inner}} = \\sum_{\\ell=1}^{L_\\phi} \\frac{\\partial \\mathcal{L}_{\\text{inner}}}{\\partial \\phi^{(\\ell)}}&quot;,&quot;id&quot;:&quot;JXDLNWDSVJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#8203;where the sum runs over all layers &#8467; of the inner parameter network &#981;. The approximation retains only the last-layer gradient term and discards the deeper terms:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\nabla_\\phi \\mathcal{L}_{\\text{inner}} \\approx \\frac{\\partial \\mathcal{L}_{\\text{inner}}}{\\partial \\phi^{(L_\\phi)}}&quot;,&quot;id&quot;:&quot;IDPLXHBQUH&quot;}" data-component-name="LatexBlockToDOM"></div><p>&#8203;This is computable directly from the output activation and the prediction error, without any backward pass through the earlier layers of &#981;. The approximation loses the signal from how the prediction error propagates back through the intermediate representations, and this is the primary quality cost of the inference-time optimization. For inner parameters that have already adapted to a reasonable local context, this approximation is tight, because the early-layer gradients are small relative to the output-layer gradient. For inner parameters that are far from a good local solution, early in a new context window for example, the approximation is looser, and the inner loop converges more slowly than it would under the full gradient.</p><h4>7.5.3 Chunked Updates and Amortization</h4><p>Even with the gradient approximation, computing an inner update at every single token is wasteful because adjacent tokens within a chunk are highly correlated. The update that &#981; would make on token t is almost identical to the update it would make on token t+1 if the two tokens carry similar information, so computing both updates independently squanders compute on a negligible difference.</p><p>Hope addresses this through chunked updates, which directly mirrors the CMS chunk structure from section 7.2. Rather than updating &#981; on every token, the inner loop accumulates a gradient estimate across a chunk of <span>C</span> tokens and applies a single update at the chunk boundary:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\phi_{i+1} = \\phi_i - g_\\Theta\\left(\\phi_i, \\, \\frac{1}{C}\\sum_{t=iC}^{(i+1)C} \\nabla_\\phi \\mathcal{L}_{\\text{inner}}(\\phi_i; x_t)\\right)&quot;,&quot;id&quot;:&quot;EPMGKTFVZJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The gradient is averaged over the chunk, which has two benefits beyond compute savings. The averaged gradient is a lower-variance estimate of the true local gradient than any single token&#8217;s gradient, so the update is more stable. Additionally, averaging across a chunk means the update reflects the aggregate local context rather than any single token&#8217;s idiosyncratic signal, which makes &#981; more robust to individual noisy or uninformative tokens.</p><p>The amortized cost per token of the inner update is now 1<span>/C</span>&#8203; of the per-token cost, since one update is shared across <span>C</span> tokens. For a chunk size of <span>C</span>=64, the overhead of the inner loop drops to less than 2% of the total forward pass cost per token, which is negligible in practice.</p><h4>7.5.4 KV Cache Compatibility</h4><p>A practical concern that is easy to overlook is how inner loop updates interact with the KV cache, the mechanism that makes autoregressive generation efficient by storing past keys and values to avoid recomputing attention over the full context at every step.</p><p>In a standard transformer, the KV cache is valid indefinitely because the attention weights are frozen. In Hope, the inner parameters &#981; change at each chunk boundary, so any KV cache entries computed under the old &#981; are no longer exactly valid under the new &#981;.</p><p>The paper handles this with a partial cache invalidation strategy. At each chunk boundary, only the KV entries corresponding to the most recent chunk are recomputed under the updated &#981;. Older KV entries, from chunks far back in the context, are retained without recomputation. The justification is that the inner update at chunk ii i represents a small perturbation to &#981;, so the keys and values computed under &#981;<sub><span>i&#8722;1</span></sub>&#8203; are close to what &#981;<sub><span>i</span></sub>&#8203; would compute for the same tokens, and the approximation error is bounded by the magnitude of the inner update, which is already constrained by the clipping from section 7.4.3.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FVRl%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FVRl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 424w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 848w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FVRl%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png" width="1456" height="668" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:668,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:206014,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FVRl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 424w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 848w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!FVRl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e79e267-bbb9-40f5-9d04-a750e9a4d998_2720x1248.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This selective cache invalidation means the KV cache overhead of Hope is slightly larger than that of a standard transformer (because recent entries are periodically recomputed) but not dramatically so, since the cost is amortized across the chunk size <span>C</span> and the recomputed entries are only the most recent <span>C</span> tokens.</p><h4>7.5.5 Net Overhead Relative to a Standard Transformer</h4><p>With all three optimizations in place (gradient approximation, chunked updates, and selective cache invalidation), the per-token inference cost of Hope relative to a standard transformer at equivalent parameter count can be summarized as follows:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ABwY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 424w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 848w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 1272w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ABwY%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png" width="1456" height="364" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/deae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:364,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:149520,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ABwY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 424w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 848w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 1272w, https://substackcdn.com/image/fetch/$s_!ABwY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeae5c48-d3b9-48a6-9cf3-c3a85c73542b_2178x544.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The 10-15% overhead figure assumes a moderately sized <span>g&#920;</span>&#8203; and a chunk size of 64. Larger chunk sizes reduce the overhead further at the cost of slower inner loop adaptation. Smaller chunk sizes increase the overhead but make &#981; more responsive to rapid context shifts.</p><p>The memory overhead is more significant than the compute overhead. Storing &#981; separately from &#920; doubles the parameter count of the self-modifying module, and keeping the chunk gradient accumulation buffer in VRAM adds memory proportional to the chunk size and the inner parameter dimension. In practice, the total memory footprint of Hope is roughly 20-25% larger than a standard transformer at the same layer count and hidden dimension, with most of the excess coming from the dual parameter representation rather than the gradient buffers.</p><h3>7.6 Muon and the Multi-Scale Momentum Optimizer (M3)</h3><p>The methodology sections so far have focused on what the model learns and how it stores that learning like the CMS, the SMLM, the nested update structure; but, there is a fourth piece that sits underneath all of this and is easy to overlook: what optimizer is actually running the outer loop? The paper argues that the standard answer : Adam is not just suboptimal but structurally mismatched with the Nested Learning paradigm. This is where <em><strong>Muon</strong></em> enters.</p><h4>7.6.1 What is Muon?</h4><p>Muon stands for <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2601.19156">Momentum Orthogonalized by Newton-Schulz</a>. It is an optimizer designed specifically for the 2D weight matrices of neural network hidden layers, and its core idea is deceptively simple: take the momentum gradient update that SGD-momentum would normally apply, and replace it with the nearest semi-orthogonal matrix to that update before applying it to the weights.</p><p>Formally, given a weight matrix gradient G&#8712;R<sub>n&#215;m</sub> with singular value decomposition G=USV<sup>&#8868;</sup>, the Muon update replaces G with:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Ortho}(G) = UV^\\top&quot;,&quot;id&quot;:&quot;SEGRAARXVN&quot;}" data-component-name="LatexBlockToDOM"></div><p>The singular values in S which encode the magnitude of the gradient in each direction are discarded entirely. What remains is only the directional information: which directions in weight space the gradient is pointing, stripped of any scale differences between them.</p><p>This is computed not via full SVD, which is prohibitively slow, but via a Newton-Schulz matrix iteration that converges to <span>UV</span><sup><span>&#8868;</span></sup> in just 5 steps and can be run stably in bfloat16:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;G&#8217; = aG + b(GG^\\top)G + c(GG^\\top)^2G&quot;,&quot;id&quot;:&quot;BTNMCRHTVQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>where the coefficients (a,b,c)=(3.4445,&#8722;4.7750,2.0315) are tuned to maximize convergence speed. Each application of this quintic polynomial pushes the singular values of G<span>&#8242;</span> closer to 1, and after 5 iterations the result is within a small tolerance of true orthogonalization. The FLOP overhead relative to standard training is at most <span>T</span>m/<span>B</span> where <span>T</span>=5 is the number of Newton-Schulz steps, m is the model dimension, and <span>B</span> is the batch size in tokens in practice under 1% for typical LLM training scenarios.</p><h4>7.6.2 Why Standard Optimizers Fall Short</h4><p>To understand why Muon matters for Nested Learning specifically, you need to understand what the paper argues is wrong with Adam as a gradient compressor.</p><p>Recall from section 7.1 that NL frames gradient-based optimizers as associative memory modules, compressing a context flow (the gradient history) into a fixed representation (the optimizer state). Adam does this compression through two running statistics: the first moment mtm_t m<span>t</span>&#8203; (a weighted average of past gradients) and the second moment <span>v</span><sub><span>t</span></sub>&#8203; (a weighted average of past squared gradients):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;m_t = \\beta_1 m_{t-1} + (1-\\beta_1) g_t \\hspace{2em} v_t = \\beta_2 v_{t-1} + (1-\\beta_2) g_t^2&quot;,&quot;id&quot;:&quot;YNRNDHPMVB&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_{t+1} = \\theta_t - \\eta \\frac{m_t}{\\sqrt{v_t} + \\epsilon}&quot;,&quot;id&quot;:&quot;YAIYDJNODJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The second moment term v<sub><span>t</span></sub>&#8203; acts as a per-coordinate scaling as it divides each gradient component by an estimate of its typical magnitude. This is beneficial when gradient components have very different scales, which is common in embedding layers and output heads. However, for the hidden 2D weight matrices of a transformer, the paper argues this coordinate-wise scaling is actively harmful. The gradient matrices for these layers typically have very high condition number as they are nearly low-rank, with most of the gradient signal dominated by a small number of directions. Adam&#8217;s coordinate-wise scaling does nothing to address this structural problem. It scales each entry independently, without any awareness of the matrix structure of the parameter it is updating.</p><p>The result is that the effective update applied by Adam to a 2D weight matrix is dominated by the same few high-singular-value directions in every step, with the rare but important directions; as the ones corresponding to small singular values consistently underweighted (mostly). The model learns the dominant directions fast and the rare directions slowly, regardless of how important those rare directions might be.</p><p>Orthogonalization fixes this by definition. By replacing G with <span>UV</span><sup><span>&#8868;</span></sup>, Muon equalizes all singular values to 1; hence every direction in weight space receives an update of equal magnitude, regardless of how large or small the corresponding gradient component was. Rare directions are no longer suppressed by the dominance of the common ones.</p><h4>7.6.3 How Muon Connects to the NL Paradigm</h4><p>The connection to Nested Learning is direct. In the NL framing, every optimizer is a memory module compressing gradient context into a parameter update. The question is which compression is optimal for which context flow.</p><p>The paper makes a specific argument: for the 2D hidden weight matrices, the relevant context flow is a sequence of gradient matrices with high condition number and near-low-rank structure. The optimal compression of this context flow, under a spectral norm objective rather than the element-wise L<span>2</span>&#8203; objective that motivates Adam, is precisely the orthogonalized gradient. Adam is the optimal associative memory for element-wise L<span>2</span>&#8203; regression on gradient vectors. Muon is the better-suited memory for the matrix-structured gradient context of hidden layers.</p><p>This is not just a philosophical point. It means that different components of the network should be optimized by different optimizers, chosen based on the structure of their gradient context flows like the corresponding embedding layers and output heads, whose gradients don&#8217;t have the same near-low-rank matrix structure, continue to use Adam. Only the hidden 2D weight matrices switch to Muon. The optimizer is no longer a single global choice but a per-component decision made on the basis of what each component&#8217;s gradient context looks like.</p><h4>7.6.4 M3 : Multi-Scale Momentum Muon</h4><p>The paper&#8217;s own contribution on top of Muon is the Multi-Scale Momentum Muon optimizer, abbreviated as M3. The motivation follows directly from the CMS design in section 7.2. If CMS showed that memory systems benefit from operating at multiple timescales simultaneously, the same logic applies to the gradient compressor which is the optimizer.</p><p>Standard Muon maintains a single momentum term at a single timescale:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;m_t = \\beta m_{t-1} + (1-\\beta)g_t \\hspace{2em} \\theta_{t+1} = \\theta_t - \\eta \\cdot \\text{Ortho}(m_t)&quot;,&quot;id&quot;:&quot;MIVGCQDTWW&quot;}" data-component-name="LatexBlockToDOM"></div><p>M3 replaces this with a chain of momentum terms at different decay rates, mirroring the CMS chain structure:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;m_t^{(k)} = \\beta_k m_{t-1}^{(k)} + (1-\\beta_k) g_t \\hspace{2em} k = 1, 2, \\ldots, K&quot;,&quot;id&quot;:&quot;MPXCZEFCFV&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\theta_{t+1} = \\theta_t - \\eta \\cdot \\text{Ortho}\\left(\\sum_{k=1}^{K} \\alpha_k m_t^{(k)}\\right)&quot;,&quot;id&quot;:&quot;AUAAKGWCSM&quot;}" data-component-name="LatexBlockToDOM"></div><p>where&#8203; each momentum term (&#946;1&#8203;&gt;&#946;2&#8203;&gt;&#8943;&gt;&#946;K) has a different decay rate, compressing gradient history over a different timescale. The fast momentum terms (<span>&#946;k</span>&#8203; close to 0) respond quickly to recent gradients. The slow momentum terms (<span>&#946;k</span>&#8203; close to 1) compress a long history of gradient information, encoding stable long-run directional structure. The final update is a weighted combination of all timescales, orthogonalized before being applied.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yro6%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yro6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 424w, https://substackcdn.com/image/fetch/$s_!yro6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 848w, https://substackcdn.com/image/fetch/$s_!yro6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 1272w, https://substackcdn.com/image/fetch/$s_!yro6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yro6%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png" width="504" height="512.3168316831683" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:616,&quot;width&quot;:606,&quot;resizeWidth&quot;:504,&quot;bytes&quot;:156572,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yro6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 424w, https://substackcdn.com/image/fetch/$s_!yro6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 848w, https://substackcdn.com/image/fetch/$s_!yro6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 1272w, https://substackcdn.com/image/fetch/$s_!yro6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c987331-91dc-4311-8b15-83ac973cbd37_606x616.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The intuition is the same as CMS: no single timescale captures everything. A single <span>&#946;</span>=0.9 momentum term compresses roughly the last 10 gradient steps. It loses information from step 100 and ignores information from step 2. M3 runs multiple compressors simultaneously and combines them, letting the optimizer retain signal from multiple depths of gradient history without having to choose a single window.</p><h4>7.6.5 Where M3 Sits in the Full Hope Architecture</h4><p>In the complete Hope architecture, the three optimization components map onto three distinct levels of the NL hierarchy:</p><ul><li><p>The <strong>inner loop</strong> (the SMLM update rule <span>g&#920;</span>&#8203;) handles inference-time adaptation, running at the fastest timescale and updating on every chunk.</p></li><li><p>The <strong>CMS chain</strong> handles multi-timescale memory storage, updating at intermediate frequencies across the sequence.</p></li><li><p><strong>M3</strong> handles outer loop training, running at the slowest timescale and compressing gradient history across the full training run into stable weight updates</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jZ1p%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jZ1p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 424w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 848w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 1272w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jZ1p%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png" width="610" height="394.6565934065934" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:942,&quot;width&quot;:1456,&quot;resizeWidth&quot;:610,&quot;bytes&quot;:395942,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jZ1p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 424w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 848w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 1272w, https://substackcdn.com/image/fetch/$s_!jZ1p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00f12766-fed7-4a83-aa29-4c239213450b_2720x1760.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each level compresses its own context flow at its own frequency. M3 is the outermost and slowest level (as we saw abaove) the one responsible for the kind of long-run structural learning that persists across training. Its multi-momentum design ensures that this compression is as expressive as possible, retaining signal from multiple depths of gradient history rather than collapsing everything into a single exponential moving average.</p><div><hr></div><h1>8. Results and Outcomes</h1><p>The paper evaluates Hope across four task categories: language modeling, common-sense reasoning, long-context reasoning, and formal language recognition. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PG2u%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PG2u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 424w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 848w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 1272w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PG2u%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png" width="1456" height="431" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:431,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114483,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!PG2u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 424w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 848w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 1272w, https://substackcdn.com/image/fetch/$s_!PG2u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82a2bb7e-bf87-47e1-87b1-594d5a75650f_1647x487.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Baselines include Transformer++, RetNet, DeltaNet, Samba, Mamba2, TTT, and the original Titans, evaluated at 340M, 760M, and 1.3B parameter scales, all trained on 30B to 100B tokens from The Pile.</p><h4>8.1 Language Modeling and Common-Sense Reasoning</h4><p>At the 1.3B parameter scale, Hope achieves the highest average accuracy of 57.23% on reasoning tasks and the lowest perplexity of 15.11 on the Wiki benchmark, outperforming Transformer++, RetNet, DeltaNet, and the original Titans.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mCgY%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mCgY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 424w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 848w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 1272w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mCgY%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png" width="972" height="432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:432,&quot;width&quot;:972,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:130264,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mCgY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 424w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 848w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 1272w, https://substackcdn.com/image/fetch/$s_!mCgY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f093a57-8043-47e2-9904-8a4c26cd91ec_972x432.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Across language modeling and common-sense reasoning tasks, Hope demonstrates lower perplexity and higher accuracy compared to modern recurrent models and standard transformers. The margin over Titans is meaningful because Titans already represented the state of the art among memory-augmented sequence models, so Hope&#8217;s improvement is not against a weak baseline. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-J2o%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-J2o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 424w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 848w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 1272w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-J2o%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png" width="970" height="287" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:287,&quot;width&quot;:970,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109512,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70563f16-0c82-48c5-9c76-7d257705cb8a_970x297.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-J2o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 424w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 848w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 1272w, https://substackcdn.com/image/fetch/$s_!-J2o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9910ab2e-7729-4fc8-91a4-f1df00415f7b_970x287.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The gain comes specifically from two places: the self-modifying update rule adapts the inner parameters to the local context more expressively than Titans&#8217; fixed surprise signal, and the CMS chain provides multi-timescale memory that recovers information at longer ranges than Titans&#8217; single long-term memory module.</p><h4>8.2 Long-Context Reasoning</h4><p>Hope showcases superior memory management in long-context Needle-In-Haystack (NIAH) downstream tasks, proving that the CMS offers a more efficient and effective way to handle extended sequences of information, outperforming Titans, TTT, and Mamba2. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xavp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xavp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 424w, https://substackcdn.com/image/fetch/$s_!xavp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 848w, https://substackcdn.com/image/fetch/$s_!xavp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 1272w, https://substackcdn.com/image/fetch/$s_!xavp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xavp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png" width="528" height="460.32576769025366" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:653,&quot;width&quot;:749,&quot;resizeWidth&quot;:528,&quot;bytes&quot;:153906,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xavp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 424w, https://substackcdn.com/image/fetch/$s_!xavp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 848w, https://substackcdn.com/image/fetch/$s_!xavp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 1272w, https://substackcdn.com/image/fetch/$s_!xavp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcf9eb36-95d7-41e2-b1c6-c4adb27465d9_749x653.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>NIAH is a particularly diagnostic benchmark for a continuously-learning memory system because it requires retrieving a specific piece of information planted early in a very long context, after processing a large amount of intervening noise. Standard transformers fail here because the relevant token falls outside the attention window. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NdsJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NdsJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 424w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 848w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 1272w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NdsJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png" width="436" height="397" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:397,&quot;width&quot;:436,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81754,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!NdsJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 424w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 848w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 1272w, https://substackcdn.com/image/fetch/$s_!NdsJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5cbb94b-52eb-4679-9d4f-bb567e30f90d_436x397.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>RAG-based systems can fail when the retriever doesn&#8217;t surface the right document. Hope&#8217;s CMS chain handles it by encoding the planted fact into a slow-frequency block whose chunk window is large enough to span the distance between the fact and the query.</p><h4>8.3 Formal Language Recognition</h4><p>Hope achieves perfect accuracy on formal language recognition tasks where standard transformers fail, leveraging non-parallelizable computation enabled by its nested recurrent structure.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b6Qm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b6Qm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 424w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 848w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 1272w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b6Qm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png" width="1251" height="395" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:395,&quot;width&quot;:1251,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97258,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b6Qm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 424w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 848w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 1272w, https://substackcdn.com/image/fetch/$s_!b6Qm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77e395a8-ca92-42ea-904f-3c9967801d79_1251x395.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Formal language recognition is a stress test for computational depth rather than memory capacity. Certain formal languages, particularly those requiring counting or stack-based operations, cannot be recognized by a standard transformer because the attention mechanism&#8217;s parallelism prevents the kind of sequential state accumulation these tasks need. Hope&#8217;s nested recurrent structure, where the inner loop updates &#981; sequentially across each chunk, provides exactly the kind of iterative computation that transformers structurally cannot perform.</p><h4>8.4 Muon and M3 : Optimizer Benchmarks</h4><p>The paper evaluates M3 against AdamW and Muon on two axes: quality and training cost.</p><p>M3 consistently occupies the bottom-left quadrant; i.e. lower train loss and lower test loss simultaneously across multiple hyperparameter configurations. AdamW clusters further right and higher, indicating both worse generalization and worse training fit. Standard Muon sits between the two, better than AdamW but consistently outperformed by M3. The shaded pink region marks the Pareto-optimal zone; M3 configurations dominate it almost entirely across both the smaller and larger model scales shown.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZM8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gZM8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 424w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 848w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 1272w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZM8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png" width="1031" height="499" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:1031,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86178,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!gZM8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 424w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 848w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 1272w, https://substackcdn.com/image/fetch/$s_!gZM8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda3679d-1f58-4cd7-8cea-1c4840ec3a73_1031x499.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When evaluating at scale; for 140M parameters M3 takes roughly 43 hours versus 38 hours for Muon and 41 hours for AdaMuon. At 1.3B parameters, M3 takes roughly 79 hours versus 70 hours for Muon and 75 hours for AdaMuon. The overhead is real but modest as it is approximately 10 to 15% above standard Muon and consistent with the theoretical estimate from section 7.5 that the multi-momentum bookkeeping adds bounded cost proportional to the number of momentum terms K.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Crtv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Crtv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 424w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 848w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 1272w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Crtv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png" width="345" height="313.57923497267757" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:549,&quot;resizeWidth&quot;:345,&quot;bytes&quot;:70019,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/202300851?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!Crtv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 424w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 848w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 1272w, https://substackcdn.com/image/fetch/$s_!Crtv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e96202d-165b-41aa-9d9c-7f6d603d7243_549x499.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The quality gain from Figure 11 outweighs the cost overhead from Figure 12 by a meaningful margin, which is the paper&#8217;s central argument for M3 as the right outer loop optimizer for Hope.</p><div><hr></div><h1>9. Thoughts</h1><p>The Nested Learning paradigm is genuinely ambitious, and Hope validates it as a proof of concept. But several questions sit underneath the benchmark numbers that deserve honest examination.</p><ul><li><p><strong>No comparison against a strong RAG baseline :</strong> Hope was not evaluated head-to-head against a strong RAG baseline on knowledge incorporation tasks. NIAH is a synthetic retrieval benchmark where the needle is planted deliberately. A real-world retrieval task with a well-tuned RAG system could tell a very different story, and the absence of that comparison leaves the paper&#8217;s central motivation empirically unresolved.</p></li><li><p><strong>The data ordering tax is a hidden deployment cost :</strong> Standard LLM training pipelines shuffle aggressively, deduplicate across document boundaries, and mix domains without regard for within-sequence coherence. Hope&#8217;s inner loop depends on that coherence to produce useful chunk-level updates. This is not a minor engineering note. It means adopting Hope at scale requires rethinking the data pipeline from the ground up, an invisible cost the benchmark numbers do not reflect.</p></li><li><p><strong>The chunk size selection problem has no principled answer right now : </strong>The CMS design shows that more frequency levels help, but the paper does not give a method for choosing the chunk size schedule. At 1.3B parameters with a small fixed set of chunk sizes, this is manageable. At 10B or 70B, with longer contexts and more diverse data distributions, the wrong frequency schedule could waste most of the multi-timescale benefit. This feels like the kind of hyperparameter that will require its own line of research before CMS is reliably deployable.</p></li><li><p><strong>M3 is the most immediately usable contribution :</strong> Unlike Hope, which requires rearchitecting the full model and training pipeline, M3 can be dropped into any existing training setup as a replacement for Adam on hidden layer parameters. The overhead is bounded and predictable, the quality gains are consistent across scales, and it requires no changes to inference. The community will likely adopt M3 independently of whether Hope itself gains traction, and the paper somewhat undersells this.</p></li><li><p><strong>The inner loop overhead scaling is uncharacterized beyond 1.3B.</strong> The 10 to 15% per-token overhead estimate from section 7.5 holds under specific assumptions about chunk size and model dimension. At larger scales, the interaction between growing model dimension, longer contexts, and the chunked update approximations introduces compounding factors that have not been studied. It is plausible that the overhead remains bounded, but it is equally plausible that it grows in ways the current analysis does not capture.</p></li><li><p><strong>The most profound implication is what NL says about the design space.</strong> If optimizers, architectures, and learning algorithms are all instances of the same underlying operation, then the field has been exploring a very small corner of what is possible. We have been treating the model and the thing that trains the model as categorically separate objects. Nested Learning dissolves that boundary. Hope is a first-order approximation of what emerges when you take that dissolution seriously. The more interesting architectures are the ones that come after it.</p></li></ul><div><hr></div><h1>10. Conclusion</h1><p>Nested Learning reframes the entire machinery of deep learning, not as a stack of layers trained by an external optimizer, but as a coherent system of nested optimization problems, each compressing its own context flow at its own frequency. Through this lens, the boundary between architecture and optimizer dissolves, the boundary between training and inference softens, and the design space for future models expands in a dimension the field has barely begun to explore.</p><p>In this article, we started by establishing why current models are structurally amnesiac as their knowledge is confined to either the immediate context window or the frozen weights of pretraining, and every mechanism built to work around this, from RAG to fine-tuning to in-context learning, is a patch on top of a system that was never designed to keep learning. We grounded the difficulty of the problem in the plasticity-stability tradeoff and the catastrophic forgetting problem, showing why continuous learning is not just an engineering challenge but a structural one.</p><p>We then built up the Nested Learning paradigm from first principles, revisiting the Titans architecture that first showed inference-time learning was possible, and tracing how Hope extends that foundation into a full multi-timescale system. We explored the Continuum Memory System, which replaces the binary long/short-term memory split with a spectrum of frequency levels each responsible for its own timescale of knowledge. We examined the Self-Modifying Titans module, whose inner loop learns not just what to update but how to update, making the adaptation mechanism itself a product of optimization. We introduced M3, which brings the same multi-timescale philosophy to the optimizer, replacing Adam&#8217;s single exponential average with a chain of momentum terms that compress gradient history at multiple depths simultaneously.</p><p>The key takeaway is that the static nature of current language models is not a fundamental constraint of the architecture class. It is a consequence of treating the model and its training procedure as two separate objects, one that learns and one that is learned. When you recognize them as the same kind of thing operating at different frequencies, a new design axis opens up. Hope is the first architecture to seriously inhabit that axis.</p><p>We are not yet at a model that learns the way a person does, continuously, selectively, without forgetting, weaving new knowledge into the substrate of old reasoning rather than retrieving it from an external store. But Nested Learning tells us what the path toward that model looks like. The question is no longer whether inference-time learning is possible. The question is how deep the nesting can go; this changes the entire framework and space on which we optimnize.</p><p>Paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2512.24695">https://arxiv.org/pdf/2512.24695</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That&#8217;s all for today.<br><br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p>]]></content:encoded></item><item><title><![CDATA[Transformers for Video: TimeSformer]]></title><description><![CDATA[TimeSformer brings Transformers to video by turning frames into patch tokens and using attention to model motion across time.]]></description><link>https://vizuara.substack.com/p/transformers-for-video-timesformer</link><guid isPermaLink="false">https://vizuara.substack.com/p/transformers-for-video-timesformer</guid><dc:creator><![CDATA[Mayank Pratap Singh]]></dc:creator><pubDate>Sat, 27 Jun 2026 04:14:05 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21H7oG%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21H7oG%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H7oG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 424w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 848w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 1272w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21H7oG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2960823,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!H7oG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 424w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 848w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 1272w, https://substackcdn.com/image/fetch/$s_!H7oG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f173764-426f-4084-aa86-0c21f48bb4b0_1456x1048.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>This chapter covers</strong></p><ul><li><p>Why video classification needs both spatial and temporal reasoning</p></li><li><p>How a video clip becomes a sequence of patch tokens</p></li><li><p>The self-attention equations used inside TimeSformer</p></li><li><p>Five space-time attention patterns: space-only, joint, divided, sparse local-global, and axial</p></li><li><p>Why divided space-time attention gives the best accuracy-efficiency tradeoff</p></li><li><p>How TimeSformer compares with 3D convolutional video models</p></li><li><p>How attention visualizations show what the model learns from video</p></li></ul><p>Architectures like Vision Transformers and Convolutional Neural Networks treat an individual image as the core unit of visual understanding. Though analyzing them can be difficult, a single image remains a fixed grid of pixels. Video, however, adds the dimension of time; it is a sequence of images where meaning and labels heavily depend on observing how the scene evolves across frames.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>TimeSformer, introduced by <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2102.05095">Bertasius, Wang, and Torresani in the ICML 2021 paper </a><em><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2102.05095"><span>Is Space-Time Attention All You Need for Video Understanding?</span></a></em>, asks a direct question: can we build a strong video recognition model using self-attention alone, without 3D convolutions? The answer from the paper is yes, provided that attention is arranged carefully over the space-time volume of a video clip.</p><p>The model starts from the Vision Transformer idea: split visual data into patches, embed those patches as tokens, add positional information, and feed the tokens to a transformer encoder. The difference is that a video has patches across both space and time. If every patch in every frame attends to every other patch, the computation becomes expensive very quickly. TimeSformer is mostly about how to make that attention usable.</p><blockquote><p><strong>Note</strong></p><p>In this chapter, the word <em>video</em> means the visual stream only. TimeSformer, as presented in the paper, does not use the audio track. The task studied here is video classification: given a clip, predict one action label for the whole clip.</p></blockquote><h1>1.1 From images to videos</h1><p>A still image classifier can sometimes solve a video task by looking at one frame. If the clip shows a cricket batter at the crease or a basketball player on the court, one frame may already contain enough context. But many action labels depend on motion. A frame from a push-up and a frame from a high plank can look nearly identical, while the sequence of frames makes the difference obvious.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Nv_P%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nv_P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 424w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 848w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Nv_P%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png" width="1431" height="1038" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1038,&quot;width&quot;:1431,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:956691,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nv_P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 424w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 848w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!Nv_P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4d93d0-2b5f-4305-a72d-a7ea0fa433a3_1431x1038.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.1.</span></strong> Static image classification can fail when two actions share nearly identical individual frames. In this example, a push-up and a high plank may look similar in a single snapshot. A video model must use the order of frames to detect whether the body is moving through an action or holding a static pose.</em></p><p>Figure 1.1 captures the central problem. A video model has to answer two questions at once: <em><span>what is visible?</span></em> and <em><span>how is it changing?</span></em> The first question is spatial. It concerns objects, body pose, background, and scene layout. The second is temporal. It concerns motion, ordering, repetition, and cause-effect patterns across frames.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Oirj%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Oirj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 424w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 848w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 1272w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Oirj%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png" width="1456" height="494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:445303,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Oirj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 424w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 848w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 1272w, https://substackcdn.com/image/fetch/$s_!Oirj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9f1684a-b403-4717-9c6b-8005434fdeb2_1644x558.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p><em><strong><span>Figure 1.2.</span></strong> A video clip can be viewed as a sequence of images ordered along time. Each frame can be divided into patches, just as in a Vision Transformer, but the model now receives many grids of patches instead of one. The token sequence therefore grows with both image resolution and the number of frames.</em></p><p>The Kinetics datasets used in the TimeSformer paper contain short videos of human actions. They include labels such as headbanging, stretching a leg, shaking hands, tickling, robot dancing, and salsa dancing. Some labels are strongly tied to appearance; others require motion to disambiguate the action.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZJS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gZJS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 424w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 848w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 1272w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZJS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png" width="1456" height="857" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:857,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1507810,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gZJS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 424w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 848w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 1272w, https://substackcdn.com/image/fetch/$s_!gZJS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32c589c1-9309-42fb-9a29-34f7ec536c52_1620x954.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.3.</span></strong> Examples from a Kinetics-style action recognition dataset. The model receives a short clip and predicts one action category for the whole clip. The examples show why both spatial context and temporal evidence matter: the person, object, and scene provide cues, but the action is often defined by movement across frames.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21e2As%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e2As!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 424w, https://substackcdn.com/image/fetch/$s_!e2As!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 848w, https://substackcdn.com/image/fetch/$s_!e2As!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 1272w, https://substackcdn.com/image/fetch/$s_!e2As!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21e2As%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png" width="1098" height="663" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:663,&quot;width&quot;:1098,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:687029,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e2As!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 424w, https://substackcdn.com/image/fetch/$s_!e2As!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 848w, https://substackcdn.com/image/fetch/$s_!e2As!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 1272w, https://substackcdn.com/image/fetch/$s_!e2As!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99e28e51-8f0a-4b06-a176-b05a917a0efb_1098x663.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.4.</span></strong> Some video labels can be predicted mostly from spatial context. A single frame of cricket or basketball already contains strong cues from the player, equipment, pose, and scene. TimeSformer still processes the clip as video, but examples like these explain why space-only attention can perform reasonably well on datasets with strong scene bias.</em></p><p><em>The opposite case is the reason TimeSformer is interesting. When appearance alone is ambiguous, the model needs to compare a region in one frame with related regions in later frames. This is where temporal attention enters.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j2G4%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j2G4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 424w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 848w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 1272w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j2G4%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png" width="1456" height="453" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:453,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1014370,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j2G4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 424w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 848w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 1272w, https://substackcdn.com/image/fetch/$s_!j2G4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36cdc8d2-4a79-4df4-b048-d7da53c913ef_1611x501.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.5.</span></strong> Spatial attention and temporal attention answer different questions. Spatial attention compares patches within a frame, such as the relationship between a hand, body, and background. Temporal attention compares corresponding or related patches across frames, allowing the model to represent motion and change over time.</em></p><h1>1.2 Turning a video into tokens</h1><p>TimeSformer follows the same tokenization idea as ViT, but applies it to every frame in a video clip. Let the input clip be</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;X \\in \\mathbb{R}^{F \\times H \\times W \\times 3},&quot;,&quot;id&quot;:&quot;XJJSWOSQAI&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <em>F</em> is the number of frames, <em>H</em> and <em>W</em> are the frame height and width, and the last dimension stores <em>RGB channels</em>. The <strong>TimeSformer</strong> paper writes the dimensions as <em>H X W X 3 X F;</em> both notations describe the same video volume.</p><p>Each frame is divided into non-overlapping patches of size <em>P x P.</em> The number of spatial patches per frame is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;N = \\frac{H}{P} \\cdot \\frac{W}{P}\n  = \\frac{HW}{P^2}.&quot;,&quot;id&quot;:&quot;HAZGRBLIDN&quot;}" data-component-name="LatexBlockToDOM"></div><p>Across <em>F</em> frames, the clip contains <em>NF</em> patch tokens. A learned classification token is prepended, so the total token count is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;M = NF + 1.&quot;,&quot;id&quot;:&quot;CWFEJUVBNX&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2136qM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!36qM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 424w, https://substackcdn.com/image/fetch/$s_!36qM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 848w, https://substackcdn.com/image/fetch/$s_!36qM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 1272w, https://substackcdn.com/image/fetch/$s_!36qM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2136qM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png" width="1456" height="777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:777,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:441727,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!36qM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 424w, https://substackcdn.com/image/fetch/$s_!36qM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 848w, https://substackcdn.com/image/fetch/$s_!36qM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 1272w, https://substackcdn.com/image/fetch/$s_!36qM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88f36d98-29a5-4484-9674-cb2d7d50b9a7_1608x858.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.6.</span></strong> Counting the number of tokens in a video transformer. A frame is divided into spatial patches, and this patch grid is repeated for every sampled frame. The total sequence length is therefore the number of patches per frame multiplied by the number of frames, plus one class token for video-level classification.</em></p><p>The default TimeSformer setting in the paper uses clips of <em>8 x 224 x 224</em> and a patch size of <em>16 x 16 pixels</em>. That gives</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;N = \\frac{224}{16} \\cdot \\frac{224}{16}\n  = 14 \\cdot 14\n  = 196&quot;,&quot;id&quot;:&quot;RNXSWYSMFH&quot;}" data-component-name="LatexBlockToDOM"></div><p>patches per frame and</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;M = 196 \\cdot 8 + 1 = 1569&quot;,&quot;id&quot;:&quot;XMVWRMGMRG&quot;}" data-component-name="LatexBlockToDOM"></div><p>tokens per clip. This is already much longer than the 197 tokens in a standard ViT image model with one 224 x 224 image and 16 x 16 patches.</p><p>For a patch at spatial index p and frame index t, the flattened RGB patch is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{p,t} \\in \\mathbb{R}^{3P^2}.&quot;,&quot;id&quot;:&quot;PAUPPEJPRC&quot;}" data-component-name="LatexBlockToDOM"></div><p>It is mapped to a D-dimensional embedding with a learned matrix E:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;z^{(0)}_{p,t} = E x_{p,t} + e^{\\mathrm{space}}_p + e^{\\mathrm{time}}_t.&quot;,&quot;id&quot;:&quot;ESIXRFVDTS&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, <em>e<sub>p</sub><sup>space </sup> </em>tells the model where the patch lies inside the frame, and <em>e<sub>t</sub><sup>time  </sup></em><sup> </sup>tells it which frame the patch came from. This separation is useful because a token has two coordinates: its spatial location and its temporal position.</p><h1>1.3 Self-attention over a video</h1><p>Once the clip is represented as tokens, TimeSformer uses the usual transformer ingredients: layer normalization, query-key-value projections, multi-head attention, residual connections, and an MLP. For head <em><strong>a</strong></em> in block <em><strong>l</strong> ,</em> query, key, and value vectors are computed as</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q^{(\\ell,a)}_{p,t}\n  = W^{(\\ell,a)}_Q \\operatorname{LN}\\!\\left(z^{(\\ell-1)}_{p,t}\\right),&quot;,&quot;id&quot;:&quot;UOQVBJGOHE&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;k^{(\\ell,a)}_{p,t}\n  = W^{(\\ell,a)}_K \\operatorname{LN}\\!\\left(z^{(\\ell-1)}_{p,t}\\right),&quot;,&quot;id&quot;:&quot;WFEGXFYQFH&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;v^{(\\ell,a)}_{p,t}\n  = W^{(\\ell,a)}_V \\operatorname{LN}\\!\\left(z^{(\\ell-1)}_{p,t}\\right).&quot;,&quot;id&quot;:&quot;TEQHVUSAPR&quot;}" data-component-name="LatexBlockToDOM"></div><p>The attention score between a query and a set of keys uses the same scaled dot-product rule as the original Transformer:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\alpha = \\operatorname{softmax}\\!\\left(\n  \\frac{qK^\\top}{\\sqrt{d_h}}\n\\right),&quot;,&quot;id&quot;:&quot;MRVBASDPIE&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <em>d<sub>h</sub> = D / A i</em>s the feature dimension of one attention head. The output for a query token is the weighted sum of value vectors:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s_{p,t} =\n  \\sum_{(p',t') \\in \\mathcal{N}(p,t)}\n  \\alpha_{(p,t),(p',t')} v_{p',t'}.&quot;,&quot;id&quot;:&quot;BCJJDWHVXJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The set</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{N}(p,t)&quot;,&quot;id&quot;:&quot;HGVLZQDGPJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>is the important part. It defines which tokens a query is allowed to attend to. TimeSformer compares several choices for this neighborhood.<br>After attention, the heads are concatenated, projected, and passed through a residual MLP:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;z^{(\\ell)}_{p,t}\n  = \\operatorname{MLP}\\!\\left(\\operatorname{LN}(z'_{p,t})\\right)\n  + z'_{p,t}.&quot;,&quot;id&quot;:&quot;GLENUZKDHJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The final video representation is taken from the output class token:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y = \\operatorname{LN}\\!\\left(z^{(L)}_{\\mathrm{cls}}\\right).&quot;,&quot;id&quot;:&quot;GAQOBCWATW&quot;}" data-component-name="LatexBlockToDOM"></div><p>A small classification head maps y to the video classes.</p><h1>1.4 Five attention patterns</h1><p>The TimeSformer paper studies five ways of arranging attention over space and time. The simplest way to understand them is to imagine choosing one query patch and asking: which other patches are allowed to become keys for this query?</p><h2>1.4.1 Space-only attention</h2><p>Space-only attention treats each frame almost like an independent image. A query patch attends to patches in the same frame, plus the class token:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{N}_S(p,t) =\n\\{\\mathrm{cls}\\}\n\\cup\n\\{(p',t) \\mid p' = 1,\\ldots,N\\}.&quot;,&quot;id&quot;:&quot;UEUTQFWBDK&quot;}" data-component-name="LatexBlockToDOM"></div><p>This needs only N+1 key comparisons per query patch. It is cheap, and it can work when static appearance gives most of the answer. But it cannot directly model how a patch changes across frames.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yblE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yblE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!yblE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!yblE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!yblE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yblE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png" width="1386" height="483" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:483,&quot;width&quot;:1386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:335394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yblE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!yblE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!yblE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!yblE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3422102-b096-4dbb-81a5-ee7edc5061e7_1386x483.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.7.</span></strong> Space-only attention. The query patch attends to patches within the same frame, but it does not directly compare itself with patches in earlier or later frames. This pattern is efficient and can work for appearance-biased labels, but it discards explicit temporal reasoning.</em></p><h2>1.4.2 Joint space-time attention</h2><p>Joint space-time attention is the most direct extension of ViT to video. A query patch attends to every patch in every frame:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{N}_{ST}(p,t) =\n\\{\\mathrm{cls}\\}\n\\cup\n\\{(p',t') \\mid p' = 1,\\ldots,N,\\; t' = 1,\\ldots,F\\}.&quot;,&quot;id&quot;:&quot;IEEXFWUSEG&quot;}" data-component-name="LatexBlockToDOM"></div><p>This gives the model full access to the video volume, but the cost grows quickly.</p><p>Each query compares against <em>NF+1 keys,</em> and the full attention matrix has size <em>(NF+1) x (NF+1).</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211J5r%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1J5r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211J5r%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png" width="1386" height="483" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:483,&quot;width&quot;:1386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:317936,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1J5r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!1J5r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb26996a0-51d5-4e4f-9916-d770cdaef770_1386x483.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.8.</span></strong> Joint space-time attention. The query patch can attend to all patches in all frames, giving the model a full global view of the clip. The drawback is computational cost: as resolution or video length increases, the number of pairwise comparisons becomes large enough to exhaust GPU memory.</em></p><p>For the default setting <em>N=196</em> and <em>F=8</em>, joint attention gives each query <em>1569</em> possible keys. For a long clip with <em>F=96</em>, the same spatial resolution would give <em>18,817</em> keys per query. This is why a naive global video transformer is difficult to scale.</p><h2>1.4.3 Divided space-time attention</h2><p>Divided space-time attention is the main TimeSformer design. It factorizes the work into two smaller attentions inside each transformer block:</p><ol><li><p>Temporal attention compares the same spatial patch location across frames.</p></li><li><p>Spatial attention compares patches within a frame.</p></li></ol><p>For temporal attention, the neighborhood is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{N}_T(p,t) =\n\\{\\mathrm{cls}\\}\n\\cup\n\\{(p,t') \\mid t' = 1,\\ldots,F\\}.&quot;,&quot;id&quot;:&quot;AQUPOMQPHN&quot;}" data-component-name="LatexBlockToDOM"></div><p>The output of temporal attention is fed into spatial attention, which then uses</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{N}_S(p,t)&quot;,&quot;id&quot;:&quot;ZNHJJHBRKT&quot;}" data-component-name="LatexBlockToDOM"></div><p>In residual form, a divided TimeSformer block can be summarized as</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde z_{p,t}\n  = z^{(\\ell-1)}_{p,t}\n  + \\operatorname{MSA}_T\\!\\left(\n      \\operatorname{LN}(z^{(\\ell-1)}_{p,t})\n    \\right),&quot;,&quot;id&quot;:&quot;AZWWVUJVMM&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat z_{p,t}\n  = \\tilde z_{p,t}\n  + \\operatorname{MSA}_S\\!\\left(\n      \\operatorname{LN}(\\tilde z_{p,t})\n    \\right),&quot;,&quot;id&quot;:&quot;WBYMPAALQG&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;z^{(\\ell)}_{p,t}\n  = \\hat z_{p,t}\n  + \\operatorname{MLP}\\!\\left(\n      \\operatorname{LN}(\\hat z_{p,t})\n    \\right).&quot;,&quot;id&quot;:&quot;YBDCKQMBHI&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217Hm5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7Hm5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 424w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 848w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 1272w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217Hm5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png" width="1456" height="475" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:475,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:339363,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7Hm5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 424w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 848w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 1272w, https://substackcdn.com/image/fetch/$s_!7Hm5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d504951-e6ab-4c38-9d5a-90ddb3e90604_1481x483.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.9.</span></strong> Divided space-time attention. The query first attends along the temporal axis at the same spatial patch location, then attends spatially within a frame. This gives the model access to both motion and appearance while avoiding the full quadratic cost of joint space-time attention.</em></p><p>Compared with <em>NF+1</em> comparisons per query for joint attention, divided attention uses only</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;(F+1) + (N+1) = N + F + 2&quot;,&quot;id&quot;:&quot;ZJZCNMBYJL&quot;}" data-component-name="LatexBlockToDOM"></div><p>comparisons per query patch. With <em>N=196</em> and <em>F=8</em>, this is 206 comparisons instead of 1569. With <em>F=96</em>, it is 294 instead of 18,817. The saving becomes larger as clips get longer.</p><h2>1.4.4 Sparse local-global attention</h2><p>Sparse local-global attention approximates full space-time attention by combining a local neighborhood with a sparse set of global locations. The local part captures nearby motion and appearance. The global part samples farther patches without attending to every possible location.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lWY3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lWY3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lWY3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png" width="1386" height="483" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eba36a98-709c-4239-857a-f791aff1c953_1386x483.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:483,&quot;width&quot;:1386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:335736,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lWY3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!lWY3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feba36a98-709c-4239-857a-f791aff1c953_1386x483.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.10.</span></strong> Sparse local-global attention. The query attends densely to a local space-time neighborhood and sparsely to farther locations. This gives the model some long-range context without paying the cost of full joint space-time attention. In the TimeSformer experiments, however, this pattern did not match divided attention&#8217;s accuracy.</em></p><h2>1.4.5 Axial attention</h2><p>Axial attention decomposes the video volume into one-dimensional passes. Instead of attending over the full space-time grid at once, it applies attention over time, then width, then height. This is another way to reduce cost by factorizing a high-dimensional attention problem.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21O485%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O485!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!O485!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!O485!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!O485!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21O485%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png" width="1386" height="483" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:483,&quot;width&quot;:1386,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:339934,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O485!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 424w, https://substackcdn.com/image/fetch/$s_!O485!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 848w, https://substackcdn.com/image/fetch/$s_!O485!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 1272w, https://substackcdn.com/image/fetch/$s_!O485!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e581d77-2420-45a3-914b-9f37c5b42865_1386x483.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.11.</span></strong> Axial attention. The model decomposes attention into separate passes along time, width, and height. This reduces the size of each attention operation, but it also imposes a stricter path for information flow through the video volume.</em></p><p>Figure 1.12 places the five attention blocks side by side. The diagrams also show where residual connections and MLP layers sit inside the block.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MH2V%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MH2V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 424w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 848w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 1272w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MH2V%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png" width="1395" height="2157" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2157,&quot;width&quot;:1395,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:148788,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MH2V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 424w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 848w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 1272w, https://substackcdn.com/image/fetch/$s_!MH2V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82c32273-9d8e-4575-a6f3-3486236a9f7c_1395x2157.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.12.</span></strong> The five TimeSformer attention block designs compared in one view. Space-only uses one spatial attention layer, joint space-time uses one global attention layer, divided space-time uses temporal attention followed by spatial attention, sparse local-global combines local and sparse global passes, and axial attention applies attention along time, width, and height.</em></p><h2>1.5 Why divided attention works well</h2><p>At first, joint space-time attention sounds like the strongest option because it lets every token directly compare itself with every other token. The experiments tell a more practical story. Joint attention is expressive, but it is expensive, and it does not give the model separate parameters for temporal and spatial interactions. Divided attention uses separate temporal and spatial query-key-value projections, so it has more specialized capacity while still doing less pairwise work.</p><p>The cost difference becomes clear when the spatial crop or the number of frames increases.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VUHy%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32607302-8373-431c-bca3-441762b6682e_869x609.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VUHy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 424w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 848w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 1272w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VUHy%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32607302-8373-431c-bca3-441762b6682e_869x609.png" width="869" height="609" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/32607302-8373-431c-bca3-441762b6682e_869x609.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:609,&quot;width&quot;:869,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:133169,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VUHy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 424w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 848w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 1272w, https://substackcdn.com/image/fetch/$s_!VUHy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32607302-8373-431c-bca3-441762b6682e_869x609.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.13.</span></strong> Computational cost comparison from the TimeSformer paper. Joint space-time attention becomes expensive as spatial crop size or input length grows, and it runs out of memory in the larger settings shown. Divided space-time attention scales more gently because it factorizes attention into temporal and spatial stages.</em></p><p>The accuracy comparison also favors divided attention.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kafR%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kafR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 424w, https://substackcdn.com/image/fetch/$s_!kafR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 848w, https://substackcdn.com/image/fetch/$s_!kafR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 1272w, https://substackcdn.com/image/fetch/$s_!kafR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kafR%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png" width="1012" height="496" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:496,&quot;width&quot;:1012,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108479,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kafR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 424w, https://substackcdn.com/image/fetch/$s_!kafR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 848w, https://substackcdn.com/image/fetch/$s_!kafR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 1272w, https://substackcdn.com/image/fetch/$s_!kafR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f36637-7429-4fc5-a1c5-100e35601cb6_1012x496.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.14.</span></strong> Video-level accuracy for the five attention schemes reported in the TimeSformer paper. Divided space-time attention obtains the best result on both Kinetics-400 and Something-Something-V2. Space-only attention performs well on Kinetics-400 but collapses on Something-Something-V2, which is a stronger test of temporal reasoning.</em></p><p>The table in Figure 1.14 is worth reading carefully. Space-only attention reaches 76.9% on Kinetics-400, which confirms that many Kinetics labels can be predicted from appearance. But it reaches only 36.6% on Something-Something-V2. That dataset contains labels where the same objects can appear in different actions, so temporal order matters much more. Divided attention reaches 78.0% on Kinetics-400 and 59.5% on Something-Something-V2, beating the other attention patterns in the paper&#8217;s comparison.</p><blockquote><p><strong>Note</strong></p><p>The main lesson is not that temporal attention should replace spatial attention. The lesson is that video classification needs both, but not necessarily in one huge attention matrix. TimeSformer gets a strong result by making time and space separate operations inside the same block.</p></blockquote><h2>1.6 An implementation view</h2><p>The implementation idea behind divided attention is simple once the tensor shape is clear. Suppose the token tensor, after removing or separately handling the class token, has shape</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x \\in \\mathbb{R}^{B \\times F \\times N \\times D},&quot;,&quot;id&quot;:&quot;DCWXRUXGXK&quot;}" data-component-name="LatexBlockToDOM"></div><p>where B is the batch size. Temporal attention should see F as the sequence dimension while keeping a fixed spatial patch index. Spatial attention should see N as the sequence dimension while keeping a fixed frame.</p><h4>Listing 1.1. </h4><p>The tensor reshaping pattern behind divided space-time attention. Temporal attention groups batch and spatial patch index together, so attention runs across frames. Spatial attention groups batch and frame index together, so attention runs across patches inside one frame.</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;ebcfca1c-76e7-4c4a-b8e4-e39b59978656&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python"># x has shape [B, F, N, D]

# Temporal attention: sequence length is F.
x_t = rearrange(x, "b f n d -&gt; (b n) f d")
x_t = temporal_attention(x_t, x_t, x_t)
x = rearrange(x_t, "(b n) f d -&gt; b f n d", n=N)

# Spatial attention: sequence length is N.
x_s = rearrange(x, "b f n d -&gt; (b f) n d")
x_s = spatial_attention(x_s, x_s, x_s)
x = rearrange(x_s, "(b f) n d -&gt; b f n d", f=F)</code></pre></div><p>Listing 1.1 is not a full TimeSformer implementation, but it captures the core trick. To apply temporal attention, we flatten the batch and patch dimensions into one larger batch and let the attention module process the frame dimension. To apply spatial attention, we flatten the batch and time dimensions and let the attention module process the patch dimension.</p><p>The full model also needs patch embedding, a class token, space and time positional embeddings, layer normalization, MLP blocks, and a classification head. These are inherited from the transformer and ViT design. TimeSformer&#8217;s main change is how attention is scheduled over a video.</p><h2>1.7 What the model learns</h2><p>Attention visualizations help make the model less abstract. When TimeSformer predicts a Something-Something-V2 action, the attended regions often track the object or the hand-object interaction that defines the action.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cqBM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F788da03e-a632-4a5a-a202-313baf80044a_996x546.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cqBM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 424w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 848w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 1272w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cqBM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F788da03e-a632-4a5a-a202-313baf80044a_996x546.png" width="996" height="546" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/788da03e-a632-4a5a-a202-313baf80044a_996x546.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:546,&quot;width&quot;:996,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:478200,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cqBM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 424w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 848w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 1272w, https://substackcdn.com/image/fetch/$s_!cqBM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F788da03e-a632-4a5a-a202-313baf80044a_996x546.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.15.</span></strong> Space-time attention visualization from the TimeSformer paper. The highlighted regions show that the model focuses on task-relevant areas, such as the hand and manipulated object, rather than spreading attention uniformly over the frame. This is the behavior expected from a model that must reason about actions, not just objects.</em></p><p>The paper also visualizes learned video embeddings with t-SNE. Each point represents a video, and videos with the same action label share a color. The divided-attention model forms more separable clusters than ViT or a space-only TimeSformer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gA8Y%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gA8Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 424w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 848w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 1272w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gA8Y%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png" width="1008" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1008,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:428019,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203580686?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gA8Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 424w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 848w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 1272w, https://substackcdn.com/image/fetch/$s_!gA8Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4cef252-4097-49f9-a3a9-a20e3e12e272_1008x637.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em><strong><span>Figure 1.16.</span></strong> Feature visualization from the TimeSformer paper. The divided space-time model forms more separated action clusters than a space-only model or a ViT baseline. This suggests that the temporal branch is not merely adding computation; it changes the learned representation in a way that separates actions more cleanly.</em></p><p>These visualizations do not prove causal reasoning by themselves, but they support the quantitative result: modeling time explicitly improves the representation for action recognition.</p><h1>1.8 Comparison with 3D convolutional models</h1><p>Before video transformers, strong video classifiers were usually built from 3D convolutions. A 3D convolution slides a local kernel over height, width, and time. This gives the model a built-in local motion bias, which is useful, but it also means long-range relationships must be built gradually through many layers.</p><p>TimeSformer takes a different route. Self-attention can connect distant patches directly, and divided attention keeps the cost manageable enough to process longer clips. The paper reports that the default TimeSformer has 121.4 million parameters but only 0.59 TFLOPs of inference cost for the reported setting, compared with 1.97 TFLOPs for a SlowFast R50 model in the same comparison. </p><p>The larger TimeSformer-L variant processes 96 input frames and reaches 80.7% top-1 accuracy on Kinetics-400 in the paper&#8217;s reported table.</p><p>The official TimeSformer repository provides pretrained model variants for Kinetics-400, Kinetics-600, Something-Something-V2, and HowTo100M, including longer-input models that cover much more temporal context than the default 8-frame setting. The Hugging Face Transformers documentation also exposes TimeSformer as a video classification model, which makes the architecture easier to reuse in modern transformer workflows.</p><p>The practical tradeoff is clear. TimeSformer benefits from image pretraining and large datasets, while 3D CNNs still offer strong inductive biases and can be easier to train in smaller-data settings. But the paper showed that a convolution-free video model was no longer just a curiosity. With the right attention pattern, transformers could compete seriously on video recognition.</p><h2>1.9 Resources</h2><p><strong>- Video:</strong> </p><p> In this video, <strong>Dr. Sreedath Panat</strong>. explains how to implement TimeSformer from scratch and walks through the main building</p><p>  blocks of the model.</p><p><a href="iframe.php?url=https%3A%2F%2Fyoutu.be%2FZAPorSv-Tas%3Fsi%3DhLIMGja45p3-EZAN">TimeSformer from Scratch</a></p><p><strong>- Paper:</strong> </p><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2102.05095">Is Space-Time Attention All You Need for Video Understanding?</a></p><p></p><h2>Summary</h2><ul><li><p>A video clip can be represented as a sequence of frame-level patches. If each frame has <em>N</em> patches and the clip has <em>F</em> frames, the transformer receives <em>NF+1</em> tokens, including the class token.</p></li><li><p>Space-only attention compares patches within the same frame. It is efficient and can work on appearance-biased datasets, but it cannot explicitly model motion across frames.</p></li><li><p>Joint space-time attention compares every patch with every patch in every frame. It is expressive, but its cost grows quickly with spatial resolution and clip length.</p></li><li><p>Divided space-time attention factorizes the work into temporal attention followed by spatial attention. This reduces the comparisons per query from <em>NF+1</em> to <em>N+F+2</em> while still modeling both motion and appearance.</p></li><li><p>In the TimeSformer paper&#8217;s comparison, divided space-time attention achieves the best accuracy among the five studied schemes on both Kinetics-400 and Something-Something-V2.</p></li><li><p>TimeSformer differs from 3D CNNs by replacing local convolutional kernels with attention over patch tokens. This gives it a direct route to long-range video modeling, especially when enough data and pretraining are available.</p></li><li><p>Attention and feature visualizations show that the divided model learns representations that focus on action-relevant regions and separate video classes more clearly than space-only variants.</p></li></ul><p></p><h1>More Blogs</h1><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;340a1ec6-4dbb-46c6-b3bf-ca4d0644373b&quot;,&quot;caption&quot;:&quot;This Blog Covers&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Diffusion Model Visual Breakdown&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-06-23T04:10:50.716Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!VKVq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif&quot;,&quot;cover_image_alt&quot;:null,&quot;cover_image_crop&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/diffusion-model-visual-breakdown&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:203080645,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:14,&quot;comment_count&quot;:3,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:190611987,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/the-transformers&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;The Transformers&quot;,&quot;truncated_body_text&quot;:&quot;The Transformer Architecture&quot;,&quot;date&quot;:&quot;2026-03-17T03:32:41.080Z&quot;,&quot;like_count&quot;:167,&quot;comment_count&quot;:5,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fthe-transformers%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">The Transformers</div></div><div class="embedded-post-body">The Transformer Architecture&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">8 months ago &#183; 167 likes &#183; 5 comments &#183; Mayank Pratap Singh</div></a></div><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:181494472,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/vision-transformers&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;Vision Transformers&quot;,&quot;truncated_body_text&quot;:&quot;Table of Contents&quot;,&quot;date&quot;:&quot;2026-03-22T04:10:41.659Z&quot;,&quot;like_count&quot;:71,&quot;comment_count&quot;:0,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fvision-transformers%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Vision Transformers</div></div><div class="embedded-post-body">Table of Contents&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">7 months ago &#183; 71 likes &#183; Mayank Pratap Singh</div></a></div><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:184705881,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/segment-anything-model-sam&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;Segment Anything Model (SAM)&quot;,&quot;truncated_body_text&quot;:&quot;Figure 0: Detailed Architecture of the Segment Anything Model (SAM).&quot;,&quot;date&quot;:&quot;2026-01-20T09:19:46.533Z&quot;,&quot;like_count&quot;:17,&quot;comment_count&quot;:0,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}},{&quot;id&quot;:136642032,&quot;name&quot;:&quot;Sreedath Panat&quot;,&quot;handle&quot;:&quot;drsreedathpanat&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fa047b9-4cee-4d9d-8ed7-4a63c5f919b4_974x1220.png&quot;,&quot;bio&quot;:&quot;I am the co-founder of Vizuara AI Labs and a PhD from MIT. I use this space to put down my thoughts and knowledge on AI/ML related topics.&quot;,&quot;profile_set_up_at&quot;:&quot;2024-12-26T07:33:54.300Z&quot;,&quot;reader_installed_at&quot;:&quot;2024-12-26T07:33:49.452Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:3662921,&quot;user_id&quot;:136642032,&quot;publication_id&quot;:3592712,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:3592712,&quot;name&quot;:&quot;Sreedath Panat&quot;,&quot;subdomain&quot;:&quot;panat&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;I am the co-founder of Vizuara AI Labs and a PhD from MIT. I use this space to put down my thoughts and knowledge on AI/ML related topics.&quot;,&quot;logo_url&quot;:null,&quot;author_id&quot;:136642032,&quot;primary_user_id&quot;:136642032,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-27T13:32:29.633Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Sreedath Panat&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fsegment-anything-model-sam%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Segment Anything Model (SAM)</div></div><div class="embedded-post-body">Figure 0: Detailed Architecture of the Segment Anything Model (SAM&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">9 months ago &#183; 17 likes &#183; Mayank Pratap Singh and Sreedath Panat</div></a></div><p>I&#8217;m also building Audio Deep Learning projects and LLM projects, sharing and discussing them on LinkedIn and Twitter. If you&#8217;re someone curious about these topics, I&#8217;d love to connect with you all!</p><p><strong>Mayank Pratap Singh</strong></p><p><strong>LinkedIn</strong> : <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fmayankpratapsingh022%2F">www.linkedin.com/in/mayankpratapsingh022</a></p><p><strong>Twitter/X</strong> : <a href="iframe.php?url=https%3A%2F%2Fx.com%2FMayank_022">x.com/Mayank_022</a>.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Diffusion Model Visual Breakdown]]></title><description><![CDATA[How diffusion models turn noise into images.]]></description><link>https://vizuara.substack.com/p/diffusion-model-visual-breakdown</link><guid isPermaLink="false">https://vizuara.substack.com/p/diffusion-model-visual-breakdown</guid><dc:creator><![CDATA[Mayank Pratap Singh]]></dc:creator><pubDate>Tue, 23 Jun 2026 04:10:50 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VKVq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VKVq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VKVq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 424w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 848w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 1272w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VKVq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3725379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VKVq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 424w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 848w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 1272w, https://substackcdn.com/image/fetch/$s_!VKVq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0b8b4a6-088b-43e4-8b6f-c009c256a680_1456x1048.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><strong>This Blog Covers</strong></p><ul><li><p>Why earlier generators such as GANs and VAEs left room for a different approach</p></li><li><p>The diffusion idea: learn to reverse a noising process</p></li><li><p>The small set of equations needed to read a DDPM diagram</p></li><li><p>How U-Nets, timestep embeddings, and latent spaces make diffusion practical</p></li><li><p>How conditioning and transformer backbones shape modern image generation</p></li></ul></blockquote><h1>1.0 Introduction</h1><p>Image generation used to be easy to describe and hard to train. A generator would take a random vector and try to turn it into a realistic image. If the image looked wrong, the training signal had to explain what was wrong. That sounds reasonable until you remember how many ways an image can fail. The subject can be distorted, the texture can be weak, the pose can collapse, the background can look fake, or the image can be sharp but repetitive. A single image is not one decision. It is a large collection of decisions that need to agree.</p><p>Diffusion models became important because they change the shape of the problem. Instead of asking a neural network to create a full image in one shot, they ask it to solve a much smaller task many times: given a noisy image, predict how to remove a little of the noise. The same model repeats that correction from heavy noise to a clean image. This makes generation feel less like a leap and more like a guided recovery process.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>This chapter starts with the older ideas because they explain why diffusion was such a useful turn. GANs showed that learned generators could make sharp, impressive images, but adversarial training could be fragile. VAEs showed that a model could learn a useful latent space, but samples often looked too smooth. Diffusion combines a different training target with a gradual sampling process. It is not free, since sampling can require many network calls, but the training signal is simple, stable, and visually powerful.</p><p>We will keep the math focused. You do not need a full derivation to understand why diffusion works. You need to know how clean images are mixed with Gaussian noise, why a timestep matters, what the denoiser predicts, and how repeated denoising turns a random sample into an image.</p><h1>1.1 Why generative models needed another path</h1><p>Before diffusion models became the standard tool for image generation, two families shaped most of the conversation: generative adversarial networks and variational autoencoders. They are worth covering first because diffusion did not replace an empty space. It solved pain points that became clear through years of work with older generators.</p><p>GANs were exciting because they could produce crisp images. The generator learned to map a random vector to an image, and a discriminator learned to judge whether an image came from the training set or from the generator. The generator improved by trying to fool the discriminator. This setup created a learned realism signal, which was much richer than a hand-written pixel loss.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21T0OW%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T0OW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 424w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 848w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 1272w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21T0OW%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png" width="909" height="531" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:531,&quot;width&quot;:909,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:154676,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T0OW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 424w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 848w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 1272w, https://substackcdn.com/image/fetch/$s_!T0OW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde69be5a-df61-4b0c-a19b-007ac3c6eee7_909x531.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.1. A basic GAN setup. The generator maps random noise to fake images. The discriminator receives both real training images and generated images, then predicts whether each input is real or fake. The generator improves by trying to fool the discriminator, so the training signal comes from a learned critic rather than from a fixed reconstruction loss.</em></p><p>As shown in Figure 8.1, a GAN is a two-network game. This game is the source of its strength and also the source of many practical problems. If the discriminator becomes too good too quickly, the generator may get weak gradients. If the generator finds a small set of outputs that fool the discriminator, it can repeat those outputs and lose diversity. This failure is often called mode collapse. The samples may be sharp, but the training process can feel like balancing two moving targets.</p><p>This contrast is useful throughout the chapter. In a GAN, the generator learns from the discriminator&#8217;s current opinion. In a diffusion model, the target for a training example is the exact noise that was added by the training code. That target is not another network&#8217;s opinion. It is a known value. This does not make diffusion magically easy, but it removes the adversarial game from the core training loop.</p><p>VAEs took a different route. A variational autoencoder learns to encode an image into a latent distribution and decode a latent sample back into an image. This gives the model a compressed internal space, which is a useful idea for generation and editing. The tradeoff is that VAE samples and reconstructions often look smoother than GAN samples, especially when the decoder is trained with losses that reward average-looking reconstructions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21iFHE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iFHE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 424w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 848w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 1272w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21iFHE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png" width="1180" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:1180,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:74063,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iFHE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 424w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 848w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 1272w, https://substackcdn.com/image/fetch/$s_!iFHE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbddb10c9-5e86-4aaa-9b1e-f53ba4f72639_1180x480.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.2. A variational autoencoder. The encoder maps input data to a latent distribution, a latent sample is drawn, and the decoder reconstructs the output. VAEs are important for this chapter because modern latent diffusion systems borrow the idea of working in a compressed representation, then use diffusion to model that latent space more powerfully.</em></p><p>As shown in Figure 8.2, the part of the VAE story that survived strongly into modern systems is compression. A good latent representation can keep the meaningful structure of an image while using far fewer values than the original pixels. Diffusion models later used this idea to reduce cost. Instead of running the denoising model directly on every pixel, latent diffusion runs it on a smaller latent tensor and decodes the result at the end.</p><p>Older generators taught the field two lessons. First, sharp images matter, and a model needs a strong learned signal for realism. Second, the representation matters, because pixel space is expensive. Diffusion uses both lessons but changes the training problem. It turns image generation into the task of learning how to remove noise at many levels of corruption.</p><p>That change sounds modest, but it is a major shift in supervision. A GAN has to learn from a moving discriminator. A VAE has to balance reconstruction quality against a regularized latent space. A diffusion model can create its own training pairs. The input is a noisy version of a real image, and the target is the noise that the training code added. This gives the model many cleanly defined tasks from each training image.</p><p>It also changes how we should think about creativity in the model. The denoiser is not storing a library of clean images and retrieving one during sampling. It learns the local direction from &#8220;less likely under the data&#8221; toward &#8220;more likely under the data&#8221; at many noise levels. When sampling begins from random noise, those local directions are applied again and again. The final image is the result of the full path, not a single lookup.</p><p>This is the motivation for the rest of the chapter. Diffusion is useful because it breaks a hard one-shot generation problem into a sequence of denoising problems. The cost is that sampling has to run the model repeatedly. The benefit is that each training example has a simple, known target, and this makes the method easier to scale than adversarial training in many settings.</p><h1>1.2 The Diffusion Idea</h1><p>The central idea of diffusion is simple: take real data, slowly corrupt it into noise, and train a model to reverse that corruption. During training, the forward corruption process is not learned. We define it. During generation, the reverse process is learned. The model starts from noise and repeatedly takes small steps toward a cleaner sample.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21f5Se%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f5Se!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 424w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 848w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21f5Se%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png" width="831" height="519" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:519,&quot;width&quot;:831,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:149339,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f5Se!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 424w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 848w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f5Se!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4759783-8c72-4591-b8fb-b3bdbb13bacf_831x519.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.3. The goal of diffusion modeling. The true image distribution P<sub>data</sub>(x) is known only through examples, not through a neat formula. A diffusion model learns a sampler that starts from a simple base distribution and gradually moves toward regions that look like the training data.</em></p><p>As shown in Figure 8.3, the problem can be read from a distribution point of view. The training images are samples from a complicated image distribution. We do not know the full distribution, and we cannot directly sample new images from it. What we can sample from easily is Gaussian noise. Diffusion connects these two worlds by defining a path from data to noise, then learning how to travel back.</p><p>This path is easier to understand if you imagine a clean image being damaged step by step. At first, the subject is still visible. Later, only broad structure remains. At the end, the image is essentially noise. Because we control this damaging process, we can create unlimited supervised training examples from every image: pick a timestep, add the right amount of noise, and ask the model to predict the noise that was added.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210_7M%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0_7M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 424w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 848w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 1272w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210_7M%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png" width="1152" height="705" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:705,&quot;width&quot;:1152,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:217266,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0_7M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 424w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 848w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 1272w, https://substackcdn.com/image/fetch/$s_!0_7M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd813d05-6e78-4a7b-b239-a34a4a50aa99_1152x705.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.4. A data manifold being diffused into a simple noise distribution. At t=0, the samples lie on a structured spiral. As the forward process adds noise, the structure spreads out and eventually becomes close to an isotropic Gaussian. The reverse process learns to move in the opposite direction, from the easy endpoint back toward the structured data.</em></p><p>The toy dataset in Figure 8.4 is two dimensional, but the picture is the same for images. The structured data starts on a thin, meaningful shape. Noise gradually washes that structure out until the final distribution is simple. The reverse model learns how to move a sample from the noisy cloud back toward the kind of structure seen in the training data.</p><p>This is why diffusion can feel backward at first. We spend training time destroying images. The point is that controlled destruction gives us a clean learning signal. If the training code added a particular noise pattern, the network can be trained to recover that pattern. Generation then uses the trained network in the opposite direction.</p><div class="pullquote"><p><strong>NOTE</strong><br>Diffusion does not mean that the first noise sample secretly contains the final image. The initial noise is random. The trained denoiser and the condition, such as a text prompt, guide the sample through many small corrections until it becomes image-like.</p></div><h2>1.3 Why the endpoint is Gaussian noise</h2><p>Every generator needs a starting point. If the starting point is already complicated, sampling is already hard. Diffusion models usually start from a standard Gaussian distribution,</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_T \\sim \\mathcal{N}(\\mathbf{0}, \\mathbf{I}).&quot;,&quot;id&quot;:&quot;SFMXCMMRSB&quot;}" data-component-name="LatexBlockToDOM"></div><p>This distribution is easy to sample from, easy to reason about, and flexible enough to act as a neutral blank canvas. It does not prefer faces, dogs, product photos, outdoor scenes, or any other category. The structure comes from the learned reverse process.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210SLJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0SLJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 424w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 848w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 1272w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210SLJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png" width="1395" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:1395,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124117,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0SLJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 424w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 848w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 1272w, https://substackcdn.com/image/fetch/$s_!0SLJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76deeb3f-173b-4af1-858a-8a9551541f35_1395x480.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.5. Why diffusion models use a Gaussian base. The structured data distribution is hard to sample from directly, but a maximum entropy Gaussian endpoint is easy to sample from. The forward process transforms structured data into that endpoint, and the reverse process learns how to undo the transformation.</em></p><p>The distribution-level reason is shown in Figure 8.5. A simple Gaussian endpoint lets us begin generation from something we can produce on demand. If we can learn a reliable reverse path from this endpoint to the data distribution, then sampling becomes possible even though the original image distribution is too complex to write down.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RqlP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RqlP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 424w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 848w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 1272w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RqlP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png" width="1086" height="489" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:489,&quot;width&quot;:1086,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39692,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RqlP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 424w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 848w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 1272w, https://substackcdn.com/image/fetch/$s_!RqlP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f59ded3-7b4b-4d63-b0cd-89fafcb9d188_1086x489.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.6. Base distributions as blank canvases. A uniform distribution and a Gaussian distribution are both high entropy choices, but Gaussian noise is especially convenient for diffusion because repeated additive Gaussian noise stays Gaussian and leads to a tractable endpoint for the forward process.</em></p><p>Possible blank canvases are compared in Figure 8.6. In practice, Gaussian noise is convenient because adding independent Gaussian noise repeatedly behaves cleanly. The endpoint remains mathematically manageable, and the training code can directly sample noisy versions of an image at any timestep. This is a practical choice, not a mystical one.</p><p>The important point is that the base distribution is simple on purpose. The model should not need a hand-designed image prior at the start. It should learn image structure from data and from the conditioning information.</p><h1>1.4 The Forward Process</h1><p>The forward process is the noising process we define. At each timestep, the clean image keeps some of its signal and receives some new Gaussian noise. The standard notation uses </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\beta_t&quot;,&quot;id&quot;:&quot;DHVISPNAXV&quot;}" data-component-name="LatexBlockToDOM"></div><p>for the amount of new noise at step</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;t&#8203;&quot;,&quot;id&quot;:&quot;IAFCVWDOGT&quot;}" data-component-name="LatexBlockToDOM"></div><p>The matching signal retention is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\alpha_t = 1 - \\beta_t.&quot;,&quot;id&quot;:&quot;VVEMLMLVVH&quot;}" data-component-name="LatexBlockToDOM"></div><p>The cumulative signal after many steps is</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t = \\prod_{s=1}^{t}\\alpha_s.&quot;,&quot;id&quot;:&quot;SONSJBMYDI&quot;}" data-component-name="LatexBlockToDOM"></div><p>You can read</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;HEMXMRAFGV&quot;}" data-component-name="LatexBlockToDOM"></div><p>as &#8220;how much of the original image is still present after step</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;t&quot;,&quot;id&quot;:&quot;FPVGTVDRBI&quot;}" data-component-name="LatexBlockToDOM"></div><p>Early in the chain, this value is close to 1. Late in the chain, it is close to 0.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nbOk%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nbOk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 424w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 848w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 1272w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21nbOk%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png" width="1456" height="1090" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1090,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:742577,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nbOk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 424w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 848w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 1272w, https://substackcdn.com/image/fetch/$s_!nbOk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe32b5828-c6a5-41e1-a07f-60e0c227cf2f_1467x1098.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.7. Forward diffusion on an image. The clean horse image is progressively corrupted with Gaussian noise. The distributional view below it shows the same change in coefficients: the signal coefficient decreases, the noise coefficient increases, and the noisy sample becomes less tied to the original image.</em></p><p>The sequence in Figure 8.7 is one of the most important ideas in the chapter. The model is not trained only on clean images and pure noise. It sees many intermediate states. Some examples are barely corrupted. Some are heavily corrupted. This gives the network a curriculum of denoising problems across the whole path from data to noise.</p><blockquote><p><strong>The math you actually need</strong></p><p>The forward process can be sampled in one step:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_t =\n\\sqrt{\\bar{\\alpha}_t}\\mathbf{x}_0 +\n\\sqrt{1-\\bar{\\alpha}_t}\\boldsymbol{\\epsilon},\n\\qquad\n\\boldsymbol{\\epsilon} \\sim \\mathcal{N}(\\mathbf{0}, \\mathbf{I}).&quot;,&quot;id&quot;:&quot;NGZSKNHSUU&quot;}" data-component-name="LatexBlockToDOM"></div><p>This equation says that a noisy image is a weighted mixture of the clean image</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_0&quot;,&quot;id&quot;:&quot;NRJTAEAMSN&quot;}" data-component-name="LatexBlockToDOM"></div><p>and pureGaussian noise</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\boldsymbol{\\epsilon}&quot;,&quot;id&quot;:&quot;IVRYONAGZO&quot;}" data-component-name="LatexBlockToDOM"></div><p>The value</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;MIBGZOKATZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Controls the signal part, and</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;1-\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;LZFMLMPWRF&quot;}" data-component-name="LatexBlockToDOM"></div><p>controls the noise part.</p></blockquote><p>This equation is worth remembering because it explains how training examples are made. We do not need to simulate every previous step to get <em><strong>X<sub>t </sub></strong></em>We can sample a random timestep <em><strong>t</strong></em>, sample a random noise tensor<sub> </sub></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\boldsymbol{\\epsilon}&quot;,&quot;id&quot;:&quot;DSLNTLXHXT&quot;}" data-component-name="LatexBlockToDOM"></div><p>, and mix the clean image with that noise using the formula above. That single line is the workhorse behind DDPM-style training.</p><p>The square roots in the equation are there because the formula is balancing variance, not ordinary image brightness. You do not need to derive this to use the equation. A useful reading is that</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sqrt{\\bar{\\alpha}_t}&quot;,&quot;id&quot;:&quot;BSGLXDAMWG&quot;}" data-component-name="LatexBlockToDOM"></div><p>scales the clean image and</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sqrt{1-\\bar{\\alpha}_t}&quot;,&quot;id&quot;:&quot;ZJSRYCHJIG&quot;}" data-component-name="LatexBlockToDOM"></div><p>scales the noise. When <em>t</em> is small, the clean coefficient is large and the noise coefficient is small. When <em>t</em> is large, the clean coefficient shrinks and the noise coefficient dominates.</p><p>This also explains why a noisy training sample is still tied to one clean image. At early timesteps, the noisy sample clearly resembles its source. At later timesteps, the source becomes harder to see, but the training code still knows exactly which clean image and which noise tensor created it. The denoiser receives the noisy sample and the timestep, then learns how much of what it sees should be treated as removable noise.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rT8R%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rT8R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 424w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 848w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 1272w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rT8R%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png" width="1371" height="510" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:510,&quot;width&quot;:1371,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108540,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rT8R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 424w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 848w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 1272w, https://substackcdn.com/image/fetch/$s_!rT8R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca500be5-500f-4bef-90a8-28dfb0600fb7_1371x510.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.8. Alpha-beta scheduling in forward diffusion. The beta schedule controls the new noise injected at each step. The alpha values track per-step signal retention, while the cumulative product </em></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;JFFIPJLMOI&quot;}" data-component-name="LatexBlockToDOM"></div><p><em>tracks how much of the original image remains after many steps.</em></p><p>The curves in Figure 8.8 explain the schedule.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\beta_t&quot;,&quot;id&quot;:&quot;RNXTFQWVLX&quot;}" data-component-name="LatexBlockToDOM"></div><p>decides how aggressively noise is added at a particular step.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\alpha_t&quot;,&quot;id&quot;:&quot;QHGYUBPJYS&quot;}" data-component-name="LatexBlockToDOM"></div><p>is the part of the signal kept at that step.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;JTLMEBEQWA&quot;}" data-component-name="LatexBlockToDOM"></div><p>is the accumulated signal retention after many steps. A good schedule makes the denoising tasks neither too easy nor too destructive. If the process destroys structure too quickly, the network sees many examples that are almost pure noise.</p><p>If it destroys structure too slowly, the sampling process wastes steps making tiny changes.</p><p>Modern systems may express the schedule through sigmas, log signal-to-noise ratios, or continuous time variables, but the beginner intuition is the same. A schedule controls how the problem changes as the sample moves from clean data to noise and back.</p><h1>1.5 What the denoiser learns</h1><p>The denoiser is the learned part of the system. It receives a noisy sample</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_t&quot;,&quot;id&quot;:&quot;HHUCAUAFFA&quot;}" data-component-name="LatexBlockToDOM"></div><p>the timestep <em>t </em>and often a condition <em>c.</em></p><p>The condition could be a class label, a text prompt, a mask, an edge map, a depth map, a low resolution image, or another signal. In the basic noise-prediction view, the network outputs</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,c),&quot;,&quot;id&quot;:&quot;JFPNRKILDV&quot;}" data-component-name="LatexBlockToDOM"></div><p>which is its estimate of the noise that was used to create</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_t&quot;,&quot;id&quot;:&quot;RNTXCGJKHJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The training target is known because the training code sampled the noise. That gives a simple supervised loss:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{\\text{simple}} =\n\\mathbb{E}_{\\mathbf{x}_0,t,\\boldsymbol{\\epsilon}}\n\\left[\n\\left\\|\n\\boldsymbol{\\epsilon}\n-\n\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,c)\n\\right\\|_2^2\n\\right].&quot;,&quot;id&quot;:&quot;RBLGHYLSYH&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is not the full probabilistic derivation, but it is the equation that explains the practical training loop. Add known noise, ask the network to predict that noise, and update the network when it is wrong.</p><p>The loss is simple, but the task is rich. At low noise levels, predicting the noise can mean finding small corruptions around edges and textures. At high noise levels, predicting the noise is tied to understanding which broad structures are plausible under the data and condition. The same loss therefore teaches both local cleanup and global structure, depending on which timestep was sampled.</p><p>This is one reason diffusion training is often easier to reason about than GAN training. The network is given a direct regression target. If the prediction is wrong, the loss says so in a straightforward way. The model may still be large, the data may still be messy, and the sampler may still require careful tuning, but the basic training signal is stable.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Rsq1%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Rsq1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 424w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 848w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Rsq1%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png" width="1113" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1113,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:200100,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Rsq1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 424w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 848w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Rsq1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a26ead-f2a3-4911-a7d9-92bd0df2c42a_1113x600.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.9. A DDPM denoising step. The noisy image <strong>X<sub>t</sub></strong> and timestep <strong>t</strong> enter the denoiser.</em></p><p><em>The network predicts the noise component</em></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\epsilon_{\\theta}(\\mathbf{x}_t,t)&quot;,&quot;id&quot;:&quot;KBHWCMUDJI&quot;}" data-component-name="LatexBlockToDOM"></div><p>, and that prediction is used to compute the next, slightly cleaner sample</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_{t-1}&quot;,&quot;id&quot;:&quot;OUJXBMRXSX&quot;}" data-component-name="LatexBlockToDOM"></div><p>Generation repeats this step many times.</p><p>The denoising step in Figure 8.9 shows why diffusion sampling is iterative. The denoiser is not asked to jump straight from noise to the final image. It is asked to make one correction for the current noise level. When those corrections are repeated across a schedule, structure emerges gradually.</p><p>Predicting noise is a good first mental model because the target is exact. Some modern models predict the clean sample, a velocity target, or a flow direction instead. These variants matter in advanced systems, but they keep the same basic teaching idea: the model learns a direction that moves a noisy sample toward the data distribution.</p><p>The timestep is essential. A sample at a low noise level should be treated differently from a sample at a high noise level. At low noise, the model should refine edges and small details. At high noise, it must infer broad structure from weak evidence and from the condition. Without timestep information, the same network would not know which denoising problem it is solving.</p><p>It is also useful to separate the denoiser from the sampler. The denoiser predicts a target from the current noisy state. The sampler decides how to use that prediction to move to the next state. Two systems can use the same trained denoiser with different samplers and produce different speed-quality tradeoffs. A slow sampler may take many careful steps. A fast sampler tries to take fewer, larger steps without drifting away from the learned path.</p><p>This is why diffusion research often talks about both models and samplers. The model learns the direction. The sampler chooses the route. For a beginner, DDPM sampling is the easiest route to understand because it follows the chain step by step. Faster samplers keep the same goal but take a more efficient path through the noise levels.</p><h1>1.6 Giving the network a sense of time</h1><p>A timestep such as <strong>t=427</strong> is just a number. Neural networks usually work better when important scalar values are expanded into richer representations. Diffusion models commonly use sinusoidal timestep embeddings, which turn a scalar timestep into a vector containing sine and cosine features at several frequencies.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-c_q%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-c_q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 424w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 848w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 1272w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-c_q%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png" width="1410" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:1410,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60177,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-c_q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 424w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 848w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 1272w, https://substackcdn.com/image/fetch/$s_!-c_q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F207b8106-580c-4ac6-85c8-ef79c5bf7fcd_1410x408.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.10: Sinusoidal timestep embedding. A scalar timestep, such as <strong>t=427</strong>, is converted into a vector using sinusoidal functions at multiple frequencies. This vector enters the denoising network so the same network can change its behavior at different noise levels.</em></p><p>As shown in Figure 8.10, the embedding gives the model a richer handle on time. Nearby timesteps produce related vectors, and distant timesteps produce different vectors. This is similar in spirit to positional embeddings in transformers, where position is turned into a vector that the model can use.</p><p>In a U-Net denoiser, the timestep embedding is usually injected into residual blocks. In a diffusion transformer, it may modulate normalization layers or block activations. The exact plumbing changes across architectures, but the purpose stays the same. The denoiser must know the current noise level before it can decide how aggressive its correction should be.</p><h1>1.7 Why U-Nets Became The Classic Denoiser</h1><p>For image diffusion, the classic denoising network is a U-Net. This is a practical match for the task. Denoising needs global context, because the model must understand what the image might contain. It also needs local precision, because the final output depends on edges, textures, alignment, and small spatial details.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21My41%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!My41!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 424w, https://substackcdn.com/image/fetch/$s_!My41!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 848w, https://substackcdn.com/image/fetch/$s_!My41!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 1272w, https://substackcdn.com/image/fetch/$s_!My41!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21My41%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:136577,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!My41!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 424w, https://substackcdn.com/image/fetch/$s_!My41!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 848w, https://substackcdn.com/image/fetch/$s_!My41!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 1272w, https://substackcdn.com/image/fetch/$s_!My41!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f9b9f0d-53df-4ff6-99cc-7b1f1b2c0876_1653x903.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.11. A U-Net denoiser for diffusion. The noisy image enters on the left. Down blocks reduce spatial resolution while increasing feature channels, middle blocks process a compact representation, and up blocks reconstruct a denoised output. Skip connections preserve fine spatial information that would otherwise be lost during downsampling.</em></p><p>The U shape in Figure 8.11 explains how the network handles both context and detail. The encoder path downsamples the image and builds wider feature maps. The decoder path upsamples back to the original resolution. Skip connections carry high resolution features from the encoder to the matching decoder stages. This lets the model use large-scale context without throwing away the precise spatial information needed for reconstruction.</p><p>This architecture fits the changing nature of diffusion. At high noise levels, the model needs broad semantic guesses: what object might be present, where the main shape might sit, and which condition should guide the composition. At low noise levels, it needs smaller corrections: sharper boundaries, smoother texture, and consistent local detail. The U-Net naturally supports both kinds of work. Attention layers are often added at selected resolutions so distant parts of the image can influence each other.</p><p>The denoiser can be written as</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,c)&quot;,&quot;id&quot;:&quot;IKFNZCIKTV&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <em><strong>c</strong></em> is optional conditioning information. If there is no <strong>c</strong>, the model is unconditional. If <em><strong>c</strong></em> is a class label, the model is class conditional. If <em><strong>c</strong></em> is a text embedding, the model becomes a text-to-image model. This notation is compact, but it captures a major design point: most modern diffusion systems differ in what they use as conditioning and how they inject it into the denoiser.</p><h1>1.8  Latent Diffusion</h1><p>Pixel-space diffusion is conceptually clean, but high resolution images are expensive. </p><p>A 512 X 512 RGB image has</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;512 \\times 512 \\times 3 = 786{,}432&quot;,&quot;id&quot;:&quot;BCIGMTDHVC&quot;}" data-component-name="LatexBlockToDOM"></div><p>values. A large denoising network may need to process that representation many times for a single sample. The cost grows quickly as resolution increases.</p><p>Latent diffusion reduces this cost by adding an autoencoder around the diffusion model. The encoder compresses an image into a smaller latent tensor. The diffusion model performs denoising in that latent space. The decoder turns the final denoised latent back into pixels. This is one of the main reasons high resolution text-to-image generation became practical on widely available hardware.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VEKv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VEKv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 424w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 848w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 1272w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VEKv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png" width="723" height="327" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:327,&quot;width&quot;:723,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28932,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VEKv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 424w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 848w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 1272w, https://substackcdn.com/image/fetch/$s_!VEKv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc93f1a6-8d37-4f44-a0e6-11ceee15cfd5_723x327.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.12. Image compression before diffusion. A 256x256x3 RGB image contains about 196k values. The autoencoder maps it to a 32x32x4 latent tensor with about 4k values. Denoising in this compressed space is far cheaper than denoising in pixel space.</em></p><p>The cost argument in Figure 8.12 is visible in the tensor sizes. The latent tensor is much smaller, but it can still preserve the information the decoder needs for a convincing image. The diffusion model no longer spends all its capacity modeling raw pixels. It works on a compressed space that is closer to perceptual structure.</p><p>There is a tradeoff. If the autoencoder compresses too hard, small text, fine geometry, faces, and repeated patterns may suffer. If it compresses too little, the diffusion model becomes expensive again. Latent diffusion is the practical compromise: keep enough visual information for good decoding, but reduce the denoising workload enough to make training and sampling feasible.</p><h1>1.9 Conditioning: Making the Model Listen</h1><p>Unconditional diffusion asks the model to generate something from the training distribution. Conditional diffusion asks it to generate something that matches an input. That input can be a label, a prompt, a low resolution image, a mask, an edge map, a depth map, a segmentation map, a pose skeleton, or another image. The denoising task is still the same, but the model receives extra information about where the sample should go.</p><p>Text-to-image systems usually encode the prompt with a text encoder and pass the resulting embeddings into the denoising network. U-Net systems often use cross-attention, where image features attend to text embeddings. The image features can then use words and phrases from the prompt as context while denoising. This is why prompt following is part architecture, part text encoder, part data, and part sampler behavior.</p><p>Cross-attention is easier to understand if you think of the noisy image features as asking for context. A feature at one spatial location may need to know which prompt tokens are relevant to that region. The attention operation gives the model a learned way to connect image features with language features. This does not guarantee perfect prompt following, but it gives the denoiser a path for using text during every denoising step.</p><p>Classifier-free guidance is a common way to make the condition stronger during sampling. During training, the model sometimes sees the condition and sometimes sees an empty condition. During sampling, we compare the conditional and unconditional predictions:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{\\boldsymbol{\\epsilon}} =\n\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,\\emptyset)\n+\ns\\left(\n\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,c)\n-\n\\boldsymbol{\\epsilon}_{\\theta}(\\mathbf{x}_t,t,\\emptyset)\n\\right).&quot;,&quot;id&quot;:&quot;SYTLQZARVA&quot;}" data-component-name="LatexBlockToDOM"></div><p>The guidance scale</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s&quot;,&quot;id&quot;:&quot;CLGLIKZQFO&quot;}" data-component-name="LatexBlockToDOM"></div><p>controls how strongly the sample is pushed toward the condition. Low guidance leaves more freedom but may ignore parts of the prompt. High guidance follows the prompt more strongly but can reduce variety or create artifacts. It is a steering knob, not a pure quality knob.</p><p>Negative prompts and empty conditions fit naturally into this same idea. They change the direction of the guidance signal by telling the model what to move away from, what to ignore, or what should receive less weight. In practice, guidance works best when the prompt and negative prompt are treated as steering signals rather than as exact instructions. The model still generates through denoising, and the denoising path can only use patterns it learned during training.</p><p>Text is flexible, but it is not precise. If a user needs a subject to follow a pose, edge map, depth layout, or segmentation mask, text alone is usually too vague. Spatial control methods add structured signals to the denoising process. The common idea is to preserve the generative ability of a pretrained model while adding a trainable path that tells it how to use control inputs. This is why modern diffusion tools can follow sketches, poses, depth maps, masks, and other layouts.</p><h1>1.10 Diffusion Transformers</h1><p>The early image diffusion systems mostly used U-Nets. More recent systems increasingly use transformer backbones. The reason is familiar from other areas of deep learning: transformers scale well, process data as tokens, and allow long-range interactions through attention. In image diffusion, this usually happens in latent space. The model patchifies the latent tensor, turns patches into tokens, injects timestep and conditioning information, and predicts a denoising target.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Vxx3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vxx3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 424w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 848w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 1272w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Vxx3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png" width="1456" height="814" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:814,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:220305,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vxx3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 424w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 848w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 1272w, https://substackcdn.com/image/fetch/$s_!Vxx3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd1116b-346b-46f5-9e58-fbebd80fd70f_1653x924.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.13. A diffusion transformer architecture. The noisy latent is split into patches and projected into tokens. Timestep and class-conditioning information modulate transformer blocks, and the output tokens are reshaped back into a latent prediction. This replaces the U-Net denoiser with a transformer denoiser.</em></p><p>The architecture in Figure 8.13 shows the shift from spatial feature maps to token processing. The denoising objective has not disappeared. The network backbone has changed. A diffusion transformer treats patches of the latent as tokens and uses attention to let those tokens interact.</p><p>If a latent tensor has height <em><strong>H<sub>z</sub></strong></em> width <em><strong>W<sub>z</sub></strong></em><sub> </sub> and patch size <em><strong>p</strong></em> the number of patch tokens is roughly</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;N = \\frac{H_z W_z}{p^2}.&quot;,&quot;id&quot;:&quot;HGWIMCQRBK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Smaller patches preserve more spatial detail but increase attention cost. Larger patches are cheaper but coarser. This tradeoff is one reason diffusion transformer design often talks about patch size, token count, and compute together.</p><p>The transformer view is attractive because it gives the model a uniform way to mix information across the image. A token can attend to distant tokens without needing many convolutional layers between them. This can help with global layout, prompt alignment, and relationships between far apart regions. The price is attention cost, which grows quickly as the number of tokens increases.</p><p>Latent space helps again here. Patchifying a raw pixel image would create too many tokens for large models. Patchifying a compressed latent tensor is much more manageable. This is why diffusion transformers and latent diffusion fit together so naturally: the autoencoder reduces the spatial burden, and the transformer spends its compute on token interactions in the smaller space.</p><p>The next three examples connect the core ideas from this chapter to current text-to-image architectures. PixArt-alpha, MM-DiT, and Stable Diffusion 3 include many engineering details, but the useful lens here is architectural: how latent patches become tokens, how text enters the denoiser, how image and language streams interact, and how these pieces form a complete generation stack.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ISgc%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ISgc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 424w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 848w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 1272w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ISgc%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png" width="876" height="1158" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1158,&quot;width&quot;:876,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:147815,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ISgc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 424w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 848w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 1272w, https://substackcdn.com/image/fetch/$s_!ISgc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7985c5b5-8bfd-49e3-92b2-8a7ae1b7d9a6_876x1158.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.14. PixArt-alpha style text-to-image diffusion transformer. Text embeddings condition the denoising transformer, and the model operates on image latent tokens. The architecture emphasizes efficient transformer conditioning rather than a U-Net backbone.</em></p><p>The text-conditioning path is explicit in Figure 8.14. Text embeddings are not added at the end of generation. They influence the denoising computation inside the model. This is why a text-to-image system is more than an image generator with captions attached. The language representation shapes the denoising trajectory step by step.<br></p><p>Multimodal diffusion transformers go further by treating text tokens and image tokens more symmetrically. Instead of using text only as an external condition, the architecture can let text and image streams exchange information through joint attention. This gives the model a direct path for aligning language with visual structure.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OV3z%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OV3z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 424w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 848w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 1272w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OV3z%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png" width="894" height="890" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:890,&quot;width&quot;:894,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31458,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OV3z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 424w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 848w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 1272w, https://substackcdn.com/image/fetch/$s_!OV3z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9c511cf-d29f-4902-b942-849f2064d9e3_894x890.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.15. A multimodal diffusion transformer block. Text embeddings and image embeddings are processed as separate streams with modulation and MLP layers, while joint attention allows information to flow between the modalities. This design is used in the Stable Diffusion 3 family.</em></p><p>The block-level idea in Figure 8.15 is to process image and text streams separately while still connecting them through attention. Image and text tokens each have their own transformations, but attention connects them. The result is a denoising block that can update image information while checking it against language information.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Z5ZN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 424w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 848w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 1272w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Z5ZN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png" width="1179" height="1209" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1209,&quot;width&quot;:1179,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56145,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/203080645?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 424w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 848w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 1272w, https://substackcdn.com/image/fetch/$s_!Z5ZN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ca8859a-fe96-41f0-8a57-b0d4e01fa830_1179x1209.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Figure 8.16. A Stable Diffusion 3 style architecture. Multiple text encoders produce conditioning signals, image latents are patchified, timestep information is embedded, and a stack of MM-DiT blocks performs the denoising computation before the output is unpatchified and decoded.</em></p><p>The full system in Figure 8.16 puts the pieces together. Text encoders produce conditioning signals, the image latent becomes a token sequence, timestep information tells the model where it is in the sampling path, and MM-DiT blocks perform the denoising computation. Stable Diffusion 3 style systems also use rectified-flow ideas, which you can think of at this level as another way to learn a path from noise to data.</p><p>The direction of modern image generation is clear even if the exact architecture keeps changing. Strong systems combine latent-space generation, powerful text encoders, transformer backbones, guidance, and carefully designed sampling paths. The diffusion idea remains the same: learn how to move from a simple noisy starting point toward a structured data sample.</p><h1>1.11 Putting the pieces together</h1><p>It helps to reduce the full pipeline to two stories: training and sampling. During training, we take a clean example, optionally encode it into a latent, choose a timestep, sample Gaussian noise, and mix the clean representation with that noise. The denoiser receives the noisy representation, the timestep, and any condition. It learns to predict the chosen target, often the noise itself. The target can differ across formulations, but the pattern is steady: corrupt a real example in a known way, then train a model to reverse that corruption.</p><p>During sampling, the direction flips. We start from random Gaussian noise. The denoiser predicts how to move one step toward a cleaner sample. The sampler applies that update and moves to a lower noise level. The process repeats until the final representation is clean enough to decode or display. If the model works in latent space, the last latent is passed through the decoder to produce pixels.</p><p>This explains both the strength and the cost of diffusion. The strength comes from many small, guided corrections. The cost comes from making many network calls. Faster samplers, distillation, consistency-style models, and flow-based formulations all try to reduce this cost while keeping the quality benefits of iterative generation.</p><p>Several design choices decide how a diffusion system behaves. The noise schedule controls which denoising tasks the model sees. The prediction target controls what the network learns to output. The backbone controls how spatial and semantic information move through the model. The conditioning path controls whether prompts, masks, depth maps, or other inputs are followed. The sampler controls the speed, quality, and amount of randomness during generation. The autoencoder controls how much information is available in latent space.</p><p>This is why two models can both be called diffusion models and still feel very different in use. They may share the same high-level path from noise to data, but use different schedules, denoisers, latent spaces, conditioning methods, and samplers.</p><h1>1.12 Common Misconceptions</h1><p>One common misunderstanding is that the model memorizes a reverse path for each training image. It does not. During training, the same clean image can be paired with many timesteps and many noise samples. The denoiser learns a general rule for moving noisy samples toward likely data, not a stored path back to one image.</p><p>Another misunderstanding is that the noise contains the image. The initial noise is just a random sample. The learned denoising function, the condition, and the sampler determine how that random sample turns into an image. Changing the random seed changes the starting point and often changes the final composition.</p><p>Prompt following is also easy to overestimate. A text-to-image model is not searching a database of captioned images. The prompt is encoded into vectors that condition the denoising process. The model has learned statistical relationships between text and image structure from data. This is why it can combine ideas in useful ways and also why it may fail on counting, spatial relationships, negation, or rare concepts.</p><p>Guidance is another common source of confusion. More guidance does not simply mean better images. Strong classifier-free guidance can make the model follow the prompt more aggressively, but it can also reduce diversity, exaggerate textures, or create artifacts. Guidance should be treated as a control knob that changes the balance between adherence and naturalness.</p><p>Finally, diffusion is broader than DDPM. DDPM is the cleanest entry point, but the broader family includes DDIM-style sampling, score-based models, EDM-style design choices, consistency models, flow matching, rectified flow, latent diffusion, U-Net diffusion, and diffusion transformers. They differ in equations and engineering details, but they share the larger idea of learning a generative path between a simple distribution and the data distribution.</p><h1>1.13 Where Diffusion Still Struggles</h1><p>Diffusion models are powerful, but they are not finished technology. Sampling cost remains one of the main challenges. The original systems used many denoising steps, and each step required a neural network evaluation. Modern samplers and distilled models can reduce the number of steps, but speed is still a central engineering issue, especially for high resolution images and video.</p><p>Fine detail can also be difficult. Latent diffusion depends on an autoencoder, and compression can discard small information. Text rendering, tiny objects, hands, precise geometry, and repeated patterns can fail when the latent representation or training data does not support them well enough.</p><p>Prompt understanding differs from reasoning. A model may understand common objects and styles but struggle with exact counts or relationships. A prompt such as &#8220;three cubes behind two spheres&#8221; is harder than &#8220;a cube on a table&#8221; because it requires structured spatial reasoning rather than visual familiarity alone.</p><p>Bias remains a data problem. Diffusion models learn from the distributions they see. If the training data overrepresents certain people, places, aesthetics, or stereotypes, generated outputs can reflect those patterns. The denoising objective does not remove this issue.</p><p>Control is also a tradeoff. Masks, depth maps, edge maps, and pose inputs can make the output more predictable, but every extra condition narrows the space of possible images. Good diffusion workflows often come down to deciding how much structure to provide and how much freedom to leave to the model.</p><h1>1.14 Resources</h1><p></p><p>These are the most relevant papers behind the diffusion ideas covered in this visual breakdown.</p><ul><li><p><a href="iframe.php?url=https%3A%2F%2Fyoutube.com%2Fplaylist%3Flist%3DPLPTV0NXA_ZShSUHKLhdHAdAw5oM9vM1Yf%26amp%3Bsi%3DirY23qsJEVW3Mxrw"> The Principles of Diffusion Models </a> One of the Best Playlist for Understanding Diffusion by Dr Rajat</p></li></ul><ul><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2006.11239">Denoising Diffusion Probabilistic Models</a> The core DDPM paper behind the forward noising equation, noise prediction loss, and iterative denoising sampler.</p></li><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2112.10752">High-Resolution Image Synthesis with Latent Diffusion Models</a> Covers latent diffusion, autoencoder compression, and cross-attention conditioning.</p></li><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2212.09748"> Scalable Diffusion Models with Transformers </a>. The Diffusion Transformer paper behind replacing U-Nets with transformer blocks over latent patches.</p></li><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2310.00426">PixArt-alpha: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image Synthesis </a>. Covers the PixArt-alpha architecture discussed in the transformer section.</p></li><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2210.02747">Flow Matching for Generative Modeling</a>. Covers the flow-matching view mentioned in the broader diffusion family.</p></li><li><p><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2403.03206">Scaling Rectified Flow Transformers for High-Resolution Image Synthesis</a> Covers the Stable Diffusion 3/MM-DiT style architecture and rectified-flow transformer design.</p></li></ul><h1>1.15 Summary</h1><ul><li><p>GANs showed that learned generators can make sharp images, but adversarial training can be unstable and can suffer from mode collapse.</p></li><li><p>VAEs introduced a useful compression idea: encode data into a latent space, then decode from that space. Latent diffusion keeps this compression idea and uses diffusion as the generative model inside the latent space.</p></li><li><p>A diffusion model defines a known forward process from data to noise and trains a neural network to reverse that process.</p></li><li><p>The key forward equation is </p><ul><li><p></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{x}_t=\\sqrt{\\bar{\\alpha}_t}\\mathbf{x}_0+\\sqrt{1-\\bar{\\alpha}_t}\\boldsymbol{\\epsilon}&quot;,&quot;id&quot;:&quot;LHPGYASUIN&quot;}" data-component-name="LatexBlockToDOM"></div></li><li><p>It says that a noisy sample is a weighted mixture of clean data and Gaussian noise.</p></li></ul></li><li><p>The beta schedule controls how much noise is added at each step. </p><ul><li><p>The cumulative alpha value </p></li><li><p></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{\\alpha}_t&quot;,&quot;id&quot;:&quot;WSXSDQHPQO&quot;}" data-component-name="LatexBlockToDOM"></div><p></p></li><li><p>tells us how much original signal remains.</p></li></ul></li><li><p>The denoiser usually receives a noisy sample, a timestep, and a condition. In the simplest DDPM view, it predicts the noise that was added.</p></li><li><p>Timestep embeddings let one denoising network handle many noise levels, from nearly clean samples to almost pure noise.</p></li><li><p>U-Nets became classic diffusion backbones because they combine broad context with high resolution skip connections.</p></li><li><p>Latent diffusion makes high resolution generation practical by denoising a compressed latent tensor instead of raw pixels.</p></li><li><p>Conditioning turns diffusion from &#8220;generate something&#8221; into &#8220;generate something matching this input.&#8221; Text prompts, masks, edge maps, depth maps, pose maps, and low resolution images are all forms of conditioning.</p></li><li><p>Classifier-free guidance combines unconditional and conditional predictions to trade off freedom against prompt adherence.</p></li><li><p>Diffusion transformers replace the U-Net denoiser with transformer blocks over latent patches. DiT, PixArt-alpha, and MM-DiT show how modern systems combine token processing, text conditioning, and scalable denoising.</p></li></ul><h1>More Blogs</h1><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:190611987,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/the-transformers&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;The Transformers&quot;,&quot;truncated_body_text&quot;:&quot;The Transformer Architecture&quot;,&quot;date&quot;:&quot;2026-03-17T03:32:41.080Z&quot;,&quot;like_count&quot;:167,&quot;comment_count&quot;:5,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fthe-transformers%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">The Transformers</div></div><div class="embedded-post-body">The Transformer Architecture&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">7 months ago &#183; 167 likes &#183; 5 comments &#183; Mayank Pratap Singh</div></a></div><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:181494472,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/vision-transformers&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;Vision Transformers&quot;,&quot;truncated_body_text&quot;:&quot;Table of Contents&quot;,&quot;date&quot;:&quot;2026-03-22T04:10:41.659Z&quot;,&quot;like_count&quot;:71,&quot;comment_count&quot;:0,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fvision-transformers%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Vision Transformers</div></div><div class="embedded-post-body">Table of Contents&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">7 months ago &#183; 71 likes &#183; Mayank Pratap Singh</div></a></div><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:184705881,&quot;url&quot;:&quot;https://www.vizuaranewsletter.com/p/segment-anything-model-sam&quot;,&quot;publication_id&quot;:3591997,&quot;embedding_publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vizuara AI Labs&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!uFo6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png&quot;,&quot;title&quot;:&quot;Segment Anything Model (SAM)&quot;,&quot;truncated_body_text&quot;:&quot;Figure 0: Detailed Architecture of the Segment Anything Model (SAM).&quot;,&quot;date&quot;:&quot;2026-01-20T09:19:46.533Z&quot;,&quot;like_count&quot;:17,&quot;comment_count&quot;:0,&quot;bylines&quot;:[{&quot;id&quot;:321073573,&quot;name&quot;:&quot;Mayank Pratap Singh&quot;,&quot;handle&quot;:&quot;mayankpratapsingh022&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;bio&quot;:&quot;I&#8217;m Mayank, an AI and LLM enthusiast, and this is my space to breaking down complex concepts into accessible insights&quot;,&quot;profile_set_up_at&quot;:&quot;2025-02-24T07:56:43.260Z&quot;,&quot;reader_installed_at&quot;:&quot;2025-08-22T12:46:43.613Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:4286927,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:4203235,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:4203235,&quot;name&quot;:&quot;Mayank&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;mayankpratapsingh022&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41e709c7-9629-4748-93e5-e3014c16fb57_460x460.jpeg&quot;,&quot;author_id&quot;:321073573,&quot;primary_user_id&quot;:321073573,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2025-02-24T08:04:27.535Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Mayank Pratap Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}},{&quot;id&quot;:4286864,&quot;user_id&quot;:321073573,&quot;publication_id&quot;:3466476,&quot;role&quot;:&quot;contributor&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:3466476,&quot;name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;subdomain&quot;:&quot;vizuara&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;My personal Substack&quot;,&quot;logo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;author_id&quot;:290241614,&quot;primary_user_id&quot;:290241614,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-05T04:03:51.614Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Vizuara AI&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}},{&quot;id&quot;:136642032,&quot;name&quot;:&quot;Sreedath Panat&quot;,&quot;handle&quot;:&quot;drsreedathpanat&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fa047b9-4cee-4d9d-8ed7-4a63c5f919b4_974x1220.png&quot;,&quot;bio&quot;:&quot;I am the co-founder of Vizuara AI Labs and a PhD from MIT. I use this space to put down my thoughts and knowledge on AI/ML related topics.&quot;,&quot;profile_set_up_at&quot;:&quot;2024-12-26T07:33:54.300Z&quot;,&quot;reader_installed_at&quot;:&quot;2024-12-26T07:33:49.452Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:3662921,&quot;user_id&quot;:136642032,&quot;publication_id&quot;:3592712,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:true,&quot;publication&quot;:{&quot;id&quot;:3592712,&quot;name&quot;:&quot;Sreedath Panat&quot;,&quot;subdomain&quot;:&quot;panat&quot;,&quot;custom_domain&quot;:null,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;I am the co-founder of Vizuara AI Labs and a PhD from MIT. I use this space to put down my thoughts and knowledge on AI/ML related topics.&quot;,&quot;logo_url&quot;:null,&quot;author_id&quot;:136642032,&quot;primary_user_id&quot;:136642032,&quot;theme_var_background_pop&quot;:&quot;#FF6719&quot;,&quot;created_at&quot;:&quot;2024-12-27T13:32:29.633Z&quot;,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Sreedath Panat&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;,&quot;language&quot;:null,&quot;explicit&quot;:false,&quot;homepage_type&quot;:&quot;newspaper&quot;,&quot;is_personal_mode&quot;:false,&quot;logo_url_wide&quot;:null}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;status&quot;:{&quot;bestsellerTier&quot;:null,&quot;subscriberTier&quot;:null,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:null,&quot;subscriber&quot;:null}}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;,&quot;source&quot;:null}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="iframe.php?url=https%3A%2F%2Fwww.vizuaranewsletter.com%2Fp%2Fsegment-anything-model-sam%3Futm_source%3Dsubstack%26amp%3Butm_campaign%3Dpost_embed%26amp%3Butm_medium%3Dweb"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFo6%21%2Cw_56%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0717dc2f-5f66-4978-99db-8ebaf589e1dd_1088x1088.png" loading="lazy"><span class="embedded-post-publication-name">Vizuara AI Labs</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Segment Anything Model (SAM)</div></div><div class="embedded-post-body">Figure 0: Detailed Architecture of the Segment Anything Model (SAM&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">9 months ago &#183; 17 likes &#183; Mayank Pratap Singh and Sreedath Panat</div></a></div><p>I&#8217;m also building Audio Deep Learning projects and LLM projects, sharing and discussing them on LinkedIn and Twitter. If you&#8217;re someone curious about these topics, I&#8217;d love to connect with you all!</p><p><strong>Mayank Pratap Singh</strong></p><p><strong>LinkedIn</strong><span> : </span><a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fmayankpratapsingh022%2F">www.linkedin.com/in/mayankpratapsingh022</a></p><p><strong>Twitter/X</strong><span> : </span><a href="iframe.php?url=https%3A%2F%2Fx.com%2FMayank_022">x.com/Mayank_022</a><span>.</span></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[FastBLT : Fast Byte Latent Transformer]]></title><description><![CDATA[BLT helped in re-navigating the tokenization bottleneck, but struggled with compute tradeoff for quality preservation; FastBLT is an attempt to fix compute-quality dilemma with architectural fixes]]></description><link>https://vizuara.substack.com/p/fastblt-fast-byte-latent-transformer</link><guid isPermaLink="false">https://vizuara.substack.com/p/fastblt-fast-byte-latent-transformer</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 18 May 2026 03:30:59 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Y51x%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7introduction">Introduction</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A72-why-is-autoregressive-generation-slow">Why is Autoregressive Generation Slow?</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A721-the-autoregressive-loop">The Autoregressive Loop</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A722-flops-vs-memory-bandwidth-what-actually-slows-you-down">FLOPs vs Memory Bandwidth (What Actually Slows You Down?)</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7flops-the-arithmetic-cost">FLOPs : The Arithmetic Cost</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7memory-bandwidth-the-data-movement-cost">Memory Bandwidth : The Data Movement Cost</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-regime-switch-compute-bound-vs-memory-bound">The Regime Switch: Compute-Bound vs Memory-Bound</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A73-generation-as-an-optimization-problem">Generation as an Optimization Problem</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A74-the-ideal-case">The Ideal Case</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A75-methodology">Methodology</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A751-data-processing-pipeline">Data processing pipeline</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A752-blt-diffusion-blt-d">BLT Diffusion (BLT-D)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A753-blt-self-speculation-blt-s">BLT Self-Speculation (BLT-S)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A754-blt-diffusion-verification-blt-dv">BLT Diffusion + Verification (BLT-DV)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7how-blt-dv-blt-d-and-blt-s-relate">How BLT-DV, BLT-D, and BLT-S relate?</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A76-the-50-memory-bandwidth-reduction">The 50% Memory Bandwidth Reduction</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A77-results-and-outcomes">Results &amp; Outcomes</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A78-thoughts">Thoughts</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fb96b23e0-447a-4b0d-aed2-9faa48b4322c%3Fupdated%3D2026-05-15T11%253A06%253A33.601Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A79-conclusion">Conclusion</a></em></p></li></ol><div><hr></div><h1>Introduction</h1><p>A while back, I wrote about the <strong>Byte Latent Transformer</strong> which is a radical rethinking of how language models process text, ditching the tokenizer entirely in favour of raw bytes grouped into dynamic patches. If you haven&#8217;t read that, I&#8217;d strongly recommend starting there, as a lot of what follows builds directly on it.<br></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;0debc746-4209-4ac8-bfaa-e3a9f803a453&quot;,&quot;caption&quot;:&quot;Recently Meta released an intriguing architecture for combining byte level tokenization and transformers at scale, which inherently not only is a better modelling choice but also opens up a multitude of potential direction for research. Let's dive into the proposed idea, but before that, let's warm up with some why? questions.&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Byte Latent Transformers : Patches Scale Better Than Tokens&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null},{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-12-20T06:40:12.775Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4787f8e-660e-492e-8e86-ae8ad92b0439_1045x674.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/byte-latent-transformers-patches&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:153304556,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:7,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>BLT was a landmark result as it demonstrated (convincingly) that tokenization which is something the field had treated as an almost axiomatic preprocessing step is not actually necessary. Byte-level models can match tokenization-based models at scale, with better robustness and more efficient compute allocation.</p><p>But there was a problem hiding in plain sight.</p><p>Byte-level generation is slow. Painfully slow. Every single byte requires its own forward pass through the model and given that a typical English word spans 4-5 bytes, you are looking at roughly 4-5x more decoding steps compared to a token-level model, for the same output. At scale, this isn&#8217;t a minor inconvenience; it is a hard barrier to practical deployment.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Y51x%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y51x!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 424w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 848w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 1272w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Y51x%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png" width="500" height="701" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:701,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Y51x!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 424w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 848w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 1272w, https://substackcdn.com/image/fetch/$s_!Y51x!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7db6eac6-069c-49b1-a92e-b4d609faeaf9_500x701.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Fast BLT is the answer to that problem. The paper introduces three distinct techniques, each attacking the speed-quality tradeoff from a different angle; that together bring byte-level inference into the realm of practical viability. Not only the memory bandwidth costs drop by over 50%, but number of required generation steps collapse and crucially, quality is largely preserved.</p><p>That is what we are unpacking today.</p><div><hr></div><h1>2. Why is Autoregressive Generation Slow?</h1><p>Before we get into Fast BLT, we need to build an honest understanding of <em>where</em> the slowness actually comes from. Most people point to compute. The real culprit is subtler.</p><h2>2.1 The Autoregressive Loop</h2><p>If you&#8217;ve read my BLT article, you&#8217;ll recall that the architecture operates on patches which is dynamically sized groups of bytes; rather than fixed subword tokens. The local encoder compresses raw bytes into patch representations, the latent transformer reasons over them, and the local decoder expands them back to bytes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hPoM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hPoM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 424w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 848w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 1272w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hPoM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png" width="623" height="300" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:300,&quot;width&quot;:623,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Markov Chain Text Generation &#8211; Part 1 &#8211; Continuous Deformation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Markov Chain Text Generation &#8211; Part 1 &#8211; Continuous Deformation" title="Markov Chain Text Generation &#8211; Part 1 &#8211; Continuous Deformation" srcset="https://substackcdn.com/image/fetch/$s_!hPoM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 424w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 848w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 1272w, https://substackcdn.com/image/fetch/$s_!hPoM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4044831-fb13-4022-af0e-9dd50ac6a376_623x300.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But here&#8217;s what doesn&#8217;t change from any standard language model: generation is still fundamentally sequential. To generate byte xt&#8203;, you need all previous bytes <code>x1,x2,&#8230;,xt&#8722;1</code>. Formally:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(x_1, x_2, \\ldots, x_T) = \\prod_{t=1}^{T} P(x_t \\mid x_1, \\ldots, x_{t-1})&quot;,&quot;id&quot;:&quot;DAVOUTSTHW&quot;}" data-component-name="LatexBlockToDOM"></div><p>Each step in this product requires a separate forward pass. There is no way around this in a standard autoregressive model as each output is conditioned on everything before it, making parallelism structurally impossible at generation time.</p><p>For a token-level model, this is manageable. A typical English sentence of 20 words = roughly 20 forward passes. For a byte-level model, that same sentence is ~100 bytes = ~100 forward passes. You&#8217;ve multiplied your decoding cost by 5x before doing anything else.</p><h2>2.2 FLOPs vs Memory Bandwidth (What Actually Slows You Down?)</h2><p>This is where most explanations stop. They say &#8220;<em>more forward passes = slower</em>&#8221; and leave it there. But to really understand the problem, you need to understand the difference between two very different types of cost: <strong>FLOPs</strong> and <strong>memory bandwidth</strong>.</p><h3>FLOPs : The Arithmetic Cost</h3><p>Your GPU is essentially a massively parallel arithmetic machine. Every operation in a neural network like attention, feed-forward layers, layer norms ultimately decomposes into two primitive operations: multiplications and additions. FLOPs (Floating Point Operations) count exactly these.</p><p>Consider the simplest case: multiplying two vectors a,b&#8712;R. The dot product is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{a} \\cdot \\mathbf{b} = \\sum_{i=1}^{n} a_i b_i&quot;,&quot;id&quot;:&quot;AFYDBXFDXY&quot;}" data-component-name="LatexBlockToDOM"></div><p>That&#8217;s n multiplications and n&#8722;1 additions which is roughly 2n FLOPs.</p><p>Now scale this up to matrix multiplication, which is the core operation of every linear layer in a transformer. Multiplying a matrix A&#8712;R(m&#215;k) with B&#8712;R(k&#215;n) produces a result C&#8712;R(m&#215;n), where each of the m&#215;n output elements is a dot product of length k:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;C_{ij} = \\sum_{l=1}^{k} A_{il} \\cdot B_{lj}&quot;,&quot;id&quot;:&quot;YMAEPYWSWU&quot;}" data-component-name="LatexBlockToDOM"></div><p>That&#8217;s 2k FLOPs per output element, and (m&#215;n) output elements, giving a total of:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{FLOPs}(A \\times B) = 2mnk&quot;,&quot;id&quot;:&quot;ULNASWSCNJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>A transformer layer with hidden dimension d=4096 doing a feed-forward projection processes sequences through matrices of size (d&#215;4d); that is a single matrix multiply costing 2&#215;4096&#215;16384&#215;seq_len FLOPs. Stack 32 such layers and you are in the hundreds of billions of FLOPs per forward pass. More FLOPs = more arithmetic = slower, in theory. But here&#8217;s where the story gets interesting.</p><h3>Memory Bandwidth : The Data Movement Cost</h3><p>Your GPU has compute cores; thousands of them that perform these FLOPs. But those cores don&#8217;t store data themselves. All the model weights, activations, and intermediate results live in <strong>VRAM</strong> (Video RAM), which is a separate high-speed memory sitting on the GPU chip.</p><p>Every time the compute cores need to do arithmetic, they must first <em>fetch</em> the relevant numbers from VRAM, bring them into registers, compute, and write the result back. <strong>Memory bandwidth</strong> is the speed at which this data transfer happens <em>(how many bytes per second can flow between VRAM and the compute cores)</em>. Read more about this in one of our articles here :</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;652f2f1a-fdec-4bcd-9ede-422affabffe2&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A Very Long Span of Attention&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-09-23T03:30:38.299Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!ihSQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27240213-16fa-4a2c-af3e-f57e797b59fc_715x349.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/a-very-long-span-of-attention&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:174145370,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:11,&quot;comment_count&quot;:1,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>A modern H100 GPU has ~3.35 TB/s of memory bandwidth. That sounds enormous. And it is huge until you realise how much data a large model actually moves around.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21e7qB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e7qB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 424w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 848w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 1272w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21e7qB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png" width="800" height="406" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:406,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e7qB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 424w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 848w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 1272w, https://substackcdn.com/image/fetch/$s_!e7qB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e44e494-46b4-44b6-902a-316d8a86f206_800x406.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Think of it this way; your GPU is a very fast chef (compute cores) working in a kitchen, but the ingredients (weights and activations) are stored in a walk-in freezer (VRAM) down the corridor. Memory bandwidth is the width of that corridor, basically how much you can carry per trip. No matter how fast the chef can cook, if they&#8217;re constantly running back and forth to the freezer, the bottleneck is the corridor, not the cooking speed.</p><h3>The Regime Switch: Compute-Bound vs Memory-Bound</h3><p>The ratio that captures which of these two bottlenecks dominates is called <strong>arithmetic intensity</strong>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Arithmetic Intensity} = \\frac{\\text{FLOPs Performed}}{\\text{Bytes Moved}}&quot;,&quot;id&quot;:&quot;YZDACQRLZB&quot;}" data-component-name="LatexBlockToDOM"></div><p>This measures how much useful arithmetic you squeeze out of every byte you transfer. High arithmetic intensity means you&#8217;re doing a lot of computation per byte fetched which means the compute cores are the bottleneck. Low arithmetic intensity hence you&#8217;re fetching enormous amounts of data but barely using it; thus the memory corridor is the bottleneck.</p><p><strong>During training</strong>, you process large batches; say 512 sequences simultaneously. Each weight matrix gets loaded once and used 512 times in a single pass. The arithmetic intensity is high. You are <strong>compute-bound</strong> (<em>imagine the chef is cooking furiously and the corridor trips are amortised/full across hundreds of meals)</em>.</p><p><strong>During inference</strong>, particularly interactive generation with batch size 1, the picture flips completely. You generate one byte at a time. Each weight matrix gets loaded, used <em>once</em>, and the pass is done. You move the same 14 GB of weights for a 7B model, but perform a fraction of the arithmetic. The arithmetic intensity collapses and you are now <strong>memory-bound</strong> <em>(the chef takes one bite and runs back to the freezer)</em>.</p><p>Concretely, the time spent just on memory movement per forward pass is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Time}_{\\text{memory}} = \\frac{\\text{Model Size (bytes)}}{\\text{Memory Bandwidth (bytes/s)}}&quot;,&quot;id&quot;:&quot;DOESTGJNQE&quot;}" data-component-name="LatexBlockToDOM"></div><p>For a 7B parameter model in fp16 (2 bytes per parameter):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Time}_{\\text{memory}} = \\frac{7 \\times 10^9 \\times 2}{3.35 \\times 10^{12}} \\approx 4.2 \\text{ ms per forward pass}&quot;,&quot;id&quot;:&quot;ASGJQWFYET&quot;}" data-component-name="LatexBlockToDOM"></div><p>That&#8217;s just the <em>data movement</em> cost. Before a single multiplication happens.</p><p>Now multiply by forward passes. A token-level model generating a 20-word sentence: ~20 passes = ~84 ms in memory movement alone. A byte-level model generating the same sentence: ~100 passes = ~420 ms. The 5x gap is entirely in how many times you are forced to stream those weights; not in any architectural inefficiency.</p><p>This is precisely the regime Fast BLT targets. Not by making the arithmetic faster, not by compressing the weights, but by reducing the number of times you are forced to make that freezer trip. Every technique in the paper is, at its core, a strategy to generate <em>more bytes per forward pass</em> which directly translates to fewer weight loads, less data movement, and dramatically faster wall-clock generation.</p><div><hr></div><h1>3. Generation as an Optimization Problem</h1><p>Every design decision in Fast BLT is a response to a single, cleanly statable tension. Before we look at how the paper resolves it, we need to set it up properly because the solutions only make sense once you feel the weight of the constraint.</p><h2>3.1 The Objective</h2><p>At its core, fast generation is an optimization problem with two competing terms.</p><p>Let B be the number of bytes generated per forward pass, and let D measure the degradation in output quality relative to standard autoregressive generation. You want:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\max_{B} \\hspace{0.5em} B \\hspace{1em} \\text{subject to} \\hspace{1em} \\mathcal{D} \\leq \\epsilon&quot;,&quot;id&quot;:&quot;HBYMMYACAT&quot;}" data-component-name="LatexBlockToDOM"></div><p>In plain terms; it asks to generate as many bytes as possible per forward pass, without letting quality fall beyond some acceptable threshold &#1013;.</p><p>Standard autoregressive generation sits at one extreme of this: B=1, D=0. Every byte is generated perfectly, conditioned on everything before it. Quality is maximally preserved. Speed is maximally sacrificed. </p><p>The question Fast BLT asks is: what happens when you move B above 1? How fast does D grow, and can you control it?</p><h2>3.2 The Fundamental Tension</h2><p>To understand why increasing B is hard, you need to look at what autoregressive conditioning actually enforces.</p><p>The joint probability of a sequence x1&#8203;,x2&#8203;,&#8230;,xT&#8203; factorises as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(x_1, \\ldots, x_T) = \\prod_{t=1}^{T} P(x_t \\mid x_1, \\ldots, x_{t-1})&quot;,&quot;id&quot;:&quot;WWXDDUDFIV&quot;}" data-component-name="LatexBlockToDOM"></div><p>This factorisation is exact as it follows directly from the chain rule of probability, with no approximation involved. Every term in the product is conditioned on the full history of everything generated before it.</p><p>The problem is that this structure is inherently sequential. To compute P(xt&#8739;x1,&#8230;,xt&#8722;1), you need xt&#8722;1&#8203; to already exist. To have xt&#8722;1&#8203;, you needed xt&#8722;2&#8203;. The dependency chain is strict and unbroken; hence there is no valid reordering, no shortcut, no way to compute two terms simultaneously without breaking the conditioning.</p><p>Parallelism requires independence. Autoregressive conditioning enforces dependence. These two requirements are in direct conflict.</p><h2>3.3 What Happens When You Break the Chain</h2><p>Suppose you decide to generate a block of B bytes simultaneously in a single forward pass. To do this, you must make some assumption about the bytes you haven&#8217;t generated yet, because each byte in the block formally depends on the ones before it within the block.</p><p>The approximation you are forced to make is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(x_t \\mid x_1, \\ldots, x_{t-1}) \\approx P(x_t \\mid x_1, \\ldots, x_{t-B}, \\hat{x}_{t-B+1}, \\ldots, \\hat{x}_{t-1})&quot;,&quot;id&quot;:&quot;RTPKIZCAYM&quot;}" data-component-name="LatexBlockToDOM"></div><p>where x_hat denotes bytes that are assumed, drafted, or approximated rather than exactly computed. The moment you introduce x_hat, you have introduced error. The quality degradation D is essentially a measure of how wrong those assumptions are.</p><p>Different strategies for handling x_hat give you different points on the speed-quality curve. Generate B bytes completely in parallel with no within-block conditioning at all; you get maximum speed and maximum error. Draft x_hat carefully and verify them with the full model, you recover quality but spend some of the speed savings on verification. The entire design space of Fast BLT lives in this tradeoff.</p><h2>3.4 The Speed-Quality Frontier</h2><p>This is best understood as a frontier which is analogous to the Pareto frontier in multi-objective optimization. Every point on the frontier represents a different answer to the question: given that I want to generate B&gt;1 bytes per pass, what is the minimum quality degradation I can achieve?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QjhC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QjhC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 424w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 848w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 1272w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QjhC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png" width="627" height="479.0481099656357" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:667,&quot;width&quot;:873,&quot;resizeWidth&quot;:627,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Academia vs Business - Inexact Science&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Academia vs Business - Inexact Science" title="Academia vs Business - Inexact Science" srcset="https://substackcdn.com/image/fetch/$s_!QjhC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 424w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 848w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 1272w, https://substackcdn.com/image/fetch/$s_!QjhC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8461870e-7a30-419b-8bd9-1f3481a51cb0_873x667.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{D}^*(B) = \\min_{\\text{strategy}} \\hspace{0.5em} \\mathcal{D} \\hspace{1em} \\text{subject to} \\hspace{1em} \\text{bytes per pass} = B&quot;,&quot;id&quot;:&quot;HSUIPEKNAC&quot;}" data-component-name="LatexBlockToDOM"></div><p>Points below this frontier are unachievable as you cannot get that quality at that speed. Points above it are suboptimal as you are leaving quality on the table unnecessarily. The goal is to find strategies that sit as close to the frontier as possible.</p><p>Standard autoregressive generation is a single point: (B=1, D=0). The three variants introduced in FastBLT (BLT-D, BLT-S, and BLT-DV) . There are three distinct engineering attempts to trace this frontier at higher values of B, each with a different philosophy for how to handle the h_hat problem. That is what the next section unpacks.</p><div><hr></div><h1>4. The Ideal Case</h1><p>Let&#8217;s start with an unconstrained dream.</p><p>The perfect fast byte generation procedure would look like this: you feed the model a prompt, it runs exactly one forward pass, and out comes the entire response; every byte, in order at perfect quality. Latency collapses to a single matrix multiply. Memory bandwidth gets hit exactly once. The freezer trip happens once, the chef cooks everything, done.</p><p><em>This is the ideal. B=T bytes in a single pass, D=0 quality loss. And it is completely unachievable.</em></p><h2>4.1 Why the Ideal Breaks Down</h2><p>The reason goes back to the factorisation we wrote in the previous section:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(x_1, \\ldots, x_T) = \\prod_{t=1}^{T} P(x_t \\mid x_1, \\ldots, x_{t-1})&quot;,&quot;id&quot;:&quot;PJCZCIEAAY&quot;}" data-component-name="LatexBlockToDOM"></div><p>To generate all T bytes in one pass, every P(xt&#8739;x1,&#8230;,xt&#8722;1) would need to be computed simultaneously. But xt&#8722;1&#8203; is itself an output of the model because it does not exist until the model generates it. You are asking the model to condition on its own outputs before those outputs exist.</p><p>This is not an engineering limitation. It is not something better hardware solves. It is a logical impossibility equivalent to asking someone to read a book they haven&#8217;t written yet. The autoregressive dependency chain is a hard structural constraint, not a soft one.</p><p>There is a useful way to think about this geometrically. Each byte xt&#8203; lives at a node in a directed graph, with edges pointing from every previous byte to the current one:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_1 \\rightarrow x_2 \\rightarrow \\cdots \\rightarrow x_{t-1} \\rightarrow x_t&quot;,&quot;id&quot;:&quot;BDRMVMRRDT&quot;}" data-component-name="LatexBlockToDOM"></div><p>Parallel generation means computing multiple nodes simultaneously. But in a directed acyclic graph with this structure, you cannot compute a node until all its parents are resolved. The chain is maximally sequential as every node has the entire history as its parent set. There is no topological ordering that allows parallelism without breaking at least one dependency edge.</p><p>Breaking a dependency edge means introducing an approximation and every approximation has a cost.</p><h2>4.2 The Cost of Approximation</h2><p>Suppose you break k dependency edges meaning you generate k bytes without conditioning on some of their true predecessors. The quality degradation D accumulates as a function of how many edges you sever and how wrong the approximations are:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{D}(k) = \\sum_{t} D_{KL}\\Big(P(x_t \\mid x_1, \\ldots, x_{t-1}) \\hspace{0.3em} \\Big\\| \\hspace{0.3em} \\hat{P}(x_t \\mid \\hat{x}_1, \\ldots, \\hat{x}_{t-1})\\Big)&quot;,&quot;id&quot;:&quot;DTWUTPWHYR&quot;}" data-component-name="LatexBlockToDOM"></div><p>where DKL is the KL divergence between the true conditional and your approximated one. Each broken edge contributes its own divergence term, and these accumulate across the sequence. The total degradation is bounded below by zero which is achievable only when no edges are broken and grows as approximations compound.</p><p>This is the fundamental tension crystallised into an equation. Speed requires breaking edges. Quality requires preserving them. You cannot do both simultaneously.</p><h2>4.3 How Much of the Ideal Can You Recover?</h2><p>This is the right question and it reframes everything that follows.</p><p>The ideal is unachievable. But the ideal is also not the only target. The real target is the best achievable point on the speed-quality frontier the curve D&#8727;(B) we introduced in the previous section. You want to get as close to (B=T, D=0) as possible, knowing you can never reach it.</p><p>What determines how close you can get? Two things:</p><p><strong>1. How intelligently you approximate the broken dependencies.</strong> If your approximation x_hat is close to the true x, the KL divergence terms stay small even as you break more edges. A model that has learned to draft good hypotheses about future bytes can break many edges with minimal quality cost.</p><p><strong>2. Whether you verify your approximations after the fact.</strong> If you generate bytes in parallel and then check them against the full autoregressive distribution, you can catch and correct the worst errors recovering quality at the cost of an additional verification pass.</p><p>These two ideas : intelligent approximation and post-hoc verification are exactly what the three Fast BLT variants are built around. BLT-D commits fully to approximation, trading some quality for maximum speed. BLT-S leans on verification to recover quality. BLT-DV combines both.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hBSU%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hBSU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 424w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 848w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 1272w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21hBSU%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png" width="969" height="578" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:578,&quot;width&quot;:969,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108127,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hBSU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 424w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 848w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 1272w, https://substackcdn.com/image/fetch/$s_!hBSU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8f49e1-7458-4b5f-b00b-4cea26b1b01d_969x578.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each is a different philosophy for navigating the same inescapable constraint. The ideal case is the star they are all steering toward, knowing they will never quite reach it.</p><div><hr></div><h1>5. Methodology</h1><h2>5.1 Data processing pipeline</h2><p>There is a fundamental tension at the heart of BLT-D&#8217;s design that needs to be resolved before training can even begin. BLT operates on <strong>variable-length patches</strong> as  the entropy-based patcher dynamically decides where patches start and end based on local byte complexity. But diffusion operates on <strong>fixed-length blocks</strong>; which means the denoising process requires a consistent, pre-defined number of positions to mask, corrupt, and recover in parallel.</p><p>These two requirements are structurally at odds. You cannot run a fixed-size diffusion process over patches whose sizes are determined at runtime. The preprocessing step is precisely the bridge that resolves this conflict.</p><h3>Block Construction</h3><p>Given a byte sequence that has been segmented by BLT&#8217;s entropy-based patcher into variable-length patches p1&#8203;,p2&#8203;,&#8230;,pM&#8203;, the preprocessing step re-segments these into fixed-length blocks of size B:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbf{b}_k = (x_{(k-1)B + 1}, x_{(k-1)B + 2}, \\ldots, x_{kB})&quot;,&quot;id&quot;:&quot;JCEUKGHQEM&quot;}" data-component-name="LatexBlockToDOM"></div><p>The critical design decision here is that blocks are constructed by <em>sliding a fixed window over the byte sequence directly</em>; not over the patch boundaries. This means a single block bk&#8203; can and frequently does span multiple patch boundaries. A block of size B=8 might contain the last 3 bytes of patch pi&#8203; and the first 5 bytes of patch pi+1&#8203;.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WSVm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WSVm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 424w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 848w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 1272w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WSVm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png" width="1456" height="806" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:806,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:586875,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WSVm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 424w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 848w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 1272w, https://substackcdn.com/image/fetch/$s_!WSVm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c8f597-58e4-4e3b-a7d9-b0eb87016058_1602x887.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is intentional, not incidental. If blocks were strictly aligned to patch boundaries, the model would only ever learn to generate bytes within a single patch context, it would never learn to predict bytes that cross into the next patch&#8217;s semantic territory. By allowing blocks to extend beyond patch boundaries, the model is forced to learn joint distributions that span patches, which is exactly what enables fast inference to work at block sizes larger than the average patch size.</p><p>The average BLT patch spans roughly 4 bytes. Fixed blocks are typically set to sizes of 8, 12, or 16 bytes; deliberately larger than the average patch, so the model always has to reason across at least one patch boundary during training.</p><h3>Diffusion Process and Masking</h3><p>Once the fixed-length blocks are constructed, the diffusion corruption process is applied. BLT-D uses <strong>absorbing discrete diffusion</strong> rather than Gaussian diffusion because bytes are discrete tokens from a vocabulary of 256 values, not continuous real numbers. Gaussian noise is meaningless in a discrete space; absorbing diffusion replaces bytes with a special [MASK] token instead.</p><p>The forward corruption process for a block b=(x1,&#8230;,xB) at diffusion timestep t is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q(x_t^i \\mid x_0^i) = \\begin{cases} \n\\text{[MASK]} &amp; \\text{with probability } \\gamma(t) \\\\ \nx_0^i &amp; \\text{with probability } 1 - \\gamma(t) \n\\end{cases}&quot;,&quot;id&quot;:&quot;VFRXSVPNDB&quot;}" data-component-name="LatexBlockToDOM"></div><p>where &#947;(t)&#8712;[0,1] is a monotonically increasing masking schedule at t=0, nothing is masked; at t=T, every position is [MASK]. Each byte in the block is independently masked according to this schedule.</p><p>The result is a corrupted block b~ where some fraction of bytes have been replaced by [MASK]. This is what gets fed to the decoder during training alongside the clean sequence.</p><p>The decoder therefore sees two views of the same byte sequence simultaneously:</p><ul><li><p>The <strong>clean sequence</strong> x, on which it is trained with the standard autoregressive next-byte prediction loss L_AR&#8203;</p></li><li><p>The <strong>corrupted block</strong> b~, on which it is trained with the masked byte prediction loss Ldiff&#8203;; predicting the original bytes at every masked position in parallel.</p></li></ul><p>This dual-view training is what gives BLT-D its two inference modes. The autoregressive loss preserves the model&#8217;s ability to generate sequentially when needed. The masked prediction loss teaches the model to recover entire blocks from partial observations; which at inference time becomes the ability to generate from a fully masked block in a small number of iterative denoising steps.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kqEP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kqEP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 424w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 848w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 1272w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kqEP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png" width="408" height="304.990099009901" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a72a724-e759-47bf-914f-a94ed7194240_808x604.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:604,&quot;width&quot;:808,&quot;resizeWidth&quot;:408,&quot;bytes&quot;:124437,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kqEP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 424w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 848w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 1272w, https://substackcdn.com/image/fetch/$s_!kqEP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a72a724-e759-47bf-914f-a94ed7194240_808x604.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Each input is processed simultaneously under two objectives; clean bytes for the autoregressive loss, and a corrupted fixed-length block for the masked prediction loss. The block construction can extend beyond individual patch boundaries, which is what allows the decoder to learn joint patch distributions</figcaption></figure></div><p>The figure above illustrates this pipeline end to end : the variable-length patch segmentation, the fixed-length block construction that cuts across patch boundaries, and the independent per-position masking that produces the corrupted block fed to the decoder.</p><h2>5.2 BLT Diffusion (BLT-D)</h2><p>BLT-D is the most aggressive answer to the ideal case problem. Rather than carefully verifying approximations or drafting conservatively, it asks a more radical question: what if you trained the model to generate entire patches at once, from the ground up?</p><p>To understand why this works, you need to understand diffusion not as a generative model for images, but as a training methodology.</p><h3>The Diffusion Intuition</h3><p>Standard autoregressive generation is like a writer working left to right, one word at a time, never allowed to look ahead or revise. Every choice is final. Every byte is conditioned on a complete, exact history.</p><p>Diffusion is a fundamentally different creative process. Imagine instead that you hand the writer a page of random noise (garbled, corrupted text) and ask them to progressively denoise it into something coherent. They don&#8217;t start from nothing and build left to right. They start from chaos and converge toward structure, iteratively refining the entire page simultaneously. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ctIp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ctIp!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 424w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 848w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 1272w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ctIp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_lossy%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif" width="1280" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ctIp!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 424w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 848w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 1272w, https://substackcdn.com/image/fetch/$s_!ctIp!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60c2574b-c663-47ba-9b07-a924e7dbb869_1280x720.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can think of diffusion like finding path going from A and B while exploring the surrounding space (basically by removing extra choices out on N choices), whereas ARMs are probabilistic walk without actual exploration where the shape of space is not taken into consideration as the next step in only function of last state (basically by performing selection out of N choices). Hence, the difference lies in the way we explore space (rejection vs selection).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Of94%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Of94!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 424w, https://substackcdn.com/image/fetch/$s_!Of94!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 848w, https://substackcdn.com/image/fetch/$s_!Of94!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 1272w, https://substackcdn.com/image/fetch/$s_!Of94!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Of94%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp" width="694" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:694,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Introduction to Diffusion Models for Machine Learning | SuperAnnotate&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Introduction to Diffusion Models for Machine Learning | SuperAnnotate" title="Introduction to Diffusion Models for Machine Learning | SuperAnnotate" srcset="https://substackcdn.com/image/fetch/$s_!Of94!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 424w, https://substackcdn.com/image/fetch/$s_!Of94!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 848w, https://substackcdn.com/image/fetch/$s_!Of94!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 1272w, https://substackcdn.com/image/fetch/$s_!Of94!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd35e6a97-0b96-46a5-bb6b-4f8c93f6b885_694x337.webp 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Formally, diffusion defines a <strong>forward process</strong> that gradually corrupts clean data x_0 into noise over T steps:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q(x_t \\mid x_{t-1}) = \\mathcal{N}(x_t; \\sqrt{1 - \\beta_t} x_{t-1}, \\beta_t I)&quot;,&quot;id&quot;:&quot;UICBCLYRVN&quot;}" data-component-name="LatexBlockToDOM"></div><p>where beta_t controls how much noise is added at each step. After enough steps, x_T is pure Gaussian noise; all structure destroyed.</p><p>The model then learns the <strong>reverse process</strong> which is denoising step by step, recovering structure from noise:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_\\theta(x_{t-1} \\mid x_t) = \\mathcal{N}(x_{t-1}; \\mu_\\theta(x_t, t), \\Sigma_\\theta(x_t, t))&quot;,&quot;id&quot;:&quot;LNOTFGOJEM&quot;}" data-component-name="LatexBlockToDOM"></div><p>The key insight is that the reverse process operates over the <em>entire sequence simultaneously</em>. The model is not predicting one byte given all previous bytes. It is predicting a denoised version of the entire patch given a noisy version of the entire patch. The within-patch dependency problem which is the broken edges from section 4; simply does not exist in this formulation, because the model never claimed to respect those dependencies in the first place.</p><h3>Block-Wise Diffusion as a Training Objective</h3><p>BLT-D applies this idea at the patch level. Recall from the original BLT architecture that the model operates on patches (dynamically grouped sequences of bytes). BLT-D introduces an auxiliary training objective that operates within each patch.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218JhE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8JhE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 424w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 848w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 1272w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218JhE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png" width="1283" height="801" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:801,&quot;width&quot;:1283,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:213850,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!8JhE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 424w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 848w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 1272w, https://substackcdn.com/image/fetch/$s_!8JhE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd29f32b-5d8d-4a8c-aefa-fddaf9a85dd9_1283x801.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>During training, for each patch of bytes <code>p = (x_1, x_2, &#8230;, x_B)</code>, the model is trained simultaneously on two objectives:</p><p><strong>1. Standard next-byte prediction</strong> : the usual autoregressive loss, preserving the model&#8217;s ability to generate sequentially:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{\\text{AR}} = -\\sum_{t=1}^{B} \\log P(x_t \\mid x_1, \\ldots, x_{t-1}, \\text{context})&quot;,&quot;id&quot;:&quot;LNHVABDXHP&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>2. Block-wise diffusion</strong> : a denoising objective over the entire patch simultaneously. A noised version of the patch  is constructed by corrupting the clean bytes, and the model is trained to recover the original:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{\\text{diff}} = \\mathbb{E}{t, \\tilde{\\mathbf{p}}} \\left[ | \\mathbf{p} - f_\\theta(\\tilde{\\mathbf{p}}, t, \\text{context}) |^2 \\right]&quot;,&quot;id&quot;:&quot;QLOJEHKHCW&quot;}" data-component-name="LatexBlockToDOM"></div><p>The combined training objective is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L} = \\mathcal{L}_{\\text{AR}} + \\lambda \\mathcal{L}_{\\text{diff}}&quot;,&quot;id&quot;:&quot;TRBAMBBZIG&quot;}" data-component-name="LatexBlockToDOM"></div><p>where lambda(&#955;) balances the two terms. The autoregressive loss keeps the model honest about sequential structure. The diffusion loss teaches the model an additional skill; recovering entire patches at once from corrupted versions of themselves.</p><p>This auxiliary objective is what unlocks parallel generation at inference time. The model has been explicitly trained to look at a noisy patch and produce a clean one without needing to condition on within-patch byte order.</p><h4>Why This Works ?</h4><p>The reason BLT-D can generate entire patches in parallel without catastrophic quality loss comes down to what the diffusion objective teaches the model to represent.</p><p>A standard autoregressive model learns, for each position t, a conditional distribution P(x_t | x&lt;t}). This is a one-dimensional slice through the joint distribution (a single byte&#8217;s distribution given a fixed history).</p><p>A model trained with the diffusion objective additionally learns to approximate the <strong>joint distribution over the entire patch</strong> P(x_1, x_2, &#8230;, x_B | context). This is a fundamentally richer object. It encodes not just what each byte should be, but how bytes within a patch co-vary with each other (their mutual dependencies) and their collective structure (imagine a higher order statistic).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JZH7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JZH7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JZH7%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png" width="1024" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:456192,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JZH7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!JZH7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b8832bd-b278-41b2-b41f-eb4f6e3efd89_1024x559.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When the model denoises a corrupted patch, it is implicitly reasoning about all within-patch dependencies simultaneously. The result is a sample from an approximation of the true joint patch distribution; which is exactly what you want for parallel generation.</p><p>The approximation is not perfect. The model&#8217;s learned joint distribution is not identical to the true autoregressive joint. But the diffusion training objective directly minimises the gap between them, and empirically, the gap is small enough that quality remains largely intact.</p><h3>A Worked Example : One Decoding Step</h3><p>To make this concrete, consider generating the phrase <strong>&#8220;neural&#8221;</strong> which is  6 bytes: <code>n</code>, <code>e</code>, <code>u</code>, <code>r</code>, <code>a</code>, <code>l</code>. Suppose BLT has grouped these into a single patch based on its dynamic patching criterion.</p><p><strong>Vanilla BLT (6 forward passes):</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Nx61%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nx61!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 424w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 848w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 1272w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Nx61%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png" width="559" height="349.375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:700,&quot;width&quot;:1120,&quot;resizeWidth&quot;:559,&quot;bytes&quot;:85278,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nx61!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 424w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 848w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 1272w, https://substackcdn.com/image/fetch/$s_!Nx61!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2131e2ec-47dd-44f9-a846-c3decf75235a_1120x700.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Six separate passes through the full model. Six separate weight loads from VRAM.</p><p><strong>BLT-D (1 forward pass):</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KFF-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KFF-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 424w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 848w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 1272w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KFF-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png" width="1285" height="492" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:492,&quot;width&quot;:1285,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:200482,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KFF-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 424w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 848w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 1272w, https://substackcdn.com/image/fetch/$s_!KFF-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceff21d8-8d2d-4ee6-aa41-e26457b7aacf_1285x492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The model receives the prompt context and a fully noised patch <code>p~&#8203;=(x~1&#8203;,x~2&#8203;,&#8230;,x~6&#8203;)</code>: pure noise at the start of the diffusion reverse process. </p><p>In a single forward pass, it denoises this entire patch simultaneously, producing:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f_\\theta(\\tilde{\\mathbf{p}}, t, \\text{context}) \\approx (n, e, u, r, a, l)&quot;,&quot;id&quot;:&quot;GWAZGDJXYT&quot;}" data-component-name="LatexBlockToDOM"></div><p>All 6 bytes, one pass, in one weight load. The within-patch ordering is handled implicitly by the learned joint distribution; not by sequential conditioning.</p><p>In practice, the denoising may take a small number of iterative refinement steps rather than exactly one pass, but the number of steps is fixed and small, independent of patch size. The scaling is fundamentally different from autoregressive generation.</p><p>The cost paid is that the output is a <em>sample</em> from an approximation of the true joint distribution, not an exact draw from the autoregressive chain. For most patches, in most contexts, the approximation is tight enough that the output is correct. For patches where the within-patch dependencies are strong and the approximation matters; the quality begins to degrade.</p><p>This is why BLT-D sits at the aggressive end of the speed-quality frontier. It trades the guarantee of exact autoregressive conditioning for the efficiency of parallel patch generation. It wins enormously on speed. It gives up a small but nonzero amount on quality.</p><p>The next two variants are built precisely to recover that quality; each in its own way.</p><h2>5.3 BLT Self-Speculation (BLT-S)</h2><p>BLT-D makes a bold bet, <em><strong>generate entire patches in parallel and accept that the approximation is good enough</strong></em>. BLT-S takes a more cautious philosophy. Rather than committing to parallel generation outright, it asks: what if you could generate speculatively, and then <em>check your work</em>?</p><p>This idea has a name in the literature : Speculative decoding. But BLT-S applies it in a way that is architecturally unique to BLT. To understand why, we need to build up speculative decoding from scratch.</p><h3>Speculative Decoding (The Core Idea)</h3><p>Standard speculative decoding involves two models : a small, fast <strong>draft model</strong> and a large, slow <strong>verification model</strong>. The procedure is:</p><ol><li><p>The draft model generates K tokens autoregressively and quickly, because it is small.</p></li><li><p>The verification model runs a single forward pass over all K drafted tokens simultaneously.</p></li><li><p>Each drafted token is accepted or rejected based on how well it matches the verification model&#8217;s distribution.</p></li><li><p>The first rejected token is resampled from the verification model&#8217;s distribution, and the process restarts.</p></li></ol><p>The key insight is that the verification model&#8217;s single forward pass is parallelisable over the K drafted tokens, because they are all inputs, not outputs. You are not generating them; you are scoring them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zXxr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zXxr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 424w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 848w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 1272w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zXxr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png" width="1456" height="417" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:417,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zXxr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 424w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 848w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 1272w, https://substackcdn.com/image/fetch/$s_!zXxr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9a87090-eef9-4456-844d-9ffcb9eaad10_1581x453.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This means you get K tokens verified in roughly the same time as one token generated, as long as most drafts are accepted. You can get more info here:</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;d0fdcedf-c200-4626-b37e-c87c997ad9ea&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Speculative Decoding &#8212; Think Fast&#9889;, Then Think Right&#9989;&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/899381b9-9023-4399-8998-8fbe507d75d2_400x400.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-04-14T03:49:56.160Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!bxOG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F066923e5-f40a-45d0-8f54-ceb044ce44da_667x374.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/speculative-decoding-think-fast-then&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:161074837,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:6,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>Formally, the acceptance criterion for a drafted token x^t&#8203; is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A(\\hat{x}_t) = \\min\\left(1, \\frac{P_{\\text{verify}}(\\hat{x}_t \\mid x_{<t})}{\\hat{P}_{\\text{draft}}(\\hat{x}_t \\mid x_{<t})}\\right)&quot;,&quot;id&quot;:&quot;UNXFLVUEYX&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is a rejection sampling condition as it guarantees that the final output distribution is <em>exactly</em> the verification model&#8217;s distribution, regardless of draft quality. Better drafts mean higher acceptance rates and faster generation. Worse drafts mean more rejections and more restarts. But correctness is always guaranteed.</p><p>The cost of speculative decoding is maintaining two separate models : a draft model and a verification model. This adds memory overhead, complexity, and the engineering burden of keeping both models aligned.</p><h3>The BLT-S Twist  (Self-Speculation)</h3><p>BLT-S eliminates the draft model entirely. Instead, it exploits something unique about BLT&#8217;s architecture which is the separation between the <strong>local decoder</strong> and the <strong>latent transformer</strong>.</p><p>Recall from the original BLT architecture: the latent transformer operates at the patch level, reasoning over compressed patch representations. The local decoder then takes each patch representation and expands it back into individual bytes, autoregressively within the patch boundary.</p><p>In vanilla BLT, the local decoder stops at the patch boundary as it generates bytes up to the end of the current patch and hands off to the latent transformer for the next patch representation.</p><p>BLT-S asks: what if the local decoder kept going past that boundary?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j77q%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4634f152-5031-4136-b715-504dbab91ee3_894x616.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j77q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 424w, https://substackcdn.com/image/fetch/$s_!j77q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 848w, https://substackcdn.com/image/fetch/$s_!j77q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 1272w, https://substackcdn.com/image/fetch/$s_!j77q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j77q%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4634f152-5031-4136-b715-504dbab91ee3_894x616.png" width="894" height="616" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4634f152-5031-4136-b715-504dbab91ee3_894x616.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:616,&quot;width&quot;:894,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97518,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j77q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 424w, https://substackcdn.com/image/fetch/$s_!j77q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 848w, https://substackcdn.com/image/fetch/$s_!j77q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 1272w, https://substackcdn.com/image/fetch/$s_!j77q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4634f152-5031-4136-b715-504dbab91ee3_894x616.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The local decoder is a much smaller, faster model than the full latent transformer. If it continues generating bytes beyond its assigned patch (drafting bytes that belong to the <em>next</em> patch) it is doing so cheaply, without invoking the expensive latent transformer. These drafted bytes are then verified with a single full-model forward pass.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BLT-S Draft} = \\text{LocalDecoder}(h_{\\text{patch}}, x_1, \\ldots, x_B, \\hat{x}_{B+1}, \\ldots, \\hat{x}_{B+K})&quot;,&quot;id&quot;:&quot;ARFZIILWLL&quot;}" data-component-name="LatexBlockToDOM"></div><p>where h_patch&#8203; is the current patch representation from the latent transformer, x1,&#8230;,xB&#8203; are the correctly generated bytes within the patch boundary, and x^B+1,&#8230;,x^B+K are the speculative bytes drafted beyond it.</p><p>The full model then verifies these K speculative bytes in a single forward pass, accepting or rejecting each using the same criterion as standard speculative decoding.</p><h4>Why This Works?</h4><p>The reason BLT-S is architecturally elegant is that the local decoder is not an arbitrary draft model; it is a component that was already trained as part of BLT, specifically to model byte-level distributions conditioned on patch representations.</p><p>Within a patch, the local decoder is highly accurate as it has the correct patch representation h_patch&#8203; to condition on. Beyond the patch boundary, the local decoder is operating with a stale patch representation; it is conditioning on h_patch&#8203; for bytes that belong to a region the latent transformer hasn&#8217;t processed yet. The quality of the draft depends on how much the correct patch representation for the next patch would differ from the current one.</p><p>Intuitively, when adjacent patches are semantically similar (which is common in fluent, locally coherent text); the stale representation is a good approximation, acceptance rates are high, and BLT-S generates many bytes per latent transformer call. When patches are semantically discontinuous like the topic shifts, rare tokens, structural boundaries; then the draft quality degrades, acceptance rates fall, and the procedure gracefully falls back toward vanilla BLT behaviour.</p><p>This is a crucial property. BLT-S never produces outputs worse than vanilla BLT as the rejection sampling guarantee ensures the output distribution is always exactly the full model&#8217;s distribution. The speed gain is variable, but the quality floor is fixed.</p><p>The expected number of bytes generated per full model forward pass is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbb{E}[\\text{bytes per pass}] = \\sum_{k=0}^{K} (B + k) \\cdot P(\\text{first rejection at position } B+k+1)&quot;,&quot;id&quot;:&quot;USTIOLQVYE&quot;}" data-component-name="LatexBlockToDOM"></div><p>When acceptance rates are high, this expectation is close to B+K which is nearly the full speculative draft is accepted. When acceptance rates are low, it collapses toward B : vanilla BLT performance. The model self-regulates based on local text coherence.</p><div><hr></div><h3>A Worked Example (One Decoding Step)</h3><p>Consider generating the phrase <strong>&#8220;the neural network&#8221;</strong> as two adjacent patches: <code>the </code>(4 bytes) and <code>neural</code> (6 bytes).</p><p><strong>Vanilla BLT:</strong></p><ul><li><p>Latent transformer runs for patch 1, local decoder generates <code>t</code>, <code>h</code>, <code>e</code>, : 4 bytes.</p></li><li><p>Latent transformer runs for patch 2, local decoder generates <code>n</code>, <code>e</code>, <code>u</code>, <code>r</code>, <code>a</code>, <code>l</code> : 6 bytes.</p></li><li><p>Total: 2 latent transformer calls, 10 local decoder steps.</p></li></ul><p><strong>BLT-S with K=6 speculative bytes:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212bAr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2bAr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 424w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 848w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 1272w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212bAr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png" width="1440" height="1040" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1040,&quot;width&quot;:1440,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:146478,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2bAr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 424w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 848w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 1272w, https://substackcdn.com/image/fetch/$s_!2bAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7b236c-dbfb-4435-96f6-8e05aa1afd72_1440x1040.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Latent transformer runs for patch 1, local decoder generates <code>t</code>, <code>h</code>, <code>e</code>, within the boundary.</p></li><li><p>Local decoder continues past the boundary, drafting <code>n</code>, <code>e</code>, <code>u</code>, <code>r</code>, <code>a</code>, <code>l</code> speculatively using the patch 1 representation as a stale approximation.</p></li><li><p>Full model runs a single verification pass over all 6 speculative bytes simultaneously.</p></li><li><p>Since <code>the </code>and <code>neural</code> are locally coherent, the patch 1 representation is a reasonable approximation for patch 2; hence high acceptance rate result in 6 bytes accepted.</p></li><li><p>Total: 1 latent transformer call, 10 local decoder steps, 1 verification pass.</p></li></ul><p>The latent transformer call (the expensive part) has been halved. The verification pass is cheap because it is parallelised over all 6 bytes at once. The output is provably drawn from the correct distribution.</p><p>Where BLT-D generates quickly but approximates, BLT-S generates at the correct distribution but spends a verification pass to get there. The speed gain is real but more conservative, hence the quality guarantee is exact.</p><h2>5.4 BLT Diffusion + Verification (BLT-DV)</h2><p>BLT-D generates fast but approximates. BLT-S generates correctly but conservatively. BLT-DV is the natural question that follows: what if you combined both?</p><p>The idea is straightforward in principle, subtle in execution. Use BLT-D&#8217;s diffusion mechanism to generate an entire patch in parallel; fast, cheap, one pass. Then use an autoregressive verification step to catch and correct the errors that the diffusion approximation introduces. You get the speed of parallel generation and the quality recovery of verification, in a single unified procedure.</p><h3>The Two-Stage Procedure</h3><p>BLT-DV operates in two stages per patch.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EtF5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EtF5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 424w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 848w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 1272w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EtF5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png" width="1045" height="670" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:670,&quot;width&quot;:1045,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157544,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EtF5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 424w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 848w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 1272w, https://substackcdn.com/image/fetch/$s_!EtF5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55418b64-74da-4dd5-b804-8bcad29249be_1045x670.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Stage 1 : Diffusion Draft.</strong> Identical to BLT-D. The model receives the prompt context and a noised patch, and denoises it in parallel to produce a draft:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{\\mathbf{p}} = (\\hat{x}_1, \\hat{x}_2, \\ldots, \\hat{x}B) = f_\\theta(\\tilde{\\mathbf{p}}, t, \\text{context})&quot;,&quot;id&quot;:&quot;XXIDTBUTCC&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is fast; one forward pass, all B bytes generated simultaneously, no within-patch sequential conditioning.</p><p><strong>Stage 2 : Autoregressive Verification.</strong> The drafted patch p_hat is now fed into an autoregressive verification pass. The full model scores each drafted byte against its true autoregressive conditional:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P_{\\text{verify}}(\\hat{x}t \\mid x{<t}, \\hat{x}{1}, \\ldots, \\hat{x}{t-1}) \\hspace{1em} \\text{for } t = 1, \\ldots, B&quot;,&quot;id&quot;:&quot;ODGKHKLEGP&quot;}" data-component-name="LatexBlockToDOM"></div><p>Using the same rejection sampling criterion as BLT-S:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A(\\hat{x}t) = \\min\\left(1, \\frac{P{\\text{verify}}(\\hat{x}t \\mid x{<t})}{\\hat{P}_{\\text{diff}}(\\hat{x}_t \\mid \\text{context})}\\right)&quot;,&quot;id&quot;:&quot;QJVUSEHFLF&quot;}" data-component-name="LatexBlockToDOM"></div><p>Bytes that pass are accepted. The first byte that fails is resampled from the verification model&#8217;s distribution, and the remaining drafted bytes after that position are discarded.</p><p>The combined objective is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}{\\text{BLT-DV}} = \\underbrace{\\mathcal{L}_{\\text{diff}}}_{\\text{parallel draft}} + \\underbrace{\\mathcal{L}_{\\text{AR}}}_{\\text{sequential verify}}&quot;,&quot;id&quot;:&quot;MUOQFENOGA&quot;}" data-component-name="LatexBlockToDOM"></div><p>which is exactly the same training objective as BLT-D; the difference is entirely in how inference is structured, not in how the model is trained.</p><h3>What Verification Actually Fixes?</h3><p>To understand what the verification step recovers, you need to think carefully about where BLT-D&#8217;s approximation fails.</p><p>The diffusion objective trains the model to learn the joint patch distribution P(x_1, &#8230;, x_B | context). The approximation is tight when within-patch dependencies are weak; for example; when knowing x_1 doesn&#8217;t dramatically change the distribution of x_2, &#8230;, x_B. In these cases, the joint distribution factorises approximately as a product of marginals, and the diffusion model captures it well.</p><p>The approximation degrades when within-patch dependencies are strong. Consider a patch containing a rare proper noun, a numerical value, or a syntactically constrained sequence. Here, the bytes within the patch are tightly coupled hence getting x_1 wrong cascades into x_2, x_3, &#8230; being wrong as well. The diffusion model&#8217;s learned joint distribution underestimates these tight couplings, and the draft patch contains errors.</p><p>Verification directly targets these failure cases. The autoregressive pass processes the drafted bytes left to right, with full within-patch conditioning:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P_{\\text{verify}}(x_t \\mid x_1, \\ldots, x_{t-1}, \\text{context})&quot;,&quot;id&quot;:&quot;OCJHIXFRTF&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is the exact distribution the diffusion model was approximating. When the draft is good (weak within-patch dependencies) the verification pass accepts most bytes, and the overhead is minimal. When the draft is bad (strong within-patch dependencies) the verification pass catches the first error, resamples it correctly, and discards the remaining corrupted bytes.</p><p>The result is a procedure that degrades gracefully. When diffusion drafts are accurate, BLT-DV behaves like BLT-D which makes it fast, parallel, cheap. But, when drafts are inaccurate, BLT-DV falls back toward sequential generation slower, but more accurate. The verification pass acts as a quality floor, catching exactly the cases where parallel generation would have introduced unacceptable error.</p><h3>How BLT-DV, BLT-D, and BLT-S relate?</h3><p>It is worth pausing here to see all three variants clearly as a family, rather than three isolated techniques.</p><p>All three are navigating the same constraint from section 4; i.e. the autoregressive dependency chain. Each makes a different architectural choice about where to place trust:</p><ul><li><p><strong>BLT-D</strong> trusts the diffusion model entirely. No verification. Maximum speed, accepts the approximation error.</p></li><li><p><strong>BLT-S</strong> trusts the local decoder as a draft model, but insists on verification by the full autoregressive model. Exact output distribution, variable speed.</p></li><li><p><strong>BLT-DV</strong> trusts the diffusion model for the draft, but adds verification as a safety net. Speed closer to BLT-D, quality closer to BLT-S.</p></li></ul><p>Formally, if we denote the expected quality degradation and expected bytes per pass for each variant:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{D}_{\\text{BLT-D}} \\geq \\mathcal{D}_{\\text{BLT-DV}} \\geq \\mathcal{D}_{\\text{BLT-S}} = 0 &quot;,&quot;id&quot;:&quot;CDWQGPQPPE&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\n\\mathbb{E}[B_{\\text{BLT-D}}] \\geq \\mathbb{E}[B_{\\text{BLT-DV}}] \\geq \\mathbb{E}[B_{\\text{BLT-S}}]&quot;,&quot;id&quot;:&quot;WIRLHUXBCI&quot;}" data-component-name="LatexBlockToDOM"></div><p>BLT-S sits at zero quality degradation (it is provably correct), BLT-D sits at maximum speed and BLT-DV occupies the middle, trading a fraction of BLT-D&#8217;s speed for a significant recovery of quality.</p><p>Together, they trace three distinct points on the speed-quality frontier we defined in section 3; each a different engineering answer to the same mathematical tension.</p><h4>A Worked Example (One Decoding Step)</h4><p>Consider generating <strong>&#8220;on 42nd Street&#8221;</strong>: a patch with strong within-patch dependencies. The number <code>42</code> and the ordinal suffix <code>nd</code> are tightly coupled, getting the digits wrong cascades into the suffix being wrong.</p><p><strong>BLT-D:</strong></p><ul><li><p>Diffusion generates the entire patch in one pass: <code>o</code>, <code>n</code>, , <code>4</code>, <code>2</code>, <code>n</code>, <code>d</code>, , <code>S</code>, <code>t</code>, <code>r</code>, <code>e</code>, <code>e</code>, <code>t</code></p></li><li><p>No verification. If the diffusion model mis-samples <code>4</code> as <code>3</code>, the output becomes <code>on 32nd Street</code> : wrong, and the error propagates silently.</p></li></ul><p><strong>BLT-DV:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xWve%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xWve!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 424w, https://substackcdn.com/image/fetch/$s_!xWve!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 848w, https://substackcdn.com/image/fetch/$s_!xWve!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!xWve!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xWve%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png" width="653" height="507.8888888888889" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1120,&quot;width&quot;:1440,&quot;resizeWidth&quot;:653,&quot;bytes&quot;:135193,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xWve!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 424w, https://substackcdn.com/image/fetch/$s_!xWve!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 848w, https://substackcdn.com/image/fetch/$s_!xWve!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!xWve!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b749848-a2c7-4d25-9d2e-a0d34c144311_1440x1120.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Diffusion generates the same draft in one pass.</p></li><li><p>Verification pass processes left to right. <code>o</code>, <code>n</code>, are accepted : low dependency, high confidence. The model reaches <code>4</code> that is high dependency context, tight coupling with what follows. If <code>4</code> was missampled, the verification distribution catches it:</p></li></ul><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A(\\hat{x}_4 = \\text{3'}) = \\min\\left(1, \\frac{P_{\\text{verify}}(\\text{3&#8217;} \\mid \\text{on '})}{P_{\\text{diff}}(\\text{3&#8217;} \\mid \\text{context})}\\right) \\ll 1&quot;,&quot;id&quot;:&quot;MZYRVBMSSO&quot;}" data-component-name="LatexBlockToDOM"></div><ul><li><p><code>3</code> is rejected, resampled as <code>4</code>. <code>2</code>, <code>n</code>, <code>d</code> are then regenerated correctly from the verified <code>4</code>.</p></li><li><p>Output: <code>on 42nd Street</code> is correct.</p></li></ul><p>The diffusion pass is not wasted the accepted bytes <code>o</code>, <code>n</code>, came for free. Only the tightly coupled suffix required correction. The verification overhead is proportional to the number of rejections, which is proportional to how wrong the diffusion draft was.</p><p>This is BLT-DV&#8217;s core value proposition: pay for verification only where the draft earns it.</p><h2>Recap of all Three Variants</h2><p>All three variants are solving the same problem by breaking the byte-by-byte autoregressive chain; but they make fundamentally different bets about where to place trust.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!z634!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 424w, https://substackcdn.com/image/fetch/$s_!z634!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 848w, https://substackcdn.com/image/fetch/$s_!z634!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 1272w, https://substackcdn.com/image/fetch/$s_!z634!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21z634%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png" width="1439" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:1439,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49747,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!z634!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 424w, https://substackcdn.com/image/fetch/$s_!z634!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 848w, https://substackcdn.com/image/fetch/$s_!z634!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 1272w, https://substackcdn.com/image/fetch/$s_!z634!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e57a01d-a4b3-4ab9-9853-8669b0ed5127_1439x166.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The progression is intuitive. BLT-D bets everything on the diffusion approximation being good enough. BLT-S never bets at all ; it always verifies. BLT-DV bets on diffusion, but keeps a safety net.</p><p>What unites them is the 50%+ memory bandwidth reduction they all achieve relative to vanilla BLT. The mechanism differs across variants: fewer forward passes in BLT-D, fewer latent transformer calls in BLT-S, fewer sequential steps in BLT-DV but the destination is the same: dramatically fewer weight loads from VRAM per byte generated.</p><p>That bandwidth number is worth unpacking on its own. Which is exactly what the next section does.</p><div><hr></div><h1>6. The 50% Memory Bandwidth Reduction</h1><p>50% lower memory bandwidth cost. The paper states it cleanly, and it is an impressive number. But a number without a denominator is just a claim. To understand what this figure actually represents and why it matters; you need to know precisely where memory bandwidth gets consumed during LLM inference, and how each Fast BLT variant attacks that consumption.</p><h2>6.1 Where Does Bandwidth Actually Go?</h2><p>During inference, memory bandwidth is consumed in two distinct places.</p><p><strong>Weight Loads.</strong> Every forward pass requires streaming the model&#8217;s parameters from VRAM into the compute cores. For a model with P parameters stored in precision p bytes each, every single forward pass costs:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW}_{\\text{weights}} = P \\times p \\hspace{1em} \\text{bytes}&quot;,&quot;id&quot;:&quot;VMCQVAUUGJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>For a 7B model in fp16, that is 14 GB per pass. For a 70B model, 140 GB. This cost is fixed and unavoidable; every forward pass pays it in full, regardless of how many bytes are generated.</p><p><strong>KV Cache Reads.</strong> The KV cache stores the key and value vectors for every token in the context, so that attention over the full history does not need to be recomputed at every step. For a model with L layers, H attention heads, head dimension d_h, and context length n, the KV cache size is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{KV Cache} = 2 \\times L \\times H \\times d_h \\times n \\times p \\hspace{1em} \\text{bytes}&quot;,&quot;id&quot;:&quot;VZMKNIOUOT&quot;}" data-component-name="LatexBlockToDOM"></div><p>The factor of 2 accounts for both keys and values. At every forward pass, the entire KV cache must be read from VRAM to compute attention over the full context. For long contexts (which are increasingly common) this term dominates. A model with 32 layers, 32 heads, head dimension 128, context length 8192, in fp16:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{KV Cache} = 2 \\times 32 \\times 32 \\times 128 \\times 8192 \\times 2 \\approx 8.6 \\text{ GB}&quot;,&quot;id&quot;:&quot;NKGMQNMCTC&quot;}" data-component-name="LatexBlockToDOM"></div><p>Per forward pass. On top of the weight loads.</p><p>So the total bandwidth consumed per forward pass is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW}{\\text{total}} = \\underbrace{P \\times p}_{\\text{weight loads}} + \\underbrace{2LHd_h n p}_{\\text{KV cache reads}}&quot;,&quot;id&quot;:&quot;BPMIJDHPNG&quot;}" data-component-name="LatexBlockToDOM"></div><p>And for autoregressive generation producing one byte per pass, the total bandwidth consumed to generate a sequence of T bytes is simply:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW}{\\text{sequence}} = T \\times \\text{BW}{\\text{total}}&quot;,&quot;id&quot;:&quot;GCBGHIAOWW&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is the number Fast BLT is attacking. Not the per-pass cost; that is fixed by model size and architecture. The total cost over a sequence, which scales linearly with the number of forward passes required.</p><h2>6.2 How Fewer Forward Passes Translates to Bandwidth Savings</h2><p>The relationship is direct and linear. If a variant generates B bytes per forward pass instead of 1, the total bandwidth consumed to generate T bytes drops by exactly a factor of B:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW}{\\text{fast}} = \\frac{T}{B} \\times \\text{BW}{\\text{total}}&quot;,&quot;id&quot;:&quot;SWDKASOYKR&quot;}" data-component-name="LatexBlockToDOM"></div><p>The bandwidth saving is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Saving} = 1 - \\frac{1}{B} = \\frac{B - 1}{B}&quot;,&quot;id&quot;:&quot;VFPVRMVGEQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>For B = 2, you save 50%. For B = 4, you save 75%. The curve is concave; the first doublings give enormous savings, and subsequent doublings give diminishing returns.</p><p>The 50%+ figure the paper reports corresponds roughly to generating 2 or more bytes per forward pass on average across all three variants. This is a lower bound in practice, BLT-D and BLT-DV often generate entire patches of 4-8 bytes per pass, yielding savings well above 50% in favourable conditions.</p><p>What is important to note is that this saving applies to <em>both</em> bandwidth terms simultaneously. Fewer forward passes means fewer weight loads <em>and</em> fewer KV cache reads. The two costs are coupled through the forward pass count, so halving the passes halves both.</p><h2>6.3 What 50% Bandwidth Reduction Means at Scale</h2><p>A 50% bandwidth reduction is not a 50% latency reduction; the relationship between bandwidth and latency is hardware-dependent and nonlinear. But the operational implications are significant and concrete.</p><p><strong>Throughput.</strong> In a serving system handling many concurrent requests, memory bandwidth is a shared resource across all requests. Reducing per-request bandwidth consumption directly increases the number of requests the system can serve simultaneously. A 50% bandwidth reduction (all else equal) roughly doubles the throughput of a memory-bound serving system. For a production system handling millions of daily requests, this is the difference between doubling capacity and buying twice the hardware.</p><p><strong>Latency.</strong> In the memory-bound regime we established in section 2, latency is approximately proportional to bandwidth consumed. Halving bandwidth consumed halves time-to-first-byte latency and halves total generation time for a fixed sequence length. For interactive applications where latency directly affects user experience, this is a first-order improvement.</p><p><strong>Hardware Efficiency.</strong> Modern GPU clusters are expensive. A significant fraction of that cost is memory bandwidth, for instance; the H100&#8217;s 3.35 TB/s of HBM3 bandwidth is one of its most expensive engineering properties. Techniques that consume less bandwidth get more useful work out of the same hardware. A 50% bandwidth reduction means each GPU in a serving cluster is doing twice as much useful generation work per second; which directly reduces the cost per token served.</p><p><strong>Context Length Scaling.</strong> Notice that the KV cache term in BW_total grows linearly with context length n. As context windows extend to 128K, 1M, and beyond, the KV cache bandwidth cost increasingly dominates weight loads. The absolute bandwidth savings from Fast BLT therefore grow with context length; the longer the context, the more each avoided forward pass saves. This makes Fast BLT progressively more valuable as the field pushes toward longer contexts, not less.</p><p>To put a concrete number on this: a 70B model serving requests with 32K context length in fp16 consumes roughly:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW}_{\\text{total}} = (70 \\times 10^9 \\times 2) + (2 \\times 80 \\times 64 \\times 128 \\times 32768 \\times 2)\\approx 247 \\text{ GB per pass}&quot;,&quot;id&quot;:&quot;XFHYUBMGUB&quot;}" data-component-name="LatexBlockToDOM"></div><p>At 3.35 TB/s bandwidth, that is roughly 74 ms per forward pass in memory movement alone. Vanilla BLT generating 100 bytes: 7.4 seconds in bandwidth cost. Fast BLT at 50% saving: 3.7 seconds. At scale, across millions of requests, these seconds compound into meaningful infrastructure cost differences.</p><div><hr></div><h1>7. Results &amp; Outcomes</h1><p>The paper evaluates all three variants at 1B and 3B parameter scales across two primary task categories: <strong>translation</strong> (WMT benchmarks) and <strong>code generation</strong> (HumanEval). These two tasks represent opposite ends of the within-patch dependency spectrum; i.e. translation is smooth and locally coherent, code is syntactically rigid and character-level precise.</p><p>The primary efficiency metric throughout is <strong>estimated memory bandwidth cost</strong> relative to vanilla BLT, computed as the ratio of total bytes moved across all forward passes. The primary quality metrics are <strong>BLEU</strong> for translation and <strong>pass@1</strong> for code generation.</p><h2>7.1 BLT-D  (Speed First)</h2><p>BLT-D achieves over 50% lower estimated memory-bandwidth cost compared to BLT on translation and code generation tasks, with larger diffusion block sizes pushing this up to 92% reduction. This is the headline number and it comes with an important qualifier. The 92% figure is achievable, but not free. Quality degrades as block size grows, because the model is predicting further into the future without autoregressive conditioning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MW48%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MW48!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 424w, https://substackcdn.com/image/fetch/$s_!MW48!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 848w, https://substackcdn.com/image/fetch/$s_!MW48!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 1272w, https://substackcdn.com/image/fetch/$s_!MW48!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21MW48%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png" width="1456" height="765" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:765,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:199405,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MW48!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 424w, https://substackcdn.com/image/fetch/$s_!MW48!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 848w, https://substackcdn.com/image/fetch/$s_!MW48!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 1272w, https://substackcdn.com/image/fetch/$s_!MW48!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5a5c2b8-6efc-4533-8d12-267a52bcca52_1543x811.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The relationship between block size B and bandwidth reduction is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{BW Reduction} = 1 - \\frac{1}{B}&quot;,&quot;id&quot;:&quot;WHUBHRSIXW&quot;}" data-component-name="LatexBlockToDOM"></div><p>At B=4: 75% reduction. At B=8: 87.5%. At B=12: ~92%. The curve is concave ie. each additional byte per block yields diminishing bandwidth returns, while quality costs accelerate.</p><p>On translation tasks, quality degradation at moderate block sizes is acceptable; BLEU scores remain competitive with vanilla BLT up to mid-range block sizes before falling meaningfully. On code generation, the degradation is sharper (syntactic constraints mean within-patch errors propagate) and pass@1 drops more steeply with block size.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fJd9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fJd9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 424w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 848w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 1272w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fJd9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png" width="1456" height="405" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:405,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:123256,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fJd9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 424w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 848w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 1272w, https://substackcdn.com/image/fetch/$s_!fJd9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72753835-940d-4da4-b1cc-f59f4ee269ae_1662x462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Performance comparison of 3B-parameter BLT and BLT-D models (block sizes: 4, 8, 16) across five benchmarks. While BLT-D variants exhibit a performance hit due to balancing next-byte prediction with the diffusion objective, the diffusion mechanism enables much faster inference for BLT-D.</figcaption></figure></div><h2>7.2 BLT-S  (Zero Quality Cost)</h2><p>BLT-S achieves up to 77% bandwidth reduction with no loss in task performance. This is the most conservative number across the three variants, but it comes with the strongest possible quality guarantee; under greedy decoding, BLT-S output is provably identical to vanilla BLT.</p><p>The bandwidth reduction here is not fixed, it varies with local text coherence and acceptance rates. On translation, where adjacent patches are semantically smooth, acceptance rates are high and bandwidth reduction approaches the upper bound. On code, where patch boundaries frequently coincide with syntactic discontinuities, acceptance rates are more variable and the effective bandwidth reduction is lower.</p><p>The metric that governs BLT-S performance is <strong>mean accepted bytes per full model call</strong>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\bar{B}_{\\text{accepted}} = \\mathbb{E}\\left[\\sum_{k=0}^{K} \\mathbf{1}[\\hat{x}_{B+k} \\text{ accepted}]\\right]&quot;,&quot;id&quot;:&quot;AYJVSBFAOD&quot;}" data-component-name="LatexBlockToDOM"></div><p>Higher B&#713;accepted&#8203; means more bytes generated per expensive encoder/global model call. The 77% upper bound corresponds to conditions where B&#713;accepted&#8203; is maximised; hence, highly coherent text where the local decoder&#8217;s stale patch representation remains a good approximation across patch boundaries.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZVx%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gZVx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 424w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 848w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 1272w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gZVx%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png" width="1456" height="765" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:765,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:240086,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gZVx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 424w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 848w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 1272w, https://substackcdn.com/image/fetch/$s_!gZVx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc0674ba-4c06-4cbb-aaef-2560eed7c791_1543x811.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>7.3 BLT-DV (The Middle Ground)</h2><p>BLT-DV recovers some quality relative to BLT-D while still achieving up to 81% bandwidth reduction compared to BLT. On code generation specifically, BLT-DV meaningfully closes the gap to vanilla BLT that BLT-D opens; verification catches the syntactically critical errors that diffusion gets wrong, while the accepted bytes from the diffusion draft still provide substantial bandwidth savings.</p><p>The efficiency of BLT-DV is governed by its <strong>acceptance rate</strong> (what fraction of diffusion-drafted bytes survive the verification pass). Let &#945; be the per-byte acceptance probability. The expected bytes generated per full model call is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathbb{E}[B_{\\text{DV}}] = \\sum_{k=1}^{B} k \\cdot \\alpha^{k-1}(1 - \\alpha) + B \\cdot \\alpha^B&quot;,&quot;id&quot;:&quot;NXYQRKVYPB&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where &#945;&#8594;1 means diffusion drafts are nearly perfect, BLT-DV behaves like BLT-D, achieving close to its 92% upper bound. When &#945;&#8594;0 means drafts are consistently wrong and BLT-DV collapses toward vanilla BLT, with the verification overhead as the only cost.</p><p>At 3B scale, BLT-DV&#8217;s acceptance rates improve relative to 1B; hence larger models produce better diffusion drafts, which means the 81% bandwidth reduction is achievable at higher quality levels as model size grows.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EIs5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 424w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 848w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 1272w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EIs5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png" width="1107" height="170" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:170,&quot;width&quot;:1107,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41256,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/197199054?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EIs5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 424w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 848w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 1272w, https://substackcdn.com/image/fetch/$s_!EIs5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1fc12c-0c3e-44b3-a2df-7873b83da4e3_1107x170.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The 50%+ figure cited in the abstract is a conservative lower bound; the floor of what each variant achieves across all experimental conditions. In practice, the ceiling is significantly higher, with BLT-D reaching 92% bandwidth reduction at its most aggressive block size configuration.</p><p>The relationship between block size and bandwidth reduction is monotonic but not linear in quality cost. Doubling the diffusion block size roughly halves the number of forward passes, but the quality degradation accelerates non-linearly as block size grows; because larger blocks require the model to predict further into the future without autoregressive conditioning, and within-patch dependencies compound.</p><div><hr></div><h1>8. Thoughts</h1><ul><li><p>BLT fixed the tokenization bottleneck whereas FastBLT fixes the inference speed bottleneck. Together, they make a complete case that byte-level models are production-viable architecture.</p></li><li><p>The three variants are not competing techniques; they are a menu. BLT-S for when correctness is non-negotiable. BLT-D for when throughput is the objective. BLT-DV for everything in between. The fact that a single training procedure (BLT-D&#8217;s combined objective) unlocks two of the three variants at inference time is an underappreciated engineering win.</p></li><li><p>The scaling result is the most interesting finding in the paper. Larger models produce better diffusion drafts, which means the quality cost of parallel generation decreases with scale. The efficiency gains compound with model size  which is the opposite of what you&#8217;d naively expect. Fast BLT gets more valuable, not less, as models grow.</p></li><li><p>The 92% bandwidth reduction figure deserves to be read carefully. It is achievable, but at a block size where code generation quality degrades meaningfully. The honest operating point for most production use cases is probably the 50-80% range, where the speed-quality tradeoff is genuinely favourable across both translation and code.</p></li><li><p>BLT-S has a property that doesn&#8217;t get enough attention, it is a strict Pareto improvement over vanilla BLT. No quality cost, up to 77% bandwidth savings. In practice, any system running vanilla BLT today has no reason not to switch to BLT-S. The only variable is how much speed you actually recover, and the floor is zero degradation.</p></li><li><p>The failure mode worth watching is BLT-D on structured outputs : code, JSON, mathematical expressions, anything with rigid character-level constraints. The diffusion approximation is fundamentally a bet that within-patch dependencies are weak. That bet fails exactly where structured generation needs it most. Until there is a mechanism to dynamically detect high-dependency patches and fall back gracefully, BLT-D should be used cautiously on structured generation tasks.</p></li><li><p>The connection to speculative decoding is deeper than the paper frames it. BLT-S and BLT-DV are essentially speculative decoding without a draft model, the architecture itself provides the draft mechanism for free. This is a hint at a more general principle: hierarchical architectures are natural homes for speculative generation, because the cheaper lower-level components can always serve as drafters for the expensive upper-level ones.</p></li><li><p>What is still unsolved is the dynamic block size problem. All three variants use fixed block sizes chosen before generation begins. The optimal block size is a function of local text complexity that is simple, coherent text wants large blocks; complex, constrained text wants small ones. An adaptive block size mechanism that responds to per-patch entropy in real time would push every variant further along the speed-quality frontier without any quality cost.</p></li><li><p>Byte-level models have one property that token-level models structurally cannot match as they are language agnostic. Fast BLT&#8217;s efficiency gains apply equally across all languages, including low-resource ones where subword tokenizers are notoriously lossy. This is an underexplored application space that the field has not fully reckoned with yet.</p></li></ul><div><hr></div><h1>9. Conclusion</h1><p>Fast BLT reframes byte-level inference as a function of parallel generation efficiency rather than sequential correctness guarantees. By abandoning the byte-by-byte orthodoxy of standard autoregressive decoding and treating generation as an integrated co-design of training objectives and inference procedures, we move closer to a byte-level model that doesn&#8217;t just process text correctly, but respects the physical constraints of the hardware it runs on.</p><p>In this article, we started by revisiting the BLT architecture and establishing why autoregressive byte-level generation, despite its theoretical elegance, hits a hard wall at inference time. We grounded the problem not in compute which is the intuitive culprit; but in memory bandwidth, showing that the true bottleneck is the repeated streaming of model weights and KV cache across every single forward pass.</p><p>We then framed generation as a constrained optimization problem, establishing the speed-quality frontier formally before the solutions landed. We defined the ideal case which is a single forward pass generating an entire sequence at zero quality cost and showed precisely why it is structurally unachievable, and what it means to approximate it intelligently.</p><p>We explored the methodology of Fast BLT through its three variants: BLT-D, which bets on diffusion to generate entire patches in parallel; BLT-S, which exploits BLT&#8217;s own local decoder as a zero-cost draft mechanism with an exact quality guarantee; and BLT-DV, which combines both into a pragmatic middle ground. Finally, we saw results that positioned each variant on the speed-quality frontier like BLT-D at 92% bandwidth reduction, BLT-DV at 81%, and BLT-S at 77% with provably zero quality degradation.</p><p>The key takeaway is that the sequential tax of autoregressive generation, the need to invoke the full model for every single byte is an inefficiency we can finally bypass. When we decouple byte generation from strict left-to-right conditioning, we don&#8217;t just get faster models; we get a new class of inference procedures that stop fighting the autoregressive dependency chain and start modeling the joint structure of the data itself.</p><p>BLT removed the vocabulary bottleneck. Fast BLT removes the speed bottleneck. The case for byte-level models is now complete.</p><p>Paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2605.08044">https://arxiv.org/pdf/2605.08044</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><p>That's all for today.<br><br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more insightful posts, till then happy Learning. Bye&#128075;</p><p></p>]]></content:encoded></item><item><title><![CDATA[TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate]]></title><description><![CDATA[What if you can quantize your KV cache. It is the silent memory killer in long-context LLMs; TurboQuant solves it with rotation, optimal codebooks, and 1-bit residuals and proves it's near-optimal.]]></description><link>https://vizuara.substack.com/p/turboquant-online-vector-quantization</link><guid isPermaLink="false">https://vizuara.substack.com/p/turboquant-online-vector-quantization</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 06 Apr 2026 03:30:57 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21C2Ya%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em>Introduction</em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A72-a-quick-primer-on-bit-representation">A Quick Primer on Bit Representation</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A721-how-numbers-live-inside-a-computer">How Numbers Live Inside a Computer</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A722-why-reducing-mantissa-shrinks-the-model-but-costs-you-information">Why Reducing Mantissa Shrinks the Model but Costs You Information</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A73-quantization-on-kv-cache">Quantization on KV Cache</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A731-two-places-you-can-quantize-an-llm">Two Places You Can Quantize an LLM</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A732-why-the-kv-cache-gets-so-large">Why the KV Cache Gets So Large</a>?</em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A733-kv-caching-is-a-necessary-evil">KV Caching Is a Necessary Evil</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A734-why-this-problem-is-different-from-weight-quantization">Why This Problem Is Different from Weight Quantization</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A74-quantization-as-a-constrained-optimization-problem">Quantization as a Constrained Optimization Problem</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A741-finding-the-right-transformation">Finding the Right Transformation</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A742-bits-as-dimensions-of-information">Bits as Dimensions of Information</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A743-the-problem-with-fixed-codebooks">The Problem with Fixed Codebooks</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A75-methodology">Methodolog</a>y</em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A751-solving-the-unknown-distribution-problem-mse-persepective">Solving the Unknown Distribution Problem (MSE persepective)</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7511-the-residual-decomposition">The Residual Decomposition</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7512-getting-into-a-known-space-via-rotation">Getting into a Known Space via Rotation</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7513-precomputing-the-optimal-codebook-via-lloyd-max">Precomputing the Optimal Codebook via Lloyd-Max</a></em></p></li><li><p><em>Example</em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A752-handling-the-residual-with-qjl-inner-product-perspective">Handling the Residual with QJL (inner-product perspective)</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7521-why-the-codebook-alone-isnt-enough">Why the Codebook Alone Isn&#8217;t Enough</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7522-johnson-lindenstrauss-the-theory-behind-the-projection">Johnson-Lindenstrauss: The Theory Behind the Projection</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7523-qjl-random-projection-meets-1-bit-quantization">QJL: Random Projection Meets 1-Bit Quantization</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7why-does-sign-quantization-still-preserve-useful-information">Why Does Sign Quantization Still Preserve Useful Information?</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7524-why-n1-bit-1-bit-qjl-beats-n-bit">Why (N&#8722;1)-bit + 1-bit QJL Beats N-bit</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7525-example">Example</a></em></p></li></ol></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A76-results-and-outcomes">Results &amp; Outcomes</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A77-thoughts">Thoughts</a></em></p></li><li><p><em>C<a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fa2c1e8de-4069-479f-8907-f774aa44ef30%3Fupdated%3D2026-04-04T20%253A30%253A42.945Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A78-conclusion">onclusion</a></em></p></li></ol><h1>Introduction</h1><p>Every few months, the AI research world finds itself at a familiar crossroads: models are getting smarter, but the cost of running them keeps climbing. More parameters, longer contexts, heavier compute. The usual response? Throw more GPUs at it.</p><p>But there&#8217;s a quieter revolution happening in parallel, one that doesn&#8217;t ask for more resources, it asks for less. A revolution built around one deceptively simple question: <em>how little information do we actually need to represent something meaningful?</em></p><p>We&#8217;ve been exploring this question together for a while now. In our <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F4-bit-llm-training-and-primer-on">4-bit LLM training article</a>, we started from the ground up; what is precision?, why does it matter?, what happens when you reduce mantissa bits? and how engineers handle the chaos that follows?. Then in the <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F1-bit-llms-the-final-frontier-for">1-bit LLMs article</a>, we pushed that question to its logical extreme like what does a model look like when each weight can only say <em>yes</em>, <em>no</em>, or <em>nothing</em>? And how did BitNet and BitNetV2 manage to make that work without the whole thing collapsing?</p><p>Both of those articles shared a common thread: they were about quantizing the <em>model</em>; hence, compressing the weights, the parameters, the learned knowledge baked into the network. And they worked, remarkably well.</p><p>But here&#8217;s the thing nobody talks about enough.</p><p><em>Even a perfectly quantized model, running at 1-bit precision, still has to think.</em> And thinking, in the transformer world, means attention. Attention means keys and values. And keys and values, as context grows longer, become their own memory problem; one that model quantization alone doesn&#8217;t solve.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wHqN!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 424w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 848w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 1272w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wHqN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_lossy%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif" width="694" height="288.2769230769231" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:108,&quot;width&quot;:260,&quot;resizeWidth&quot;:694,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wHqN!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 424w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 848w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 1272w, https://substackcdn.com/image/fetch/$s_!wHqN!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94196287-7f9e-4606-9665-9ad669c2c228_260x108.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This is where <strong>TurboQuant</strong> comes in. And it&#8217;s doing something fundamentally different from everything we&#8217;ve discussed before.</p><p>TurboQuant isn&#8217;t about compressing what the model <em>knows</em>. It&#8217;s about compressing what the model <em>remembers while thinking</em> which is the KV cache, the running ledger of keys and values that attention maintains across every token it has ever seen. As we discussed in the Kimi-Linear article, KV caching is a necessary evil. Remove it and you&#8217;re back to recomputing attention from scratch at every step, which is orders of magnitude more expensive. Keep it and it balloons with every token, eating memory that scales with context length, not model size.</p><p>So the question TurboQuant asks is sharp and specific: <em>can we quantize the KV cache itself, not as an afterthought, but as a principled optimization problem, with theoretical guarantees about what we lose and what we keep?</em></p><p>The answer, as we&#8217;ll see, isn&#8217;t just yes. It&#8217;s an answer that comes with a beautiful mathematical argument for <em>why</em> its approach is provably better than naive quantization at the same bit budget. <em><strong>And to get there, it reaches into some surprisingly elegant territory that is rotation, Gaussian distributions, Johnson-Lindenstrauss projections, and a residual trick that turns the limits of quantization into an advantage.</strong></em></p><p>In this article, we&#8217;ll try to build TurboQuant from scratch, the same way we&#8217;ve approached everything else here: starting with the <em>why</em>, building up the tools, and letting the methodology emerge naturally from the problem. By the end, the math won&#8217;t just make sense; it&#8217;ll feel inevitable. Let&#8217;s start with why quantization is such a big deal, and why the KV cache is the next frontier. </p><p><em>(Side note : The informtion in this article is upper bounded by a function of my knowledge/grasp on the topic, expressiveness and verboseness of my writing, the delta between my expression/writing and thought/understanding, my mood to type for hours and a writing medium that doesnt support inline latex. Hence; I would encourage you to re-visit every thing you read/learn here.)</em></p><div><hr></div><h1>2. A Quick Primer on Bit Representation</h1><p><em>If you&#8217;ve read our earlier deep-dive on <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F4-bit-llm-training-and-primer-on">4-bit LLM training</a>, some of this will feel familiar. Think of this as a focused recap of just the pieces TurboQuant builds on; if you haven&#8217;t, this section has everything you need.</em></p><h2>2.1 How Numbers Live Inside a Computer</h2><p>Every number your model works with every weight, every activation, every key and value in the KV cache is stored as a sequence of bits. The question is: <em>how many bits, and how are they arranged?</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A-HA%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A-HA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 424w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 848w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 1272w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A-HA%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png" width="1108" height="663" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:663,&quot;width&quot;:1108,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A-HA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 424w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 848w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 1272w, https://substackcdn.com/image/fetch/$s_!A-HA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca655a90-4f6f-4e6b-a157-bbea4ef7e0ae_1108x663.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Floating point numbers, which are the standard currency of deep learning, are split into three parts:</p><ul><li><p><strong>Sign bit</strong> : is this number positive or negative? One bit, straightforward.</p></li><li><p><strong>Exponent</strong> : how large or small is the number, in terms of powers of 2? This controls the <em>range</em> of values you can represent.</p></li><li><p><strong>Mantissa</strong> : the fractional precision, the fine-grained detail <em>within</em> that range.</p></li></ul><p>A helpful way to think about this: imagine you&#8217;re describing a location on a number line. The exponent tells you <em>which neighbourhood</em> you&#8217;re in; it places you coarsely on the line, somewhere between 0.001 and 0.01, or between 10 and 100. The mantissa then tells you <em>exactly where inside that neighbourhood</em> you are. More mantissa bits = more precise location within the neighbourhood. Fewer mantissa bits = you can only point to a rough spot, not an exact address.</p><p>This maps directly onto something we use every day. In scientific notation, the number &#960; &#8776; 3.14159265358979323846... is written as 3.14159265358979323846&#8230;. &#215; 10&#8304;. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QVl2%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QVl2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 424w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 848w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QVl2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg" width="314" height="350.796875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:715,&quot;width&quot;:640,&quot;resizeWidth&quot;:314,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;8 Day Pi Day Memes to Celebrate Pi Day - FueledByLOLZ&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="8 Day Pi Day Memes to Celebrate Pi Day - FueledByLOLZ" title="8 Day Pi Day Memes to Celebrate Pi Day - FueledByLOLZ" srcset="https://substackcdn.com/image/fetch/$s_!QVl2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 424w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 848w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!QVl2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95057472-e868-40e9-b0bb-6529a0a03f14_640x715.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The part before the decimal that is the 3; is the coarse location. The part to the <em>right</em> of the decimal .14159265358979323846...  is the mantissa. It&#8217;s the fractional residue that carries the fine-grained information. </p><p>In coordinate geometry, if you think of a number line as an x-axis, the exponent places you at a position along that axis (the abscissa the horizontal distance from the origin), while the mantissa is like the sub-division of that position, the fractional part that sits <em>within</em> the unit interval at that location. Two completely different ideas, but they illuminate the same underlying structure: coarse placement first, fine detail second.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219g-Q%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9g-Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 424w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 848w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 1272w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219g-Q%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png" width="1456" height="835" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:835,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9g-Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 424w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 848w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 1272w, https://substackcdn.com/image/fetch/$s_!9g-Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412bf04a-459f-49e2-b6d8-da4acdd7bf24_1666x956.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>FP32 gives you 23 mantissa bits and 8 exponent bits. BF16 trades mantissa precision for speed; it keeps the same 8 exponent bits (so the range stays large) but cuts the mantissa down to 7 bits. INT4 goes further still, with essentially no mantissa at all just 4 bits of integer range.</p><div><hr></div><h2>2.2 Why Reducing Mantissa Shrinks the Model but Costs You Information</h2><p>Here is the core tension that every quantization paper is wrestling with.</p><p>Fewer bits = less memory. A weight stored in FP32 takes 32 bits. The same weight in INT4 takes 4 bits is an 8&#215; reduction. At the scale of billions of parameters, this is the difference between a model that fits on one GPU and one that requires eight. So the pressure to reduce bits is real and enormous.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HFs_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 424w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 848w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 1272w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HFs_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png" width="1456" height="227" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:227,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HFs_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 424w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 848w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 1272w, https://substackcdn.com/image/fetch/$s_!HFs_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a7d2c77-a96a-4eb9-aa1c-b6de65444f33_1985x310.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>But every bit you remove from the mantissa is a resolution you&#8217;re giving up permanently. Values that were once distinct; say 0.7312 and 0.7318; now round to the same bucket. The model can no longer tell them apart. And unlike lossy image compression where you might not notice a blurry background, in a neural network these small distinctions compound. A gradient that was 0.003 might round to zero. A key vector that was subtly different from its neighbour might become identical. Multiplied across billions of parameters and thousands of forward passes, these small rounding errors accumulate into meaningful drift.</p><p>This is not just a storage problem. It&#8217;s an <em>information geometry</em> problem. When you quantize, you are partitioning a continuous space into a finite number of buckets, and everything that falls into the same bucket becomes indistinguishable. The fewer the bits, the larger the buckets, the coarser the partition, and the more information irreversibly collapses.</p><p>The mantissa is precisely where this collapse happens. The exponent controls <em>which</em> part of the number line you&#8217;re on, as soon as you reduce it; you lose range (which is not desirable). But reduce the mantissa, and you lose resolution <em>within</em> each range; which is painful but more tolerable, because in large distributed systems, each individual weight doesn&#8217;t need to be infinitely precise. The collective effect of many imprecise weights can still approximate a good function, especially when the weights are spread across many dimensions.</p><p>This is the bet that quantization makes. And up to 4-bit, as we saw in earlier articles, it&#8217;s a bet that largely pays off for model weights.</p><p>The KV cache, however, is a different story and that&#8217;s exactly what makes TurboQuant&#8217;s approach necessary. We&#8217;ll get to that shortly.</p><div><hr></div><h1>3. Quantization on KV Cache</h1><p><em>Before we get into what TurboQuant does, we need to deeply understand the problem it&#8217;s solving. This section is about building that conviction; why the KV cache specifically?, why quantizing it is different from quantizing weights, and why it&#8217;s become the next big thing.</em></p><h2>3.1 Two Places You Can Quantize an LLM</h2><p>When we talk about making LLMs more efficient through quantization, there are really only two places to intervene: the <strong>weight space</strong> and the <strong>token space</strong>.</p><p><strong>Weight space</strong> is what we&#8217;ve been discussing in our earlier articles. The model&#8217;s learned parameters are composed of the billions of floating point numbers baked in during training which are then compressed to lower precision. This is a one-time cost. You quantize the weights once, and you carry that compressed model everywhere (Techniques like BitNet, QLoRA, GPTQ have been covered <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F1-bit-llms-the-final-frontier-for">here</a>).</p><p><strong>Token space</strong> is different. This is the space of <em>activations</em>; the intermediate computations the model performs as it processes each new token at inference time. These aren&#8217;t fixed like weights as they&#8217;re generated fresh for every new input, and they grow with every token the model sees. This is where the KV cache lives.</p><p>Now, the research community has done an admirable job on weight space quantization. We have robust methods, strong theoretical understanding, and production-grade implementations that let us run models at 4-bit or even 1-bit with surprisingly little quality loss. That problem, while not fully solved, is reasonably well understood. <em><strong>Token space quantization and specifically KV cache quantization is where the real uncharted territory begins and the reason it matters is scale.</strong></em></p><div><hr></div><h2>3.2 Why the KV Cache Gets So Large</h2><p>Let&#8217;s make this concrete. Every transformer layer maintains a cache of keys and values for every token it has processed. This is the mechanism that lets the model attend to past context without recomputing it from scratch. As we discussed in the Kimi-Linear article, this is not optional it&#8217;s the thing that makes autoregressive generation tractable at all. But the cost is memory, and that grows without bound.</p><p>For a model with L layers, H attention heads, head dimension d, and a context of n tokens, the KV cache size is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{KV Cache} = 2 \\times L \\times H \\times d \\times n \\times \\text{bytes per element}&quot;,&quot;id&quot;:&quot;JBTMOCLOEJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The factor of 2 is for keys and values separately. Everything else is fixed by architecture; except n (context length), which grows with every token generated. At 128k context, a single LLaMA-70B layer&#8217;s KV cache can rival the size of the model weights themselves. Across all layers, it easily exceeds them.</p><p>This means two things. First, the KV cache is often the <em>dominant</em> memory cost at inference, not the model weights. Second, unlike weights which you compress once offline, the KV cache must be compressed <em>online</em>, token by token, at inference speed. That constraint fundamentally changes what methods are viable.<br></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21au3w%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!au3w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 424w, https://substackcdn.com/image/fetch/$s_!au3w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 848w, https://substackcdn.com/image/fetch/$s_!au3w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!au3w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21au3w%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png" width="1456" height="782" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:782,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;blog/kv-cache-quantization.md at main &#183; huggingface/blog &#183; GitHub&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="blog/kv-cache-quantization.md at main &#183; huggingface/blog &#183; GitHub" title="blog/kv-cache-quantization.md at main &#183; huggingface/blog &#183; GitHub" srcset="https://substackcdn.com/image/fetch/$s_!au3w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 424w, https://substackcdn.com/image/fetch/$s_!au3w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 848w, https://substackcdn.com/image/fetch/$s_!au3w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!au3w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcbca096c-5aca-4b7b-beaa-b673a878c557_2018x1084.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">source : https://github.com/huggingface/blog/blob/main/kv-cache-quantization.md</figcaption></figure></div><div><hr></div><h2>3.3 KV Caching Is a Necessary Evil</h2><p>Here is a thought experiment worth sitting with. What happens if you simply don&#8217;t cache the KV pairs?</p><p>Every time the model generates a new token, it would need to recompute the full attention over all previous tokens from scratch. The keys and values for every past token would need to be recomputed by re-running them through the model. For a context of n tokens, this means O(n) full forward passes just to generate one new token. The compute cost becomes quadratic  O(N^2) in context length; this is exactly the problem the KV cache was invented to solve/avoid.</p><p>So removing the cache entirely is not a real option. It would push the cost back into weight-space compute, multiplied by sequence length, and that product grows catastrophically. The KV cache is the mechanism by which we <em>offload</em> that quadratic cost into linear memory. It is, in the truest sense, trading memory for compute. A necessary evil.</p><p>Which means the question isn&#8217;t whether to have a KV cache. It&#8217;s how to make the one we have as small as possible, without losing what attention actually needs from it.</p><div><hr></div><h2>3.4 Why This Problem Is Different from Weight Quantization</h2><p>You might reasonably ask: if we can quantize model weights to 4-bit with good results, why not just do the same thing to KV cache entries?</p><p>The answer is that KV cache vectors and model weights have very different statistical properties, and quantization methods that work well for one tend to work poorly for the other.</p><p>Model weights, after training, settle into distributions that are relatively well-behaved roughly Gaussian, with moderate outliers that can be managed. They&#8217;re also <em>static</em>. You can study their distribution offline, design a codebook around it, and apply it once.</p><p>KV cache vectors are <em>dynamic</em>. They&#8217;re produced by the model as it processes each new token, and their distribution shifts with every input. A key vector generated while processing a legal document looks nothing like one generated mid-conversation. Outliers appear unpredictably, distributions are non-uniform across dimensions, and the whole thing changes at inference time when you have no opportunity for offline calibration.</p><p>This is precisely why naive quantization of the KV cache like applying INT4 or INT8 as you would to weights; leads to noticeable quality degradation. The buckets you designed for one distribution are wrong for another. Information collapses in the exact dimensions where attention needs it most.</p><p>TurboQuant&#8217;s central insight is that this isn&#8217;t a quantization problem to be patched; it&#8217;s an <em>optimization problem</em> to be solved properly. And solving it properly requires a completely different framework, one that doesn&#8217;t assume anything about the shape of the input distribution, but instead transforms the data into a shape where quantization can be applied optimally. That framework is what we build next.</p><div><hr></div><h1>4. Quantization as a Constrained Optimization Problem</h1><p><em>This is where TurboQuant stops being just another compression trick and starts being something more interesting. We&#8217;re going to reformulate the entire quantization problem from scratch; not as an engineering patch, but as a mathematical optimization with a well-defined objective. Once you see it this way, everything that follows in the methodology feels inevitable.</em></p><h2>4.1 Finding the Right Transformation</h2><p>Let&#8217;s start with the most general possible framing. Lets say you have a matrix A, which is a block of key vectors from your KV cache, stored in full precision. You want to find a compressed version B, stored in far fewer bits, such that the information loss is minimized. Formally, you&#8217;re looking for a transformation G such that:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;B=G(A)&quot;,&quot;id&quot;:&quot;JLMQZXTPPR&quot;}" data-component-name="LatexBlockToDOM"></div><p>and the difference between A and G(A) is as small as possible in some meaningful sense. </p><p>But what does &#8220;meaningful sense&#8221; actually mean here? This is the question most quantization papers gloss over, and it&#8217;s where TurboQuant takes a sharp turn. The naive answer is mean squared error.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;MSE_{A,B} = minimize &#8741;A&#8722;B&#8741;^2&quot;,&quot;id&quot;:&quot;HGPLQWDLUP&quot;}" data-component-name="LatexBlockToDOM"></div><p>Simple, differentiable, easy to optimize. But MSE treats all errors as equally bad, regardless of direction. A large error in a dimension that attention never looks at costs the same as a tiny error in a dimension that attention relies on completely. That&#8217;s clearly wrong.</p><p>The right objective, once you think about it is this: <strong>preserving verboseness/variance, while minimising bits required to represent the information; which is basically our well-known cross entopy.</strong> This is a rate-distortion problem. Minimize distortion (error in attention scores; represented by a inner-product) subject to a bit-rate constraint (how many bits you&#8217;re allowed to use).</p><p>Formally, if q is a query vector and k is a key vector, what you care about preserving is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q\\top k \\approx q^\\top \\hat{k}&quot;,&quot;id&quot;:&quot;HILSYSDUPH&quot;}" data-component-name="LatexBlockToDOM"></div><p>where k_hat is the quantized version of k. Every design choice in TurboQuant flows from this single objective. <em>Found this intuitive? No? Don&#8217;t worry, this will be discussed in-depth in upcoming sections.</em></p><div><hr></div><h2>4.2 Bits as Dimensions of Information</h2><p><em>Here&#8217;s a reframing that makes the optimization problem much cleaner to think about. </em>Each bit you allocate is an additional dimension of information. A 1-bit representation can distinguish two states. A 2-bit representation can distinguish four. An N-bit representation carves your space into 2^N distinct buckets.</p><p>Now think about what this means geometrically. Your key vector k&#8712;R^d lives in a d-dimensional space. Quantization is the act of partitioning that space into 2^N regions and assigning every vector in the same region the same code. The quality of your quantization depends entirely on <em>how well those regions align with where your data actually lives</em>.</p><p>This is where the connection to principal components becomes natural. If your data has high variance along certain directions and near-zero variance along others; which is almost always true for real activation vectors, then the optimal partition should allocate (in ideal case) more resolution to the high-variance directions and less to the low-variance ones. The directions of maximum variance are exactly the eigenvectors of the covariance matrix. Each principal component is, in a very real sense, the most informative dimension to allocate a bit to.</p><p><em><strong>So the optimization problem becomes: find the transformation G that, before quantization, rotates your data so that the bits you have are spent on the dimensions that carry the most information. Not uniformly. Not blindly. But Adaptively, according to where the variance is maximum. </strong>This is the core of TurboQuant, and everything else is working out the details of how to do this efficiently.</em></p><div><hr></div><h2>4.3 The Problem with Fixed Codebooks</h2><p>Most existing quantization methods like INT4, BF16, NF4 which work with a fixed/static codebook. A codebook is just a lookup table (that contains our range) and our G function maps our domain/input to this range. Algorithmically; it is a pre-defined set of 2^N values that every quantized number must be mapped to. You find the nearest codebook entry to your input, store its index, and call it done. In practical cases, these could should be thought of as eigen matrix (where codebook vectors are principle components); but due to unavailability of known domain of input, we can&#8217;t do that.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218Sa7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8Sa7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 424w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 848w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 1272w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218Sa7%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png" width="1004" height="780" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:780,&quot;width&quot;:1004,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8Sa7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 424w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 848w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 1272w, https://substackcdn.com/image/fetch/$s_!8Sa7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f15535f-3aff-4b69-aa19-25d21f52fb82_1004x780.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The problem is that these codebooks make an assumption about the shape of your data. INT4 assumes uniform spacing across a fixed range. NF4, as we discussed in the QLoRA context, assumes a normal distribution. These assumptions are baked in at design time, before anyone has seen your specific data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Gaka%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Gaka!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 424w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 848w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 1272w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Gaka%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png" width="862" height="622" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:622,&quot;width&quot;:862,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Gaka!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 424w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 848w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 1272w, https://substackcdn.com/image/fetch/$s_!Gaka!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb431e1d-3da6-43d4-bca1-39b55a0604b1_862x622.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">To understand through a working example; find another article <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F4-bit-llm-training-and-primer-on">here</a></figcaption></figure></div><p>For model weights, this is acceptable. Weights are roughly Gaussian after training, and you can verify this offline. But for KV cache vectors, as we established in the previous section, the distribution is dynamic, non-uniform, and shifts with every input. Any static codebook will be wrong for at least some inputs and wrong in exactly the dimensions attention cares most about.</p><p>There&#8217;s a deeper issue too; in high-dimensional spaces, data rarely distributes uniformly across all dimensions. It clusters along a few principal directions a low-dimensional manifold embedded in a high-dimensional space. When you apply a uniform codebook to such data, you&#8217;re spreading your resolution budget evenly across all dimensions, most of which contain almost no information. The result is that the dimensions that actually matter; i.e. the principal directions get the same resolution as the noise dimensions (that&#8217;s a terrible allocation).</p><p>What you really want is a codebook that <em>adapts to the data&#8217;s geometry</em>; something that concentrates resolution where variance is high and vice versa. The way to achieve that (as we&#8217;ll see in the methodology), is to first transform the data into a space where the distribution <em>is</em> approximately uniform and known, apply the optimal codebook for that known distribution, and then handle whatever the transformation couldn&#8217;t capture with a second, complementary step.</p><p>That two-step structure : <strong>transform then quantize (which is where the vector is; handled through MSE based TurboQuant) </strong>+ <strong>handle the residual (which direction the vector points; handled through inner-product based TurboQuant)</strong> separately is the architecture of TurboQuant&#8217;s solution. We&#8217;ll build it piece by piece in the next section.</p><div><hr></div><h1>5. Methodology</h1><p><em>This is where everything we&#8217;ve built so far the optimization framing, the codebook problem, the geometry of high-dimensional data; all comes together into an actual algorithm. We&#8217;ll take it in two parts. First, how TurboQuant transforms the problem into one it can solve optimally. Then, how it handles what&#8217;s left over (residual) through QJL .</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21C2Ya%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!C2Ya!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 424w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 848w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21C2Ya%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png" width="1440" height="1312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/98df6f7c-edef-404f-970f-94147911b221_1440x1312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1312,&quot;width&quot;:1440,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:168587,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!C2Ya!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 424w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 848w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!C2Ya!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98df6f7c-edef-404f-970f-94147911b221_1440x1312.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>5.1 Solving the Unknown Distribution Problem (MSE persepective)</h2><p>Recall where we ended up in Section 4. The fundamental difficulty with quantizing KV cache vectors is that their distribution is unknown, non-uniform, and shifts with every input. Any fixed codebook will be misaligned with the data&#8217;s actual geometry, wasting resolution on low-variance dimensions and starving the dimensions that attention actually depends on.</p><p>TurboQuant&#8217;s answer to this is elegant: <em>don&#8217;t try to design a codebook for an unknown distribution. Instead, transform the data into a known distribution, and design the optimal codebook for that. </em>The target distribution is Gaussian. Here&#8217;s why that choice is not arbitrary.</p><h3>5.1.1 The Residual Decomposition</h3><p>Lets start with the fundamental decomposition that frames the entire methodology:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A = B + \\varepsilon&quot;,&quot;id&quot;:&quot;TMAVZOAWDW&quot;}" data-component-name="LatexBlockToDOM"></div><p>where A is your original full-precision key vector, B is the quantized approximation, and &#949; is the residual; the information that quantization failed to capture. The task is to minimize &#949;, and TurboQuant attacks this in two complementary stages that together give you N bits of total representation.</p><p>The transformation G handles the first stage:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;B,&#949;=G(A)&quot;,&quot;id&quot;:&quot;MRPGUAUWYH&quot;}" data-component-name="LatexBlockToDOM"></div><p><em><strong>G transforms A into a known distribution B which is easier to quantize</strong></em> and work with. The only condition is that G must be bijective/invertible; because if it isn&#8217;t, you&#8217;ve already destroyed information before quantization even begins. The next question is what G should do to make the quantization of B as lossless as possible.</p><div><hr></div><h3>5.1.2 Getting into a Known Space via Rotation</h3><p>The first thing G does is apply a rotation to the input vector. Why rotation specifically? Because rotation has a property that no other transformation shares for this purpose: it is <strong>norm-preserving</strong>. For any orthogonal matrix R:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\|Rk\\| = \\|k\\|&quot;,&quot;id&quot;:&quot;CHUEHJUCPT&quot;}" data-component-name="LatexBlockToDOM"></div><p>The total energy of the vector; i.e. the sum of squared values across all dimensions; is unchanged. What rotation does is <em>redistribute</em> that energy. A vector that had most of its energy concentrated in 2 of 8 dimensions, after a well-chosen rotation, can have its energy spread more evenly across all 8.</p><p>This redistribution matters enormously for quantization. Remember, a fixed codebook allocates equal resolution to every dimension. If your data is spiky then high variance in a few dimensions, near-zero in the rest; then equal resolution allocation is a terrible fit. Most of your bits are spent describing near-zero dimensions, and the high-variance dimensions get the same coarse treatment as everything else. After rotation, the energy is spread; each dimension now carries a more comparable amount of information, and equal resolution allocation starts to make sense. <em>By rotating we are not corrupting the vector; because during inference when we apply the same randomized rotation matrix for decoding / reverse the rotation; then we get the original vector back (almost).</em></p><p><strong>Why does rotation specifically give a Gaussian distribution?</strong> This is where the Central Limit Theorem earns its place. The Hadamard rotation matrix which is the specific rotation TurboQuant uses has a beautiful structure: each output dimension is a sum of all input dimensions, weighted by &#177;1/d. Concretely, for a d-dimensional input vector k:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;(Hk)_i = \\frac{1}{\\sqrt{d}} \\sum_{j=1}^{d} \\pm k_j&quot;,&quot;id&quot;:&quot;AGAFBFLJXR&quot;}" data-component-name="LatexBlockToDOM"></div><p>Each rotated dimension is a sum of many terms. By the Central Limit Theorem, the sum of many independent (or weakly dependent) random variables converges to a Gaussian distribution, regardless of the original distribution of the individual terms. So even if the raw KV cache vector had a spiky, non-uniform, pathological distribution, after Hadamard rotation its dimensions are approximately N(0,&#963;^2).</p><p>Hence, the domain is now <em>known which is a normal distribution</em>; and a known domain means you can precompute the optimal codebook offline.</p><div><hr></div><h3>5.1.3 Precomputing the Optimal Codebook via Lloyd-Max</h3><p>Once you know your data is approximately Gaussian, the codebook design problem has a clean, classical solution: the <strong>Lloyd-Max algorithm</strong>.</p><p>Lloyd-Max finds the MSE-optimal quantization thresholds and reconstruction levels for any known distribution. For a Gaussian, these are fixed constants as they depend only on the number of bits N and the variance &#963;^2, both of which you can estimate or normalize for. Concretely, for an N-bit codebook, Lloyd-Max gives you 2^N thresholds {t1,t2,&#8230;,t2N&#8722;1} and 2^N reconstruction levels {r1,r2,&#8230;,r2N} such that the expected squared error is minimized over the Gaussian distribution.</p><p>The key point is that these thresholds are <em>precomputed once and reused for every vector</em>. You do the offline work once, and at inference time, quantization is just a lookup; find which threshold bin the rotated value falls into and store the bin index. This is both theoretically optimal for the Gaussian distribution and practically fast.</p><p>The MSE perspective (Lloyd-Max + rotation) here is solving the storage problem. Given a vector, how do you represent it in fewer bits such that the reconstructed vector is as close as possible to the original in Euclidean distance? This is a Cartesian problem as it lives in the coordinate space of the vector itself. The rotation + Gaussian + Lloyd-Max pipeline is the optimal solution to this specific problem. It minimizes ||k&#8722;k^||2</p><p>This solves the transformation G for the main body of the information. But G optimizes MSE in a fixed known space, and MSE in Cartesian coordinates is not the same as preserving inner products. There will be a residual &#949; which are small, but non-zero and that represents the gap between what the codebook can express and the true vector. And as we&#8217;re about to see, the way TurboQuant handles that residual is where things get genuinely interesting.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ydWw%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ydWw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 424w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 848w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 1272w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ydWw%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png" width="1456" height="701" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:701,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:239535,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ydWw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 424w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 848w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 1272w, https://substackcdn.com/image/fetch/$s_!ydWw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8baf27a6-ddbe-479a-881e-bed65e8f186f_2114x1018.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h3>5.1.4  Example</h3><p>Let&#8217;s make this concrete with a worked example. Real KV cache head dimensions are typically 64, 96, or 128. We&#8217;ll use d=8 to keep the arithmetic readable while preserving the qualitative behavior of the high-dimensional case.</p><p>Take a raw key vector in full precision:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;k=[3.2,0.1,&#8722;0.05,2.9,0.08,&#8722;3.1,0.04,&#8722;0.07]&quot;,&quot;id&quot;:&quot;RJAVLUTTOK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Notice the structure: most energy is in dimensions 1, 4, and 6, with near-zero values everywhere else. This is typical of real attention key vectors, as they have sparse energy, not uniformly distributed.</p><p><strong>Step 1 &#8212; Hadamard Rotation</strong></p><p>Apply the normalized 8&#215;8 Hadamard matrix H. Each output dimension becomes a &#177;1/sqrt(8)&#8203; weighted sum of all inputs. The result, approximately:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Hk \\approx [1.06,\\ 0.21,\\ -0.98,\\ 1.13,\\ -0.89,\\ 0.76,\\ -1.21,\\ 0.94]&quot;,&quot;id&quot;:&quot;BHYFSLEKZG&quot;}" data-component-name="LatexBlockToDOM"></div><p>The energy that was concentrated in three dimensions is now spread across all eight. The values are roughly comparable in magnitude as no single dimension dominates. The distribution of these values across many such vectors would be approximately N(0,&#963;2) by CLT.</p><p><strong>Step 2 &#8212; Normalize to N(0,1)</strong></p><p>Estimate &#963; from the rotated vector (or from a running estimate across recent vectors). Divide through:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;k~=Hk/&#963;&#8776;[0.88,0.17,&#8722;0.81,0.94,&#8722;0.74,0.63,&#8722;1.00,0.78]&quot;,&quot;id&quot;:&quot;ZZKZHSYITD&quot;}" data-component-name="LatexBlockToDOM"></div><p>Now each component is approximately standard normal.</p><p><strong>Step 3 &#8212; Apply Lloyd-Max 3-bit Codebook</strong></p><p>For a standard Gaussian, the 3-bit Lloyd-Max thresholds are approximately:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;[&#8722;1.748,&#8722;1.050,&#8722;0.501,0.000,0.501,1.050,1.748]&quot;,&quot;id&quot;:&quot;LIIYPHQDAW&quot;}" data-component-name="LatexBlockToDOM"></div><p>with 8 reconstruction levels at the conditional means between each pair of thresholds. Mapping each component of k^ to its nearest reconstruction level:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{k} \\approx [0.76,\\ 0.17,\\ -0.76,\\ 0.76,\\ -0.76,\\ 0.63,\\ -1.15,\\ 0.76]&quot;,&quot;id&quot;:&quot;ITEOMBKHKZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>storing 3 bits &#215; 8 dimensions = <strong>24 bits</strong>, plus a scalar &#963; in 16-bit = <strong>40 bits total</strong> for the main quantization.</p><p><strong>Residual:</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\varepsilon = \\tilde{k} - \\hat{k} \\approx [0.12,\\ 0.00,\\ -0.05,\\ 0.18,\\ 0.02,\\ 0.00,\\ 0.15,\\ 0.02]&quot;,&quot;id&quot;:&quot;DMUJIUTMLM&quot;}" data-component-name="LatexBlockToDOM"></div><p>Small; but not zero. This residual contains the fine-grained directional information that the codebook&#8217;s fixed grid couldn&#8217;t capture. And this is exactly what Section 5.2 will handle, using QJL to compress it into a single additional bit per projected dimension, in a way that is provably better than simply allocating those bits to the main quantization instead.</p><div><hr></div><h2>5.2 Handling the Residual with QJL (inner-product perspective)</h2><p>We have the main quantization done. The rotation spreads the energy, the Lloyd-Max codebook captures most of it optimally, and what remains is a small residual vector &#949;. The question now is: what do you do with it? And why is the answer compressing it with a completely different kind of tool is provably better than just throwing more codebook bits at the original problem?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SSVI%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SSVI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 424w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 848w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 1272w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SSVI%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png" width="1456" height="620" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:620,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:194864,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SSVI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 424w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 848w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 1272w, https://substackcdn.com/image/fetch/$s_!SSVI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea66a92c-b402-471b-858c-dcd41ceb9338_1878x800.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>5.2.1 Why the Codebook Alone Isn&#8217;t Enough</h3><p>Let&#8217;s think carefully about what &#949; is.</p><p>After the Lloyd-Max quantization, &#949; is the vector of errors the difference between the true normalized key vector and the nearest codebook reconstruction. Geometrically, &#949; lives in the <em>gaps between codebook grid line</em>s. It&#8217;s the sub-grid residue that the quantizer couldn&#8217;t represent because the grid isn&#8217;t fine enough.</p><p>The obvious response is: just add more bits. Go from 3-bit to 4-bit quantization. The grid becomes finer, the gaps shrink, and &#949; gets smaller.</p><p>This is correct, but it&#8217;s not the whole story. And here&#8217;s the subtle point TurboQuant makes: adding another codebook bit reduces &#949; in the MSE sense, but MSE is not what attention cares about. Attention cares about inner products; specifically, whether M and N are close enough; These are related but not identical objectives.<br></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;M = q&#8868;\\hat{k}; N=q&#8868;K&quot;,&quot;id&quot;:&quot;HNOCOYAYYL&quot;}" data-component-name="LatexBlockToDOM"></div><p>More concretely: the residual &#949; after (N&#8722;1)-bit quantization has a specific geometric structure. It lives in directions that the codebook, by construction, cannot represent the sub-cell directions, orthogonal in some sense to the quantization grid. Adding a N-th bit to the codebook refines the grid, but the refinement happens in the same Cartesian geometry as the original quantization. The directions the codebook couldn&#8217;t represent at N&#8722;1 bits are still the directions it struggles with at N bits; they&#8217;re just slightly smaller.</p><p>QJL operates in an entirely different geometric space; which is the inner product space and that orthogonality of approaches is precisely what makes the combination powerful.</p><h3>5.2.2 <a href="iframe.php?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FJohnson%25E2%2580%2593Lindenstrauss_lemma">Johnson-Lindenstrauss</a>: The Theory Behind the Projection</h3><p>Before getting into the sign quantization step, it&#8217;s worth understanding what the Johnson-Lindenstrauss (JL) lemma actually guarantees, because TurboQuant&#8217;s theoretical claims rest on it directly.</p><p>The JL lemma states: for any set of vectors in Rd, there exists a random projection matrix S&#8712;R of (m&#215;d) dimensions with m&#8810;d, such that for any two vectors u,v:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\left| \\langle Su, Sv \\rangle - \\langle u, v \\rangle \\right| \\leq \\epsilon \\cdot \\|u\\| \\cdot \\|v\\|&quot;,&quot;id&quot;:&quot;CDFARLBWLP&quot;}" data-component-name="LatexBlockToDOM"></div><p>with high probability, where each entry of S is drawn i.i.d. from N(0,1/m).</p><p>In plain language: a random projection preserves inner products in expectation, up to a bounded error that shrinks as m grows. The projection is lower-dimensional; you go from d dimensions to m dimensions; but the geometric relationships between vectors in inner-product space are approximately maintained (the things that are close remain relatively close after the transformation; remeber UMAP, TSNE?)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PgYN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PgYN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21PgYN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg" width="675" height="262.2857142857143" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:544,&quot;width&quot;:1400,&quot;resizeWidth&quot;:675,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;UMAP: An alternative dimensionality reduction technique | by Fernando Luna  | MCD-UNISON | Medium&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="UMAP: An alternative dimensionality reduction technique | by Fernando Luna  | MCD-UNISON | Medium" title="UMAP: An alternative dimensionality reduction technique | by Fernando Luna  | MCD-UNISON | Medium" srcset="https://substackcdn.com/image/fetch/$s_!PgYN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PgYN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4f385b5-c5d7-4df9-b08e-5140d5ea46b6_1400x544.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fmedium.com%2Fmcd-unison%2Fumap-an-alternative-dimensionality-reduction-technique-7a5e77e80982">https://medium.com/mcd-unison/umap-an-alternative-dimensionality-reduction-technique-7a5e77e80982</a></figcaption></figure></div><p>This is the key property TurboQuant needs. Because attention scores are inner products between queries and keys, and JL projections preserve inner products, you can work in the projected space and still recover approximate attention scores. The randomness of S provides the guarantee; not any specific structure, just the statistical property of Gaussian random matrices.</p><h3>5.2.3 QJL: Random Projection Meets 1-Bit Quantization</h3><p>QJL combines the JL projection with the most aggressive quantization possible: storing only the <em>sign</em> of each projected dimension. The procedure is straightforward. Given the residual vector &#949;&#8712;Rd:</p><p><strong>Step 1 &#8212; Project:</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{\\varepsilon} = S\\varepsilon \\in \\mathbb{R}^m&quot;,&quot;id&quot;:&quot;WFWRCIBHVP&quot;}" data-component-name="LatexBlockToDOM"></div><p>where S&#8712;Rm&#215;d is a random Gaussian matrix, fixed at initialization and shared across all tokens. <em><strong>This is a one-time cost.</strong></em></p><p><strong>Step 2 &#8212; Quantize to 1 bit:</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{\\varepsilon} = \\text{sign}(\\tilde{\\varepsilon}) \\in \\{-1, +1\\}^m&quot;,&quot;id&quot;:&quot;NOPDNGFROT&quot;}" data-component-name="LatexBlockToDOM"></div><p>Store only the sign of each projected dimension; this results in m bits total. That&#8217;s it. The entire residual is compressed to m bits, regardless of the original dimension d.</p><h3>Why Does Sign Quantization Still Preserve Useful Information?</h3><p>Think about this as a search problem. Imagine a large grid of people standing in a field. You&#8217;re trying to locate where a specific person is standing, but you can&#8217;t look directly. Instead, you can ask other people in the field a single binary question: <em>did you find them on your left or your right?</em></p><p>One person&#8217;s answer is almost useless. They might be standing at an awkward angle where even two people far apart look like they&#8217;re on the same side. But ask enough people, each standing at a different random position in the field, and something remarkable happens; the <em>pattern</em> of left/right answers starts to triangulate the target&#8217;s location. More people answer the same way &#8594; the target is nearby. Answers are evenly split &#8594; the target is far, or in the opposite direction entirely. This process helps in reconstructing the entire manifold/matrix/nodes from relations/edges.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21455f%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!455f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!455f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!455f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!455f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21455f%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png" width="1024" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:781245,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!455f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!455f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!455f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!455f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff53cedfa-8e59-492e-a67c-f5ccba32d912_1024x559.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is exactly what sign quantization does to vectors. Your high-dimensional vector space is the field. Every possible key vector is a person standing somewhere in it. Each random projection vector si&#8203; is someone you're asking and their specific position gives them a unique perspective on the space, determining what they consider "left" versus "right." The sign bit is their answer. And Hamming agreement the fraction of people who give the same answer about two different targets tells you how close together those targets are standing.</p><p><em><strong>Lets looking it from a more geometrical viewpoint;</strong></em><br>Imagine two vectors in 2D; an arrow pointing mostly right, and another pointing mostly right-and-slightly-up. They&#8217;re similar. The angle between them is small.</p><p>Now imagine a random line through the origin. When you project both vectors onto this line, you get a number which is positive if the vector points &#8220;with&#8221; the line, negative if it points &#8220;against&#8221; it. The question is: <strong>do both vectors land on the same side?</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Gi3z%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Gi3z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 424w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 848w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 1272w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Gi3z%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png" width="491" height="465.7743119266055" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1034,&quot;width&quot;:1090,&quot;resizeWidth&quot;:491,&quot;bytes&quot;:136945,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!Gi3z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 424w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 848w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 1272w, https://substackcdn.com/image/fetch/$s_!Gi3z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdcfcf7f-9162-4d40-ad37-980604c963f6_1090x1034.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If the angle between the two vectors is small then they&#8217;re nearly parallel which means almost any random line will put them on the same side. They&#8217;ll both be positive, or both be negative. Sign agreement is high.</p><p>If the angle is large then they point in opposite directions which means many random lines will separate them. One lands positive, one lands negative. Sign agreement is low.</p><p>If they&#8217;re exactly perpendicular (90&#176; apart) then exactly half the random lines will agree, half will disagree.</p><p>This is the key insight: <strong>the fraction of random lines on which two vectors agree in sign is a smooth, monotonic function of the angle between them.</strong> More similar vectors &#8594; more sign agreement. More different vectors &#8594; less sign agreement.</p><div><hr></div><h2>Why This Recovers the Inner Product</h2><p>The inner product q&#8868;k can be decomposed as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q^\\top k = \\|q\\| \\cdot \\|k\\| \\cdot \\cos\\theta&quot;,&quot;id&quot;:&quot;LSMVJVDDLM&quot;}" data-component-name="LatexBlockToDOM"></div><p>Three things: the magnitude of q, the magnitude of k, and the angle between them.</p><p>QJL&#8217;s sign bits directly encode cos&#952; whic is the angular part. Here&#8217;s how:</p><ul><li><p>You draw m random Gaussian vectors s1&#8203;,s2&#8203;,&#8230;,sm&#8203;</p></li><li><p>For each one, you record whether si&#8868;&#8203;q and si&#8868;k have the same sign</p></li><li><p>The fraction of agreements across all mm m vectors estimates 1&#8722;&#952;/&#960;, which is a direct function of cos&#952;</p></li></ul><p>So from the sign bits alone, you can recover the angle. And if you also store ||K|| separately (which TurboQuant does, via the scale factor &#963;), you have everything you need to reconstruct q&#8868;k.</p><p><strong>Simple Example</strong></p><p>Say q=[1,0] and k=[0.9,0.1] almost the same direction, small angle between them.</p><p>Draw a random vector s=[0.6,0.8]</p><ul><li><p>s&#8868;q=0.6 &#8594; positive</p></li><li><p>s&#8868;k=0.54+0.08=0.62 &#8594; positive</p></li></ul><p>Same sign. &#10003;</p><p>Draw another: s=[&#8722;0.3,0.95]</p><ul><li><p>s&#8868;q=&#8722;0.3 &#8594; negative</p></li><li><p>s&#8868;k=&#8722;0.27+0.095=&#8722;0.17 = &#8722;0.175 &#8594; negative</p></li></ul><p>Same sign. &#10003;</p><p>Now try q=[1,0] and k=[&#8722;0.9,0.1] nearly opposite directions, large angle.</p><p>Draw s=[0.6,0.8]</p><ul><li><p>s&#8868;q=0.6 &#8594; positive</p></li><li><p>s&#8868;k=&#8722;0.54+0.08=&#8722;0.46 &#8594; negative</p></li></ul><p>Different sign. &#10007;</p><p>If you repeat this many times, the fraction of agreements directly tells you how similar the two vectors are directionally. Formally, for any two vectors x and y, the probability that a random Gaussian vector s gives them the same sign is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\left(\\text{sign}(s^\\top x) = \\text{sign}(s^\\top y)\\right) = 1 - \\frac{\\theta_{xy}}{\\pi}&quot;,&quot;id&quot;:&quot;CUWJUMYZEN&quot;}" data-component-name="LatexBlockToDOM"></div><p>where &#952;xy&#8203; is the angle between them. Small angle &#8594; high agreement. Large angle &#8594; low agreement. Exactly what the field analogy predicts.</p><p>as we saw above, the inner product q&#8868;k decomposes into three things:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q\\top k = \\|q\\| \\cdot \\|k\\| \\cdot \\cos\\theta&quot;,&quot;id&quot;:&quot;TMUFWWUMTV&quot;}" data-component-name="LatexBlockToDOM"></div><p>The magnitudes ||q|| and ||k|| are stored separately as scalar scale factors. The sign bits recover cos&#952; which is the angular part through Hamming agreement. Put them together and you have the full inner product, reconstructed entirely from binary observations.</p><p>The part that feels almost too good to be true is that you never measure distance directly. You never store magnitudes of individual projections. You throw away everything except the sign (the most aggressive compression imaginable) and yet the geometry survives, statistically, across enough random perspectives. This is why QJL error scales as 1/sqrt{m}: each additional question is an independent measurement from a new angle, and independent measurements average out their individual errors progressively.</p><p>This also explains why spending your last bit on QJL beats spending it on a finer codebook grid. Adding a codebook bit makes your existing map slightly more detailed in one region; but it refines the same Cartesian geometry the previous bits already worked in. Asking a new random person is an entirely new perspective from an independent angle reduces uncertainty everywhere simultaneously, including directions your codebook had never covered at all.</p><p>Concretely, at inference time, to estimate the attention score q&#8868;k using the QJL-compressed residual:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q^\\top \\varepsilon \\approx \\frac{\\pi}{2} \\cdot \\|\\varepsilon\\| \\cdot \\frac{1}{m}\\sum_{i=1}^{m} \\text{sign}(s_i^\\top q) \\cdot \\text{sign}(s_i^\\top \\varepsilon)&quot;,&quot;id&quot;:&quot;XLGWSSQZVX&quot;}" data-component-name="LatexBlockToDOM"></div><p>The Hamming agreement between sign vectors is a simple bitwise operation (XOR) gives an unbiased estimator of the inner product. This is extremely cheap to compute at inference time, which matters enormously for a KV cache operation that runs on every single generated token.</p><h3>5.2.4 Why (N&#8722;1)-bit + 1-bit QJL Beats N-bit</h3><p>This is the result that elevates TurboQuant from a clever engineering trick to something with genuine theoretical teeth. Let&#8217;s build the argument carefully.</p><p><strong>Pure MSE quantization at N bits:</strong></p><p>For a Gaussian source with variance &#963;^2, the distortion of the optimal N-bit quantizer scales as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_N \\propto \\sigma^2 \\cdot 2^{-2N}&quot;,&quot;id&quot;:&quot;MMUCCABCTZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>The improvement from (N&#8722;1) bits to N bits is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_{N-1} - D_N = D_{N-1}\\left(1 - \\frac{1}{4}\\right) = \\frac{3}{4} D_{N-1}&quot;,&quot;id&quot;:&quot;SFALJRQBYV&quot;}" data-component-name="LatexBlockToDOM"></div><p>So adding the N-th bit to the codebook reduces distortion by a factor of 3/4 of the previous level&#8217;s distortion. This is what you get from spending that extra bit on the main quantization.</p><p><strong>QJL on the residual at 1 bit:</strong></p><p>The QJL estimator&#8217;s error for inner product estimation is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_{\\text{QJL}} \\propto \\frac{\\|\\varepsilon\\|^2}{m}&quot;,&quot;id&quot;:&quot;GTLFYPZAYU&quot;}" data-component-name="LatexBlockToDOM"></div><p>where m is the number of random projections (= number of sign bits stored). Crucially, this error is geometrically independent of the MSE codebook error. Here&#8217;s why: the codebook error lives in the sub-cell directions of the quantization grid(the Cartesian gaps the grid couldn&#8217;t resolve). The QJL error lives in the angular estimation error of random hyperplane projections which is a completely different geometric object. The two errors don&#8217;t share subspace.</p><p>This independence is the key. When you add a N-th codebook bit, you&#8217;re reducing error in the same space that the first N&#8722;1 bits already worked in the Cartesian MSE space. The marginal gain shrinks because you&#8217;re refining a grid that already captured most of the structure.</p><p>When you instead add QJL on the residual, you&#8217;re reducing error in a <em>new space</em>; whic is the inner product space where the codebook had zero coverage. The marginal gain is much larger because you&#8217;re covering territory that was previously completely unaddressed.</p><p>More formally, the combined distortion of (N&#8722;1)-bit codebook plus 1-bit QJL on the residual satisfies:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_{\\text{combined}} = D_{N-1}^{\\text{Cartesian}} + D_{\\text{QJL}}^{\\text{inner product}}&quot;,&quot;id&quot;:&quot;ENQYFNSDCC&quot;}" data-component-name="LatexBlockToDOM"></div><p>and because these errors are in orthogonal subspaces relative to the attention objective, they don&#8217;t compound. Whereas pure N-bit quantization gives:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_N^{\\text{Cartesian}} > D_{\\text{combined}}&quot;,&quot;id&quot;:&quot;TMQJQJSVZD&quot;}" data-component-name="LatexBlockToDOM"></div><p>for the inner product preservation objective, whenever mm m is chosen appropriately relative to d. The theorem in the paper makes this precise with explicit constants, but the intuition is clean: spending your last bit on a completely different geometric tool covers more ground than spending it on refining the same tool you already have.</p><p>The inner product block (QJL) is solving the inference problem. Given a compressed key, how do you estimate q&#8868;k accurately at query time? This is not a Cartesian problem as it's an angular problem. It doesn't care how close k^ is to k in Euclidean distance. It cares whether the angle between q-k is preserved and reproducable.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SO2c%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SO2c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 424w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 848w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 1272w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SO2c%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png" width="1456" height="701" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:701,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:280321,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SO2c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 424w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 848w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 1272w, https://substackcdn.com/image/fetch/$s_!SO2c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff788df2c-cfde-4eb3-812e-1b99b7f3cb3b_2114x1018.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h3>5.2.5 Example</h3><p>Returning to our key vector from Section 5.1.4. After 3-bit Lloyd-Max quantization, we had:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\varepsilon \\approx [0.12,\\ 0.00,\\ -0.05,\\ 0.18,\\ 0.02,\\ 0.00,\\ 0.15,\\ 0.02]&quot;,&quot;id&quot;:&quot;GXGLISCGWS&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>Step 1 : Sample random projection matrix</strong></p><p>Draw S&#8712;R(6&#215;8 matrix), each entry is sampled from &#8764;N(0,1/6). Fixed at initialization, reused for every key vector. A representative S:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;S = \\begin{bmatrix} 0.8 &amp; -0.3 &amp; 0.5 &amp; -0.6 &amp; 0.2 &amp; 0.9 &amp; -0.4 &amp; 0.1 \\\\ -0.2 &amp; 0.7 &amp; -0.8 &amp; 0.3 &amp; 0.6 &amp; -0.1 &amp; 0.5 &amp; -0.9 \\\\ 0.5 &amp; 0.4 &amp; 0.2 &amp; -0.7 &amp; -0.3 &amp; 0.6 &amp; 0.8 &amp; -0.2 \\\\ -0.6 &amp; -0.5 &amp; 0.9 &amp; 0.1 &amp; 0.7 &amp; -0.4 &amp; -0.3 &amp; 0.6 \\\\ 0.3 &amp; 0.8 &amp; -0.4 &amp; 0.5 &amp; -0.9 &amp; 0.2 &amp; 0.6 &amp; -0.7 \\\\ 0.7 &amp; -0.6 &amp; 0.3 &amp; -0.8 &amp; 0.4 &amp; -0.5 &amp; 0.1 &amp; 0.9 \\end{bmatrix}&quot;,&quot;id&quot;:&quot;AWASGZUTFV&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>Step 2 : Project the residual</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{\\varepsilon} = S\\varepsilon \\approx [0.09,\\ -0.03,\\ 0.07,\\ -0.11,\\ 0.04,\\ -0.08]&quot;,&quot;id&quot;:&quot;MYWJIPZAMY&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>Step 3 : Take the sign</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\hat{\\varepsilon} = \\text{sign}(\\tilde{\\varepsilon}) = [+1,\\ -1,\\ +1,\\ -1,\\ +1,\\ -1]&quot;,&quot;id&quot;:&quot;QIREULQZCO&quot;}" data-component-name="LatexBlockToDOM"></div><p>Stored as 6 bits: <code>101010</code>.</p><p><strong>Final storage summary:</strong></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8GxY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 424w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 848w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 1272w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218GxY%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png" width="1456" height="302" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:302,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:142035,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8GxY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 424w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 848w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 1272w, https://substackcdn.com/image/fetch/$s_!8GxY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb35a15be-c5f7-467d-901f-75488f8b05a5_2448x508.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Compare to full FP32 storage: 8&#215;32=256. That&#8217;s a <strong>5.6&#215; compression</strong> on this toy example. At real head dimension d=128, the compression ratio grows substantially ; the codebook scales linearly with d, but the QJL sign budget m can be held fixed or grown much more slowly, since inner product estimation error scales as 1/sqrt{m} regardless of d.</p><p><strong>At inference</strong>, to estimate the attention score between a query q and this compressed key:</p><ol><li><p>Reconstruct the main term: dequantize k^ using the codebook and scale by &#963;.</p></li><li><p>Estimate the residual contribution: compute sign(Sq) and take Hamming agreement with stored &#949;^.</p></li><li><p>Combine:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q^\\top k \\approx q^\\top(\\sigma \\hat{k}) + \\frac{\\pi}{2}\\|\\varepsilon\\| \\cdot \\text{HammingAgreement}(\\text{sign}(Sq),\\ \\hat{\\varepsilon})&quot;,&quot;id&quot;:&quot;LAMBNZVTGU&quot;}" data-component-name="LatexBlockToDOM"></div></li></ol><p>Both operations are fast: the codebook lookup is a table read, and the Hamming agreement is a bitwise XOR followed by a popcount; a single CPU/GPU instruction.</p><div><hr></div><h1>6. Results &amp; Outcomes</h1><h2>6.1 Theoretical Bounds Hold in Practice</h2><p>The first thing the authors validate is whether TurboQuant&#8217;s distortion actually matches what the theory predicts. Using 100,000 vectors from the DBpedia dataset encoded into 1536-dimensional OpenAI embeddings, they measure inner product error and MSE across bit-widths 1 through 5.</p><p>The results confirm two things cleanly. First, TurboQuantprod_{inner_prod} remains unbiased for inner product estimation across all bit-widths as its error distribution is centered at zero regardless of how high or low the average inner product is. TurboQuantmse_{mse}&#8203;, by contrast, introduces a bias that grows with the average inner product value and only diminishes at higher bit-widths. Second, the observed distortions track tightly with the theoretical upper and lower bounds derived in the paper; the gap between TurboQuant and the information-theoretic optimum is consistently within the predicted factor of sqrt(3&#960;&#8203;/2)&#8776;2.7.</p><p>This is important because most quantization papers validate empirically without connecting results back to theory. TurboQuant earns both.</p><p></p><h2>6.2 Needle-in-a-Haystack: Perfect Recall at 4&#215; Compression</h2><p>On the Needle-in-a-Haystack benchmark; where Llama-3.1-8B-Instruct must retrieve a specific hidden sentence from contexts ranging from 4k to 104k tokens; TurboQuant achieves a recall score of <strong>0.997</strong>, identical to the full-precision uncompressed baseline, while using only 25% of the full KV cache.</p><p>For reference, the competing methods at the same compression ratio score:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ibTd%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ibTd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 424w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 848w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ibTd%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png" width="1456" height="868" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:868,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:245340,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ibTd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 424w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 848w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!ibTd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98481da-0004-4d1d-91d8-e5b313a9116d_1906x1136.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This means methods without formal theoretical guarantees like SnapKV, PyramidKV; degrade noticeably as context grows. KIVI holds up reasonably but still falls short. TurboQuant matches full precision exactly, which is the result the theoretical guarantees predict: unbiased inner product estimation means retrieval tasks, which depend entirely on which key vector is most similar to the query, should be unaffected by compression.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UXh5%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UXh5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 424w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 848w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 1272w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UXh5%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png" width="1456" height="748" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:748,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:399328,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UXh5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 424w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 848w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 1272w, https://substackcdn.com/image/fetch/$s_!UXh5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3a1f03f-56d8-42a2-9c15-f6711509e7d3_2546x1308.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>6.3 Compression Ratios: How Much Memory Does It Actually Save?</h2><p>At real KV cache head dimensions typically d=64 to d=128; the compression story is compelling.</p><p>Full precision FP16 storage for a single key vector of dimension d=128 costs 128&#215;16=2048 bits. TurboQuant&#8217;s representation breaks down as:</p><ul><li><p><strong>Scale factor &#963;</strong>: 16 bits (one FP16 scalar)</p></li><li><p><strong>Lloyd-Max indices</strong>: (N&#8722;1) bits &#215; d dimensions</p></li><li><p><strong>QJL signs</strong>: m bits, where mm m is chosen independently of d</p></li></ul><p>At N=4 (3-bit codebook + 1-bit QJL) and m=64 random projections:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Total} = 16 + (3 \\times 128) + 64 = 464 \\text{ bits}&quot;,&quot;id&quot;:&quot;SDEVOAXFLF&quot;}" data-component-name="LatexBlockToDOM"></div><p>That&#8217;s a <strong>4.4&#215; compression</strong> over FP16, or equivalently, roughly <strong>4-bit effective precision</strong>; matching INT4 quantization in storage cost, but with the theoretical inner product preservation guarantees that raw INT4 cannot provide.</p><p>At m=32 projections, you get:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{ bits} \\approx \\textbf{4.7&#215;}16+384+32=432&quot;,&quot;id&quot;:&quot;EDTMORZUNX&quot;}" data-component-name="LatexBlockToDOM"></div><p>And importantly, m can be tuned independently of d. For very long contexts where memory is the primary bottleneck, you reduce m. For tasks where attention precision is critical, you increase it, this flexibility doesn&#8217;t exist in fixed-codebook methods where every bit is committed to the same geometric space.</p><p>At the system level, a 4.4&#215; reduction in KV cache size translates directly into one of three benefits, depending on what you optimize for: you can serve the same context length on a GPU with 4.4&#215; less memory, or serve 4.4&#215; longer contexts on the same hardware, or fit 4.4&#215; more concurrent users in the same memory budget. In production serving, where KV cache is typically the binding memory constraint at long contexts, any of these is significant.</p><div><hr></div><h2>6.4 Comparison Against Baselines</h2><p>On LongBench-E; which covers single and multi-document QA, summarization, few-shot learning, synthetic tasks, and code completion, TurboQuant is evaluated at two effective bit-widths: 2.5 and 3.5 bits. These non-integer values come from treating outlier channels separately, applying higher precision to the 32 most active channels and lower precision to the remaining 96.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21N1Va%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N1Va!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 424w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 848w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 1272w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21N1Va%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png" width="1456" height="745" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:745,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:293068,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!N1Va!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 424w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 848w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 1272w, https://substackcdn.com/image/fetch/$s_!N1Va!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d130229-3327-4302-9b4d-3fa4a8bbe698_2092x1070.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Against naive INT4:</strong> At the same 4-bit budget, TurboQuant preserves inner products more accurately because the rotation step ensures the distribution is Gaussian before quantization, rather than applying a fixed grid to an arbitrary distribution. On tasks with long contexts and distributional shift between training and inference; exactly the cases where KV cache quantization matters most; there these gaps widens.</p><p><strong>Against KIVI:</strong> KIVI applies group quantization with per-channel scaling, which partially addresses the non-uniform distribution problem. TurboQuant&#8217;s rotation approach is more principled; it provably Gaussianizes the distribution rather than approximately normalizing it and the addition of QJL for the residual gives it a second degree of freedom that KIVI doesn&#8217;t have.</p><p><strong>Against KVQuant:</strong> KVQuant uses learned codebooks calibrated on representative data. This works well in-distribution but requires calibration data and can degrade on inputs that differ from the calibration set. TurboQuant&#8217;s codebook is optimal for the Gaussian distribution, which the rotation step guarantees regardless of the original input distribution; hence no calibration data required.</p><p>At 3.5 bits, TurboQuant matches the full-precision baseline exactly, the average score 50.06 while compressing the KV cache by more than 4.5&#215;. At 2.5 bits, the degradation is marginal (49.44), and crucially, TurboQuant at 2.5 bits outperforms KIVI at 3 bits despite using fewer bits. The same pattern holds on Ministral-7B-Instruct, where TurboQuant at 2.5 bits scores 49.62 against a full-cache baseline of 49.89.</p><h2>6.5 Nearest Neighbor Search: Better Recall, Zero Indexing Time</h2><p>TurboQuant is also evaluated on high-dimensional nearest neighbor search using GloVe (d=200) and OpenAI embeddings (d=1536, d=3072), compared against Product Quantization (PQ) and RabitQ.</p><p>On recall, TurboQuant consistently outperforms both baselines across all datasets and bit-widths. On indexing time, the gap is not close, it is categorical:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4W_0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 424w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 848w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 1272w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214W_0%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png" width="1456" height="295" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:295,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:129208,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/193180973?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4W_0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 424w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 848w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 1272w, https://substackcdn.com/image/fetch/$s_!4W_0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbd5f8c0-0435-4278-8496-31e2d8eb0206_2548x516.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>PQ requires running k-means to build its codebook is expensive and data-dependent. RabitQ is even slower and lacks GPU vectorization entirely. TurboQuant&#8217;s indexing time is effectively zero because the rotation matrix and codebook are precomputed once for the Gaussian distribution and reused for any input. No calibration, no k-means, no offline pass over the data.</p><p>This is what data-oblivious means in practice: the quantization time is essentially a constant, independent of dataset size or dimension.</p><div><hr></div><h1>7. Thoughts</h1><ol><li><p><strong>The residual is the real innovation:</strong> The rotation and Lloyd-Max combination is elegant, but not entirely new; whereas Gaussianization before quantization has precedent. What genuinely surprised me is the residual treatment. Using a geometrically orthogonal tool for the remainder rather than just refining the same approach is the kind of insight that feels obvious in hindsight but clearly wasn&#8217;t.</p></li><li><p><strong>The field analogy scales:</strong> The more I think about the sign quantization argument, the more I think it generalizes beyond KV caches. Any setting where you need to preserve angular relationships between high-dimensional vectors under aggressive compression like retrieval, dense passage ranking, multimodal embeddings, etc. QJL feels like a natural fit. I&#8217;d be curious to see it applied there.</p></li><li><p><strong>m is an underappreciated hyperparameter: </strong>The number of random projections m is presented as a tunable knob, but the paper doesn&#8217;t give strong guidance on how to set it in practice relative to context length, model size, or task type. My intuition says this will matter a lot in production and deserves its own ablation.</p></li><li><p><strong>No calibration data is both a strength and a question:</strong> TurboQuant&#8217;s Gaussianization guarantee holds regardless of input distribution, which makes it robust and calibration-free. But I wonder whether, for a known fixed deployment domain; say, a model exclusively serving legal documents, a domain-calibrated codebook would outperform the universal Gaussian one. The universality is a feature until it isn&#8217;t.</p></li><li><p><strong>The backward pass is untouched:</strong> Like BitNetV2, TurboQuant focuses entirely on inference-time compression. The training loop is conventional. I&#8217;d be curious whether a version of QJL could be made differentiable, perhaps along the lines of DGEs from the FP4 training paper and used during training itself to close the train-inference gap further.</p></li><li><p><strong>Orthogonality as a design principle:</strong> The deepest lesson here isn&#8217;t specific to quantization. It&#8217;s that when you have a budget of N bits, spending them all on one geometric tool is almost never optimal. Splitting your budget across tools that operate in orthogonal spaces like Cartesian MSE and inner product space here consistently outperforms going deeper on any single approach. That feels like a broadly applicable principle worth remembering.</p></li></ol><div><hr></div><h1>8. Conclusion</h1><p>At its core, TurboQuant is answering a question that the weight quantization literature never had to ask: <em>what does it mean to compress something that is moving?</em></p><p>Model weights are static. You compress them once, offline, with all the time in the world to study their distribution and design the right codebook. The KV cache is the opposite as it grows with every token, shifts with every input, and must be compressed and decompressed at inference speed, token by token, with no opportunity to stop and recalibrate. The tools that work beautifully for one simply don&#8217;t transfer to the other.</p><p>We started this article by situating TurboQuant in the broader quantization story we&#8217;ve been building together. From the basics of mantissa and exponent in the FP4 article, to the extremes of ternary weights in BitNet, the thread running through all of it has been the same tension: fewer bits means less memory and faster compute, but also less resolution and more information loss. Every paper in this space is negotiating that tradeoff in a slightly different way.</p><p>What TurboQuant does differently is refuse to treat quantization as a fixed engineering decision and instead frame it as a constrained optimization problem with a clear objective which is to preserve inner products while minimizing representation bits. From that framing, everything else follows naturally. The rotation step emerges because you need a known distribution before you can design an optimal codebook. The Lloyd-Max codebook emerges because it&#8217;s the provably optimal quantizer for that known distribution. And QJL on the residual emerges because the last bit you have is worth more in a geometrically orthogonal space than it is refining a grid that already captured most of the structure.</p><p>Whether TurboQuant becomes the standard approach for KV cache compression or gets superseded by something better, the underlying principle feels durable: when you have a fixed bit budget, spend it across orthogonal geometric tools rather than going deeper on any single one. That lesson extends well beyond quantization.</p><p>With this, we come to the end of what turned out to be a genuinely long journey through some beautiful mathematics. As always, I&#8217;ve omitted nuances and simplified arguments to keep things readable, I&#8217;d strongly encourage going through the paper directly for the full theoretical treatment.</p><p>TurboQuant paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2504.19874">https://arxiv.org/pdf/2504.19874</a><br>QJL paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2406.03482">https://arxiv.org/pdf/2406.03482</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today. Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye &#128075;</p>]]></content:encoded></item><item><title><![CDATA[Flash-KMeans: Fast and Memory-Efficient Exact K-Means]]></title><description><![CDATA[Scaling K-means on GPU is IO-bound; Flash-KMeans provides an efficient memory allocation level solution to reduce memory footprint and improve speed while maintaining an exact solution space.]]></description><link>https://vizuara.substack.com/p/flash-kmeans-fast-and-memory-efficient</link><guid isPermaLink="false">https://vizuara.substack.com/p/flash-kmeans-fast-and-memory-efficient</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Tue, 17 Mar 2026 03:30:56 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wum8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F54792623-c151-4e70-9836-08349cbce516_500x500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em>Introduction</em></p></li><li><p><em>Parametric vs. Non-parametric methods</em></p></li><li><p><em>How exactly KNN works?</em></p></li><li><p><em>Problems with Memory Allocations and Speed</em></p></li><li><p><em>Why we need KNNs to work really fast? :</em> <em>(Spatial Partitioning: Voronoi and Delaunay, HNSW, From Hard-assignments to soft-assignments; from EM &#8594; VI)</em></p></li><li><p><em>The Ideal Case</em></p><ol><li><p><em>Lloyd&#8217;s Algorithm and Standard GPU Implementation</em></p></li><li><p><em>Kernel-Level Bottlenecks</em></p></li><li><p><em>System-Level Constraints in Real Deployments</em></p></li></ol></li><li><p><em>Methodology</em></p><ol><li><p><em>FlashAssign: Materialization-Free Assignment via Online Argmin</em></p></li><li><p><em>Sort-Inverse Update: Low-Contention Centroid Aggregation</em></p></li><li><p><em>Efficient Algorithm-System Co-design</em></p></li></ol></li><li><p><em>Results and Outcomes</em></p></li><li><p><em>Thoughts</em></p></li><li><p><em>Conclusion</em></p></li></ol><h1>Introduction</h1><p>In the current landscape of Artificial Intelligence, the spotlight is almost exclusively held by Large Language Models (LLMs) and the generative magic they perform. However, the most sophisticated RAG (Retrieval-Augmented Generation) pipelines are only as good as their silent engine: <strong>the search and clustering layer.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wum8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F54792623-c151-4e70-9836-08349cbce516_500x500.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wum8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 424w, https://substackcdn.com/image/fetch/$s_!wum8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 848w, https://substackcdn.com/image/fetch/$s_!wum8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 1272w, https://substackcdn.com/image/fetch/$s_!wum8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wum8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F54792623-c151-4e70-9836-08349cbce516_500x500.png" width="500" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54792623-c151-4e70-9836-08349cbce516_500x500.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wum8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 424w, https://substackcdn.com/image/fetch/$s_!wum8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 848w, https://substackcdn.com/image/fetch/$s_!wum8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 1272w, https://substackcdn.com/image/fetch/$s_!wum8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54792623-c151-4e70-9836-08349cbce516_500x500.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Clustering isn&#8217;t just a classic data science task; it is the fundamental mechanism we use to organize high-dimensional vector spaces so that an LLM can find the right memory in a sea of billions of documents/Parameters. But as datasets scale, the standard algorithms we&#8217;ve relied on for decades are hitting a wall.</p><p>This article dives into <strong>Flash-KMeans</strong>, a recently proposed framework that challenges the status quo of GPU-accelerated clustering. Inspired by the Flash philosophy of minimizing data movement, this paper presents a way to perform exact K-Means that is both faster and significantly more memory-efficient than industry-standard implementations like FAISS. We aren&#8217;t just looking at an incremental speedup; we are looking at a fundamental shift in how we handle the materialization of data during the clustering process.</p><div><hr></div><h1>Parametric vs. Non-parametric methods</h1><p>Before we dissect the mechanics of modern retrieval, we must ground ourselves in the fundamental divide of statistical learning: <strong>Parametric</strong> versus <strong>Non-parametric</strong> models.</p><ul><li><p><strong>Parametric Methods:</strong> These models assume that the underlying data follows a fixed functional form or distribution, defined by a finite set of parameters (e.g., Linear Regression or Logistic Regression). The complexity of the model is constant; it does not grow, regardless of how much data you throw at it.</p></li><li><p><strong>Non-parametric Methods:</strong> Methods like K-Nearest Neighbors (KNN) make no such assumptions. The parameters are the data points themselves. Consequently, the model&#8217;s complexity and its ability to capture intricate, non-linear patterns grows as the dataset expands.</p></li></ul><h3>Intelligence as Symmetry and Compression</h3><p>To understand why we obsess over these methods, we have to look at the very nature of intelligence. At its core, <strong>intelligence is the ability to find symmetry in chaos and compress information without losing its essence.</strong> Raw data is high-entropy and noisy. Intelligence functions by identifying recurring patterns/symmetries across different data points and mapping them to a unified concept. This is where <strong>clustering</strong> becomes indispensable. By grouping similar information together, we transform a massive, unmanageable dataset into a compressed set of representative centroids.</p><p>In a sense, every time we cluster, we are performing a form of lossy compression that retains the most vital semantic relationships. Without this ability to categorize and condense, a system would be forced to treat every new experience as a unique event, making generalized reasoning impossible. We cluster so that we can navigate the world through abstractions rather than raw bits.</p><div><hr></div><h1>How exactly KNN works?</h1><p>To appreciate the optimizations in <strong>Flash-KMeans</strong>, we must first look at the raw mechanics of its precursor: the <strong>K-Nearest Neighbors (KNN)</strong> algorithm. While K-Means is an iterative clustering process, each iteration fundamentally relies on a nearest neighbor search to assign points to their closest centroids.</p><h4><strong>Algorithm:</strong></h4><p>The logic of KNN is mathematically elegant but computationally heavy. For every query point, the algorithm follows these steps:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21u4Ft%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!u4Ft!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 424w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 848w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 1272w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21u4Ft%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp" width="800" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;K-Nearest Neighbor(KNN) Algorithm - GeeksforGeeks&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="K-Nearest Neighbor(KNN) Algorithm - GeeksforGeeks" title="K-Nearest Neighbor(KNN) Algorithm - GeeksforGeeks" srcset="https://substackcdn.com/image/fetch/$s_!u4Ft!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 424w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 848w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 1272w, https://substackcdn.com/image/fetch/$s_!u4Ft!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc59f2b4a-dda5-4e55-bbd9-59c9aa89b878_800x400.webp 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">source :<a href="iframe.php?url=https%3A%2F%2Fwww.geeksforgeeks.org%2Fmachine-learning%2Fk-nearest-neighbours%2F"> https://www.geeksforgeeks.org/machine-learning/k-nearest-neighbours/</a></figcaption></figure></div><ol><li><p><strong>Distance Computation:</strong> It calculates the distance (usually Euclidean or Cosine) between the query point and every single point in the dataset.</p></li><li><p><strong>Sorting:</strong> It sorts these distances in ascending order.</p></li><li><p><strong>Selection:</strong> It identifies the <code>K</code> points with the smallest distances.</p></li><li><p><strong>Decision:</strong> In classification, it takes a majority vote of those <code>K</code> neighbors; in clustering, it assigns the point to that specific neighborhood.</p></li></ol><h4><strong>Time and Memory Complexity Analysis</strong></h4><p>In a research environment, we evaluate algorithms based on how they scale as data grows. Let <code>N</code> be the number of data points and <code>D</code> be the number of dimensions (features):</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RiKy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 424w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 848w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 1272w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RiKy%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png" width="1456" height="151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:151,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44429,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RiKy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 424w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 848w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 1272w, https://substackcdn.com/image/fetch/$s_!RiKy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e135fe8-7510-40a4-b530-89f08368ea07_1636x170.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><ul><li><p><strong>The Bottleneck:</strong> Because KNN is non-parametric, it doesn&#8217;t learn a simplified model; it searches therough the entire weight space of the dataset. At search time, calculating the distance to every point (O(N*D)) becomes a massive overhead.</p></li><li><p><strong>The Materialization Problem:</strong> The memory complexity is equally daunting. To perform these calculations on a GPU, we traditionally materialize (store in memory) the intermediate distance matrices and cluster assignments. As N and D scale, we eventually run out of VRAM, leading to the crashes or slow-downs that <strong>Flash-KMeans</strong> aims to solve.</p></li></ul><div><hr></div><h1>Problems with Memory Allocations and Speed</h1><p>While the theory behind KNN and K-Means is robust, the implementation on modern hardware specifically GPUs hits a physical wall. In high-performance computing, we often find that the bottleneck isn&#8217;t the raw floating-point operations (FLOPs), but rather how the hardware manages the flow of data.</p><h4><strong>IO-Bound Bottleneck in Assignment</strong></h4><p>In the standard assignment stage, the GPU must calculate the distance between every data point and every centroid. Traditionally, this requires materializing a massive distance matrix in the GPU&#8217;s global memory.</p><ul><li><p><strong>The Problem:</strong> Global memory (VRAM) is significantly slower than the GPU&#8217;s on-chip SRAM.</p></li><li><p><strong>The Impact:</strong> The system becomes <strong>IO-bound</strong>. The processing cores sit idle, waiting for the distance data to be moved from the slow VRAM to the fast SRAM. As K (number of clusters) or N (number of points) increases, the sheer volume of data movement chokes the throughput.</p></li></ul><h4><strong>Atomic Write Contention in Update Stage</strong></h4><p>Once assignments are made, we must calculate the new centroids by averaging the coordinates of all points assigned to them.</p><ul><li><p><strong>The Problem:</strong> Multiple GPU threads, each processing a different data point, may attempt to update the same centroid simultaneously.</p></li><li><p><strong>The Impact:</strong> This creates <strong>atomic write contention</strong>. To prevent data corruption, the hardware must serialize these writes, or use atomic add operations that become incredibly slow when hundreds of threads are fighting over the same memory address.</p></li></ul><h4><strong>System-Level Constraints</strong></h4><p>Beyond the algorithm itself, we face hard system-level limits:</p><ol><li><p><strong>VRAM Ceiling:</strong> If your dataset or distance matrix exceeds the GPU&#8217;s memory (e.g., 80GB on an H100), the process fails entirely or relies on swapping to system RAM, which is orders of magnitude slower.</p></li><li><p><strong>Latency in Real-Time Systems:</strong> In a production scenario such as a <strong>large-scale recommendation engine</strong> or an <strong>automated fraud detection system</strong> clustering needs to happen in milliseconds to be useful for real-time inference.</p></li></ol><div><hr></div><h1>Why we need KNNs to work really fast?</h1><p>In theory O(N*D) complexity is not a huge issue (at smaller scales). In production scenarios like high-frequency trading, real-time recommendation engines, or large-scale legal document analysis it is a catastrophic bottleneck. To understand why we are obsessed with optimizing this, we have to look at how we currently partition our data to make sense of it efficiently.</p><h4><strong>Spatial Partitioning: Voronoi and Delaunay</strong></h4><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j8YJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 424w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 848w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 1272w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j8YJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg" width="548" height="225.2054794520548" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:120,&quot;width&quot;:292,&quot;resizeWidth&quot;:548,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;DelaunayTriangulation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="DelaunayTriangulation" title="DelaunayTriangulation" srcset="https://substackcdn.com/image/fetch/$s_!j8YJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 424w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 848w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 1272w, https://substackcdn.com/image/fetch/$s_!j8YJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6c704d1-25a5-4e5b-86a7-19b254feb1e2_292x120.svg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">source : <a href="iframe.php?url=https%3A%2F%2Fmathworld.wolfram.com%2FDelaunayTriangulation.html">https://mathworld.wolfram.com/DelaunayTriangulation.html</a></figcaption></figure></div><p>To avoid comparing a query to every single point, we could use geometric shortcuts to structure our search space:</p><ul><li><p><strong>Voronoi Diagrams:</strong> These partition the space into cells based on proximity to a set of seeds (centroids). Each cell contains all points closer to its seed than any other, allowing us to narrow our search region immediately.</p></li><li><p><strong>Delaunay Triangulation:</strong> This is the dual of the Voronoi diagram. It connects centroids that share a boundary, forming a graph that allows us to hop from one region to another with mathematical efficiency.</p></li><li><p>In high-dimensional vector space, we organize data by partitioning it into &#8220;neighborhoods.&#8221; This is done through two intertwined structures:</p><ul><li><p><strong>Voronoi Diagrams (The Country Level):</strong> This represents node-level sovereignty. Each centroid (the &#8220;capital&#8221;) defines a boundary. If you are searching for a specific Name, you use the Voronoi partition. If your query  falls within the boundaries of &#8220;France,&#8221; you have immediately narrowed your search to that specific node. You don&#8217;t need to look at the rest of the world.</p></li><li><p><strong>Delaunay Triangulation (The Cuisine Level):</strong> This represents edge-level connectivity. These are the bridges between neighboring countries (features); could be anything like cuisine, favorite sport, GDP, etc. Let&#8217;s say; you are already at the &#8220;France&#8221; node but your query is about &#8220;Mediterranean Pasta,&#8221; the Voronoi boundaries alone won&#8217;t help you move. You look at the Edges. Since France and Italy share a boundary, they share a Delaunay edge which could be a shared feature like Cuisine.</p></li><li><p>The power of the dual system lies in the <strong>Next Hop</strong> logic:</p><ol><li><p>You use the Voronoi cell to find where you are currently standing (e.g., France).</p></li><li><p>To find a more relevant result, you use Delaunay to see where you can go. If the &#8220;Expected Condition&#8221; of your search is &#8220;Food,&#8221; the edge leads you to Italy.</p></li><li><p>You bypass &#8220;Germany&#8221; because, while it is a neighbor, it doesn&#8217;t share that specific &#8220;Cuisine&#8221; edge.</p><p></p></li></ol></li></ul><p><em>In the standard K-Means algorithm, every iteration relies on this Voronoi logic to function. During the Assignment Phase, the algorithm must determine which &#8220;Country&#8221; (Voronoi cell) every single data point belongs to.</em></p><p><em>If you have a billion points and 10,000 centroids, the algorithm has to measure the distance from every point to every capital city. This creates the massive O(N*K) computational tax. Standard K-Means is essentially the process of redrawing these &#8220;Country&#8221; borders (Voronoi cells) over and over again until the capitals (centroids) are perfectly centered within their respective territories.</em></p></li></ul><h4><strong>The Core of Retrieval: HNSW</strong></h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lv6k%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lv6k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 424w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 848w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 1272w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lv6k%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png" width="1024" height="601" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:601,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;HNSW Indexing Fundamentals - Qdrant&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="HNSW Indexing Fundamentals - Qdrant" title="HNSW Indexing Fundamentals - Qdrant" srcset="https://substackcdn.com/image/fetch/$s_!lv6k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 424w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 848w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 1272w, https://substackcdn.com/image/fetch/$s_!lv6k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65da135c-a5b8-4d4b-8012-f0b46a5c15ab_1024x601.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">source : <a href="iframe.php?url=https%3A%2F%2Fqdrant.tech%2Fcourse%2Fessentials%2Fday-2%2Fwhat-is-hnsw%2F">https://qdrant.tech/course/essentials/day-2/what-is-hnsw/</a></figcaption></figure></div><p>Modern vector databases rely on <strong>Hierarchical Navigable Small Worlds (HNSW)</strong> to perform approximate nearest neighbor search.</p><ul><li><p>Think of HNSW as a multi-layered graph which is a skip-list for high-dimensional space.</p></li><li><p>The top layers have fewer points and long-range connections for fast traversal, while lower layers provide fine-grained density.</p></li><li><p>At every layer, the algorithm performs a local KNN search to find the next entry point. If the underlying KNN is slow, the entire graph traversal lags; hence the entire retrieval component of RAG suffers.</p></li></ul><h4><strong>From Determinism to Variational Inference</strong></h4><p>KNNs as methodology are simply a discretized variant of Variational Inference:</p><ul><li><p>KNN is Deterministic (Hard Bounded); hence a point belongs to a cluster or it doesn&#8217;t; it is a rigid geometric assignment.</p></li><li><p>On the other hand; GMMs are Probabilistic (Soft Bounded). This means Gaussian Mixture Models represent the world as overlapping distributions where a point has a <em>probability</em> of belonging to multiple clusters. GMMs are optimized via algorithm called as <strong>Expectation-Maximization (EM)</strong>.</p></li><li><p>EM is essentially a discretized, specific version of <strong>Variational Inference (VI)</strong>. </p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bj_8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bj_8!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 424w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 848w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 1272w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bj_8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_lossy%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif" width="360" height="309" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:309,&quot;width&quot;:360,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Expectation&#8211;maximization algorithm - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Expectation&#8211;maximization algorithm - Wikipedia" title="Expectation&#8211;maximization algorithm - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!bj_8!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 424w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 848w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 1272w, https://substackcdn.com/image/fetch/$s_!bj_8!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7b096c-2fe1-4780-9fa4-bfbde56f6cdb_360x309.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Since VI is the mathematical heart of nearly all generative models (including VAEs and the loss functions of modern LLMs), a simple K-Means assignment is actually a simplified, hard version of the complex probabilistic reasoning used in the most advanced AI today. We need KNN to be fast because it is the fundamental base case for understanding how information is distributed.</p></li></ul><div><hr></div><h1>The Ideal Case</h1><p>To design a superior system, we must first understand exactly where the standard implementations fail. Standard GPU-accelerated K-Means which are utilized in libraries like FAISS or scikit-learn is built on <strong>Lloyd&#8217;s Algorithm</strong>, which iterates through two distinct phases: <strong>Assignment</strong> and <strong>Update</strong>.</p><h3><strong>3.1 Lloyd&#8217;s Algorithm and Standard GPU Implementation</strong></h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210Hju%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0Hju!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 424w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 848w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 1272w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210Hju%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png" width="1237" height="465" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:465,&quot;width&quot;:1237,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111967,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0Hju!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 424w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 848w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 1272w, https://substackcdn.com/image/fetch/$s_!0Hju!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb686d52-01ca-4704-9b39-753675ee3cdc_1237x465.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLloyd%2527s_algorithm">https://en.wikipedia.org/wiki/Lloyd%27s_algorithm</a></figcaption></figure></div><ul><li><p><strong>Assignment Phase:</strong> Each data point is compared against all <code>K</code> centroids to find the nearest neighbor using a distance metric (typically Euclidean distance).</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0ZmC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 424w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 848w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 1272w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210ZmC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png" width="283" height="72.49887640449438" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:114,&quot;width&quot;:445,&quot;resizeWidth&quot;:283,&quot;bytes&quot;:11981,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0ZmC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 424w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 848w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 1272w, https://substackcdn.com/image/fetch/$s_!0ZmC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd02c9593-166e-47c0-bad5-ecadeb484f55_445x114.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>Update Phase:</strong> Centroids are recalculated by taking the mean of all data points assigned to them.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rdez!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 424w, https://substackcdn.com/image/fetch/$s_!rdez!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 848w, https://substackcdn.com/image/fetch/$s_!rdez!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 1272w, https://substackcdn.com/image/fetch/$s_!rdez!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rdez%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png" width="478" height="77.22789115646259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:95,&quot;width&quot;:588,&quot;resizeWidth&quot;:478,&quot;bytes&quot;:10268,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rdez!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 424w, https://substackcdn.com/image/fetch/$s_!rdez!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 848w, https://substackcdn.com/image/fetch/$s_!rdez!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 1272w, https://substackcdn.com/image/fetch/$s_!rdez!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed60413b-e2ba-4cc4-a9a2-599c532d93ee_588x95.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>Data Materialization:</strong> In standard implementations, the GPU materializes (writes to global memory) a large assignment vector to track which point belongs to which cluster.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FXl-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 424w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 848w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 1272w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FXl-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png" width="490" height="74.90445859872611" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:120,&quot;width&quot;:785,&quot;resizeWidth&quot;:490,&quot;bytes&quot;:17977,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FXl-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 424w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 848w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 1272w, https://substackcdn.com/image/fetch/$s_!FXl-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F439848e6-aa6b-4e0c-839d-46c369d3ddeb_785x120.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li></ul><p><em>Does this sound familiar? Yes, this is exactly how Kmeans is performed right now. Modern day implementation of Kmeans is written using Lloyds algorithm; which doesn&#8217;t scale very well with GPUs.</em></p><h3><strong>Kernel-Level Bottlenecks</strong></h3><p>Here the Ideal Case remains out of reach for standard implementations due to two primary kernel-level issues:</p><ul><li><p><strong>Memory Bandwidth (The IO Wall):</strong> The assignment phase is inherently IO-bound. Standard implementations spend more time moving distance data from slow VRAM to the GPU cores than actually performing the calculations.</p></li><li><p><strong>Atomic Write Contention:</strong> During the update phase, multiple threads processing different data points often attempt to update the same centroid at the same time (example atomic_add in algo). This forces the hardware to serialize these writes, creating a massive queue that stalls the entire pipeline.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217YNv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7YNv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 424w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 848w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 1272w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217YNv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png" width="1236" height="642" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:642,&quot;width&quot;:1236,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:223403,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7YNv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 424w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 848w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 1272w, https://substackcdn.com/image/fetch/$s_!7YNv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05b3d029-f175-4ad3-85d9-3af0f692eee9_1236x642.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3><strong>System-Level Constraints in Real Deployments</strong></h3><p>In real-world scenarios, these bottlenecks manifest as hard limits on scalability:</p><ul><li><p><strong>Excessive VRAM Usage:</strong> The need to store large intermediate assignment matrices means that as <code>K</code> increases, the memory footprint grows linearly, often exceeding the 80GB limit of even top-tier A100 or H100 GPUs.</p></li><li><p><strong>Low Compute Utilization:</strong> Because the system is stuck waiting for memory IO, the high-performance Tensor Cores or CUDA cores sit underutilized, leading to inefficient bubbles in the execution timeline.</p></li></ul><p>An Ideal implementation would avoid writing intermediate assignments to global memory entirely. It would keep data in the fastest possible memory tier which is the on-chip <strong>SRAM</strong> and only commit the final, aggregated results to the main memory.</p><p><em>To bridge this gap, we must move away from generic, off-the-shelf clustering libraries and toward a system-level co-design ones. This means rewriting the very kernels of the algorithm to respect the physical hierarchy of silicon prioritizing on-chip speed over global capacity. In the next section, we see how <strong>Flash-KMeans</strong> achieves this by introducing two key architectural innovations that turn these hardware bottlenecks into parallelized strengths.</em></p><div><hr></div><h1><strong>Methodology</strong></h1><p>The innovation of <strong>Flash-KMeans</strong> lies in its <strong>Algorithm-System Co-design</strong>, which re-engineers the execution flow of the K-Means algorithm to bypass the physical limitations of GPU hardware. The framework introduces two pivotal components: <strong>FlashAssign</strong> and <strong>Sort-Inverse Update</strong>, along with system-level optimizations for real-world deployment. Let&#8217;s go through each component one-by-one as referenced in paper.</p><h2><strong>1. FlashAssign: Materialization-Free Assignment via Online Argmin</strong></h2><p>To address the severe High Bandwidth Memory (HBM) traffic overhead identified in traditional implementations; specifically the IO wall caused by materializing a massive N*K distance matrix, the paper introduces <strong>FlashAssign</strong>. FlashAssign fuses distance computation and reduction into a single streaming procedure, ensuring the full distance matrix is never explicitly constructed in memory.</p><h3><strong>Online Argmin</strong></h3><p>The heart of FlashAssign is the <strong>online argmin</strong> update. Traditionally, a GPU would calculate all distances, store them, and then find the minimum. FlashAssign flips this:</p><ul><li><p><strong>Running States:</strong> For each data point x_i, the kernel maintains only two running states in local registers: the current minimum distance (m_i) and the corresponding centroid index (a_i).</p></li><li><p><strong>Tile-Based Scanning:</strong> Centroids are scanned in tiles. For each tile, the kernel computes local distances on-chip, finds the local minimum within that tile, and compares it with the running (m_i, a_i).</p></li><li><p><strong>Registers over HBM:</strong> By repeating this over all centroid tiles, the global minimum is identified entirely on-chip, using registers instead of global memory.</p></li></ul><h3><strong>Latency Hiding: Tiling and Asynchronous Prefetch</strong></h3><p>To ensure the GPU cores are never idling for data, FlashAssign employs a two-dimensional tiling strategy over both points and centroids.</p><ul><li><p><strong>Double Buffering:</strong> The implementation uses a double-buffer pattern.</p></li><li><p><strong>Overlap:</strong> While the GPU is busy computing distances for the current centroid tile (t), it asynchronously prefetches the next tile (t+1) from HBM into the alternate on-chip buffer. This overlaps memory latency with computation, keeping the throughput high.</p></li></ul><h3><strong>Algorithm Breakdown</strong></h3><p>The process follows a strict streaming logic:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eGSs%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eGSs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 424w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 848w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 1272w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eGSs%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png" width="880" height="515" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b834bfc3-88af-427a-89ed-445fcc820354_880x515.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:515,&quot;width&quot;:880,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151451,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eGSs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 424w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 848w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 1272w, https://substackcdn.com/image/fetch/$s_!eGSs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb834bfc3-88af-427a-89ed-445fcc820354_880x515.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>Initialize:</strong> Initialize on-chip states to m = +infinity and precompute norms.</p></li><li><p><strong>Streaming Loop:</strong> Scan through centroid tiles sequentially.</p></li><li><p><strong>Compute and Update:</strong> Calculate local distances on-chip, compute tile-local minima, and update the global running state via the online argmin logic.</p></li><li><p><strong>Final Write:</strong> Once all centroids are processed, only the final assignment a is written to HBM.</p></li></ol><p>By fusing these steps, FlashAssign fundamentally alters the dataflow. It reduces the dominant IO complexity from O(NK) to O(Nd + Kd), effectively removing the 2*&#920;(NK)$ HBM traffic penalty that plagues standard FAISS-style implementations</p><h2><strong>2. Sort-Inverse Update: Low-Contention Centroid Aggregation</strong></h2><p>To resolve the severe write-side serialization that occurs in the centroid update stage, the paper proposes the <strong>Sort-Inverse Update</strong>. Traditional implementations use a scatter-style update where tokens are directly scattered to their assigned centroids, leading to high atomic contention when multiple threads update the same centroid simultaneously.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kIvB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kIvB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 424w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 848w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 1272w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kIvB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png" width="1106" height="635" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:635,&quot;width&quot;:1106,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:177467,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!kIvB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 424w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 848w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 1272w, https://substackcdn.com/image/fetch/$s_!kIvB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2dbd731-f05e-4ebf-88f7-84e789ab35be_1106x635.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>The Core Innovation: Explicit Inverse Mapping</strong></h4><p>Instead of struggling with irregular mappings, Flash-KMeans transforms the token-to-cluster update into a cluster-to-token gather.</p><ul><li><p><strong>Argsort Operation:</strong> The framework first applies an <code>argsort</code> to the assignment vector <code>a </code>to obtain a permutation index, <code>sorted_idx</code>.</p></li><li><p><strong>Logical Grouping:</strong> This creates a sorted cluster-ID sequence where identical cluster IDs are naturally grouped into contiguous segments.</p></li><li><p><strong>Memory Efficiency:</strong> Crucially, this sorting is only performed on the 1D assignment vector; the heavy point matrix X is never physically permuted in memory.</p></li></ul><h4><strong>Segment-Level Localized Aggregation</strong></h4><p>Once the inverse mapping is constructed, the actual reduction moves from global memory to the GPU&#8217;s fast on-chip memory.</p><ul><li><p><strong>On-Chip Accumulation:</strong> Each thread block (CTA) processes a contiguous chunk of the sorted sequence and identifies segment boundaries.</p></li><li><p><strong>Localized Reduction:</strong> Partial sums and counts are accumulated entirely in registers or shared memory for each segment.</p></li><li><p><strong>Bypassing the Bottleneck:</strong> The CTA only issues global <code>atomic_add</code> operations to HBM at segment boundaries rather than for every token.</p></li></ul><h4><strong>Complexity and Contention Analysis</strong></h4><p>This reorganization drastically reduces the number of atomic operations required.</p><ul><li><p><strong>Reduction in Atomics:</strong> In a standard update, atomics scale as O(Nd).</p></li><li><p><strong>Optimization Scale:</strong> In the Sort-Inverse design, the number of atomic merges drops to:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;O((K + \\lceil N/B_N \\rceil)d)&quot;,&quot;id&quot;:&quot;FRJVSDSPSQ&quot;}" data-component-name="LatexBlockToDOM"></div></li><li><p><strong>Result:</strong> This theoretical reduction directly translates to the elimination of write contention, allowing for contention-free memory writes that hide latency and accelerate the reduction phase.</p></li></ul><h3><strong>Algorithm Breakdown</strong></h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Fp3q%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Fp3q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 424w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 848w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 1272w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Fp3q%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png" width="815" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:435,&quot;width&quot;:815,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:134616,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Fp3q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 424w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 848w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 1272w, https://substackcdn.com/image/fetch/$s_!Fp3q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9edb0f9-7ab2-4564-bbba-fa75d7e0ee74_815x435.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>Sort:</strong> Compute <code>sorted_idx</code> via <code>argsort(a)</code> and construct sorted cluster IDs.</p></li><li><p><strong>Initialize:</strong> Set centroid sums (s) and counts (n) to zero.</p></li><li><p><strong>Identify Segments:</strong> Iterate through chunks of the sorted sequence to find contiguous identical cluster IDs.</p></li><li><p><strong>Gather &amp; Accumulate:</strong> Gather token features from the original order and accumulate local partial sums and counts on-chip.</p></li><li><p><strong>Atomic Merge:</strong> Issue a single <code>atomic_add</code> to HBM per segment boundary.</p></li><li><p><strong>Final Update:</strong> Recalculate centroids as c_k = s_k / n_k.</p></li></ol><h2><strong>3. Efficient Algorithm-System Co-design</strong></h2><p>The final layer of the methodology focuses on <strong>deployability</strong>. High-performance kernels are useless if they cannot scale beyond a single GPU&#8217;s memory or if they require hours of tuning every time the data shape changes. The paper addresses these practical hurdles through two co-design strategies.</p><h4><strong>Large-Scale Data Processing via Chunked Stream Overlap</strong></h4><p>In real-world systems, datasets often exceed the available VRAM. To handle this, Flash-KMeans uses a streaming pattern to stage data from the CPU (Host) to the GPU (Device):</p><ul><li><p><strong>Asynchronous Transfers:</strong> The data is partitioned into chunks.</p></li><li><p><strong>Stream Coordination:</strong> Using CUDA streams, the system copies one chunk to the GPU while the previous chunk is being processed by the assignment and update kernels.</p></li><li><p><strong>Double-Buffering:</strong> This ensures that the PCIe bus and the GPU cores are active simultaneously, hiding the latency of moving data from system RAM to the GPU.</p></li></ul><h4><strong>Cache-Aware Compile Heuristic</strong></h4><p>One of the biggest hidden costs in high-performance ML is <strong>compilation time</strong>. Different data shapes (different N, D, or K) usually require exhaustive auto-tuning to find the best kernel configurations.</p><ul><li><p>Instead of exhaustive searching, Flash-KMeans uses a cache-aware heuristic that directly selects configurations based on the hardware&#8217;s physical characteristics (specifically the L1 and L2 cache sizes).</p></li><li><p><strong>Fast Time-to-First-Run:</strong> This approach allows the system to match near-best performance levels almost instantly, even when deployed across different hardware architectures or with dynamic data shapes.</p></li></ul><p>Thanks to all the optimization in centroid allocations and chunking; we arrive at Flash-Kmeans; now let&#8217;s have a look at the outcome of the entire development.</p><div><hr></div><h1><strong>Results and Outcomes</strong></h1><p>The performance of <strong>Flash-KMeans</strong> is evaluated against industry-standard baselines, primarily <strong>FAISS</strong>, which is widely regarded as the state-of-the-art for GPU-accelerated vector search and clustering. The results demonstrate that by solving the IO and contention bottlenecks, Flash-KMeans redefines the efficiency frontier for exact K-Means. The setup for evaluation/benchmarking is NVIDIA H200 (80GB) GPU, focusing on both execution speed and memory footprint.</p><h4><strong>End-to-End Speedup</strong></h4><p>To understand the real-world impact of the framework, we examine three representative regimes that typically haunt GPU implementations:</p><ul><li><p><strong>Large N with Large K (Memory-Intensive):</strong> This is the &#8220;OOM&#8221; (Out-Of-Memory) danger zone. For a workload of N=1 M, K=64K, standard PyTorch implementations fail entirely as they attempt to materialize the massive distance matrix. Flash-KMeans, however, achieves its most dominant absolute speedup here, outperforming the best alternative (fastkmeans) by over <strong>5.4&#215;</strong>.</p></li><li><p><strong>Large N with Small K (Compute-Intensive):</strong> When searching across massive datasets (N=8M), the latency is usually dominated by raw distance calculations. Flash-KMeans reduces this end-to-end latency by <strong>94.4%</strong>, representing a staggering <strong>17.9&#215; speedup</strong> over traditional implementations.</p></li><li><p><strong>Small N with Small K (Framework Overhead):</strong> Even in smaller, highly batched scenarios (B=32) where framework and kernel launch overheads usually obscure algorithmic gains, Flash-KMeans remains robust, delivering consistent acceleration and up to a <strong>15.3&#215; speedup</strong>.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NQ-N%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NQ-N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 424w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 848w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 1272w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NQ-N%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png" width="1263" height="772" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:772,&quot;width&quot;:1263,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124470,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NQ-N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 424w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 848w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 1272w, https://substackcdn.com/image/fetch/$s_!NQ-N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc8eea0b-9da5-45b9-b244-ddda6d5e35f1_1263x772.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>Kernel-Level Efficiency</strong></h4><p>To verify that the acceleration stems from neutralizing specific hardware bottlenecks, we look at the individual performance of the two core stages:</p><ul><li><p><strong>FlashAssign (Assignment Stage):</strong> In highly demanding configurations (N=1M, K=8192), FlashAssign drastically slashes execution time from 122.5ms to just 5.8ms. This <strong>21.2&#215; speedup</strong> over standard assignment methods confirms that the materialization-free, online argmin approach effectively bypasses the High Bandwidth Memory (HBM) traffic penalty.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m1Ux%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m1Ux!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 424w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 848w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 1272w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m1Ux%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png" width="1118" height="485" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:485,&quot;width&quot;:1118,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:123167,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!m1Ux!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 424w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 848w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 1272w, https://substackcdn.com/image/fetch/$s_!m1Ux!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87975afe-c18a-40ae-8b87-1c6ce12e4dda_1118x485.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>Sort-Inverse Update (Reduction Stage):</strong> Simultaneously, the sort-inverse update systematically accelerates the centroid calculation. On massive-scale workloads (N=33M), it achieves up to a <strong>6.3&#215; speedup</strong> by transforming unstructured, high-contention atomic scatters into regularized, segment-level reductions.</p></li></ul><h4><strong>Large-Scale Out-of-Core Processing</strong></h4><p>To test the limits, the researchers benchmarked workloads where the dataset severely exceeds the GPU&#8217;s VRAM capacity, scaling up to <strong>one billion points</strong>.</p><ul><li><p><strong>The &#8220;Billion-Point&#8221; Benchmark:</strong> On an extreme workload (N=10^9, K=32768), standard PyTorch implementations immediately crash due to OOM errors. Flash-KMeans, however, completes an iteration in just 41.4 seconds compared to 261.8 seconds for the most robust baseline (<strong>fastkmeans</strong>).</p></li><li><p><strong>Speedup at Scale:</strong> This represents a <strong>6.3&#215; to 10.5&#215; end-to-end speedup</strong> in massive-scale scenarios. It proves that the framework&#8217;s pipelined execution successfully bounds the peak memory footprint while delivering order-of-magnitude acceleration for data that &#8220;doesn&#8217;t fit&#8221; on the card.</p></li></ul><h4><strong>Fast Time-to-First-Run</strong></h4><p>One of the &#8220;hidden&#8221; costs of high-performance ML is the time spent on exhaustive &#8220;auto-tuning&#8221; to find the best kernel configurations for a specific data shape.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210nHE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0nHE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 424w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 848w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 1272w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210nHE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png" width="1115" height="479" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:479,&quot;width&quot;:1115,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:134670,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/191107060?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0nHE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 424w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 848w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 1272w, https://substackcdn.com/image/fetch/$s_!0nHE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F873bbfeb-969e-4da9-8ea6-526d7a2dce56_1115x479.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Heuristic vs. Exhaustive:</strong> In massive shapes (N=8M, K=64K), exhaustive tuning takes over 325 seconds to find an optimal configuration. The <strong>cache-aware compile heuristic</strong> analytically derives a near-perfect configuration in <strong>less than 2.5 seconds</strong>.</p></li><li><p><strong>175&#215; Faster Setup:</strong> This results in up to a <strong>175&#215; reduction in time-to-first-run</strong>.</p></li><li><p><strong>Zero Performance Degradation:</strong> Most importantly, the heuristic matches the optimal performance of the &#8220;exhaustive oracle&#8221; within a 0.3% margin. You get the best possible speed without the minutes-long wait before the first iteration begins.</p></li></ul><h4><strong>Quality vs. Speedup</strong></h4><p>A critical takeaway is that these speedups do not come at the cost of accuracy. Unlike approximate methods (like Product Quantization) that trade precision for time, <strong>Flash-KMeans remains mathematically exact.</strong> The 12.5&#215; average speedup isn&#8217;t achieved by cutting corners in the math, but by cutting the <strong>IO overhead</strong>. It is a rare &#8220;free lunch&#8221;: you get the same mathematical convergence as Lloyd&#8217;s algorithm, just significantly faster and within a fraction of the memory footprint.</p><p><em>These experiments proves Flash-KMeans as the first exact K-Means implementation that can scale to very large K values on a single GPU while maintaining peak hardware efficiency. It effectively turns the memory-intensive task of clustering into a compute-bound streaming process.</em></p><div><hr></div><h2><strong>Thoughts</strong></h2><ul><li><p>Just as <strong>FlashAttention</strong> revolutionized LLMs by respecting the GPU memory hierarchy, <strong>Flash-KMeans</strong> proves that we are in a new era of algorithm design where FLOPS are cheap but memory movement is the true tax.</p></li><li><p>I find the move from &#8220;scatter-style&#8221; updates to &#8220;cluster-to-token gather&#8221; particularly brilliant. Instead of fighting hardware-level atomic contention in parallel programming the authors restructured the logic to align with the silicon&#8217;s physical strengths.</p></li><li><p>Unlike many speed-focused implementations that rely on approximations (like product quantization) to trade accuracy for time, Flash-KMeans is an <strong>exact</strong> implementation of Lloyd&#8217;s algorithm. You get a <strong>12.5&#215; speedup</strong> with zero loss in mathematical fidelity.</p></li><li><p>While <strong>Flash-KMeans</strong> excels at exact clustering, the next logical step is a deeper co-design with approximate structures like <strong>HNSW</strong>. Implementing a "Flash-HNSW" that uses materialization-free kernels for local neighborhood exploration could drastically reduce the memory overhead of maintaining large, multi-layered navigation graphs</p></li><li><p>This framework essentially kills the O(NK) HBM traffic penalty. By treating the GPU as a specialized stream processor rather than a simple memory buffer, it turns what used to be an &#8220;IO-bound&#8221; bottleneck into a &#8220;compute-bound&#8221; strength.</p></li><li><p><strong>Dynamic K and Adaptive Tiling:</strong> The current implementation relies on a cache-aware heuristic to select tile sizes (B_N, B_K) based on static hardware profiles. A potential improvement would be a <strong>runtime-adaptive tiling mechanism</strong> that can dynamically adjust these sizes mid-iteration to account for varying cluster densities or fluctuating GPU compute availability.</p></li><li><p>The current work focuses heavily on single-GPU efficiency. Extending the <strong>Sort-Inverse Update</strong> logic to a distributed multi-GPU setting where cluster segments are partitioned across high-speed interconnects like NVLink would allow for the exact clustering of truly massive, petabyte-scale datasets that even a single A100 cannot hold.</p></li></ul><div><hr></div><h2><strong>Conclusion</strong></h2><p><strong>Flash-KMeans</strong> reframes clustering as a function of <strong>streaming efficiency</strong> rather than static memory capacity. By abandoning the materialization-heavy orthodoxy of traditional GPU implementations and treating the algorithm as an integrated co-design of silicon and logic, we move closer to a machine that doesn&#8217;t just store data, but respects the physical hierarchy of the hardware it inhabits.</p><p>In this article, we started by exploring the <strong>Information Hypothesis</strong>, seeing how intelligence arises from identifying the low-dimensional symmetries in high-dimensional data. We established the <strong>Parametric vs. Non-parametric</strong> divide and revisited the <strong>Theoretical Bridge</strong> between deterministic KNNs and the probabilistic world of <strong>Variational Inference</strong>, framing K-Means as the atomic unit of information organization.</p><p>We then identified the <strong>IO-bound bottlenecks</strong> and <strong>atomic write contentions</strong> that have historically acted as an architectural ceiling for standard libraries like FAISS. We explored the <strong>Methodology</strong> of Flash-KMeans, seeing how it realizes an &#8220;Ideal Case&#8221; through <strong>FlashAssign</strong> (which replaces the O(NK) memory tax with a materialization-free <strong>Online Argmin)</strong> and the <strong>Sort-Inverse Update</strong>, which transforms unstructured scatter into regularized, segment-level reductions. Finally, we saw results that showed that an exact implementation of Lloyd&#8217;s algorithm delivering a <strong>12.5x speedup</strong>, proving that <strong>Memory Efficiency</strong> is the true frontier of scaling in a world where compute is cheap but bandwidth is the bottleneck.</p><p>The key takeaway is that the Materialization Tax of traditional clustering (the need to externalize every intermediate distance into slow global memory) is an inefficiency we can finally bypass. When we decouple <strong>Centroid Calculation</strong> from <strong>HBM Traffic</strong>, we don&#8217;t just get faster tools; we get a new class of high-performance algorithms that stop fighting the silicon and start modeling the structural symmetry of the data itself.</p><p>Paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2603.09229">https://arxiv.org/pdf/2603.09229</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today.<br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p><p></p><p></p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Diffusion Policy: Teaching Robots to Act by Denoising]]></title><description><![CDATA[How diffusion models solve the multimodal action problem in robot imitation learning?]]></description><link>https://vizuara.substack.com/p/diffusion-policy-teaching-robots</link><guid isPermaLink="false">https://vizuara.substack.com/p/diffusion-policy-teaching-robots</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Mon, 23 Feb 2026 11:46:36 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EoTe%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>The Multimodal Action Problem</h2><p>Let us start with a simple example. Imagine you are training a robot to push a T-shaped block into a target zone on a table.</p><p>You collect expert demonstrations by asking several humans to perform the task. Some humans push the block from the left side, steering it rightward into the target. Others push from the right side, steering it leftward. Both strategies work perfectly.</p><p>Now, you train a standard neural network on this data. The network takes the current image of the table as input and predicts a single action: which direction to push.</p><p>Here is the problem: the network sees that for the same observation (T-block sitting in the center), the correct answer is sometimes &#8220;push left&#8221; and sometimes &#8220;push right.&#8221; To minimize its total error across all demonstrations, the network does what any reasonable regression model would do &#8212; it takes the average.</p><p>The average of &#8220;push left&#8221; and &#8220;push right&#8221; is &#8220;push straight ahead.&#8221;</p><p>And pushing straight ahead slams directly into the flat edge of the T-block. The robot fails.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21o2Sc%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o2Sc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21o2Sc%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Point estimates average conflicting demos and fail.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Point estimates average conflicting demos and fail." title="Point estimates average conflicting demos and fail." srcset="https://substackcdn.com/image/fetch/$s_!o2Sc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!o2Sc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84d823e6-4d65-4e3a-980b-dac5f00e049d_1408x768.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is called the <strong>multimodal action problem</strong>. In robotics, it shows up constantly. A robot picking up an object can reach from the left or the right. A robot navigating around an obstacle can go clockwise or counter-clockwise. Whenever multiple valid strategies exist for the same observation, a point-estimate policy collapses them into a single useless average.</p><p>What we really want is a policy that captures the <strong>full distribution</strong> of possible actions &#8212; not just the mean. The policy should be able to sample from this distribution, and each sample should be a coherent, valid action sequence.</p><p>So, how do we build a policy that captures the full distribution of actions, not just the average?</p><div><hr></div><h2>From Image Generation to Action Generation</h2><p>This brings us to an elegant idea: What if we borrowed the same technique that generates images from noise &#8212; diffusion models &#8212; and used it to generate robot actions from noise?</p><p>Let us quickly understand how diffusion models work. The core idea has two parts.</p><p><strong>The Forward Process:</strong> Take a clean piece of data &#8212; say, an image of a cat &#8212; and gradually add Gaussian noise to it, step by step, until the image becomes pure random noise. This is a fixed process. We do not need to learn anything here. We just keep adding noise.</p><p><strong>The Reverse Process:</strong> Train a neural network to undo this corruption. Given a noisy image, the network learns to predict what the slightly-less-noisy version looks like. If we chain many such denoising steps together &#8212; starting from pure noise &#8212; we can generate a clean image that looks like it came from the training distribution.</p><p>The mathematical formulation for the forward process is straightforward. At each step k, we corrupt the clean data A&#8304; by mixing it with Gaussian noise:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A^k_t = \\sqrt{\\bar{\\alpha}_k} \\, A^0_t + \\sqrt{1 - \\bar{\\alpha}_k} \\, \\epsilon, \\quad \\epsilon \\sim \\mathcal{N}(0, I)&quot;,&quot;id&quot;:&quot;RYPTXSGWCV&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, &#8113;&#8342; is a noise schedule parameter that controls how much of the original signal remains at step k. When k is small, &#8113;&#8342; is close to 1, so most of the original data is preserved. When k is large, &#8113;&#8342; is close to 0, and we have almost pure noise.</p><p>Let us plug in some simple numbers to see how this works. Suppose our clean action is A&#8304;&#8348; = 3.0 (a joint angle in radians), the noise schedule gives &#8113;&#8342; = 0.5 at step k, and the sampled noise is &#949; = 0.8:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A^k_t = \\sqrt{0.5} \\times 3.0 + \\sqrt{1 - 0.5} \\times 0.8 = 0.707 \\times 3.0 + 0.707 \\times 0.8 = 2.12 + 0.57 = 2.69&quot;,&quot;id&quot;:&quot;TVDJBYYEKU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Notice how the original action value of 3.0 has been pulled partway toward noise. If we continued this process with smaller and smaller &#8113;&#8342;, the value would eventually become indistinguishable from a random Gaussian sample. This is exactly what we want.</p><p>Now, here is the key insight from the Diffusion Policy paper by Chi et al. (2023): instead of denoising pixels to generate images, we can denoise <strong>action sequences</strong> to generate robot behaviors.</p><p>The input to our denoising process is random noise in the action space &#8212; imagine a completely random sequence of joint angles and velocities. The output, after many denoising steps, is a smooth, coherent sequence of robot actions that solves the task.</p><p>And the conditioning signal? The robot&#8217;s current observations &#8212; what the camera sees and what the joint encoders report.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EoTe%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EoTe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EoTe%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;The same denoising principle applies to robot actions.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The same denoising principle applies to robot actions." title="The same denoising principle applies to robot actions." srcset="https://substackcdn.com/image/fetch/$s_!EoTe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!EoTe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36e8f085-63b0-4377-940d-9e361c7c8e80_1408x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>The Diffusion Policy Formulation</h2><p>Now let us formalize how Diffusion Policy works, step by step.</p><p>The first important design choice is how the policy interacts with time. The authors define three temporal horizons:</p><p><strong>Observation Horizon (T&#8338;):</strong> The policy receives the latest T&#8338; steps of observation data. For example, with T&#8338; = 2, the robot looks at the current camera frame and the previous one. This gives the network a sense of motion and velocity.</p><p><strong>Prediction Horizon (T&#8346;):</strong> The diffusion model predicts T&#8346; future action steps all at once. Typically T&#8346; = 16, meaning the model outputs a sequence of 16 future actions in a single forward pass.</p><p><strong>Action Horizon (T&#8336;):</strong> Of those T&#8346; predicted actions, only T&#8336; are actually executed on the robot before the policy replans. Typically T&#8336; = 8, meaning we execute half the predicted sequence, then re-observe and generate a new plan.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M1OH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M1OH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M1OH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Predict T&#8346; actions, execute only T&#8336;, then replan.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Predict T&#8346; actions, execute only T&#8336;, then replan." title="Predict T&#8346; actions, execute only T&#8336;, then replan." srcset="https://substackcdn.com/image/fetch/$s_!M1OH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!M1OH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc609d88d-adef-47b5-9f5a-b9fc31c6f482_1408x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now let us look at the training process. The training objective is beautifully simple: <strong>predict the noise that was added.</strong></p><p>During training, we take a clean action sequence A&#8304;&#8348; from the demonstration data, add noise at a random level k, and ask the network to predict the noise. The loss function is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L} = \\text{MSE}\\Big(\\epsilon^k, \\; \\epsilon_\\theta(O_t, \\; A^0_t + \\epsilon^k, \\; k)\\Big)&quot;,&quot;id&quot;:&quot;LVUCGAMYEH&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, &#949;&#7503; is the actual noise that was added, &#949;_&#952; is our noise-prediction network, O&#8348; is the observation, and k is the noise level. The network learns to look at a noisy action sequence and predict what noise was added to it.</p><p>Let us plug in some simple numbers. Suppose our action sequence has 3 dimensions (for a 3-DOF robot), and the true noise added was &#949;&#7503; = [0.3, -0.1, 0.5]. Our model predicts &#949;&#770; = [0.28, -0.12, 0.48]. The MSE loss is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L} = \\frac{1}{3}\\left[(0.3 - 0.28)^2 + (-0.1 - (-0.12))^2 + (0.5 - 0.48)^2\\right] = \\frac{1}{3}[0.0004 + 0.0004 + 0.0004] = 0.0004&quot;,&quot;id&quot;:&quot;NFCGNAKBBW&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is a very small loss, which means our model is predicting the noise accurately. This is exactly what we want.</p><p>At inference time, we start from pure Gaussian noise and iteratively denoise:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A^{k-1}t = \\alpha \\left( A^k_t - \\gamma \\, \\epsilon\\theta(O_t, A^k_t, k) + \\mathcal{N}(0, \\sigma^2 I) \\right)&quot;,&quot;id&quot;:&quot;VXLZQAEKCC&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>Let us walk through one denoising step with concrete numbers. Suppose A&#7503;&#8348; = 1.5 (a noisy action value), our network predicts &#949;_&#952; = 0.8, and the denoising parameters are &#945; = 0.99, &#947; = 0.5, and &#963; = 0.1. The random noise sample is z = 0.05:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A^{k-1}_t = 0.99 \\times (1.5 - 0.5 \\times 0.8 + 0.1 \\times 0.05) = 0.99 \\times (1.5 - 0.4 + 0.005) = 0.99 \\times 1.105 = 1.094&quot;,&quot;id&quot;:&quot;DMPCTNQTUX&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>Notice how the action value moved from 1.5 toward a less noisy value of 1.094. The network&#8217;s noise prediction of 0.8 told us that a large part of the current value was noise, so we subtracted it out. After many such steps, we arrive at a clean action sequence.</p><div><hr></div><h2>Two Architectures: CNN and Transformer</h2><p>Now the question is: what does the noise prediction network &#949;_&#952; actually look like inside?</p><p>The Diffusion Policy paper proposes two architectures.</p><h3>CNN-Based Diffusion Policy</h3><p>The first architecture uses a <strong>1D temporal convolutional network</strong>. Think of it as a series of convolution layers that slide along the time axis of the action sequence.</p><p>The clever part is how observations are injected. Rather than concatenating observation features to the input, the authors use <strong>FiLM conditioning</strong> (Feature-wise Linear Modulation). At every convolutional layer, the observation features scale and shift the hidden activations:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h&#8217; = \\gamma(O_t) \\odot h + \\beta(O_t)&quot;,&quot;id&quot;:&quot;ADEEWOJDSN&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>Here, h is the hidden activation from the convolution layer, &#947;(O&#8348;) and &#946;(O&#8348;) are learned functions of the observation that produce per-channel scale and shift values, and &#8857; denotes element-wise multiplication.</p><p>Let us plug in some simple numbers. Suppose a convolutional layer produces a hidden value of h = 2.0 for one channel. The observation features generate &#947; = 1.5 and &#946; = -0.3 for this channel:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h&#8217; = 1.5 \\times 2.0 + (-0.3) = 3.0 - 0.3 = 2.7&quot;,&quot;id&quot;:&quot;HFIUSXCJJU&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>The observation has modulated the hidden feature from 2.0 to 2.7. Different observations will produce different &#947; and &#946; values, allowing the network to condition its denoising behavior on what the robot currently sees. This is exactly what we want.</p><p>For the visual encoder, the authors use a <strong>ResNet-18</strong> backbone with two modifications: they replace global average pooling with spatial softmax pooling (which preserves spatial information about where features are located), and they swap BatchNorm for GroupNorm (which is more stable when using exponential moving average of weights during training).</p><h3>Transformer-Based Diffusion Policy</h3><p>The second architecture uses <strong>Transformer decoder blocks</strong>, inspired by minGPT. The noisy action sequence is treated as a sequence of tokens, with the diffusion timestep k prepended as a special token. The observation features are provided as a separate sequence that the action tokens attend to via <strong>cross-attention</strong>.</p><p>The processing flow is: noisy action tokens pass through self-attention (with causal masking), then cross-attend to the observation tokens, then produce the noise prediction through a feed-forward layer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qwIv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qwIv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qwIv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;CNN uses FiLM conditioning; Transformer uses cross-attention.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="CNN uses FiLM conditioning; Transformer uses cross-attention." title="CNN uses FiLM conditioning; Transformer uses cross-attention." srcset="https://substackcdn.com/image/fetch/$s_!qwIv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!qwIv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F139a20c5-a272-46f1-b196-de6fdcf0d093_1408x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which one should you use? The CNN-based architecture is the default workhorse &#8212; it is faster to train, requires less hyperparameter tuning, and works well on most tasks. The Transformer-based architecture shines on tasks with high-frequency action changes, such as velocity control, where the temporal convolutions of the CNN tend to over-smooth the predictions.</p><div><hr></div><h2>Why Diffusion Policy Handles Multimodality</h2><p>Let us come back to our original question: how does Diffusion Policy solve the multimodal action problem?</p><p>The key insight comes from an energy-based interpretation. The noise prediction network &#949;_&#952; implicitly learns the gradient of an energy function over the action space:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\nabla_a \\log p(a \\mid o) = -\\nabla_a E_\\theta(a, o)&quot;,&quot;id&quot;:&quot;FYXIDFGFJN&quot;}" data-component-name="LatexBlockToDOM"></div><p>This equation tells us that the noise prediction network is learning to point toward regions of high probability in the action space. The beautiful thing is that this works without ever needing to compute a normalizing constant &#8212; a notoriously difficult problem for energy-based models.</p><p>Let us see this with a simple 1D example. Suppose for a given observation, there are two valid actions: a = -1 (go left) and a = +1 (go right). The energy landscape might look like a surface with two valleys &#8212; one at a = -1 and one at a = +1 &#8212; with a high ridge at a = 0.</p><p>If we start from a random noise sample, say a&#7479; = 0.3, the gradient will point toward the nearest valley. After many denoising steps, the action will settle into the valley at a = +1.</p><p>If we start from a&#7479; = -0.4, the gradient points the other way, and the action settles into the valley at a = -1.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HwSA%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HwSA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HwSA%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Two valleys in the energy landscape &#8212; initial noise determines which mode is selected.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Two valleys in the energy landscape &#8212; initial noise determines which mode is selected." title="Two valleys in the energy landscape &#8212; initial noise determines which mode is selected." srcset="https://substackcdn.com/image/fetch/$s_!HwSA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!HwSA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c08d43e-6266-484b-abd6-a31f01da2b42_1408x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is the fundamental difference from a point-estimate policy. The point-estimate policy would output a = 0 &#8212; the average of the two modes &#8212; which is not a valid action. The diffusion policy starts from random noise and naturally &#8220;falls into&#8221; one of the valid modes.</p><p>And here is what makes this even more elegant: the model <strong>commits to a single mode within each rollout</strong>. Because the entire action sequence is denoised together, all 16 predicted timesteps land in the same mode. You will never see a trajectory that starts going left and then suddenly switches to going right mid-execution.</p><div><hr></div><h2>Receding Horizon Control: Smooth and Reactive</h2><p>There is one more important piece of the puzzle: how does the robot actually execute these predicted actions in the real world?</p><p>The authors use a strategy called <strong>receding horizon control</strong>. The idea is simple but powerful:</p><ol><li><p>The policy observes the current state and predicts T&#8346; = 16 future action steps</p></li><li><p>The robot executes only the first T&#8336; = 8 steps</p></li><li><p>After executing 8 steps, the robot re-observes the world and generates a fresh prediction of 16 steps</p></li><li><p>Repeat</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JNlZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JNlZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JNlZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png" width="1408" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Predict long, execute short, replan often.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Predict long, execute short, replan often." title="Predict long, execute short, replan often." srcset="https://substackcdn.com/image/fetch/$s_!JNlZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 424w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 848w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 1272w, https://substackcdn.com/image/fetch/$s_!JNlZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1f54b8b-7247-4f23-b6f5-9fe7bdf8a6fd_1408x768.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Why not just predict one action at a time? Because single-step prediction leads to jerky, inconsistent motions. The robot might oscillate between modes at every timestep. By predicting a long sequence, the diffusion model ensures temporal consistency &#8212; all actions within one prediction are coherent and smooth.</p><p>Why not execute all 16 predicted steps? Because the world changes. If the robot gets bumped, or an object shifts unexpectedly, we want to react. By re-observing and replanning every 8 steps, the robot stays responsive to disturbances.</p><p>This creates a beautiful balance: <strong>long prediction horizon for consistency, short execution horizon for reactivity.</strong></p><p>The authors also found that using <strong>position control</strong> (predicting target joint positions) is much more robust than velocity control when dealing with computational latency. With position targets, the robot can still reach approximately the right pose even if the next action arrives a few milliseconds late. With velocity commands, even a small delay causes the robot to overshoot.</p><div><hr></div><h2>Practical Implementation</h2><p>Enough theory &#8212; let us look at some practical implementation now.</p><p>We will implement the two core operations: (1) adding noise to a clean action sequence during training, and (2) the denoising loop during inference.</p><p>First, let us set up the noise schedule and the forward diffusion process:</p><pre><code><code>import torch
import torch.nn as nn

# --- Noise Schedule ---
def cosine_beta_schedule(T, s=0.008):
    """Cosine noise schedule (improved over linear)."""
    steps = torch.arange(T + 1, dtype=torch.float32)
    alpha_bar = torch.cos((steps / T + s) / (1 + s) * torch.pi / 2) ** 2
    alpha_bar = alpha_bar / alpha_bar[0]
    betas = 1 - alpha_bar[1:] / alpha_bar[:-1]
    return torch.clamp(betas, max=0.999)

# --- Forward Diffusion (Training) ---
def add_noise(clean_actions, k, alpha_bar):
    """Add noise to clean actions at diffusion step k."""
    noise = torch.randn_like(clean_actions)
    sqrt_alpha_bar = torch.sqrt(alpha_bar[k]).view(-1, 1, 1)
    sqrt_one_minus = torch.sqrt(1 - alpha_bar[k]).view(-1, 1, 1)
    noisy_actions = sqrt_alpha_bar * clean_actions + sqrt_one_minus * noise
    return noisy_actions, noise
</code></code></pre><p>Let us understand this code in detail. The <code>cosine_beta_schedule</code> function computes a noise schedule where the amount of noise added at each step follows a cosine curve &#8212; this gives a smoother transition than a linear schedule. The <code>add_noise</code> function takes a clean action sequence, a diffusion step k, and applies the forward diffusion equation we saw earlier. It returns both the noisy actions (which the network will see as input) and the true noise (which the network must learn to predict).</p><p>Now, let us implement the denoising loop used during inference:</p><pre><code><code># --- Denoising Loop (Inference) ---
@torch.no_grad()
def denoise_actions(model, obs_features, alpha_bar, T=100):
    """Generate actions by iteratively denoising from pure noise."""
    betas = 1 - alpha_bar[1:] / alpha_bar[:-1]
    alphas = 1 - betas

    # Start from pure Gaussian noise: shape (1, T_p, action_dim)
    action = torch.randn(1, 16, 6)  # 16 steps, 6-DOF robot

    for k in reversed(range(T)):
        # Predict the noise at this step
        predicted_noise = model(obs_features, action, k)

        # Remove predicted noise (simplified DDPM update)
        alpha_k = alphas[k]
        alpha_bar_k = alpha_bar[k]
        action = (1 / torch.sqrt(alpha_k)) * (
            action - (betas[k] / torch.sqrt(1 - alpha_bar_k)) * predicted_noise
        )

        # Add small noise (except at final step)
        if k &gt; 0:
            action += torch.sqrt(betas[k]) * torch.randn_like(action)

    return action  # Clean action sequence: shape (1, 16, 6)
</code></code></pre><p>This is the heart of the Diffusion Policy inference. We start from pure Gaussian noise with shape <code>(1, 16, 6)</code> &#8212; one batch, 16 timesteps, 6 degrees of freedom. Then we loop backward from step T to step 0. At each step, the model predicts the noise component, we subtract it out (scaled appropriately), and add a small amount of fresh noise for stochasticity. After all T steps, we have a clean, coherent action sequence ready to send to the robot.</p><p>Notice how compact this is. The entire inference loop is just a few lines of code. The complexity lives inside the <code>model</code> &#8212; which is either the 1D CNN or the Transformer architecture we discussed earlier.</p><div><hr></div><h2>Results: How Well Does It Work?</h2><p>Now let us see how Diffusion Policy performs across different tasks.</p><p>The authors evaluated across <strong>15 tasks from 4 different benchmarks</strong>, in both simulation and the real world. The results are remarkable.</p><p><strong>Simulation Results (RoboMimic):</strong></p><p>On standard manipulation tasks like lifting, picking, and placing, most methods do well. But the gap becomes dramatic on harder tasks:</p><ul><li><p><strong>ToolHang</strong> (hang a tool on a hook &#8212; requires precise multimodal grasping): Diffusion Policy CNN achieves <strong>93%</strong> success. Implicit Behavioral Cloning (IBC) achieves <strong>0%</strong>. Behavior Transformer (BET) achieves <strong>52%</strong>. The task requires the robot to choose between multiple valid grasp orientations &#8212; exactly the multimodal scenario where point estimates fail.</p></li><li><p><strong>Transport</strong> (bimanual manipulation &#8212; two arms must coordinate): Diffusion Policy achieves <strong>96%</strong> success, outperforming all baselines.</p></li><li><p><strong>Kitchen</strong> (multi-stage cooking tasks): Diffusion Policy achieves <strong>96-99%</strong> on the hardest metric, compared to <strong>44%</strong> for BET. This is a <strong>213% improvement</strong>.</p></li></ul><p><strong>Real-World Results:</strong></p><p>The Push-T task we discussed at the beginning? Diffusion Policy achieves <strong>95% success</strong> with a coverage IoU of 0.80. LSTM-GMM achieves only 20% success. IBC achieves 0%. The human baseline is 100% success with 0.84 IoU &#8212; Diffusion Policy is remarkably close to human performance.</p><p>On more complex real-world tasks: - <strong>Sauce pouring:</strong> 79% success with 0.74 IoU (human: 0.79 IoU) - <strong>Sauce spreading:</strong> 100% success with 0.77 coverage (human: 0.79) - <strong>Shirt folding</strong> (bimanual): 75% success from 284 demonstrations - <strong>Mug flipping</strong> (7-DOF with complex 3D rotations): 90% success</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21w_Pq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w_Pq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 424w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 848w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21w_Pq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png" width="1456" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Diffusion Policy outperforms prior methods, especially on hard tasks.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Diffusion Policy outperforms prior methods, especially on hard tasks." title="Diffusion Policy outperforms prior methods, especially on hard tasks." srcset="https://substackcdn.com/image/fetch/$s_!w_Pq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 424w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 848w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!w_Pq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9943c8fa-42ec-4c20-82e2-93bea947c151_1980x1178.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Across all tasks, Diffusion Policy achieves an <strong>average improvement of 46.9%</strong> over the previous state-of-the-art. Not bad, right?</p><div><hr></div><h2>Conclusion</h2><p>Let us summarize the three key ideas behind Diffusion Policy:</p><ol><li><p><strong>Represent robot policies as conditional denoising diffusion processes.</strong> Instead of predicting a single action, sample from the full action distribution by iteratively denoising random noise, conditioned on observations.</p></li><li><p><strong>Predict action sequences, not single actions.</strong> By generating an entire trajectory at once, the policy produces temporally consistent, smooth motions that commit to one mode.</p></li><li><p><strong>Use receding horizon control for execution.</strong> Predict long (T&#8346; = 16), execute short (T&#8336; = 8), replan often. This balances consistency with reactivity.</p></li></ol><p>Diffusion Policy has become a foundational method in modern robot learning. Its ability to handle multimodal demonstrations, produce smooth trajectories, and work reliably in the real world has made it the default choice for many imitation learning systems that followed.</p><p>Here is the link to the original paper: Chi et al., &#8220;Diffusion Policy: Visuomotor Policy Learning via Action Diffusion&#8221; (2023)</p><p>Project page: https://diffusion-policy.cs.columbia.edu/</p><p><strong>References:</strong></p><ul><li><p>Chi et al., &#8220;Diffusion Policy: Visuomotor Policy Learning via Action Diffusion&#8221; (2023)</p></li><li><p>Ho et al., &#8220;Denoising Diffusion Probabilistic Models&#8221; (2020)</p></li><li><p>Janner et al., &#8220;Planning with Diffusion for Flexible Behavior Synthesis&#8221; (2022)</p></li><li><p>Florence et al., &#8220;Implicit Behavioral Cloning&#8221; (2022)</p></li><li><p>Shafiullah et al., &#8220;Behavior Transformers: Cloning k Modes with One Stone&#8221; (2022)</p></li><li><p>Perez et al., &#8220;FiLM: Visual Reasoning with a General Conditioning Layer&#8221; (2018)</p></li></ul><p>That&#8217;s it!</p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: </p><p>https://robotlearningbootcamp.vizuara.ai/</p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Scaling Latent Reasoning via Looped Language Models]]></title><description><![CDATA[LoopedLMs is an attempt in solving reasoning in LLMs using depth/Time as dimension similar to CTMs and HRMs; but done at scale. Proposed model Ouro showcases strong performance across benchmarks.]]></description><link>https://vizuara.substack.com/p/scaling-latent-reasoning-via-looped</link><guid isPermaLink="false">https://vizuara.substack.com/p/scaling-latent-reasoning-via-looped</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 23 Feb 2026 03:30:28 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21POfZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em>Introduction</em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A72-the-information-hypothesis-intelligence-as-symmetry">The Information Hypothesis: Intelligence as Symmetry</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A73-scaling-laws-the-predictability-of-power">Scaling Laws: The Predictability of Power</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7i-the-kaplan-law-openai-2020">The Kaplan Law (OpenAI, 2020)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7ii-the-chinchilla-law-deepmind-2022">The Chinchilla Law (DeepMind, 2022)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7iii-the-broken-neural-scaling-law-bnsl">The Broken Neural Scaling Law (BNSL)</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A74-the-architectural-ceiling-why-transformers-struggle-to-reason">The Architectural Ceiling: Why Transformers Struggle to Reason</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A75-the-ideal-case">The Ideal Case</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A76-methodology">Methodology</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A761-data-pipeline-and-scaling">Data Pipeline and Scaling</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A762-model-architecture-the-recurrent-transformer-block">Model Architecture: The Recurrent Transformer Block</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A763-training-pipeline-the-entropy-regularized-objective">Training Pipeline: The Entropy-Regularized Objective</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A764-inference-the-dynamic-exit-and-token-level-pondering">Inference: The Dynamic Exit and Token-Level Pondering</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7kv-cache-sharing-for-inference-efficiency">KV Cache Sharing for Inference Efficiency</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A77-hrms-vs-ctms-vs-looped-lms">HRMs vs CTMs vs Looped LMs</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A78-resultsoutcomes">Results/Outcomes</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7thoughts">Thoughts</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fdc305ed6-9d60-49d1-8aec-f0d2431a39fa%3Fupdated%3D2026-02-21T15%253A57%253A57.546Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7conclusion">Conclusion</a></em></p></li></ol><div><hr></div><h1>1. Introduction</h1><p>For the last half-decade, the &#8220;Intelligence&#8221; of Large Language Models has been treated as a function of <strong>Scale and Sequence</strong>. We assumed that if we stacked enough layers and fed them enough tokens, reasoning would emerge as a byproduct of next-token prediction. This led to the era of the &#8220;One-Pass&#8221; Transformer: a massive, feed-forward monolith that attempts to solve multi-hop logic problems in a single, lightning-fast traversal from input embeddings to output logits.</p><p>However, we are hitting a wall. True reasoning; possibly the kind that human cognition performs through internal deliberation cannot be captured by a fixed-depth circuit. <strong>Ouro (Looped Language Models and the topic we are discussing today; </strong>named after the <em>recursive Ouroboros</em>) represents one of the first serious architectural rebellion against this static depth.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qLZ2%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qLZ2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 424w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 848w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 1272w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qLZ2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png" width="352" height="387.904" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:551,&quot;width&quot;:500,&quot;resizeWidth&quot;:352,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qLZ2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 424w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 848w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 1272w, https://substackcdn.com/image/fetch/$s_!qLZ2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F405215ff-261a-4a3d-abf1-73a85fdd5035_500x551.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The Ouroboros is <strong>an ancient symbol depicting a serpent or dragon consuming its own tail, representing the eternal cycle of life, death, and rebirth, as well as unity, infinity, and self-reflexivity</strong></figcaption></figure></div><p>It suggests that intelligence shouldn&#8217;t be scaled by adding more parameters (N), but by scaling the <strong>Recursive Depth (T)</strong> of the computation. It falls in line with recent works like Continuous Thought Machine (CTMs) and Hierarchical Reasoning model (HRMs) with more tweaks and adaptations.</p><p>That said, let&#8217;s start with understanding why we need a new dimension to explore for reasoning and why it is restricted by lossy compression of information  in modern day &#8220;One-pass&#8221; architectures like transformers.</p><div><hr></div><h1>2. The Information Hypothesis: Intelligence as Symmetry</h1><p>To understand why &#8220;Looping&#8221; works, we have to look at the fundamental relationship between data and intelligence.</p><h3>2.1 Compression, Symmetry, and the Emergence of Logic</h3><p>Intelligence is, at its core, the ultimate form of Lossy Compression. A model is &#8220;intelligent&#8221; not because it remembers every pixel in an image, but because it discovers the Symmetries; i.e. the underlying rules that remain invariant across different data points.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bBmG%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bBmG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 424w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 848w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 1272w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bBmG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg" width="324" height="440.6896551724138" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c888637-f775-4845-9db6-2f2d5e1a70f2.svg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:710,&quot;width&quot;:522,&quot;resizeWidth&quot;:324,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Symmetry group - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Symmetry group - Wikipedia" title="Symmetry group - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!bBmG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 424w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 848w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 1272w, https://substackcdn.com/image/fetch/$s_!bBmG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c888637-f775-4845-9db6-2f2d5e1a70f2.svg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The Logic is simple; If a model understands the <em>symmetry</em> of a mathematical operation (e.g., commutativity), it no longer needs to store A+B and B+A as separate facts. Hence, Intelligence is the process of stripping away the &#8220;Noise&#8221; of the high-dimensional data space to find the &#8220;Signal&#8221; of the low-dimensional manifold.</p><h3>2.2 The Manifold Constraint</h3><p>The &#8220;Information Hypothesis&#8221; posits that while our data exists in a massive, high-dimensional Data Subspace (millions of pixels or thousands of vocabulary tokens), the actual Information or the semantic/contextual truth lies in a much lower-dimensional Latent Subspace.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{Z} \\ll \\mathcal{X}&quot;,&quot;id&quot;:&quot;TXDEFYPQZP&quot;}" data-component-name="LatexBlockToDOM"></div><p>Consider a 1000-word essay. In the <strong>Data Subspace</strong>, this is a sparse sequence of discrete tokens. In the <strong>Latent Subspace</strong>, this can be compressed into a single, dense vector which is like a &#8220;Contextual DNA&#8221; that carries the entire semantic weight of the prose.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zqRg%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zqRg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 424w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 848w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zqRg%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg" width="675" height="334.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:446,&quot;width&quot;:900,&quot;resizeWidth&quot;:675,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Simplicity in higher dimensions &#171; Einstein-Online&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Simplicity in higher dimensions &#171; Einstein-Online" title="Simplicity in higher dimensions &#171; Einstein-Online" srcset="https://substackcdn.com/image/fetch/$s_!zqRg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 424w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 848w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!zqRg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc14711bd-ff8e-4c33-a158-5049ea7648e1_900x446.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Grey region is data dimensions; red sub-space is information</figcaption></figure></div><p>The problem with current Transformers is that they spend the majority of their FLOPs navigating the high-dimensional <strong>Data Subspace</strong> (calculating attention between every literal word for reasoning though methods like <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fi%2F165613351%2Fhow-reasoning-is-mostly-done">CoT, COCONUT</a>, etc.) rather than operating directly on the <strong>Latent Manifold</strong>. By moving the reasoning process into the latent space through <strong>Recursive Looping</strong>, we allow the model to navigate this lower-dimensional manifold repeatedly, refining its &#8220;thought&#8221; before ever committing to a high-dimensional (and expensive) text token.</p><div><hr></div><h1>3. Scaling Laws: The Predictability of Power</h1><p>Scaling laws describe the empirical relationship between a model&#8217;s performance (usually measured as <strong>Test Loss</strong>) and three primary variables: the number of model parameters (N), the size of the training dataset (D), and the total amount of compute used during training (C).</p><h3>3.1 Why We Need Scaling Laws</h3><p>Without these laws, building an LLM would be a multi-million dollar gamble. We need scaling laws to answer the &#8220;What if?&#8221; questions:</p><p><em>If I double my budget, should I build a deeper model or collect more data?</em> <em>At what point does adding more parameters yield diminishing returns?</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mlzI%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mlzI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 424w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 848w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 1272w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mlzI%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png" width="298" height="298" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:330,&quot;width&quot;:330,&quot;resizeWidth&quot;:298,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Pareto front - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Pareto front - Wikipedia" title="Pareto front - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!mlzI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 424w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 848w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 1272w, https://substackcdn.com/image/fetch/$s_!mlzI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42f4916f-00c2-481f-831a-2f7f566c19b3_330x330.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Red boundary condition is Pareto frontier</figcaption></figure></div><p>Scaling laws provide the <strong>Pareto Frontier (optimal operating space for optimization)</strong> which is the most efficient path to maximizing intelligence for every dollar spent on GPUs.</p><h3>3.2 The Mathematical Essence: Power Laws</h3><p>Neural scaling follows a <strong>Power Law</strong> distribution. As we increase scale, the error decreases predictably, following the general form:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L(x) \\propto x^{-\\alpha}&quot;,&quot;id&quot;:&quot;SAATYUNTGK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where L is the loss and x is the scale (parameters or data). The exponent alpha determines how quickly we hit &#8220;diminishing returns.&#8221; This predictable decay suggests that as long as we can scale the inputs, we can continue to squeeze &#8220;Surprise&#8221; (Entropy) out of the data.</p><h3>3.3 The Landmarks of Scaling</h3><p>To understand where we are, we must look at the three laws that defined the era of the &#8220;Large&#8221; Language Model:</p><h4>I. The Kaplan Law (OpenAI, 2020)</h4><p>The first major flag in the ground. Kaplan and his team suggested that <strong>Model Size (N)</strong> was the most dominant factor in performance. They argued that you could train massive models on relatively small amounts of data and still see massive gains. This led to the &#8220;Parameter Arms Race,&#8221; where models ballooned from 1B to 175B (GPT-3) in record time.</p><h4><strong>II. The Chinchilla Law (DeepMind, 2022)</strong></h4><p>DeepMind&#8217;s Hoffmann et al. challenged the Kaplan paradigm. They discovered that most models were significantly <strong>over-parameterized and under-trained</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21G8tO%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G8tO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 424w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 848w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21G8tO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Chinchilla data-optimal scaling laws: In plain English &#8211; Dr Alan D.  Thompson &#8211; LifeArchitect.ai&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Chinchilla data-optimal scaling laws: In plain English &#8211; Dr Alan D.  Thompson &#8211; LifeArchitect.ai" title="Chinchilla data-optimal scaling laws: In plain English &#8211; Dr Alan D.  Thompson &#8211; LifeArchitect.ai" srcset="https://substackcdn.com/image/fetch/$s_!G8tO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 424w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 848w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!G8tO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe4c12099-b6d2-4b8f-a0ee-86817f41dded_1920x1080.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Law states that; for every doubling of compute, parameters and data should grow in equal proportions. This shifted the industry from &#8220;Bigger Models&#8221; to &#8220;Better Trained Models.&#8221; It&#8217;s the reason why Llama-3 (8B) trained on 15 trillion tokens can outperform older models ten times its size.</p><h4><strong>III. The Broken Neural Scaling Law (BNSL)</strong></h4><p>While Kaplan and Chinchilla assume smooth curves, BNSL accounts for <strong>&#8220;Phase Transitions&#8221;</strong> or &#8220;Emergence.&#8221; It describes how certain capabilities (like coding or multi-step math) don&#8217;t appear gradually; they stay at zero until the model hits a critical &#8220;Compute Threshold,&#8221; at which point performance spikes. This suggests that scale isn&#8217;t just about reducing loss (it&#8217;s like unlocking skills by learning essays).</p><p>As we look at these laws, the bottleneck becomes clear: they all assume a "one-pass" architecture. Scaling N and D is becoming prohibitively expensive. This leads us to our next section: why the current attention-heavy, fully connected architectures are starting to break under their own weight.</p><p><em>While Scaling Laws give us the map, the <strong>Transformer architecture</strong> is the vehicle and right now, that vehicle is overheating. To understand why we need Looped Models, we have to look at the structural decay occurring in our current &#8220;Attention-is-all-you-need&#8221; orthodoxy.</em></p><div><hr></div><h1>4. The Architectural Ceiling: Why Transformers Struggle to Reason</h1><p>The standard transformer is a <strong>fully connected graph</strong> over time. While this makes it incredibly powerful at capturing global context, it introduces a series of scaling and representational bottlenecks that make deep reasoning prohibitively expensive.</p><h3>4.1 The Attention Tax (O(N^2))</h3><p>The core of the issue is the <strong>Quadratic Bottleneck</strong>. In standard Self-Attention, every token must attend to every other token.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YRLO%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YRLO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 424w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 848w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 1272w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YRLO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png" width="438" height="395" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:395,&quot;width&quot;:438,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;The Illustrated Transformer &#8211; Jay Alammar &#8211; Visualizing machine learning  one concept at a time.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The Illustrated Transformer &#8211; Jay Alammar &#8211; Visualizing machine learning  one concept at a time." title="The Illustrated Transformer &#8211; Jay Alammar &#8211; Visualizing machine learning  one concept at a time." srcset="https://substackcdn.com/image/fetch/$s_!YRLO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 424w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 848w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 1272w, https://substackcdn.com/image/fetch/$s_!YRLO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f0afde4-3f15-4f4d-a288-705d84a6ac4d_438x395.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">source : <a href="iframe.php?url=https%3A%2F%2Fjalammar.github.io%2Fillustrated-transformer%2F">https://jalammar.github.io/illustrated-transformer/</a></figcaption></figure></div><ul><li><p><strong>The Problem:</strong> If you double the context to allow for deeper &#8220;thinking&#8221; (Chain-of-Thought), the computational cost and memory requirements quadruple.</p></li><li><p><strong>The &#8220;Large Scale&#8221; Failure:</strong> As we move toward reasoning tasks that require massive internal context, the Key-Value (KV) cache grows until it consumes the entire GPU memory, leaving no room for the model&#8217;s &#8220;thoughts.&#8221;</p></li></ul><h3>4.2 The sub-optimal solutions: SWA and Interleaved Attention</h3><p>To fight the O(N2) explosion, we&#8217;ve developed approximations like <strong>Sliding Window Attention (SWA)</strong> and <strong>Interleaved Attention</strong>.</p><ul><li><p><strong>The Trade-off:</strong> By only looking at a local &#8220;window&#8221; of tokens, we save memory, but we destroy the model&#8217;s ability to perform <strong>Long-Range Composition</strong>.</p></li><li><p><strong>Quality vs. Compute:</strong> You end up with a model that can process 100k tokens but has the &#8220;working memory&#8221; of a goldfish. It can see the pixels, but it loses the &#8220;Global Symmetry&#8221; of the argument.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IJ8Y%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 424w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 848w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 1272w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IJ8Y%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png" width="1007" height="545" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:545,&quot;width&quot;:1007,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Mistral uses sliding window attention&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Mistral uses sliding window attention" title="Mistral uses sliding window attention" srcset="https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 424w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 848w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 1272w, https://substackcdn.com/image/fetch/$s_!IJ8Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51679121-5be3-442a-8a0c-f7f6f31c6a77_1007x545.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3>4.3 Vocabulary Restrictions: The &#8220;Thinking in English&#8221; Trap</h3><p>Perhaps the most subtle issue is <strong>Tokenization</strong>. As discussed in the <strong><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fbyte-latent-transformers-patches">Byte Latent Transformer (BLT)</a></strong> framework, forcing a model to &#8220;reason&#8221; in discrete text tokens is fundamentally sub-optimal.</p><ul><li><p><strong>Discrete vs. Continuous:</strong> Text is a sparse, human-engineered code. True pondering should happen in a continuous, high-dimensional latent space.</p></li><li><p><strong>The Bottleneck:</strong> When we force a model to output &#8220;Step 1... Step 2...&#8221; in text, we are limited by the entropy of the vocabulary. We are essentially forcing a supercomputer to do math using an abacus.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CqUz%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CqUz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 424w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 848w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 1272w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CqUz%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png" width="589" height="364.5491905354919" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:497,&quot;width&quot;:803,&quot;resizeWidth&quot;:589,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CqUz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 424w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 848w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 1272w, https://substackcdn.com/image/fetch/$s_!CqUz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51b6de49-c758-4f30-b6c9-adbbbac368f4_803x497.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This also holds for images/visual domain; in text we have a markovian chain assumption whereas in 2d space we have markovian blanket assumption.</p><h3>4.4 Hardware Hacks: Flash and Paged Attention</h3><p>Solutions like <strong>FlashAttention</strong> (optimizing IO/SRAM usage) and <strong>PagedAttention</strong> (managing KV cache like OS memory) are brilliant engineering feats, but they are <strong>Optimization, not Innovation</strong>. They make the quadratic bottleneck <em>faster</em> to calculate, but they don&#8217;t remove the bottleneck itself. They ease the memory handling, but the fundamental representational inefficiency remains.</p><h3>4.5 The Ghost of Recurrence: LSTM and Mamba</h3><p>To escape the O(N^2) trap, many have looked back at <strong>Recurrent Architectures</strong>.</p><ul><li><p><strong>The LSTMs :</strong> LSTMs used a &#8220;hidden state&#8221; that evolved via Read, Write, and Forget gates. While they have O(N) linear scaling (great for memory!), the &#8220;hidden state&#8221; is a fixed-size bottleneck. It eventually &#8220;forgets&#8221; the beginning of a complex reasoning chain, leading to a massive loss in <strong>Representational Power</strong>.</p></li><li><p><strong>The Mamba/SSM Evolution:</strong> State Space Models (SSMs) like <strong>Mamba</strong> attempt to find the &#8220;Sweet Spot&#8221; by making the recurrence data-dependent. Although Mamba is incredibly fast, it consistently struggles with &#8220;State-Heavy&#8221; tasks like complex text generation and multi-hop logic compared to pure Attention. It lacks the &#8220;Global Look-back&#8221; that Attention provides, which is crucial for verifying reasoning steps.</p></li></ul><h3>The Crisis Point</h3><p>We are stuck in a loop:</p><ol><li><p><strong>Attention</strong> has the power but hits a memory wall.</p></li><li><p><strong>Recurrence</strong> has the efficiency but hits a quality wall.</p></li><li><p><strong>Text-based Reasoning</strong> is too slow and sparse.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-qH8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-qH8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 424w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 848w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 1272w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-qH8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png" width="469" height="499.5869565217391" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:833,&quot;width&quot;:782,&quot;resizeWidth&quot;:469,&quot;bytes&quot;:1203856,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca035a80-7ac2-4ab5-a88c-e31f0b89719b_1024x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-qH8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 424w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 848w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 1272w, https://substackcdn.com/image/fetch/$s_!-qH8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F697033ef-b0cc-425f-90bd-7f4e8c65c0dc_782x833.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We need a model that can <strong>navigate the latent manifold</strong> with the precision of Attention but the iterative efficiency of a Recurrent system. This is where the <strong>Ideal Case</strong> the Looped Latent Reasoning model emerges (which is our topic of discussion).</p><div><hr></div><h1>5. The Ideal Case</h1><p>To move beyond the architectural ceiling, we must transition from models that simply <strong>store and retrieve</strong> to systems that <strong>ruminate and refine</strong>. The &#8220;Ideal Case&#8221; for a next-generation architecture isn&#8217;t just a deeper stack of unique layers; it is a system that balances its data, parameter space, and computational budget by shifting the heavy lifting into the latent dimension.</p><h3>5.1 The Expectation: Adaptive Computational Depth</h3><p>In the &#8220;One-Pass&#8221; era, intelligence is a fixed cost. Whether a model is answering &#8220;What is 2+2?&#8221; or &#8220;Solve this differential equation,&#8221; it uses the same number of layers. The Goal is to find an ideal architecture which could introduce a third axis of scaling: T (Time/Depth).</p><p>Instead of scaling N (Parameters), we should scale how many times a hidden state circulates through the model&#8217;s weights. This shifts the focus from Knowledge Capacity (storage) to Knowledge Manipulation (processing), allowing for &#8220;Slow Thinking&#8221; on complex tasks.</p><h3>5.2 Navigating the Trained Manifold</h3><p>We expect a model to have a higher <strong>Degree of Freedom</strong> in how it navigates its own trained manifold; as the inference process is realisitically a mapping/retrieval task. This concept, rooted in <strong>Hierarchical Reasoning Models (HRM)</strong> and <strong>Continuous Thought Machines which I mentioned earlier</strong>, suggests that retrieval should be an internal, iterative process.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ke3N%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ke3N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 424w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 848w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 1272w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ke3N%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png" width="460" height="380.9375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:848,&quot;width&quot;:1024,&quot;resizeWidth&quot;:460,&quot;bytes&quot;:1119741,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ke3N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 424w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 848w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 1272w, https://substackcdn.com/image/fetch/$s_!ke3N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764ca2e2-011e-4e04-b6d7-06875ab870a7_1024x848.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>A theoretical ideal would involve a high-level &#8220;Planner&#8221; performing abstract reasoning in the latent space, while a low-level &#8220;Executor&#8221; handles the rapid, detailed generation. By looping information, the model effectively &#8220;re-reads&#8221; its own internal state, boosting its ability to retrieve and compose distant facts that a single pass would inevitably skip.</em></p><h3>5.3 Thinking in Latent Space</h3><p>The ultimate expectation is <strong>Latent Pondering</strong>. When a model &#8220;thinks&#8221; in text (Chain-of-Thought), it is limited by a 15-bits-per-token vocabulary. A true reasoner should operate in the continuous latent space, accessing <strong>~40,000 bits per hidden vector</strong>.</p><p>However, latent reasoning is only effective if it includes a <strong>Grounding and Verification Loop</strong>:</p><ol><li><p><strong>Iterative Refinement:</strong> The model generates a candidate latent &#8220;thought.&#8221;</p></li><li><p><strong>The Quality Check:</strong> An internal mechanism evaluates the <strong>Entropy</strong> of the latent state. If the information is &#8220;fuzzy&#8221; or inconsistent, the model should refuse to emit a token.</p></li><li><p><strong>Recursive Feedback:</strong> Instead of moving forward, the model loops the state back through its blocks, refining the vector until the internal &#8220;thought&#8221; stabilizes.</p></li><li><p><strong>Informed Emission:</strong> Only when the internal logic is verified in the latent space does the model commit to a high-dimensional text token.</p></li></ol><p>This <strong>Recursive Pipeline</strong> represents the shift from a stochastic parrot to a latent reasoner model that consumes its own internal context to ensure accuracy before it ever speaks.</p><p>Moving from our theoretical "Ideal Case" to engineering reality, we arrive at <strong>Ouro</strong> . This architecture by ByteDance is the first large-scale proof that we can build reasoning into the <strong>pre-training phase</strong> by treating "Loop Depth" as a first-class citizen.</p><div><hr></div><h1>6. Methodology</h1><h3>6.1 Data Pipeline and Scaling</h3><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pray!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 424w, https://substackcdn.com/image/fetch/$s_!pray!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 848w, https://substackcdn.com/image/fetch/$s_!pray!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 1272w, https://substackcdn.com/image/fetch/$s_!pray!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pray%21%2Cw_2400%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png" width="1200" height="164.83516483516485" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;large&quot;,&quot;height&quot;:200,&quot;width&quot;:1456,&quot;resizeWidth&quot;:1200,&quot;bytes&quot;:104527,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:&quot;center&quot;,&quot;offset&quot;:false}" class="sizing-large" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!pray!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 424w, https://substackcdn.com/image/fetch/$s_!pray!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 848w, https://substackcdn.com/image/fetch/$s_!pray!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 1272w, https://substackcdn.com/image/fetch/$s_!pray!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a166cd-afaf-4dde-b1fe-453325a5de40_1737x239.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>In the &#8220;One-Pass&#8221; era, data is often treated as fuel for parameter memory. In Ouro, data is treated as a substrate for <strong>Computational Depth</strong>. The training process is a multi-stage evolution designed to teach the model how to &#8220;polish&#8221; its internal representations over 7.7 trillion tokens.</p><h4><strong>I. The Phased Training Flow</strong></h4><p>As illustrated in the training pipeline diagram above, the journey from raw tokens to a reasoning model is highly structured:</p><ul><li><p><strong>Warmup &amp; Foundation</strong>: The process begins with a <strong>Warmup</strong> phase, leading into <strong>Stable Training on 3T tokens</strong>. This phase builds the foundational language capabilities common to both model sizes.</p></li><li><p><strong>Model Branching (Upcycling)</strong>: After the initial 3T tokens, the pipeline forks. One path continues as the <strong>1.4B</strong> model, while the other is &#8220;upcycled&#8221; into the <strong>2.6B</strong> variant.</p></li><li><p><strong>Recursive Refinement</strong>: Both branches then move through <strong>CT Annealing (1.4T tokens)</strong>, <strong>LongCT (20B tokens)</strong>, and <strong>Mid-Training (300B tokens)</strong>. These stages stabilize the weights for deep recurrence and extend the model&#8217;s context handling.</p></li><li><p><strong>The Final Transformation</strong>: The pipeline concludes with <strong>Reasoning SFT</strong>, which aligns the latent loops of the base models to produce the specialized <strong>Ouro-Thinking</strong> variants.</p></li></ul><h4><strong>II. Knowledge vs. Manipulation Split</strong></h4><p>Through controlled &#8220;Physics-of-LMs&#8221; experiments, researchers found a critical scaling divergence:</p><ul><li><p><strong>Factual Storage</strong>: Ouro stores roughly the same amount of &#8220;raw facts&#8221; per parameter as a standard Transformer (~2 bits/param).</p></li><li><p><strong>Manipulation Mastery</strong>: While storage is fixed, the model&#8217;s ability to <strong>compose, retrieve, and execute multi-hop logic</strong> scales exponentially with the number of training tokens and recurrent steps.</p></li></ul><h4><strong>III. Recursive Exposure and Utility</strong></h4><ul><li><p><strong>Recursive Exposure</strong>: During training, every token in the 7.7T corpus is processed through the recurrent loops. The model encounters the data T times in a single gradient step, forcing the weights to learn iterative refinement.</p></li><li><p><strong>Rank Invariance</strong>: The data mixture assumes &#8220;Rank Invariance,&#8221; meaning the highest-quality data sources remain superior across all scales. The team balanced <strong>Utility</strong> (contribution), <strong>Diversity</strong> (overfitting mitigation), and <strong>Scale</strong> to maximize the 7.7T token budget.</p></li></ul><div><hr></div><h3>6.2 Model Architecture: The Recurrent Transformer Block</h3><p>The Ouro architecture departs from the traditional &#8220;deep stack&#8221; of unique layers in favor of a <strong>LoopLM</strong> to a recurrent structure that simulates massive depth through weight-sharing and iterative latent refinement.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2101Mv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!01Mv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 424w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 848w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 1272w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2101Mv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png" width="192" height="416.19161676646706" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:724,&quot;width&quot;:334,&quot;resizeWidth&quot;:192,&quot;bytes&quot;:38323,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!01Mv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 424w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 848w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 1272w, https://substackcdn.com/image/fetch/$s_!01Mv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72de7b21-31d4-4a3e-b864-a331fc81d1be_334x724.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>I. The Loop Unit: Weight-Shared Recurrence</strong></h4><p>Unlike a standard transformer that passes a hidden state through L distinct layers <em>(L_1 &#8594; L_2 &#8594; &#8230; &#8594; L_n)</em>, Ouro groups layers into a &#8220;Loop Unit.&#8221;</p><ul><li><p><strong>The Structure:</strong> A Loop Unit consists of a block of transformer layers (e.g., 6 or 12 layers). During a single forward pass, the hidden state h is passed through this same block multiple times (T loops).</p></li><li><p><strong>The Mathematical Operator:</strong> Each loop can be viewed as an application of a fixed operator <em>f_theta</em>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_{t+1} = f_\\theta(h_t)&quot;,&quot;id&quot;:&quot;LITIQUYWOD&quot;}" data-component-name="LatexBlockToDOM"></div><p>where theta represents the shared parameters. This architecture forces the model to learn a <strong>differential update</strong> by iteratively nudging the latent vector toward the correct semantic manifold rather than attempting to reach it in one &#8220;leap.&#8221;</p></li></ul><h4><strong>II. Residual Dynamics and Sandwich Normalization</strong></h4><p>Deep recurrence is notoriously unstable. To prevent gradient explosion and maintain signal integrity over many loops, Ouro implements a specific normalization strategy:</p><ul><li><p><strong>Sandwich Norm:</strong> Instead of standard Pre-Norm or Post-Norm, Ouro uses a &#8220;sandwich&#8221; approach, applying Layer Normalization both before and after the residual branches within the loop. This ensures that the variance of the hidden state remains bounded, even if the model &#8220;thinks&#8221; for 8 or 16 iterations.</p></li><li><p><strong>Rotary Positional Embeddings (RoPE):</strong> To ensure the model maintains positional awareness across loops, RoPE is applied at every step. This prevents the &#8220;spatial drift&#8221; that often plagues recurrent models, where the model loses track of token order as the latent state is transformed.</p></li></ul><h4><strong>III. Parameter Efficiency: Intelligence vs. VRAM</strong></h4><p>The architectural magic of Ouro lies in its <strong>Compute-to-Memory ratio</strong>.</p><ul><li><p><strong>The 2.6B &#8220;Phantom&#8221; Depth:</strong> An Ouro-2.6B model with a 4x loop depth has the physical VRAM footprint of a 2.6B model but the <strong>effective computational depth</strong> of a ~10B model.</p></li><li><p><strong>KV Cache Optimization:</strong> Since the recurrence happens <em>internally</em> within the same block for a single token, the Key-Value (<em>KV</em>) cache only needs to store the final refined state. This avoids the O(N^2) memory explosion that would occur if we tried to achieve similar depth through a standard linear stack (more on this later).</p></li></ul><h4><strong>IV. The Exit Head (The Gating Mechanism)</strong></h4><p>The architecture includes a specialized <strong>Classification Head</strong> attached to each loop. This head acts as a &#8220;Readout&#8221; or &#8220;Exit Gate.&#8221; During training, it learns to predict the probability of exiting given current hidden state from any given loop <em>t</em>. This multi-exit architecture is what enables the training pipeline to supervise the model at every stage of its &#8220;thinking&#8221; process, rather than just at the end. If probability (lambda here) is greater then a threshold, we exit out with the token/output of current head.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!U5R2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 424w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 848w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 1272w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21U5R2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png" width="458" height="67" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:67,&quot;width&quot;:458,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9627,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!U5R2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 424w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 848w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 1272w, https://substackcdn.com/image/fetch/$s_!U5R2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97d4e058-d438-48e8-b27e-2e2b9d8d6c9a_458x67.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><h3>6.3 Training Pipeline: The Entropy-Regularized Objective</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21POfZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!POfZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 424w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 848w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 1272w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21POfZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png" width="486" height="471.92275862068965" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:704,&quot;width&quot;:725,&quot;resizeWidth&quot;:486,&quot;bytes&quot;:68542,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!POfZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 424w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 848w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 1272w, https://substackcdn.com/image/fetch/$s_!POfZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b98a03b-aa53-410a-9396-8f29003b860d_725x704.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The core innovation of Ouro&#8217;s training lies in how it supervises the <strong>latent trajectory</strong>. Unlike standard models that only care about the final output, Ouro uses a multi-staged approach to teach the model how to &#8220;think&#8221; during the loops.</p><h4><strong>Stage I: Learning with Entropy Regularization</strong></h4><p>During the initial pre-training on 7.7T tokens, the model doesn&#8217;t just learn next-token prediction; it learns to distribute its &#8220;confidence&#8221; across the loop steps.</p><ul><li><p><strong>Objective : </strong>Ouro optimizes a joint loss that combines standard cross-entropy with an <strong>Entropy-Regularized</strong> term to maximize information content across depth.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QLcE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 424w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 848w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 1272w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QLcE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png" width="695" height="129.35782967032966" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:271,&quot;width&quot;:1456,&quot;resizeWidth&quot;:695,&quot;bytes&quot;:64180,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QLcE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 424w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 848w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 1272w, https://substackcdn.com/image/fetch/$s_!QLcE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7ce0ad8-1bc0-48e5-8890-e6a24ba5e72a_1458x271.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>The Uniform Prior:</strong> The training uses a variational inference approach with a <strong>uniform prior</strong> (<em>ELBO</em>) over all possible exit steps against a uniform distribution.</p><p>Most adaptive models have an inductive bias (hence could fall into reward hacking problem) toward shallow computation (exiting early to save loss). By forcing a uniform prior, Ouro encourages the model to explore the full depth of the 4x loops uniformily, ensuring that the parameters in the shared block are optimized for <strong>deep latent refinement</strong> rather than just quick shortcuts.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GhQb%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GhQb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 424w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 848w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 1272w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GhQb%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png" width="394" height="424.1390820584145" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:774,&quot;width&quot;:719,&quot;resizeWidth&quot;:394,&quot;bytes&quot;:117452,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GhQb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 424w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 848w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 1272w, https://substackcdn.com/image/fetch/$s_!GhQb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F379c8b2d-23b8-4057-bf74-24e374cc6d62_719x774.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>Intermediate Supervision:</strong> The next-token-prediction loss is calculated at <em>every</em> loop iteration <em>t</em>. This ensures that the latent state <em>h_t</em> is semantically meaningful at every stage of the reasoning process.</p></li></ul><h4><strong>Stage II: Focused Adaptive Gate Training</strong></h4><p>Once the base model has learned how to refine its latent state, the second stage focuses purely on the <strong>Gating Mechanism</strong> (&#955;).</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4kxG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 424w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 848w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 1272w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214kxG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png" width="812" height="135" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:135,&quot;width&quot;:812,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20459,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4kxG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 424w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 848w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 1272w, https://substackcdn.com/image/fetch/$s_!4kxG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F622d4e51-23dd-4f9b-90ae-068b7e84b16f_812x135.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><ul><li><p>The transformer weights are frozen, and only the lightweight classification heads (the gates) are trained. The Goal is To sharpen the exit distribution. The model is taught to recognize when a &#8220;thought&#8221; has reached its peak utility.</p></li><li><p><strong>The Loss Metric:</strong></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yDqr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 424w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 848w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 1272w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yDqr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png" width="480" height="135" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:135,&quot;width&quot;:480,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11988,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yDqr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 424w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 848w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 1272w, https://substackcdn.com/image/fetch/$s_!yDqr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8938c97-5b31-4ee5-b734-16c7bc0e97d7_480x135.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>here w_t is a target continuation probability based on the actual loss improvement between h_t and h_{t+1}. If looping again significantly reduces the loss, the gate is penalized for stopping; if it doesn&#8217;t, the gate is penalized for &#8220;overthinking.&#8221;</p></li></ul><h4><strong>Stage III. Reasoning SFT (Ouro-Thinking)</strong></h4><p>For the &#8220;Thinking&#8221; variants of Ouro, a final <strong>Supervised Fine-Tuning (SFT)</strong> stage is applied.</p><ul><li><p><strong>Alignment with CoT:</strong> While the model primarily reasons in the latent space, this stage aligns those latent trajectories with explicit reasoning tasks (math, code, logic, etc.).</p></li><li><p><strong>Causal Faithfulness:</strong> The training ensures that the latent state h_t actually contains the logic required for the final answer, making the model&#8217;s &#8220;internal thoughts&#8221; more causally aligned with its output than a standard model&#8217;s hallucination-prone Chain-of-Thought.</p></li></ul><h3>6.4 Inference: The Dynamic Exit and Token-Level Pondering</h3><p>Inference in Ouro is a <strong>variable-depth</strong> process. Unlike a standard transformer that spends the same amount of FLOPS on every token, Ouro allocates its &#8220;thinking time&#8221; based on the complexity of the semantic transition.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p04_%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p04_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 424w, https://substackcdn.com/image/fetch/$s_!p04_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 848w, https://substackcdn.com/image/fetch/$s_!p04_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 1272w, https://substackcdn.com/image/fetch/$s_!p04_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p04_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png" width="631" height="468.1799816345271" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:808,&quot;width&quot;:1089,&quot;resizeWidth&quot;:631,&quot;bytes&quot;:88226,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!p04_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 424w, https://substackcdn.com/image/fetch/$s_!p04_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 848w, https://substackcdn.com/image/fetch/$s_!p04_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 1272w, https://substackcdn.com/image/fetch/$s_!p04_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf26cc7c-ecf5-493e-8236-e9e156f7a480_1089x808.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>I. Exit vs. Continue</h4><p>Think of the exit gate as a <strong>binary router</strong> attached to each loop. At every iteration <em>t</em>, the gate evaluates the stability of the current latent state <em>h_t</em>:</p><ul><li><p>The gate produces an exit probability &#955;. If &#955; exceeds a predefined confidence threshold (the <strong>q-threshold</strong>), the model halts and exits.</p></li><li><p><strong>The Decision:</strong></p><ul><li><p><strong>For simple tokens</strong> the gate sees high confidence after <em>T=1</em>. It exits immediately, hence saving compute.</p></li><li><p><strong>Whereas for Complex Token (e.g., differentiation):</strong> The gate sees high entropy/uncertainty. It rejects the exit (&#955;_t &lt; q_thresh) and loops the state back for T=2, 3, &#8230; until the logic resolves.</p></li></ul></li></ul><h4>II. The Reach Probability</h4><p>Because Ouro is a probabilistic system, it uses <strong>Reach Probability</strong> to manage its trajectory. The probability of the model actually emitting a token at loop <em>t</em> is the joint probability that it <em>didn&#8217;t</em> exit at any previous step:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;P(\\text{exit at } t) = \\lambda_t \\times \\prod_{i=1}^{t-1} (1 - \\lambda_i)&quot;,&quot;id&quot;:&quot;CKVELHGKAK&quot;}" data-component-name="LatexBlockToDOM"></div><p>This ensures that the model&#8217;s depth is not just a hard switch but a weighted distribution of its internal certainty.</p><h4>III. Hardware Efficiency: KV Cache Reuse</h4><p>One of the most critical engineering advantages of Ouro&#8217;s inference is how it handles memory.</p><ul><li><p><strong>Sequential Latent Steps:</strong> Since the model is looping <em>internally</em> for a single token, it does not need to store new KV pairs for every loop (caching could be utilized after the first token is cached/passed).</p></li><li><p><strong>The Buffer:</strong> It simply overwrites the &#8220;working&#8221; latent state. Only the <strong>final refined state</strong> is committed to the long-term KV cache used for future tokens. This keeps the memory footprint identical to a standard 2.6B model while providing the reasoning depth of a 10B+ model.</p></li></ul><p><strong>Example;</strong></p><ul><li><p>Calculate the square root of 144 = ...</p></li><li><p><strong>Token 1 (&#8221; 12&#8221;):</strong></p><ul><li><p><strong>Loop 1:</strong> The model has a &#8220;fuzzy&#8221; latent state (mixing 144, 12, and 14). &#955;_1 is low (0.2).</p></li><li><p><strong>Loop 2:</strong> The model refines the math. &#955;_2 rises to 0.5.</p></li><li><p><strong>Loop 3:</strong> The latent state stabilizes on the concept of &#8220;12.&#8221; &#955;_3 hits 0.9.</p></li><li><p><strong>Action:</strong> Exit after <strong>3 loops</strong>.</p></li></ul></li></ul><p>This <strong>Adaptive Computation</strong> is what allows Ouro to be fast when it can and slow when it must.</p><h3>KV Cache Sharing for Inference Efficiency</h3><p>The recurrent architecture of Ouro presents a significant memory challenge: by looping a hidden state four times, the model effectively quadruples the required <strong>Key-Value (KV) cache</strong> storage if each iteration is treated as a unique layer. Since memory bandwidth is often the primary bottleneck in LLM inference, a 4x overhead would negate the efficiency gains of a smaller parameter count. To solve this, the researchers evaluated whether the model could function by sharing a single cache across all recurrent steps.</p><h3>The Prefilling Phase</h3><p>During the initial &#8220;prefill&#8221; stage; where the model processes the input prompt the experiment showed that KV cache sharing is non-viable. Each of the four recurrent passes transforms the input representation into a fundamentally different latent state. Because the early layers of a reasoning chain are semantically distinct from the later, refined states, attempting to force them into a single shared cache results in a massive loss of signal. Benchmark results showed a drop of over 10 points on GSM8K when prefill caches were merged, confirming that the model needs distinct &#8220;memory&#8221; for each stage of its initial thought process.</p><h3>The Decoding Phase</h3><p>The dynamics shift during the auto-regressive decoding phase (generating one token at a time). The researchers tested three specific strategies to reduce the memory footprint by 4x:</p><ul><li><p><strong>First-step Reuse:</strong> Only the KV cache from the initial pass (T=1) is stored. This resulted in a total performance collapse (GSM8K score dropping from 78.92 to 18.73), proving that the initial, &#8220;unrefined&#8221; representation lacks the necessary information for the model to continue a logical sequence.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AIz9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AIz9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 424w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 848w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 1272w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AIz9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png" width="899" height="244" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:244,&quot;width&quot;:899,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45769,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AIz9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 424w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 848w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 1272w, https://substackcdn.com/image/fetch/$s_!AIz9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e228fb5-71c6-4c7b-b291-dc9c7dd5be50_899x244.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>Averaged Reuse:</strong> A mathematical average of the KV pairs from all four passes is stored. This was surprisingly effective, maintaining most of the performance, but still introduced slight noise in high-precision math tasks.</p></li><li><p><strong>Last-step Reuse:</strong> Only the KV cache from the final, most refined pass (T=4) is stored.</p></li></ul><h3>Practical Implementation and Efficiency</h3><p>The <strong>Last-step Reuse</strong> strategy emerged as the optimal engineering solution. It achieved a near-perfect recovery of the original performance (78.85 vs. 78.92 on GSM8K) while successfully reducing the memory requirement by <strong>75%</strong>.</p><p>This finding implies that while the model needs &#8220;space to think&#8221; during the initial prompt processing, the subsequent tokens only need to reference the <strong>most refined version</strong> of the previous context. By discarding the intermediate &#8220;draft&#8221; states from loops 1, 2, and 3, Ouro-2.6B can operate with the VRAM footprint of a standard 2.6B model while utilizing the reasoning depth of a much larger system. This optimization is critical for maintaining high throughput on consumer-grade GPUs where memory capacity is limited.</p><div><hr></div><h1>7. HRMs vs CTMs vs Looped LMs</h1><p>In our earlier articles we discussed and very similar reasoning paradigm, namely CTMs and HRMs/TRLs. All of them have a shared subspace for reasoning which is refined iteratively; but, HRMs/CTMs tackled this problem at smaller scale whereas LoopedLMs is an attempt of realizing the same dream at larger scale. Lets have a look to understand potential differences between them.</p><h3>1. The Similarities</h3><ul><li><p><strong>The Thinking Tax:</strong> All three agree that you cannot solve complex logic in a single pass. You have to pay for intelligence with <strong>Time/Iterations</strong>, not just more parameters.</p></li><li><p><strong>Latent Pondering:</strong> They all try to keep the &#8220;thinking&#8221; inside the hidden layers. They avoid the &#8220;Chain-of-Thought&#8221; trap where the model has to talk to itself in English tokens (which is slow and messy).</p></li><li><p><strong>Adaptive Exit:</strong> They all have a &#8220;Halt&#8221; signal. If a problem is easy (1+1), they stop immediately. If it&#8217;s hard, they loop until the answer stabilizes.</p></li></ul><h3>2. The Differences: How they approach the problem</h3><h4>LoopLMs</h4><ul><li><p><strong>Method:</strong> It&#8217;s a standard Transformer bent into a circle. The hidden state goes through the <strong>exact same weights</strong> 4 or 8 times.</p></li><li><p><strong>In Practice:</strong> Think of it like a sculptor. The first loop gives the rough shape; each following loop polishes the details. It doesn&#8217;t change the &#8220;logic&#8221; it just refines the precision.</p></li><li><p><strong>It is best for </strong>General language tasks, coding, and math where you already have the data but need to &#8220;squeeze&#8221; out more accuracy.</p></li></ul><h4>HRMs</h4><ul><li><p><strong>Method:</strong> It splits the memory module into two parts: a <strong>High-level &#8220;teacher&#8221;</strong> (H-module) and a <strong>Low-level &#8220;student&#8221;</strong> (L-module).</p></li><li><p><strong>In Practice:</strong> The Boss looks at the big picture once every few steps (e.g., &#8220;We are trying to find the exit of this maze&#8221;). The Worker does the fast, repetitive steps (e.g., &#8220;Left, Right, Straight&#8221;). The Boss tells the Worker <em>how</em> to think and further recommendations.</p></li><li><p><strong>Best For:</strong> Strategic planning, long-form logic, and tasks like <strong>ARC-AGI</strong> or complex puzzles where you can easily get lost in the &#8220;weeds.&#8221;</p><p></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;5cd2db6d-a395-4f61-86fd-7d4a258d738b&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Hierarchical Reasoning Model : Thinking fast and Slow&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da98159-88a8-4d06-953d-ed065a986e72_144x144.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-09-09T03:30:30.230Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!WK2K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c576a5b-b34a-4a1b-85c3-ef5f64d5fed3_666x500.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/hierarchical-reasoning-model-thinking&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:173034195,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:7,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div></li></ul><h4>CTMs</h4><ul><li><p><strong>Method:</strong> It throws away the &#8220;token-by-token&#8221; clock. The model &#8220;pulses&#8221; its neurons as many times as it wants between getting an input and giving an output and is counted by Ticks (fundamental proposed units of refinement).</p></li><li><p><strong>Best For:</strong> Real-time robotics, vision-based reasoning, and tasks where the &#8220;answer&#8221; isn&#8217;t a word, but a continuous action or state.<br></p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;8ebbd669-39fc-46fa-b3b5-d2bc7cefb874&quot;,&quot;caption&quot;:&quot;Table of content&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Continuous Thought Machine : Think before you speak&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da98159-88a8-4d06-953d-ed065a986e72_144x144.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-06-16T03:21:50.941Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!aSo3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F310f4248-e1a7-49aa-a7bb-c3391853f6b2_755x500.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/continuous-thought-machine-think&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:165613351,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:4,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div></li></ul><div><hr></div><h1>8. Results/Outcomes</h1><h3>8.1 Base Model Evaluation</h3><p>The core finding of the base model evaluation is the <strong>2&#8211;4x parameter efficiency</strong> gain. Ouro doesn&#8217;t just compete with models in its own size class; it consistently defeats much larger &#8220;dense&#8221; (one-pass) architectures.</p><h3>Key Performance Highlights:</h3><ul><li><p><strong>Ouro-1.4B vs. The Field:</strong> With 4 recurrent steps (T=4), the 1.4B model performs comparably to the <strong>Qwen3-4B</strong>. Most notably, it crushes larger models in reasoning-heavy tasks like <strong>MATH500</strong> (82.40 vs. 59.60 for Qwen3-4B).</p></li><li><p><strong>Ouro-2.6B vs. The Giants:</strong> The 2.6B variant outperforms dense models up to <strong>8B parameters</strong>. On the <strong>BBH</strong> (Big Bench Hard) benchmark, it scored <strong>80.46</strong>, surpassing the <strong>Qwen3-8B</strong> (77.65) and <strong>Llama3.1-8B</strong> (71.56).</p></li><li><p><strong>The Reasoning Edge:</strong> The most pronounced gains were observed in <strong>MMLU-Pro, BBH, GSM8K, and MATH500</strong>. This validates the hypothesis that iterative computation is specifically suited for tasks requiring knowledge manipulation rather than just simple retrieval.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21oMgA%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oMgA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 424w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 848w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 1272w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21oMgA%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png" width="766" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:766,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:101823,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oMgA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 424w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 848w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 1272w, https://substackcdn.com/image/fetch/$s_!oMgA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7fd38a9-e7c6-4193-8511-0d8e6dc5c3b4_766x450.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3>8.2 Reasoning Model (Ouro-Thinking) Evaluation</h3><p>When fine-tuned for deep reasoning (<strong>SFT</strong>), the LoopLM architecture shows its true strength in high-difficulty academic and competitive benchmarks (AIME, GPQA).</p><ul><li><p><strong>Competition-Level Math:</strong> The <strong>Ouro-1.4B-Thinking</strong> reached a score of <strong>71.6 on OlympiadBench</strong>, nearly matching the much larger <strong>Qwen3-4B (73.2)</strong>.</p></li><li><p><strong>Expert-Level Science:</strong> On <strong>BeyondAIME</strong> (math beyond competition level), the <strong>2.6B model (39.0)</strong> outperformed the <strong>Qwen3-8B (38.0)</strong>, proving that the recurrent bottleneck forces the model to develop more robust logical internal states.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xs1B%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xs1B!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 424w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 848w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 1272w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xs1B%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png" width="760" height="244" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:244,&quot;width&quot;:760,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60128,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xs1B!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 424w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 848w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 1272w, https://substackcdn.com/image/fetch/$s_!xs1B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ab93bfb-8c3b-4f19-9646-87ba92113aac_760x244.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3>8.3 Performance by Depth</h3><p>The researchers tested how the model performs if you change the number of loops (T) during inference. Since the model was trained with T=4, this created a clear &#8220;performance curve.&#8221;</p><h3><strong>The Evolution of a Thought:</strong></h3><ol><li><p><strong>T=1 (The Failure):</strong> At a single pass, the models perform poorly, especially the Thinking variants (often near 0% on math). This proves the weights are specifically optimized for <strong>cooperative iteration</strong>, not one-pass intuition.</p></li><li><p><strong>T=4 (The Peak):</strong> Performance generally peaks at the trained depth. This is where the model is most &#8220;comfortable&#8221; and accurate.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tqms%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tqms!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 424w, https://substackcdn.com/image/fetch/$s_!tqms!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 848w, https://substackcdn.com/image/fetch/$s_!tqms!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 1272w, https://substackcdn.com/image/fetch/$s_!tqms!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tqms%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png" width="617" height="244" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:244,&quot;width&quot;:617,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42055,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tqms!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 424w, https://substackcdn.com/image/fetch/$s_!tqms!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 848w, https://substackcdn.com/image/fetch/$s_!tqms!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 1272w, https://substackcdn.com/image/fetch/$s_!tqms!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff912b6c1-d9ed-4814-b22d-ede420bf4580_617x244.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>T=5 to 8 (Extrapolation):</strong></p><ol><li><p><strong>Task Performance:</strong> Generally <strong>degrades</strong>. Pushing the model to think &#8220;longer&#8221; than it was trained for causes its internal logic to drift or falter.</p></li><li><p><strong>The Safety Exception:</strong> Interestingly, while benchmark scores drop, <strong>Safety Alignment</strong> actually <em>improves</em> at higher depths. The model becomes more certain of its refusals the longer it iterates.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-kDD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-kDD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 424w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 848w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 1272w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-kDD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png" width="617" height="244" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:244,&quot;width&quot;:617,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41896,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/188710128?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-kDD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 424w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 848w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 1272w, https://substackcdn.com/image/fetch/$s_!-kDD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe2317fa-fcbc-4887-91d4-448540eb2b1f_617x244.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ol></li></ol><div><hr></div><h1>Thoughts</h1><p>The move toward <strong>Looped Language Models</strong> and <strong>Latent Reasoning</strong> represents a shift from &#8220;Intelligence as a Product&#8221; (the output token) to &#8220;Intelligence as a Process&#8221; (the latent trajectory). It challenges the assumption that scaling requires more parameters, suggesting instead that we can scale by increasing the time a model spends navigating its own internal manifold.</p><p>However, as we transition from static towers to recursive loops, we encounter new theoretical and practical friction points:</p><h3>The Uniformity of the Loop</h3><p>In the current Ouro implementation, the hidden state passes through the same weights for every iteration. While parameter-efficient, this assumes that the &#8220;logic&#8221; required to start a thought is identical to the logic required to finish it. In human cognition, we often switch from abstract planning to detailed execution. Future architectures might benefit from <strong>Heterogeneous Looping</strong>, where the weights themselves are modulated by the loop index t, allowing the shared parameters to &#8220;shift gears&#8221; as the reasoning matures.</p><h3>The &#8220;Echo Chamber&#8221; of Internal States</h3><p>Recursive models run the risk of <strong>Latent Collapse</strong>, where the hidden state iterates into a fixed-point attractor that no longer represents the input data accurately. While Ouro uses entropy regularization to prevent this, there is a delicate balance between &#8220;refining&#8221; a thought and simply &#8220;echoing&#8221; an error. We need more robust <strong>Topological Constraints</strong>/loss functions that ensure the latent state remains anchored to the semantic reality of the prompt even after dozens of iterations.</p><h3>Beyond Entropy</h3><p>Currently, the &#8220;quality check&#8221; for whether to exit a loop is largely based on entropy which is a measure of certainty. But certainty is not the same as correctness. A model can be very certain of a hallucination. The next evolution of the &#8220;Exit Gate&#8221; should move toward <strong>Structural Verification</strong>: an internal mechanism that checks if the latent state satisfies the logical constraints of the task (e.g., does the math add up? is the code syntactically valid?) before allowing the token to be emitted.</p><h3>The Bottleneck of Synchronous Recurrence</h3><p>Ouro processes recurrence sequentially, which preserves the causal chain but limits the potential for parallel &#8220;brainstorming.&#8221; If we look toward <strong>Multi-path Recurrence</strong>, we could imagine a model that explores several latent trajectories in parallel, using a &#8220;consensus mechanism&#8221; to decide which path reaches a stable state first. This would turn the linear loop into a tree-search within the latent space, potentially unlocking the reasoning depth required for scientific discovery or complex system design.</p><h3>Scaling the Manifold, Not the VRAM</h3><p>The most immediate takeaway from Ouro&#8217;s success is that the <strong>VRAM-to-Intelligence ratio</strong> is not fixed. By proving that a 2.6B model can simulate the depth of a 12B model, we are opening the door for high-intelligence agents on edge devices. The challenge now is to optimize the hardware for this new paradigm. Current GPUs are designed for massive, parallel one-pass matrix multiplications; they are not yet optimized for the rapid, iterative state-updates required by recursive reasoning.</p><p>Ultimately, Ouro proves that the &#8220;Token Tax&#8221; is a choice, not a law. We no longer have to wait for the model to speak to know that it is thinking. By shifting the focus to the <strong>Latent Loop</strong>, we are finally building architectures that respect the complexity of the problems they are asked to solve.</p><div><hr></div><h1>Conclusion</h1><p>At its core, <strong>Ouro</strong> reframes intelligence as a function of <strong>iterative refinement</strong> rather than static capacity. By abandoning the fixed-depth orthodoxy of the &#8220;one-pass&#8221; Transformer and treating the architecture as a recursive operator, we move closer to a machine that doesn&#8217;t just predict the next token, but actually ruminates on the underlying logic.</p><p>In this article, we started by looking at the <strong>Information Hypothesis</strong>, seeing how intelligence arises from finding the low-dimensional symmetries in high-dimensional data. We revisited the <strong>Scaling Laws</strong> of the past from Kaplan to Chinchilla and identified the architectural ceiling where adding parameters no longer yields a proportional increase in reasoning depth. We explored the theoretical &#8220;Ideal Case&#8221; of <strong>Latent Reasoning</strong>, framing a future where models navigate their own manifolds through internal quality gates.</p><p>We then dissected the Ouro methodology, seeing how it realizes this vision through <strong>Weight-Shared Recurrence</strong> and an <strong>Entropy-Regularized</strong> training pipeline. We saw how engineering hurdles like the <strong>KV Cache bottleneck</strong> were solved through last-step reuse, proving that a model can be deep in thought without being heavy in memory. Finally, the results spoke for themselves: a 2.6B model punching up to match 12B giants, proving that <strong>Computational Depth (T)</strong> is the new frontier of scaling.</p><p>The key takeaway is that the &#8220;Token Tax&#8221; of traditional LLMs which is basically the need to externalize every thought into text is an inefficiency we can finally bypass. When we decouple <strong>Knowledge Storage</strong> from <strong>Reasoning Depth</strong>, we don&#8217;t just get smaller, more efficient models; we get a new class of &#8220;Slow Thinking&#8221; agents that respect the complexity of the problems they are asked to solve. Personally, I am excited for a future where our models stop &#8220;reading&#8221; our queries and start modeling the structural symmetry of the answers.</p><p>Paper : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2510.25741">Scaling Latent Reasoning via Looped Language Models</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today.<br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p>]]></content:encoded></item><item><title><![CDATA[How to run Robotics simulations in Maniskill Environment?]]></title><description><![CDATA[Getting started with Robotics simulation environments!]]></description><link>https://vizuara.substack.com/p/how-to-run-robotics-simulations-in</link><guid isPermaLink="false">https://vizuara.substack.com/p/how-to-run-robotics-simulations-in</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Sun, 08 Feb 2026 06:27:53 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CB0n%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am documenting my experience with the Maniskill environment in this article.</p><p>I was looking for a simulation environment, where I can easily simulate robot policies. I stumbled across Maniskill, while listening to this podcast.</p><div id="youtube2-fpOCPQB2spM" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;fpOCPQB2spM&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="iframe.php?url=https%3A%2F%2Fwww.youtube-nocookie.com%2Fembed%2FfpOCPQB2spM%3Frel%3D0%26amp%3Bautoplay%3D0%26amp%3Bshowinfo%3D0%26amp%3Benablejsapi%3D0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>Here Stone Tao, explains about his journey and motivations behind building Maniskill.</p><p>First, let us understand the basics. For any simulation environment, we need 2 things:</p><h3>(1) The Physics Engine</h3><p>The Physics Engine is a simulator designed specifically to help robots understand how to interact with physical objects. </p><p>Maniskill uses a Physics Engine called SAPIEN.</p><p>While many simulators focus on robots walking or navigating (like a Roomba avoiding a wall), SAPIEN focuses on <strong>manipulation</strong> - using a robot arm to open drawers, turn faucets, or pick up cups.</p><ul><li><p><strong>What it does:</strong> It calculates the physics of the world. If a robot arm bumps a table, SAPIEN calculates how the table moves, how the objects on it shake, and how the friction feels.</p></li><li><p><strong>The &#8220;Basics&#8221; Analogy:</strong> Think of SAPIEN as a <strong>video game engine</strong> (like Unity or Unreal Engine) but built strictly for scientific robots. It simulates the gravity, friction, and &#8220;touch&#8221; that a robot needs to understand the world.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lCWn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lCWn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lCWn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;GitHub - haosulab/SAPIEN: SAPIEN Embodied AI Platform&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="GitHub - haosulab/SAPIEN: SAPIEN Embodied AI Platform" title="GitHub - haosulab/SAPIEN: SAPIEN Embodied AI Platform" srcset="https://substackcdn.com/image/fetch/$s_!lCWn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!lCWn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fe588c4-c4db-4a19-a3ce-a0d4813a1180_1200x600.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>(2) High-Level Framework</h3><p><strong>ManiSkill</strong> is a collection of tasks and data built <em>on top</em> of SAPIEN.</p><p>Just having a physics engine (SAPIEN) isn&#8217;t enough; you need specific goals to train the robot. ManiSkill provides those goals. It includes difficult tasks like &#8220;pick up this pen,&#8221; &#8220;pour water from this bucket,&#8221; or &#8220;assemble this chair.&#8221;</p><ul><li><p><strong>What it does:</strong> It acts as a standardized test. It provides thousands of demonstrations (digital recordings of a task being done correctly) so researchers can train their AI, and then it scores the AI on how well it can repeat the task.</p></li><li><p><strong>The &#8220;Basics&#8221; Analogy:</strong> If SAPIEN is the <strong>gym building</strong> with all the equipment, ManiSkill is the <strong>personal trainer</strong> who gives you a specific workout plan and tracks your reps.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CB0n%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CB0n!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CB0n%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg" width="1456" height="656" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:656,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;User Guide &#8212; ManiSkill 3.0.0b22 documentation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="User Guide &#8212; ManiSkill 3.0.0b22 documentation" title="User Guide &#8212; ManiSkill 3.0.0b22 documentation" srcset="https://substackcdn.com/image/fetch/$s_!CB0n!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CB0n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0384876a-95a3-4eef-bc8d-e5ac4289532d_4800x2161.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Most importantly, ManiSkill supports <strong>GPU parallelization</strong>. Instead of running one robot simulation at a time, you can run 2,000+ simultaneously. This means you can collect millions of training steps in minutes rather than days.</p><p>Now, let us see how to get started with Maniskill!</p><div><hr></div><h3>Getting Started with Maniskill</h3><h4>Step 1: Installation</h4><p>First, you need to install the library and its dependencies. ManiSkill is built on the SAPIEN engine and integrates with PyTorch.</p><p>Run this command in your terminal or notebook:</p><pre><code>pip install maniskill torch</code></pre><p><em>Note: You may also need to set up Vulkan (the graphics API) drivers if you are running this locally.</em></p><h4>Step 2: Run a Basic Environment (CPU)</h4><p>Before we go fast, let&#8217;s go slow. We&#8217;ll run a single environment on the CPU just to see how the API works. If you&#8217;ve used OpenAI Gym or Gymnasium before, this will feel like home.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JFbu%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JFbu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 424w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 848w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 1272w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JFbu%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png" width="1280" height="640" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:640,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;GitHub - Farama-Foundation/Gymnasium: An API standard for single-agent  reinforcement learning environments, with popular reference environments  and related utilities (formerly Gym)&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="GitHub - Farama-Foundation/Gymnasium: An API standard for single-agent  reinforcement learning environments, with popular reference environments  and related utilities (formerly Gym)" title="GitHub - Farama-Foundation/Gymnasium: An API standard for single-agent  reinforcement learning environments, with popular reference environments  and related utilities (formerly Gym)" srcset="https://substackcdn.com/image/fetch/$s_!JFbu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 424w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 848w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 1272w, https://substackcdn.com/image/fetch/$s_!JFbu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b6283bf-bf3a-4405-8313-d0299df44970_1280x640.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We will load the <code>PegInsertionSide-v1</code> task, where a robot arm tries to insert a peg into a hole sideways - a classic precision task.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qq6r%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qq6r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 424w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 848w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 1272w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qq6r%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png" width="256" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:256,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Table-Top 2 Finger Gripper Tasks &#8212; ManiSkill 3.0.0b22 documentation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Table-Top 2 Finger Gripper Tasks &#8212; ManiSkill 3.0.0b22 documentation" title="Table-Top 2 Finger Gripper Tasks &#8212; ManiSkill 3.0.0b22 documentation" srcset="https://substackcdn.com/image/fetch/$s_!qq6r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 424w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 848w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 1272w, https://substackcdn.com/image/fetch/$s_!qq6r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6434ce4b-91a9-41ca-a392-29b5374aebd9_256x256.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Code to run the &#8220;Peg Insertion&#8221; task:</strong></p><pre><code>import gymnasium as gym
import mani_skill.envs

# Create the environment with a human-viewable render mode
env = gym.make("PegInsertionSide-v1", render_mode="human")
obs, _ = env.reset()

done = False
while not done:
    # Sample a random action (just flailing around for now)
    action = env.action_space.sample()
    
    # Step the environment
    obs, reward, terminated, truncated, info = env.step(action)
    done = terminated or truncated
    
    # Render the scene
    env.render()

env.close()</code></pre><p><em>When you run this, you should see a window pop up with a robot arm moving randomly. It won&#8217;t succeed, but it proves your physics engine is alive.</em></p><p>Note the similarity between the code syntax here and the Gymnasium code syntax. We are using the same functions: gym.make, env.action.space.sample() etc.</p><p>Have a look at this article, where I explain about the Gymnasium environment separately using some practical examples: </p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;5f249972-e8dd-41f8-af80-af50e0697312&quot;,&quot;caption&quot;:&quot;In this lecture, we began our journey by first understanding classical reinforcement learning.&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Hands-on RL Bootcamp Lecture 1&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-08-01T10:25:41.889Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!zmaD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98ed7c5c-7c63-4406-92b5-d8863ae17eb2_1000x662.jpeg&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/hands-on-rl-bootcamp-lecture-1&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:169648519,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:20,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><h4>Step 3: Unleashing the GPU (The &#8220;ManiSkill Magic&#8221;)</h4><p>Now, let&#8217;s do what ManiSkill was born to do: massive scaling.</p><p>We are going to switch to the <code>PickCube-v1</code> task and run <strong>2,048 environments</strong> at the same time.</p><pre><code>import gymnasium as gym
import mani_skill.envs
import torch

# Create 2048 parallel environments
# obs_mode="state" gives us physical data (coordinates) rather than images
env = gym.make("PickCube-v1", num_envs=2048, obs_mode="state")

obs, _ = env.reset()

# Generate random actions for ALL 2048 environments
# Note: ManiSkill expects a PyTorch tensor for actions on GPU
action_batch = torch.from_numpy(env.action_space.sample())

# Step all 2048 environments instantly
obs, reward, terminated, truncated, info = env.step(action_batch)

print(f"Observation shape: {obs.shape}") 
# Output: torch.Size([2048, 42])</code></pre><p><em>If you check your performance logs, you&#8217;ll likely see this running at over <strong>20,000 Frames Per Second (FPS)</strong> on a standard GPU (like a T4 or RTX 3060). This speed is the &#8220;unfair advantage&#8221; of modern robot learning.</em></p><h4>Step 4: Training an Agent with PPO</h4><p>Flailing randomly is fun, but let&#8217;s actually teach the robot something.</p><p>ManiSkill comes with pre-baked training scripts for <strong>Proximal Policy Optimization (PPO)</strong>, a popular reinforcement learning algorithm. We can use these to solve the <code>PushCube-v1</code> task in just a few minutes.</p><p><strong>1. Get the training script:</strong> Download the high-performance PPO implementation provided by the ManiSkill team:</p><pre><code>wget https://raw.githubusercontent.com/haosulab/ManiSkill/main/examples/baselines/ppo/ppo.py</code></pre><p><strong>2. Start Training:</strong> Run the following command in your terminal. This will spin up 1,024 parallel environments and train for 600,000 steps.</p><pre><code>python ppo.py --env_id="PushCube-v1" \
  --num_envs=1024 \
  --update_epochs=8 \
  --num_minibatches=32 \
  --total_timesteps=600_000</code></pre><p><strong>What&#8217;s happening here?</strong></p><ul><li><p><strong>num_envs=1024:</strong> We are gathering experience from 1,024 &#8220;timelines&#8221; simultaneously.</p></li><li><p><strong>total_timesteps=600_000:</strong> The agent will practice 600k interactions. Because of parallelization, this might finish in <strong>less than 2 minutes</strong>.</p></li></ul><p>Once finished, the script will save a model checkpoint and often generate a video showing the robot successfully pushing the cube to its target.</p><h4>Step 5: Learning from Experts (Imitation Learning)</h4><p>Maybe you don&#8217;t want the robot to learn by trial and error. Maybe you want to <em>show</em> it what to do. This is called <strong>Imitation Learning</strong>, and ManiSkill has a massive dataset of expert demonstrations ready to download.</p><p><strong>Download the data:</strong></p><pre><code># Downloads expert demos for the Peg Insertion task
python -m mani_skill.utils.download_demo "PegInsertionSide-v1" -o demos</code></pre><p><strong>Watch the expert:</strong> You can replay these demonstrations to visualize &#8220;perfect&#8221; behavior:</p><pre><code>python -m mani_skill.trajectory.replay_trajectory \
  --traj-path demos/PegInsertionSide-v1/motionplanning/trajectory.h5 \
  --save-video --allow-failure</code></pre><p>This generates a video file (usually in the <code>videos</code> folder) where you can see exactly how the motion planner solves the puzzle.</p><p><strong>This shows the following:</strong></p><div class="pullquote"><p>ManiSkill lowers the barrier to entry for robotics research significantly. You no longer need a supercomputer to test advanced RL algorithms; you just need a laptop and a few lines of Python.</p></div><h2>Training a Robot using ACT Policy in Simulation</h2><p>If you&#8217;ve been following AI robotics lately, you&#8217;ve likely seen the <strong>Aloha</strong> robot - those bimanual arms cooking shrimp or folding clothes. The &#8220;brain&#8221; behind that robot isn&#8217;t magic; it&#8217;s an architecture called <strong>ACT (Action Chunking with Transformers)</strong>.</p><p>But here is the problem: Physical robots are expensive. They break. They are hard to reset.</p><p>The solution? <strong>Simulation.</strong></p><p>Today, I&#8217;m going to walk you through how to train a robot arm to perform a manipulation task (picking up a cube) from scratch, entirely in simulation, using a single GPU (like on RunPod). We will be using <strong>ManiSkill</strong>, a lightning-fast simulator, and the official ACT implementation.</p><h2>The Tech Stack</h2><p>We are going to use a pipeline that mimics a real-world workflow:</p><ol><li><p><strong>The Simulator:</strong> ManiSkill (uses GPU physics to run fast).</p></li><li><p><strong>The Brain:</strong> ACT (Imitation Learning that predicts &#8220;chunks&#8221; of future actions).</p></li><li><p><strong>The Task:</strong> <code>PickCube-v1</code> (The &#8220;Hello World&#8221; of robotics).</p></li></ol><div><hr></div><h2>Step 1: The Environment Setup</h2><p>Robotics simulation is notorious for &#8220;dependency hell&#8221;&#8212;specifically getting Vulkan drivers (for rendering images) to play nice with headless cloud GPUs.</p><p>If you are running this on a cloud provider like RunPod (recommended: RTX 3090 or 4090), you need to install system-level drivers before Python libraries.</p><p>I&#8217;ve condensed the setup into a script that handles the heavy lifting. It installs Vulkan, sets up the NVIDIA ICD files, and installs the specific versions of <code>torch</code> and <code>mani_skill</code> required.</p><p><strong>What&#8217;s happening under the hood?</strong> Normally, simulators run on a CPU. ManiSkill runs physics on the GPU. This allows us to collect data and train massively faster than real time.</p><div><hr></div><h2>Step 2: Getting &#8220;Expert&#8221; Data</h2><p>ACT is a form of <strong>Imitation Learning</strong>. This means we don&#8217;t punish or reward the robot (like in Reinforcement Learning); instead, we show it examples of a human (or a script) doing the job perfectly, and say, <em>&#8220;Do it like this.&#8221;</em></p><p>In the real world, you would control the robot via teleoperation to collect data. In ManiSkill, we can download pre-recorded &#8220;perfect&#8221; trajectories.</p><pre><code># This downloads the expert motion planning data
python -m mani_skill.utils.download_demo "PickCube-v1"</code></pre><h3>The &#8220;Vision&#8221; Problem</h3><p>The downloaded demos are usually stored as <strong>State</strong> data (exact XYZ coordinates of the cube). But we want our robot to see with cameras, just like a real robot would.</p><p>We use a process called <strong>Trajectory Replay</strong>. We take the coordinate data, replay it inside the simulator, and render the camera views (RGB + Depth) frame-by-frame. This creates a new dataset containing the video feed the robot <em>would have seen</em> if it were doing the task.</p><p>In the pipeline script, this command handles the conversion:</p><pre><code>python -m mani_skill.trajectory.replay_trajectory \
    --traj-path ~/.maniskill/demos/PickCube-v1/motionplanning/trajectory.h5 \
    --use-env-states \
    -o rgbd \
    --save-video</code></pre><p><em>Note: We use </em><code>--use-env-states</code><em> to ensure the replay is physically accurate to the original demo.</em></p><h2>Step 3: Action Chunking with Transformers (ACT)</h2><p>Now for the magic. Why is ACT better than standard behavioral cloning?</p><p>Standard policies look at an image and predict <strong>one</strong> step: <em>&#8220;Move left 1mm.&#8221;</em> ACT looks at an image and predicts a <strong>chunk</strong> of steps: <em>&#8220;Move left, then down, then close gripper.&#8221;</em></p><p>This &#8220;chunking&#8221; makes the robot&#8217;s motion smoother and less jittery. It uses a <strong>VAE (Variational Autoencoder)</strong> to compress the style of movement and a <strong>Transformer</strong> to predict the sequence.</p><h3>The Training Loop</h3><p>We utilize a unified training script (<code>train_act.sh</code>) that automates the process. For the <code>PickCube-v1</code> task, we don&#8217;t need a massive compute cluster.</p><p><strong>Key Hyperparameters:</strong></p><ul><li><p><strong>Demos:</strong> 100 trajectories is usually enough for this simple task.</p></li><li><p><strong>Iterations:</strong> 30,000 gradient steps (about 15-20 minutes on an RTX 4090).</p></li><li><p><strong>Episode Length:</strong> 125 steps (if it takes longer, the robot has likely failed).</p></li></ul><p>The script launches the training:</p><pre><code>python train_rgbd.py \
    --env-id PickCube-v1 \
    --demo-path demos/PickCube-v1/rgbd_trajectory.h5 \
    --control-mode pd_joint_delta_pos \
    --total_iters 30000</code></pre><h2>Step 4: Seeing the Results</h2><p>Once training is done, looking at a loss curve isn&#8217;t enough. In robotics, you need to watch the video.</p><p>The pipeline automatically runs an <strong>Inference</strong> step. It loads the saved model weights (<code>best_eval_success_once.pt</code>) and runs the robot in a fresh environment it hasn&#8217;t seen before.</p><p><strong>What to look for:</strong></p><ol><li><p><strong>Smoothness:</strong> Does the arm jitter, or does it swoop down confidently? (ACT is known for the swoop).</p></li><li><p><strong>Recovery:</strong> If the robot misses the grasp slightly, does it adjust?</p></li><li><p><strong>Success Rate:</strong> For picking up a cube, a well-trained ACT policy should hit nearly 100% success.</p></li></ol><p>Here are some of the results we got after training!</p><p><strong>Video 1:</strong></p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;dbfed687-ebae-487a-936f-0f76a03861b3&quot;,&quot;duration&quot;:null}"></div><p><strong>Video 2:</strong></p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;dbfed687-ebae-487a-936f-0f76a03861b3&quot;,&quot;duration&quot;:null}"></div><p><strong>Video 3:</strong></p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;ffffc3e6-b1da-4fb4-9588-5dab4200b993&quot;,&quot;duration&quot;:null}"></div><p><strong>Video 4:</strong></p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;f9edb559-59fe-4565-89bb-9a89e66cfff1&quot;,&quot;duration&quot;:null}"></div><p></p><p><strong>Video 5:</strong></p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;6c40f031-fe17-4a48-88fc-fc6645963c58&quot;,&quot;duration&quot;:null}"></div><p>The robot is learning the pick and place successfully!</p><p>Look at the evaluation curves! They look promising :)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mnxK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mnxK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 424w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 848w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 1272w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mnxK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png" width="1456" height="903" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:903,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:241609,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/187054496?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mnxK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 424w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 848w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 1272w, https://substackcdn.com/image/fetch/$s_!mnxK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39e8e54a-c5a2-43dd-904a-b4b26f583a94_2398x1488.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can follow the Github repo here to replicate these results: https://github.com/VizuaraAILabs/ACT-Maniskill</p><p>We used Runpod for training the policy. We used the RTX-4090 GPU.</p><p><em>Just clone the repo and run the following commands:</em></p><p>(1) bash setup_maniskill.sh<br>(2) bash train_act.sh</p><p>That&#8217;s it!</p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: <a href="iframe.php?url=https%3A%2F%2Frobotlearningbootcamp.vizuara.ai%2F">https://robotlearningbootcamp.vizuara.ai/</a></p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[DeepSeek OCR : Contexts Optical Compression]]></title><description><![CDATA[DeepSeekOCR is an attempt to bridge the gap between semantics & context through tokenization-free architecture by applying the techniques from ViT based modules onto document understanding and OCR.]]></description><link>https://vizuara.substack.com/p/deepseek-ocr-contexts-optical-compression</link><guid isPermaLink="false">https://vizuara.substack.com/p/deepseek-ocr-contexts-optical-compression</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 02 Feb 2026 03:30:35 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217BER%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A71-introduction">Introduction</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A72-how-ocr-is-typically-done">How OCR is Typically Done</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A721-the-fragmented-pipeline">The Fragmented Pipeline</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A722-the-diminishing-quality-of-representation">The Diminishing Quality of Representation</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A73-compression-as-geometric-discovery-leading-to-intelligence">Compression as Geometric Discovery leading to Intelligence</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A74-quantifying-compression-through-matrix-decomposition">Quantifying Compression through Matrix Decomposition</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A75-the-inductive-biasness-with-representation">The Inductive biasness with representation</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A76-the-ideal-case">The Ideal Case</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A77-methodology-the-architecture-of-optical-context-compression">Methodology: The Architecture of Optical Context Compression</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A773-data-engine-training-on-a-30m-page-multimodal-corpus">Data Engine: Training on a 30M-Page Multimodal Corpus</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A774-dynamic-resolution-and-gundam-mode">Dynamic Resolution &amp; Gundam Mode</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A775-model-architecture">Model Architecture</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A776-the-two-step-training-pipeline">The Two step Training Pipeline</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A777-inference">Inference</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A78-results-and-outcomes-the-efficiency-frontier">Results and Outcomes</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7thoughts">Thoughts</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2F50e70fc2-d929-497c-9f1d-ac8e8978e79b%3Fupdated%3D2026-01-31T09%253A53%253A24.282Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7conclusion">Conclusion</a></em></p></li></ol><div><hr></div><h1>1. Introduction</h1><p>In the modern intelligence stack, Information Retrieval (IR) and document parsing have evolved from being mere administrative utilities to becoming the absolute bottleneck of the reasoning paradigm. We live in a world governed by dense PDFs, complex financial schematics, and nested mathematical structures; the ability of a system to &#8220;ingest&#8221; this data is no longer just a feature; it is the primary constraint on its intelligence. At its most abstract level, Optical Character Recognition (OCR) is simply an Image-to-Text (I2T) task, a bridge meant to translate raw pixel-level signals into semantic strings.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217BER%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7BER!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 424w, https://substackcdn.com/image/fetch/$s_!7BER!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 848w, https://substackcdn.com/image/fetch/$s_!7BER!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 1272w, https://substackcdn.com/image/fetch/$s_!7BER!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217BER%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png" width="427" height="386.3333333333333" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:475,&quot;width&quot;:525,&quot;resizeWidth&quot;:427,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7BER!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 424w, https://substackcdn.com/image/fetch/$s_!7BER!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 848w, https://substackcdn.com/image/fetch/$s_!7BER!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 1272w, https://substackcdn.com/image/fetch/$s_!7BER!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe33ac349-948c-4de5-ae17-4d48ec73b30f_525x475.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>However, for a decade, that bridge has been brittle. Traditional approaches have treated OCR as a literalist exercise which is to have a &#8220;find-and-replace&#8221; function for the visual world. DeepSeek-OCR shatters this convention. It is not just another incremental I2T model optimized for higher accuracy; it represents a fundamental shift in the representational aspect and modeling choice of the data itself.</p><p>By moving away from the &#8220;literal string&#8221; and toward the concept of Contextual Optical Compression, DeepSeek-OCR treats the visual document as a dense, high-entropy signal that can be modeled and compressed directly into latent intelligence. It moves us beyond the era of &#8220;reading&#8221; pixels and into the era of modeling visual context, proving that the way we represent document data is just as important as the model that processes it.</p><h3><strong>The Representational Shift: Moving Beyond the String</strong></h3><p>Imagine for a moment that we stop treating text as the primary query to an LLM. Instead of feeding a model a sequence of discrete, one-dimensional text tokens, we use a <strong>visual-first head</strong>. Instead of a string of 1,000 words, we feed the model a single image containing those words.</p><p>In this paradigm, we discard the traditional tokenizer entirely and instead apply a <strong>Visual Markovian Blanket</strong> which is a spatial inductive bias that assumes a pixel&#8217;s meaning is derived from its neighborhood (a dependency already elegantly managed by modern attention mechanisms; (remember Swin transformers/ViTs).</p><p>The economic and computational implications are staggering:</p><ul><li><p><strong>The Token Tax is Abolished:</strong> You no longer pay for each individual word. A single image containing 100 or N words can be structurally broken into just <strong>16 or K visual patches</strong> (where K &lt; &lt; N).</p></li><li><p><strong>Efficiency by Order of Magnitude:</strong> Where a standard tokenizer would demand 130 &#8220;word-tokens&#8221; to represent a paragraph, the visual-first approach represents the same semantic density in a fraction of the &#8220;patch-tokens.&#8221;</p></li></ul><p>This is the shift <strong><a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2510.18234">DeepSeek-OCR</a></strong> targets. It is far more than a tool for Optical character recognition; it is a fundamental challenge to our representational assumptions. It proves that by treating the visual modality as the primary compression primitive, we can bypass the &#8220;Tokenization Bottleneck&#8221; and move toward a more dense, efficient form of machine intelligence.</p><div><hr></div><h1>2. How OCR is Typically Done</h1><p>To understand why a shift is necessary and solvable, we must first look at the traditional anatomy of document intelligence. At its most fundamental level, OCR is an <strong>Image-to-Text (I2T)</strong> translation problem. It is the process of taking an unstructured, high-dimensional grid of pixels and mapping it onto a structured, one-dimensional sequence of characters. However, in the legacy paradigm, this translation is rarely a direct flight; it is a series of layovers.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!793W!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 424w, https://substackcdn.com/image/fetch/$s_!793W!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 848w, https://substackcdn.com/image/fetch/$s_!793W!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!793W!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21793W%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg" width="458" height="257.625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:180,&quot;width&quot;:320,&quot;resizeWidth&quot;:458,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Convolutional Network Demo from 1989 - YouTube&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Convolutional Network Demo from 1989 - YouTube" title="Convolutional Network Demo from 1989 - YouTube" srcset="https://substackcdn.com/image/fetch/$s_!793W!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 424w, https://substackcdn.com/image/fetch/$s_!793W!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 848w, https://substackcdn.com/image/fetch/$s_!793W!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!793W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb717e9a3-41d7-4c15-9f87-98b5b61125aa_320x180.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFwFduRA_L6Q">Convolutional Network Demo from 1989</a> (Yann Lecun)</figcaption></figure></div><h3>2.1 The Fragmented Pipeline</h3><p>The industry-standard framework has historically relied on a &#8220;Divide and Conquer&#8221; strategy, typically consisting of three decoupled stages:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R9vs%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!R9vs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 424w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 848w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 1272w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R9vs%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png" width="1456" height="764" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:764,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!R9vs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 424w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 848w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 1272w, https://substackcdn.com/image/fetch/$s_!R9vs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841595bb-6f9a-4530-af3f-6c8efe4c14a3_1876x984.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>Extraction:</strong> The &#8220;dumb&#8221; phase. Using object detection (to find text boxes) and primitive recognition, the system simply fetches raw text strings from the image.</p></li><li><p><strong>Understanding:</strong> The &#8220;contextual&#8221; phase. Once the text is a string, a secondary model (often an NLP-based one) tries to infer the relationship between those strings.</p></li><li><p><strong>Parsing:</strong> The &#8220;structural&#8221; phase. The system attempts to reconstruct the data into a usable format, like a JSON table or a Markdown list.</p></li></ol><p>In this world, we rely on a fractured ecosystem of libraries and methods. We see tools like <strong>Tesseract</strong> for raw engine work, <strong>EasyOCR</strong> or <strong>PaddleOCR</strong> for deep-learning-based detection, and specialized layouts like <strong>LayoutLM</strong> for attempting to stitch the meaning back together.</p><h3>2.2 The Diminishing Quality of Representation</h3><p>The fatal flaw of this decoupled approach is the <strong>Representational Bottleneck</strong>. Because <strong>Extraction</strong> is treated merely as a task of &#8220;fetching text,&#8221; the structural and spatial metadata of the document are often discarded the moment the pixels are converted to strings.</p><p>As information moves down these modules, we see a <strong>diminishing quality of data</strong>. If the extraction phase misidentifies a column boundary in a financial table, the &#8220;Understanding&#8221; module receives a jumbled string of numbers with no spatial context. No amount of downstream intelligence can fix a corrupted upstream representation. The extraction phase becomes a &#8220;leaky bucket,&#8221; where the semantic richness of the original visual layout is drained away long before it reaches the final parsing stage.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!niED!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 424w, https://substackcdn.com/image/fetch/$s_!niED!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 848w, https://substackcdn.com/image/fetch/$s_!niED!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 1272w, https://substackcdn.com/image/fetch/$s_!niED!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21niED%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png" width="643" height="212.41964285714286" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:481,&quot;width&quot;:1456,&quot;resizeWidth&quot;:643,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!niED!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 424w, https://substackcdn.com/image/fetch/$s_!niED!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 848w, https://substackcdn.com/image/fetch/$s_!niED!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 1272w, https://substackcdn.com/image/fetch/$s_!niED!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F567c8713-2059-4cc4-aa0e-e6305e66f960_1780x588.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>By the time we get to structural understanding, we aren&#8217;t working with the original document anymore; we are working with a low-fidelity, &#8220;noisy&#8221; ghost of it.</p><div><hr></div><h1>3. Compression as Geometric Discovery leading to Intelligence</h1><p>To understand why DeepSeek-OCR treats document parsing as an exercise in <strong>Optical Compression</strong>, we must move beyond the idea of &#8220;shrinking files&#8221; and enter the realm where intelligence meets <strong>Group Theory</strong>. In the framework of modern AI, intelligence isn&#8217;t just about storing data; it is the process of discovering and utilizing the <strong>symmetries of space</strong>.</p><h3>3.1 Intelligence as the Exploitation of Symmetry</h3><p>A document is not a random collection of pixels. It is a highly structured manifold governed by geometric and semantic &#8220;rules&#8221; lines of text follow translation symmetries, tables exhibit grid-based permutations, and headers maintain scale-invariant hierarchies.</p><p>From the perspective of <strong>Group Theory</strong>, these patterns are elements of a symmetry group <code>G</code> acting on the document space <code>X</code>. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DL3F%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DL3F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 424w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 848w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21DL3F%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png" width="369" height="439.36744186046514" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:860,&quot;resizeWidth&quot;:369,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;GROUP THEORY - SOUL OF MATHEMATICS&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="GROUP THEORY - SOUL OF MATHEMATICS" title="GROUP THEORY - SOUL OF MATHEMATICS" srcset="https://substackcdn.com/image/fetch/$s_!DL3F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 424w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 848w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!DL3F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf869c10-5f90-4eb4-b6b8-244346bd18a5_860x1024.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fsoulofmathematics.com%2Findex.php%2Fgroup-theory%2F">https://soulofmathematics.com/index.php/group-theory/</a></figcaption></figure></div><p>An &#8220;intelligent&#8221; model is one that learns the <strong>invariants</strong> of these transformations. It realizes that a &#8220;Paragraph&#8221; remains a &#8220;Paragraph&#8221; whether it is shifted, scaled, or slightly rotated. By &#8220;solving&#8221; for these symmetries, the model effectively compresses the problem domain: instead of learning every possible pixel arrangement, it learns the <strong>fundamental group of document structures</strong>.</p><h3>3.2 The ELBO and the Geometric Squeeze</h3><p>This discovery of symmetry is mathematically enforced by a constraint optimization setup; which in my opinion could be easily represented during training by something like <strong>Evidence Lower Bound (ELBO) in VAE</strong>. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fPjx%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F716b1da0-baac-4105-879e-4265c9766d83_958x702.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fPjx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 424w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 848w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 1272w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fPjx%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F716b1da0-baac-4105-879e-4265c9766d83_958x702.png" width="958" height="702" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/716b1da0-baac-4105-879e-4265c9766d83_958x702.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:702,&quot;width&quot;:958,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Variational AutoEncoders (VAE) with PyTorch - Alexander Van de Kleut&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Variational AutoEncoders (VAE) with PyTorch - Alexander Van de Kleut" title="Variational AutoEncoders (VAE) with PyTorch - Alexander Van de Kleut" srcset="https://substackcdn.com/image/fetch/$s_!fPjx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 424w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 848w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 1272w, https://substackcdn.com/image/fetch/$s_!fPjx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F716b1da0-baac-4105-879e-4265c9766d83_958x702.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Favandekleut.github.io%2Fvae%2F">https://avandekleut.github.io/vae/</a></figcaption></figure></div><p>We force the high-dimensional document signal x through a latent bottleneck z, where the model must find a representation that is both compact and reconstructible (be mindful; this isn&#8217;t the exact setup; this is just for mental model for connecting ideas of compression and retrieval):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}(\\theta, \\phi; x) = \\underbrace{\\mathbb{E}_{q_\\phi(z|x)}[\\log p_\\theta(x|z)]}_{\\text{Information Retrieval}} - \\underbrace{D_{KL}(q_\\phi(z|x) || p(z))}_{\\text{Symmetry Discovery}}&quot;,&quot;id&quot;:&quot;DLLGCLCAPK&quot;}" data-component-name="LatexBlockToDOM"></div><p>The <strong>KL Divergence</strong> term acts as a geometric pressure. It forces the model to map diverse document inputs into an <strong>overlapping latent distribution</strong>. This overlap is where intelligence is born: for two different images of a table to occupy the same region in latent space, the model <em>must</em> have successfully discarded the superficial &#8220;noise&#8221; of pixels and extracted the underlying <strong>symmetry of the table structure</strong>.</p><h3>3.3 The Optimal Overlap: A Semantic Manifold</h3><p>If the model fails to compress (low KL pressure), it merely &#8220;memorizes&#8221; the pixels, resulting in a sparse, disjointed latent space with no understanding. But by forcing the distributions to overlap just enough, the model is compelled to explore the <strong>topology of the data</strong>.</p><p>It begins to understand that the &#8220;transformation&#8221; from a raw image to a structured Markdown table is a path along a <strong>semantic manifold</strong>. In DeepSeek-OCR, this means the vision tokens aren&#8217;t just smaller versions of the image; they are dense, geometric &#8220;keys&#8221; that unlock the underlying logic of the page. Intelligence, therefore, is the ability to navigate this compressed space where symmetry has turned chaotic pixels into a coherent, navigable map of information.</p><div><hr></div><h1>4. Quantifying Compression through Matrix Decomposition</h1><p>To measure the &#8220;work&#8221; of DeepSeek-OCR, we need to move from the abstract &#8220;bottleneck&#8221; of the previous section into the hard mathematics of <strong>Information Theory</strong>. If Section 2 identified the fractured pipeline of traditional OCR, Section 4 provides the mathematical tools to evaluate how a unified architecture handles the signal-to-noise ratio.</p><h3>4.1 Decomposing Document Intelligence: SVD vs. Auto-encoders</h3><p>The most intuitive way to visualize document compression is through <strong>Singular Value Decomposition (SVD)</strong>. Any document image, represented as a matrix A, can be decomposed into:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A = U \\Sigma V^T&quot;,&quot;id&quot;:&quot;XFCGEQVJAR&quot;}" data-component-name="LatexBlockToDOM"></div><p>In our specific context of document intelligence, these matrices are not just numbers as they represent the functional stages of the OCR process we discussed in Section 2:</p><ul><li><p><strong>U (The Encoder/Extraction):</strong> These are the left singular vectors. They represent the basis of the &#8220;Visual Language.&#8221; This is the map/function that extracts high-frequency features (edges, glyphs) and compresses them into a latent coordinate system.</p></li><li><p><strong>Sigma (The Understanding):</strong> The diagonal matrix of singular values. This represents the <strong>semantic weight</strong> or the &#8220;relevance&#8221; of each feature. A high singular value corresponds to a structural truth (like a paragraph boundary); a low value is negligible noise. It acts as the &#8220;Understanding&#8221; bridge, deciding which parts of the visual signal are essential for the reconstruction of the document&#8217;s logic.</p></li><li><p><strong>V^T (The Decoder/Parsing):</strong> These are the right singular vectors. They define the &#8220;Output Space&#8221; which in our case is the structured text or Markdown. They take the compressed energy of U and Sigma and reconstruct it into a readable, parsed format.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yr_a%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yr_a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 424w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 848w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 1272w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yr_a%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png" width="1456" height="411" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:411,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Singular Value Decomposition (SVD), Demystified | Towards Data Science&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Singular Value Decomposition (SVD), Demystified | Towards Data Science" title="Singular Value Decomposition (SVD), Demystified | Towards Data Science" srcset="https://substackcdn.com/image/fetch/$s_!yr_a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 424w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 848w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 1272w, https://substackcdn.com/image/fetch/$s_!yr_a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbdca46e-6330-420b-95f3-33e96a27a259_2064x582.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Ftowardsdatascience.com%2Fsingular-value-decomposition-svd-demystified-57fc44b802a0%2F">https://towardsdatascience.com/singular-value-decomposition-svd-demystified-57fc44b802a0/</a></figcaption></figure></div><p>While SVD is linear, an <strong>Auto-encoder</strong> (like the one in DeepSeek-OCR) is the non-linear generalization of this process. It learns to perform this &#8220;Decomposition&#8221; using neural weights, seeking to represent 1,000 words of text not through 1,300 text tokens, but through a handful of <strong>Dense Vision Tokens</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JjpQ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JjpQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 424w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 848w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 1272w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JjpQ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png" width="1456" height="903" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:903,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!JjpQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 424w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 848w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 1272w, https://substackcdn.com/image/fetch/$s_!JjpQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4dfc0277-2300-453a-ab31-1bf0f7bfad3d_1696x1052.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Instead of 105 tokens for representing text, we only need 15 visual tokens here (Cell count in the grid)</figcaption></figure></div><p><em>This is also one of the reason why Generative models flourish because they are dual-purpose machines: they are Compressors (mapping data to latents) and Samplers (generating data from latents). In the case of images, we derive Latents (as in VAEs) which occupy a much lower dimensionality than the pixel space and is able to learn and use the shared feature space.</em></p><h3>4.2 Entropy and the Retrieval Tax</h3><p>The efficiency of this compression is measured by the gap between the <strong>True Information Density (P)</strong> and the <strong>Model&#8217;s Distribution (Q)</strong>.</p><ul><li><p><strong>Entropy H(P):</strong> The absolute minimum number of bits needed to represent the document.</p></li><li><p><strong>Cross-Entropy H(P, Q):</strong> The number of bits our model actually uses.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H(P, Q) = -\\sum_{x} P(x) \\log Q(x)&quot;,&quot;id&quot;:&quot;PIPEHHATRP&quot;}" data-component-name="LatexBlockToDOM"></div><p>The goal of a good model is to minimize the <strong>Kullback-Leibler (KL) Divergence</strong> (H(P,Q) - H(P)), which we can think of as the <strong>Retrieval Tax</strong>. If the model is poorly designed, it pays a high tax using thousands of tokens to represent simple text. DeepSeek-OCR lowers this tax by ensuring its vision tokens are &#8220;Entropy-Dense.&#8221;</p></li></ul><div><hr></div><h1>5. The Inductive biasness with representation</h1><p>If intelligence is the discovery of symmetry, and compression is the metric of that discovery, we must eventually ask: <strong>What stops us from reaching the absolute Shannon Limit?</strong> The answer lies in <strong>Inductive Bias</strong>; it is the set of introduced assumptions that a model takes to predict the unknown. While these biases allow models to learn from limited data, they also act as a mathematical &#8220;floor&#8221; that restricts how far we can compress a representation.</p><h3>5.1 The Weight of Representation</h3><p>Representation is the &#8220;alphabet&#8221; of the model&#8217;s universe. If your representation is inefficient, the model is forced to expend its cognitive energy just to manage the data, rather than reasoning about it. In document parsing, a poor representation doesn&#8217;t just take up more memory; it actively obscures the <strong>structural symmetries</strong> we discussed in Section 3.</p><h3>5.2 The Markovian Blanket and the Image Constraint</h3><p>In the visual domain, our primary inductive bias is the <strong>Markovian Blanket</strong> (or spatial locality). We assume that a pixel&#8217;s meaning is primarily defined by its immediate neighbors.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AN0D%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AN0D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 424w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 848w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 1272w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AN0D%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png" width="307" height="350.6515625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/db95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1462,&quot;width&quot;:1280,&quot;resizeWidth&quot;:307,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Markov blanket - Wikipedia&quot;,&quot;title&quot;:&quot;Markov blanket - Wikipedia&quot;,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Markov blanket - Wikipedia" title="Markov blanket - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!AN0D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 424w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 848w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 1272w, https://substackcdn.com/image/fetch/$s_!AN0D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdb95938f-b457-49fd-b900-a6f21c2cdf16_1280x1462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In Convolutional Neural Networks (CNNs) or standard ViTs, this bias is &#8220;hardcoded.&#8221; The model assumes that &#8220;context&#8221; is something that scales spatially. While this is great for detecting a character, it is a bottleneck for <strong>Optical Compression</strong>. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mi_6%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mi_6!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 424w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 848w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 1272w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mi_6%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_lossy%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif" width="526" height="384" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:384,&quot;width&quot;:526,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Convolution | NVIDIA Developer&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Convolution | NVIDIA Developer" title="Convolution | NVIDIA Developer" srcset="https://substackcdn.com/image/fetch/$s_!mi_6!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 424w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 848w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 1272w, https://substackcdn.com/image/fetch/$s_!mi_6!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ba58836-ff30-4647-9e21-893581d0e247_526x384.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fdeveloper.nvidia.com%2Fdiscover%2Fconvolution">https://developer.nvidia.com/discover/convolution</a></figcaption></figure></div><p>If the model is forced to treat every (16x16) patch as a semi-independent unit, it cannot easily &#8220;collapse&#8221; a whole page of repetitive text into a single latent vector. The Markovian assumption forces the representation to remain &#8220;wide&#8221; even when the information is semantically &#8220;thin.&#8221;</p><h3>5.3 The Tokenization Bottleneck</h3><p>The most restrictive bias, however, is <strong>Text Tokenization</strong>. We have been conditioned to believe that the &#8220;Token&#8221; (Byte-Pair Encoding or WordPiece) is the fundamental unit of meaning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xOgL%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xOgL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 424w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 848w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 1272w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xOgL%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png" width="625" height="349" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:349,&quot;width&quot;:625,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77980,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xOgL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 424w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 848w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 1272w, https://substackcdn.com/image/fetch/$s_!xOgL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82db843b-fec2-49c3-abda-6cca2c1757f5_625x349.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is a fallacy of representation. Tokenization is a discrete, human-engineered inductive bias that assumes the &#8220;string&#8221; is the optimal way to store context. But tokens are actually quite high-level; there is significant semantic redundancy <em>within</em> and <em>between</em> tokens.</p><ul><li><p><strong>The Reality:</strong> You can actually compress information <strong>below the token level</strong>.</p></li><li><p><strong>The Vision Advantage:</strong> Images do not have a fixed &#8220;vocabulary&#8221; in the way text does. By bypassing text tokenization and mapping pixels directly to a latent &#8220;Contextual Vision Token,&#8221; DeepSeek-OCR can achieve a higher density of information than a string ever could.</p></li></ul><p>Let&#8217;s compare the theoretical lower bounds of compressing a simple repeated phrase: <em>&#8220;The quick brown fox jumps over the lazy dog.&#8221;</em> (Approx. 44 characters). <strong>Text Tokenization Representation</strong></p><ul><li><p>Using a standard tokenizer (like Llama-3), this sentence is roughly <strong>10 tokens</strong>.</p></li><li><p>If each token is a 4096-dimensional vector (FP16), the &#8220;cost&#8221; of representing this sentence is fixed by the token count. You cannot represent 10 tokens with 5 tokens without losing the discrete identity of the words.</p></li><li><p><strong>Lower Bound:</strong> 10 Vectors.</p></li></ul><p>This means under any circumstance; the information cannot be further compressed with chance of 100% retrieval/re-extraction. Obviously we can apply weighted averaging/pooling; but all of that will be lossy compression by nature.</p><div><hr></div><h1>6. The Ideal Case</h1><p>If we accept that tokenization is an artificial ceiling, we must look toward a &#8220;cleaner&#8221; way of teaching models to ingest the world. This brings us to the <strong>Visual Learning Paradigm</strong>; which is the idea that the most efficient way to understand complex systems isn&#8217;t through the granular reconstruction of strings, but through the holistic absorption of visual information.</p><h3>6.1 Learning Without the &#8220;String&#8221;</h3><p>Human cognition doesn&#8217;t operate by tokenizing reality. When you look at a dense deck of cards, a complex architectural blueprint, or a random string of numbers, your brain doesn&#8217;t necessarily convert them into a 1D sequence of characters to &#8220;store&#8221; them. Instead, you utilize <strong>spatial memory</strong> and <strong>visual grouping</strong>.</p><p>In the world of LLMs, we are seeing a shift toward this &#8220;token-free&#8221; or &#8220;visual-first&#8221; future. My previous explorations into <strong><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fbyte-latent-transformers-patches%3Fr%3Dnc23e">BLT (Byte Latent Transformers)</a></strong> and <strong><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Flarge-concept-models-language-modeling%3Fr%3Dnc23e">LCMs (Large concept Models)</a></strong> touched on this. </p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;a46c0b85-b462-4f4c-91c4-e89307b369d8&quot;,&quot;caption&quot;:&quot;Recently Meta released an intriguing architecture for combining byte level tokenization and transformers at scale, which inherently not only is a better modelling choice but also opens up a multitude of potential direction for research. Let's dive into the proposed idea, but before that, let's warm up with some why? questions.&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;showDescription&quot;:true,&quot;showImage&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Byte Latent Transformers : Patches Scale Better Than Tokens&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:39193754,&quot;name&quot;:&quot;Siddhant Rai&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da98159-88a8-4d06-953d-ed065a986e72_144x144.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null},{&quot;id&quot;:290241614,&quot;name&quot;:&quot;Vizuara AI&quot;,&quot;bio&quot;:&quot;Deep dive into AI. Deep content. No fluff. &quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-12-20T06:40:12.775Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4787f8e-660e-492e-8e86-ae8ad92b0439_1045x674.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://vizuara.substack.com/p/byte-latent-transformers-patches&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:153304556,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:7,&quot;comment_count&quot;:0,&quot;publication_id&quot;:3466476,&quot;publication_name&quot;:&quot;Vizuara&#8217;s Substack&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!D3Nd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1a48e78-8537-4335-aee7-95b52957e861_3456x3456.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>The realization that the discrete nature of text tokens is actually a barrier to semantic fluidity, by removing the text-tokenization layer we allow the model to learn directly from the <strong>continuity of the signal</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2175dP%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!75dP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 424w, https://substackcdn.com/image/fetch/$s_!75dP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 848w, https://substackcdn.com/image/fetch/$s_!75dP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 1272w, https://substackcdn.com/image/fetch/$s_!75dP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2175dP%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png" width="505" height="274.35096153846155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:791,&quot;width&quot;:1456,&quot;resizeWidth&quot;:505,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!75dP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 424w, https://substackcdn.com/image/fetch/$s_!75dP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 848w, https://substackcdn.com/image/fetch/$s_!75dP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 1272w, https://substackcdn.com/image/fetch/$s_!75dP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b6d0d79-e990-41bc-a9ba-f692a7f811b9_2040x1108.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>6.2 Visual Tokens as a Semantic Proxy</h3><p>In the &#8220;Ideal Case&#8221; of DeepSeek-OCR, the <strong>Visual Token (this we will discuss in next section)</strong> acts as a superior proxy for the <strong>Text Token</strong>. We can model this relationship through the lens of <strong>Cross-Entropy</strong> between two distributions:</p><ul><li><p><strong>P (The High-Dimensional Visual Distribution):</strong> The raw, continuous reality of the document.</p></li><li><p><strong>Q (The Discrete Text Distribution):</strong> The fragmented, tokenized approximation of that document.</p></li></ul><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!faKY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 424w, https://substackcdn.com/image/fetch/$s_!faKY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 848w, https://substackcdn.com/image/fetch/$s_!faKY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 1272w, https://substackcdn.com/image/fetch/$s_!faKY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21faKY%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png" width="406" height="212.4607190412783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:393,&quot;width&quot;:751,&quot;resizeWidth&quot;:406,&quot;bytes&quot;:193820,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!faKY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 424w, https://substackcdn.com/image/fetch/$s_!faKY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 848w, https://substackcdn.com/image/fetch/$s_!faKY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 1272w, https://substackcdn.com/image/fetch/$s_!faKY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e398614-28ce-4452-9769-a0b3c2d52af7_751x393.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Traditional OCR tries to force P into Q, losing the &#8220;connective tissue&#8221; of the layout in the process. DeepSeek-OCR, however, stays in the visual domain for as long as possible. It maps P to a set of <strong>Contextual Latents</strong> that are &#8220;Token-Agnostic.&#8221; This allows the model to preserve the <strong>Symmetries/redundancy and abstractions</strong> (translation, scale, grid) we discussed earlier, ensuring that the &#8220;Information Density&#8221; remains higher than what any BPE-based tokenizer could ever achieve.</p><p>By treating the visual modality as the primary representational primitive, we aren&#8217;t just doing &#8220;better OCR.&#8221; We are moving toward a <strong>Visual-Contextual Intelligence</strong> where the model learns the &#8220;concept&#8221; of the document before it ever worries about the &#8220;spelling&#8221; of the words. It is a transition from literal transcription to a deep, compressed understanding of the world&#8217;s visual data.</p><div><hr></div><h1>7. Methodology: The Architecture of Optical Context Compression</h1><h2>7.1 Visual Tokens as a Semantic Proxy</h2><p>In this architecture, the <strong>Visual Token</strong> is the primary currency. We can model this relationship through the <strong>Cross-Entropy (H)</strong> between the true visual-structural distribution of the document (P) and the model&#8217;s textual representation (Q):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H(P, Q) = -\\sum_{x} P(x) \\log Q(x)&quot;,&quot;id&quot;:&quot;EGFTKTUYBN&quot;}" data-component-name="LatexBlockToDOM"></div><p>In traditional OCR, Q is a rigid, discrete text-token distribution. This creates a &#8220;lookup table&#8221; bottleneck as text tokens are 1:1 mappings from a fixed vocabulary. DeepSeek-OCR, however, treats visual tokens as <strong>continuous vectors</strong> generated directly from pixels.</p><p>Unlike discrete text tokens, these visual latents exist in a continuous embedding space, allowing them to capture <strong>&#8220;inter-token&#8221; nuances</strong> like typography, spatial relationships, and layout density that are lost in a string representation. By minimizing the cross-entropy at the source, the model ensures that each visual token acts as a dense, high-capacity proxy for approximately <strong>7-10 text tokens</strong>, effectively bypassing the limitations of human-engineered tokenizers.</p><h2>7.2 The Logic of Contextual Optical Compression</h2><p>Why is &#8220;Optical Compression&#8221; the only logical step forward? In the current LLM landscape, we are hitting a <strong>Token Wall</strong>. If a document requires 10,000 text tokens to represent, that is 10,000 discrete steps of attention.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fjSq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fjSq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 424w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 848w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 1272w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fjSq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png" width="1280" height="411" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:411,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77255,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!fjSq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 424w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 848w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 1272w, https://substackcdn.com/image/fetch/$s_!fjSq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc43de36d-cd77-4ecb-a3d2-68d62104d0be_1280x411.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Forgetting mechanisms constitute one of the most fundamental characteristics of human memory. The contexts optical compression approach can simulate this mechanism by rendering previous rounds of historical text onto images for initial compression, then progressively resizing older images to achieve multi-level compression, where token counts gradually decrease and text becomes increasingly blurred, thereby accomplishing textual forgetting.</figcaption></figure></div><p>DeepSeek-OCR flips the script: instead of treating images as &#8220;extra&#8221; data that adds to the token count, it treats the <strong>Image as a Compression Primitive</strong>. The paper identifies that a document image is naturally redundant (white space, repetitive headers, standard font structures). By identifying these <strong>Symmetries</strong>, the model performs a &#8220;lossy but semantically perfect&#8221; compression. It is the visual equivalent of a <strong>ZIP file</strong> for context: it strips away the pixel-level noise while preserving the &#8220;structural essence&#8221; required for reconstruction. This allows for a massive reduction in the context window footprint, enabling 97% accuracy while using an order of magnitude less compute.</p><h2>7.3 Data Engine: Training on a 30M-Page Multimodal Corpus</h2><p>To ground the theoretical &#8220;Contextual Optical Compression&#8221; in reality, DeepSeek-OCR was forged in a massive, high-diversity data engine. The training corpus is designed to balance literal transcription with a deep understanding of structural and specialized visual languages.</p><p>The data mix is roughly structured as follows:</p><ul><li><p><strong>OCR 1.0 (30M Page PDF Backbone):</strong> The primary training data consists of 30 million diverse PDF pages collected from the internet. This set is truly global, spanning over <strong>100 languages</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21reMa%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!reMa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 424w, https://substackcdn.com/image/fetch/$s_!reMa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 848w, https://substackcdn.com/image/fetch/$s_!reMa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 1272w, https://substackcdn.com/image/fetch/$s_!reMa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21reMa%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png" width="1037" height="762" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:762,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:290532,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!reMa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 424w, https://substackcdn.com/image/fetch/$s_!reMa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 848w, https://substackcdn.com/image/fetch/$s_!reMa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 1272w, https://substackcdn.com/image/fetch/$s_!reMa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F16e52db7-cf50-4ebb-989a-b288ddae8cb3_1037x762.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Tiered Annotation:</strong> To teach the model both basic recognition and advanced layout understanding, DeepSeek used a &#8220;Coarse-to-Fine&#8221; strategy. 25 million pages received <strong>Coarse Annotations</strong> (basic text extraction via <em>fitz</em>), while 4 million high-priority pages (2M Chinese, 2M English) were processed with <strong>Fine Annotations</strong>. These fine labels use advanced layout models (like <em>PP-DocLayout</em>) and OCR engines (like <em>MinerU</em>) to construct a detection-and-recognition interleaved dataset, essentially teaching the model the &#8220;grammar&#8221; of the page.</p></li></ul></li><li><p><strong>OCR 2.0: The Specialized Visual Language:</strong> DeepSeek identified that standard OCR fails at non-linear text. To solve this, they included a massive synthetic dataset known as &#8220;OCR 2.0&#8221;:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HQtK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HQtK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 424w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 848w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 1272w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HQtK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png" width="1456" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:301655,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HQtK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 424w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 848w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 1272w, https://substackcdn.com/image/fetch/$s_!HQtK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ffaa26d-92f0-4b20-bce8-5cb9aca8c7f7_1714x678.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>10 Million Synthetic Charts:</strong> Rendered via <em>pyecharts and</em> <em>matplotlib</em> to teach the model to parse axes, legends, and data points.</p></li><li><p><strong>5 Million Chemical Formulas:</strong> Ensuring the model understands molecular bonds and sub/superscript notations.</p></li><li><p><strong>1 Million Geometric Figures:</strong> For parsing diagrams and blueprints.</p></li></ul></li><li><p><strong>General Vision &amp; Text Supplements:</strong> To prevent the model from becoming a &#8220;narrow&#8221; OCR specialist, the training includes 20% general vision data (10M images from <strong>LAION</strong> and <strong>Wukong</strong> with detection/grounding labels) and 10% text-only corpus. This ensures the 3B-MoE decoder retains strong linguistic reasoning and general scene-understanding capabilities.</p></li></ul><h2>7.4 Dynamic Resolution &amp; Gundam Mode</h2><p>The model&#8217;s handling of resolution is a direct implementation of the &#8220;Entropy-Matching&#8221; theory we discussed. Instead of a fixed grid, it uses a <strong>multi-scale sampling strategy</strong>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bXzI%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bXzI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 424w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 848w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 1272w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bXzI%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png" width="1057" height="416" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:416,&quot;width&quot;:1057,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:185110,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!bXzI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 424w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 848w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 1272w, https://substackcdn.com/image/fetch/$s_!bXzI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8304b70-c3eb-4ea8-9177-4387a852e587_1057x416.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Native Scaling (Tiny to Large):</strong> The model supports native inputs from <strong>512&#178; up to 1280&#178;</strong>. During inference, you choose a &#8220;flavor&#8221; based on document density. A simple receipt might only need 64 vision tokens (Tiny), while a dense academic paper utilizes 400 tokens (Large) to resolve tiny mathematical symbols.</p></li><li><p><strong>The Gundam Protocol (Tiling):</strong> For ultra-high-density documents that break the 1280px barrier, DeepSeek-OCR activates &#8220;Gundam Mode.&#8221; This utilizes a <strong>Dynamic Tiling</strong> strategy (similar to <em>InternVL</em>) where the image is split into multiple (640 x 640) local tiles combined with a single (1024 x 1024) global thumbnail. This &#8220;Gundam&#8221; assembly allows the model to zoom into local details without losing the global structural context, supporting effective context compression for even the most complex newspaper layouts.</p></li></ul><h2>7.5 Model Architecture</h2><p>The actual &#8220;engine&#8221; of DeepSeek-OCR is a unified, end-to-end Vision-Language Model (VLM) that collapses the traditional multi-stage pipeline into a single, high-efficiency path. This is achieved through two highly specialized towers and a critical mathematical bottleneck.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Lqe0%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Lqe0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 424w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 848w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 1272w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Lqe0%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png" width="1313" height="533" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:533,&quot;width&quot;:1313,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:180627,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Lqe0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 424w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 848w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 1272w, https://substackcdn.com/image/fetch/$s_!Lqe0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1664ecb8-36ba-43d4-93ef-4dd6d6c4cd58_1313x533.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>I. The DeepEncoder: Dual-Stream Perception (380M parameters)</strong></h4><p>The DeepEncoder is a hybrid vision backbone designed to solve the &#8220;Resolution Paradox&#8221; the need for high-resolution character recognition without the memory explosion typically associated with it. It uses two distinct transformers in series:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VKKp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VKKp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 424w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 848w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 1272w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VKKp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png" width="1205" height="507" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:507,&quot;width&quot;:1205,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:95003,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VKKp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 424w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 848w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 1272w, https://substackcdn.com/image/fetch/$s_!VKKp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f8f52f7-4da9-4277-b46e-1eddae0b4ffc_1205x507.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>The Local Perceiver (SAM-base, 80M):</strong> Based on Meta&#8217;s <em>Segment Anything Model</em>, this block utilizes <strong>Window Attention</strong>. Instead of calculating global dependencies (which scale quadratically with resolution), it scans local (16 X 16) windows. This is the &#8220;detail scanner&#8221; that identifies the serifs on a font, the dot on an &#8216;i&#8217;, or the boundary of a chemical bond.</p></li><li><p><strong>The Global Knowledge Base (CLIP-large, 300M):</strong> After the local scan, a CLIP-based transformer applies <strong>Dense Global Attention</strong>. This isn&#8217;t looking for letters; it&#8217;s looking for <em>context</em>. It understands the layout, the flow of a multi-column article, and the relationship between a figure and its caption.</p></li></ul><h4><strong>II. The 16x Convolutional Bridge: The &#8220;Zip&#8221; Engine</strong></h4><p>Between these two encoders lies the most critical component: a <strong>2-layer convolutional downsampling module</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FAg9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FAg9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 424w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 848w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 1272w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FAg9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png" width="351" height="307.125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1274,&quot;width&quot;:1456,&quot;resizeWidth&quot;:351,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FAg9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 424w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 848w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 1272w, https://substackcdn.com/image/fetch/$s_!FAg9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbe88647-3a9b-4017-8844-ef33ba7816ba_1532x1340.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>The Squeeze:</strong> If an image is split into 4,096 patches (64 X 64), this module uses a stride-2 convolution to reduce the spatial resolution by 4x, and then another 4x.</p></li><li><p><strong>The Result:</strong> Total compression of <strong>16x</strong>. It collapses the thousands of local detail tokens into just <strong>256 dense Vision Tokens</strong>. This bridge is what allows DeepSeek-OCR to pass high-resolution information into the decoder without exceeding the context window. It essentially &#8220;summarizes&#8221; local visual patterns into a higher-level representational language.</p></li></ul><h4><strong>III. The DeepSeek-3B-MoE Decoder: Expert Reconstruction</strong></h4><p>The final stage is a <strong>3-billion-parameter Mixture-of-Experts (MoE)</strong> decoder. This is the &#8220;brain&#8221; that decompresses the vision tokens back into structured text.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pP_p%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pP_p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 424w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 848w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 1272w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pP_p%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png" width="432" height="370.8791208791209" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1250,&quot;width&quot;:1456,&quot;resizeWidth&quot;:432,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pP_p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 424w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 848w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 1272w, https://substackcdn.com/image/fetch/$s_!pP_p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb790fb69-ebaf-462f-8c09-a406f9b17cbc_1500x1288.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Sparse Activation:</strong> While the model has 3B parameters for broad &#8220;knowledge,&#8221; it only activates approximately <strong>570M parameters</strong> per token.</p></li><li><p><strong>Specialized Routing:</strong> The system utilizes 64 routed experts and 2 shared experts. An intelligent router directs vision tokens to specialized subnetworks:</p><ul><li><p><strong>Math Tokens</strong> &#8594; Experts trained on LaTeX/Equations.</p></li><li><p><strong>Tabular Tokens</strong> &#8594; Experts trained on JSON/Markdown table structures.</p></li><li><p><strong>Multilingual Tokens</strong> &#8594; Experts specializing in Chinese, Hindi, or Arabic scripts.</p></li></ul></li></ul><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f_{\\text{dec}} : \\mathbb{R}^{n \\times d_{\\text{latent}}} \\to \\mathbb{R}^{N \\times d_{\\text{text}}} ; \\hat{X} = f_{\\text{dec}}(Z) \\text{ where } n \\leq N&quot;,&quot;id&quot;:&quot;JXXVAQQSFL&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where Z are the compressed latent vision tokens and X_hat is the reconstructed text representation. This confirms the core thesis: the latent Z is a more compact and efficient representation of the data than the final text X, proving that <strong>Visual Context</strong> is the superior primitive for large-scale document intelligence.</p><p>This architecture ensures that the &#8220;Understanding&#8221; phase isn&#8217;t just a general guessing game as it is a specialized reconstruction where the most relevant &#8220;experts&#8221; fire to translate the compressed visual signal into its final, parsed form.</p><h2>7.6 The Two step Training Pipeline</h2><p>To achieve this level of contextual compression, DeepSeek followed a disciplined, two-stage training strategy. The goal was to ensure the &#8220;Vision Tokenizer&#8221; (DeepEncoder) could master visual mapping before the &#8220;Language Brain&#8221; (MoE Decoder) attempted to reconstruct the semantics.</p><h4><strong>Stage 1: Independent DeepEncoder Training</strong></h4><p>In this &#8220;Cold Start&#8221; phase, the goal is to teach the <strong>DeepEncoder</strong> how to summarize an image without losing the character-level details.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jiG4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 424w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 848w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 1272w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jiG4%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png" width="809" height="226" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:226,&quot;width&quot;:809,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28214,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jiG4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 424w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 848w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 1272w, https://substackcdn.com/image/fetch/$s_!jiG4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d30f337-c7a4-45a4-8b64-2f9c7b944ce1_809x226.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><ul><li><p>The encoder is trained using a <strong>Next-Token Prediction</strong> framework, where a small, &#8220;compact&#8221; language model acts as a temporary decoder.</p></li><li><p>Then The model is forced to map document images (x) to a latent space (z) such that the text can be perfectly predicted. This ensures that the <strong>16x Convolutional Bridge</strong> learns to preserve &#8220;high-entropy&#8221; features like chemical bonds or tiny table borders while discarding the redundant white space.</p></li><li><p>This stage utilizes the full <strong>OCR 1.0 and 2.0 datasets</strong> plus <strong>100 million general images</strong> from LAION to provide a strong visual baseline. It is trained for 2 epochs at a sequence length of 4096.</p></li></ul><h4><strong>Stage 2: Full System Alignment (Training the DeepSeek-OCR)</strong></h4><p>Once the DeepEncoder is &#8220;frozen&#8221; (or nearly frozen), the focus shifts to the <strong>DeepSeek-3B-MoE decoder</strong>.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9Kd1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 424w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 848w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 1272w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219Kd1%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png" width="1022" height="226" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:226,&quot;width&quot;:1022,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41806,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9Kd1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 424w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 848w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 1272w, https://substackcdn.com/image/fetch/$s_!9Kd1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff16d6f44-34b4-4079-8db7-1a142dd0f25c_1022x226.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><ul><li><p>In this stage, the visual tokens from the pre-trained DeepEncoder are fed into the MoE decoder. The model is fine-tuned to align the visual context with structured language outputs (Markdown, LaTeX, HTML).</p></li><li><p>The training objective remains next-token prediction, but the complexity of the &#8220;target&#8221; increases. The model is now learning <strong>&#8220;Reading Order&#8221;</strong> and <strong>&#8220;Structural Inference.&#8221;</strong> It learns that a visual block on the left and right are columns, and should be interleaved according to human reading logic.</p></li><li><p>The MoE router is trained here to efficiently direct &#8220;Math-dense&#8221; visual tokens to the scientific experts and &#8220;Layout-dense&#8221; tokens to the structural experts.</p></li></ul><h4><strong>Stage 3 (Bonus) : The Gundam-Master Continued Training</strong></h4><p>A final, specialized phase is used to create the <strong>Gundam-Master mode</strong>. This is obtained by taking the pre-trained DeepSeek-OCR and continuing its training on a curated sample of <strong>6 million high-resolution documents</strong>. This stage focuses exclusively on the &#8220;Dynamic Tiling&#8221; logic by teaching the model how to perfectly stitch the global 1024px view with the n local 640px tiles.</p><h2>7.7 Inference</h2><p>Inference in DeepSeek-OCR is not a static process; it is a dynamic resource-allocation problem. Because the model treats resolution as a proxy for information entropy, it allows the user to select an inference &#8220;flavor&#8221; that matches the density of the document. This ensures that the model never wastes its &#8220;Token Budget&#8221; on simple images while providing a &#8220;Deep Zoom&#8221; capability for complex ones.</p><h4><strong>I. Available options</strong></h4><p>Depending on the target task, the model can be deployed in four native resolutions, each resulting in a specific number of vision tokens. This allows for a granular trade-off between <strong>Latency</strong> and <strong>Precision</strong>:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AksR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 424w, https://substackcdn.com/image/fetch/$s_!AksR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 848w, https://substackcdn.com/image/fetch/$s_!AksR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 1272w, https://substackcdn.com/image/fetch/$s_!AksR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AksR%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png" width="1229" height="151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:151,&quot;width&quot;:1229,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45837,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AksR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 424w, https://substackcdn.com/image/fetch/$s_!AksR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 848w, https://substackcdn.com/image/fetch/$s_!AksR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 1272w, https://substackcdn.com/image/fetch/$s_!AksR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72d25694-70b3-4227-99a8-0ac34c9810f2_1229x151.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><h4><strong>II. The Gundam Protocol: Ultra-High-Resolution Tiling</strong></h4><p>For documents that exceed the 1280 x 1280 threshold such as massive engineering blueprints, intricate financial tables, or newspaper broadsheets; DeepSeek-OCR activates its final form: <strong>Gundam Mode</strong>.</p><p>Gundam mode utilizes a <strong>Dynamic Tiling Strategy</strong> to prevent the &#8220;Signal Dilution&#8221; that occurs when a massive image is squashed into a small latent space. The process works as follows:</p><ol><li><p><strong>Local Tiling:</strong> The high-res image is split into n local tiles, each at a 640 x 640 resolution. Each tile captures fine-grained glyph details.</p></li><li><p><strong>Global Pooling:</strong> Simultaneously, the entire image is downsampled into a single 1024 x 1024 <strong>Global Thumbnail</strong>.</p></li><li><p><strong>Semantic Stitching:</strong> The vision tokens from all n local tiles are concatenated with the global tokens. This allows the MoE decoder to maintain <strong>Local Precision</strong> (reading the tiny numbers in a table cell) while utilizing <strong>Global Context</strong> (knowing which column and row that cell belongs to).</p></li></ol><h4><strong>III. Throughput: The 200k Pages/Day Benchmark</strong></h4><p>The ultimate result of this inference architecture is a massive leap in hardware utilization. By collapsing the extraction-understanding-parsing pipeline into a single forward pass, the model achieves a throughput that was previously impossible for high-accuracy systems:</p><ul><li><p><strong>Performance:</strong> On a single <strong>NVIDIA A100 (40GB)</strong>, DeepSeek-OCR can process over <strong>200,000 pages per day</strong>.</p></li><li><p><strong>The &#8220;Context Benefit&#8221;:</strong> Because the <strong>16x Convolutional Bridge</strong> reduces the token count so aggressively, the decoder&#8217;s self-attention mechanism (which scales O(N^2)) stays in its &#8220;sweet spot.&#8221; This allows for long-form document parsing that remains computationally &#8220;cheap&#8221; even as the document complexity grows.</p></li></ul><div><hr></div><h2>8. Results and Outcomes</h2><p>The theoretical promise of &#8220;Contextual Optical Compression&#8221; is ultimately measured by its performance on the most demanding document parsing benchmarks. In the 2025/2026 landscape, <strong>OmniDocBench</strong> has emerged as the gold standard, testing models on everything from multi-column newspapers to dense financial reports.</p><h3>8.1 Breaking the &#8220;Token-Accuracy&#8221; Paradox</h3><p>Historically, high accuracy in OCR required high token counts. If you wanted to resolve a dense LaTeX formula, you had to feed the model thousands of tokens. DeepSeek-OCR breaks this linear relationship.</p><ul><li><p><strong>SOTA Performance:</strong> On <strong>OmniDocBench v1.5</strong>, DeepSeek-OCR 2 achieved a remarkable score of <strong>91.09%</strong>. While specialized pipelines like Baidu&#8217;s PaddleOCR-VL (92.86%) still hold a slight edge in raw accuracy, they do so with significantly higher computational overhead.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fib9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fib9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 424w, https://substackcdn.com/image/fetch/$s_!fib9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 848w, https://substackcdn.com/image/fetch/$s_!fib9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 1272w, https://substackcdn.com/image/fetch/$s_!fib9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fib9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png" width="809" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:809,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127270,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fib9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 424w, https://substackcdn.com/image/fetch/$s_!fib9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 848w, https://substackcdn.com/image/fetch/$s_!fib9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 1272w, https://substackcdn.com/image/fetch/$s_!fib9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa690ff14-72ba-42b2-87b4-47b72539f0ba_809x720.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>The Edit Distance Edge:</strong> When compared to &#8220;Massive&#8221; VLMs like <strong>Gemini-3 Pro</strong>, DeepSeek-OCR 2 demonstrated a lower Normalized Edit Distance (0.100 vs. 0.115). This means that despite its aggressive compression, the model makes fewer fundamental errors in the final text reconstruction.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Fqiy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 424w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 848w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 1272w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Fqiy%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png" width="909" height="227" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:227,&quot;width&quot;:909,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60337,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Fqiy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 424w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 848w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 1272w, https://substackcdn.com/image/fetch/$s_!Fqiy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd3d337-ffe0-41e6-8f5e-7df9144cc319_909x227.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>The &#8220;Compression Cliff&#8221;:</strong> The paper defines a clear performance boundary.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HDMy%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HDMy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 424w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 848w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 1272w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HDMy%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png" width="809" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:809,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110724,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HDMy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 424w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 848w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 1272w, https://substackcdn.com/image/fetch/$s_!HDMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6833fdf-5ac1-4c8f-86de-ae42d9e19857_809x720.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>&lt;10x Compression:</strong> Achieves near-lossless <strong>97% precision</strong>.</p></li><li><p><strong>10x&#8211;12x Compression:</strong> Maintains ~90% accuracy, suitable for most production tasks.</p></li><li><p><strong>20x Compression:</strong> Accuracy drops to ~60%, proving that while 2D images are efficient, there is a physical &#8220;Shannon Limit&#8221; to how much text can be packed into a single latent vector.</p></li></ul></li></ul><h3>8.2 Benchmark Comparison</h3><p>The most striking result is the comparison of <strong>Vision Tokens per Page</strong>. DeepSeek-OCR operates in a different league of efficiency compared to other SOTA models:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Lt3X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 424w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 848w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 1272w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Lt3X%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png" width="1039" height="151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:151,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36689,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Lt3X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 424w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 848w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 1272w, https://substackcdn.com/image/fetch/$s_!Lt3X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b19d669-3d37-403b-a950-b23ec6c9834c_1039x151.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>DeepSeek&#8217;s <strong>Gundam Mode</strong> manages to outperform MinerU 2.0 while using <strong>8.5x fewer tokens</strong>. This is the practical validation of the &#8220;Intelligence via Symmetry&#8221; theory: by modeling the document&#8217;s structure, the model doesn&#8217;t need to &#8220;see&#8221; every pixel to know what the text says.</p><h3>8.3 Production Impact</h3><p>Beyond benchmarks, the model&#8217;s throughput in a production environment is its most &#8220;transformational&#8221; outcome.</p><ul><li><p><strong>The Single-GPU Benchmark:</strong> On a single <strong>NVIDIA A100-40GB</strong>, DeepSeek-OCR can process over <strong>200,000 pages per day</strong>.</p></li><li><p><strong>The Cost Revolution:</strong> For large-scale data rescue projects (digitizing million-page backlogs), this reduces the raw compute cost.</p></li><li><p><strong>Data Synthesis:</strong> DeepSeek itself used this model to generate 33 million pages of high-quality training data for its larger LLM projects, proving that the model is its own best customer.</p></li></ul><h3>8.4 General VQA retention</h3><p>DeepSeek-OCR maintains parity with standard VLMs in <strong>general visual tasks</strong> (description, detection, grounding) and preserves core <strong>linguistic reasoning</strong> via the inclusion of text-only corpora. However, as the pipeline lacks a dedicated <strong>Instruct/Chat SFT phase</strong>, the model functions as a base completion engine rather than a conversational agent; specific capabilities require precise <strong>completion-style prompting</strong> for activation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dDdT%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dDdT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 424w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 848w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 1272w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dDdT%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png" width="1149" height="790" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:790,&quot;width&quot;:1149,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1055850,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/186275579?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dDdT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 424w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 848w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 1272w, https://substackcdn.com/image/fetch/$s_!dDdT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F921c8f11-625e-45f4-8e40-ce2d9c02c1e8_1149x790.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h1>Thoughts</h1><ul><li><p>The architecture itself (a ViT-based/inspired encoder) followed by a language decoder is quite standard. We&#8217;ve seen similar &#8220;Global + Local&#8221; perception stacks in image captioning and general scene-understanding models for years. DeepSeek-OCR isn&#8217;t reinventing the neural block; it&#8217;s repurposing a mature design.</p></li><li><p>The shift is purely in the <strong>application</strong>. Previously, this level of visual compression was reserved for &#8220;fuzzy&#8221; semantic summaries (e.g., describing a photo). For structured text, the industry default was high-resolution, patch-by-patch extraction to avoid losing character-level detail.</p></li><li><p>DeepSeek-OCR proves that <strong>Structured data is compressible as </strong>Document layouts and text follow patterns (symmetries) can be modeled as a continuous latent signal rather than just transcribed.</p></li><li><p>Instead of a single bottleneck, a multi-scale/pyramid approach like extracting large, medium, and small patch tokens simultaneously would allow the model to capture global layout and micro-text details in parallel. Currently, the "Gundam" tiling is a manual workaround for a limitation that a native multi-resolution pyramid could solve at the feature-map level.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qK2o%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qK2o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 424w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 848w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 1272w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qK2o%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp" width="696" height="347.5655430711611" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;normal&quot;,&quot;height&quot;:400,&quot;width&quot;:801,&quot;resizeWidth&quot;:696,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Feature Pyramid Network (FPN) - GeeksforGeeks&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:&quot;center&quot;,&quot;offset&quot;:false}" class="sizing-normal" alt="Feature Pyramid Network (FPN) - GeeksforGeeks" title="Feature Pyramid Network (FPN) - GeeksforGeeks" srcset="https://substackcdn.com/image/fetch/$s_!qK2o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 424w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 848w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 1272w, https://substackcdn.com/image/fetch/$s_!qK2o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01fab5b9-d004-42a8-a3b4-82677371ba35_801x400.webp 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fwww.geeksforgeeks.org%2Fcomputer-vision%2Ffeature-pyramid-network-fpn%2F">https://www.geeksforgeeks.org/computer-vision/feature-pyramid-network-fpn/</a></figcaption></figure></div></li><li><p>Future iterations should leverage <strong>Group Relative Policy Optimization (GRPO)</strong> or similar RL-based frameworks. By using a reward function that penalizes structural inconsistency (e.g., Markdown table alignment) or hallucinated glyphs, the model could move from "guessing the next token" to "verifying the document logic."</p></li></ul><div><hr></div><h1>Conclusion</h1><p>At its core, <strong>DeepSeek-OCR</strong> reframes document intelligence as a problem of <strong>contextual optical compression</strong> rather than literal transcription. By abandoning the &#8220;Token Tax&#8221; of traditional string-based pipelines and treating the document as a high-dimensional visual manifold, we gain the ability to process dense structural data with an efficiency that was previously considered the &#8220;Shannon Limit&#8221; of the field.</p><p>In this article, we began by tracing the lineage of OCR, moving from the fractured, multi-stage pipelines of the past to the unified Vision-Language Model (VLM) paradigm. We identified the <strong>&#8220;Representational Gap&#8221;</strong> as the critical inefficiency where models would waste massive context windows on redundant pixels. We explored the methodology of <strong>Visual Tokens as Semantic Proxies</strong>, using the lens of cross-entropy to see how a document&#8217;s feature space can be mapped directly from pixels to latents. We dissected the architecture, highlighting the <strong>DeepEncoder&#8217;s</strong> dual-stream perception and the <strong>16x Convolutional Bridge</strong> that &#8220;zips&#8221; 4,096 patches into just 256 dense tokens. We then looked at the <strong>Gundam Protocol</strong>, a dynamic tiling strategy that enables the model to resolve ultra-high-res layouts without signal dilution. Finally, we critiqued the current bottlenecks, discussing the potential for <strong>Hierarchical Pyramid Networks</strong> and the transition toward <strong>RL-based (GRPO)</strong> training to enforce topological consistency.</p><p>The key takeaway is that DeepSeek-OCR is not just a faster OCR engine; it is a fundamental shift in <strong>representation assumptions</strong>. It proves that when we treat the visual modality as the primary compression primitive, we don&#8217;t just get faster parsing; we get a model that understands the structural logic of the page.</p><p><strong>Reference</strong></p><p>DeepSeek OCR : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2510.18234">https://arxiv.org/pdf/2510.18234</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today.<br>If you liked the article make sure to like and share this article with your network. Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p><p></p><p></p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[mHC: Manifold-Constrained Hyper-Connections]]></title><description><![CDATA[Maintaining feature diversity while preserving stability in residual hyper-connections is a significant challenge; mHC is an attempt by DeepSeek team to fix the loophole in the modern transformers.]]></description><link>https://vizuara.substack.com/p/mhc-manifold-constrained-hyper-connections</link><guid isPermaLink="false">https://vizuara.substack.com/p/mhc-manifold-constrained-hyper-connections</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 12 Jan 2026 03:30:55 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-He-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em>Introduction</em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7dense-residual-connections">Dense Residual Connections</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-information-theoretic-view-mutual-information">The Information Theoretic View (Mutual Information</a>)</em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7alignment-with-neural-odes">Alignment with Neural ODEs</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7generalizing-the-connection">Generalizing the Connection</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7defining-connection-orders">Defining Connection Orders</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7problems-with-the-n-residual-connection">Problems with the N-Residual Connection</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-information-theoretic-demand-for-n-steps">The Information Theoretic Demand for N-Steps</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7transformers-as-dense-n-to-n-graphs">Transformers as Dense N-to-N Graphs</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-failure-modes-of-high-order-residuals">The Failure Modes of High-Order Residuals</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7how-to-control-the-issues-ideally">How to Control the Issues Ideally?</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-limits-of-simple-scaling">The Limits of Simple Scaling</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7borrowing-from-discrete-representations-vq-vae-logic">Borrowing from Discrete Representations (VQ-VAE logic)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7preserving-information-diversity-anti-mode-collapse">Preserving Information Diversity (Anti-Mode Collapse)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-allocation-problem-and-optimal-transport">The Allocation Problem and Optimal Transport</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7some-pre-requisites">Some pre-requisites</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7breaking-the-complexity-deconstructing-mhc">Breaking the Complexity: Deconstructing &#8220;mHC&#8221;</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7what-is-optimal-transport">What is Optimal Transport?</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7from-where-sinkhorn-knopp-comes">From where Sinkhorn-knopp comes?</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-reparameterization-trick-and-why-normalization-works">The Reparameterization trick and Why Normalization Works?</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7methodology">Methodology</a></em></p><ol><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-gcn-foundation-self-connection-and-the-identity-crisis">The GCN Foundation: Self-Connection and the Identity Crisis</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7transitioning-to-hyper-connections-hc-the-broadband-highway">Transitioning to Hyper-Connections (HC): The Broadband Highway</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-mhc-refinement-manifold-constrained-evolution">The mHC Refinement: Manifold-Constrained Evolution</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7the-constraint-as-a-discrete-bottleneck-vq-vae-logic">The Constraint as a Discrete Bottleneck (VQ-VAE Logic)</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7dynamic-feature-selection-and-signal-denoising">Dynamic Feature Selection and Signal Denoising</a></em></p></li></ol></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7results">Results</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7thoughts">Thoughts</a></em></p></li><li><p><em><a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fc001fc7f-3c4a-400d-bbbd-c1a1ea66f57a%3Fupdated%3D2026-01-08T11%253A41%253A11.015Z%26amp%3BpostPreview%3Dpaid%26amp%3Bsub%3Dfree%26amp%3Bdevice%3Ddesktop%26amp%3Baudience%3Deveryone%26amp%3Bfree_preview%3Dfalse%26amp%3Bfreemail%3Dtrue%23%25C2%25A7conclusion">Conclusion</a></em></p></li></ol><h1>1. Introduction</h1><p>The evolution of Deep Learning can be summarized as a relentless pursuit of depth. However, depth introduces a paradox: the more layers we add to a network, the more we risk the degradation of the very signals we aim to refine. Historically, <strong>Residual Connections (ResNets)</strong> solved this by creating a &#8220;short circuit&#8221; for gradients, allowing models to scale to hundreds, and now thousands, of layers. But as we push into the era of trillion-parameter models, the standard residual block is beginning to show its limits as a narrow, single-lane information bottleneck.</p><p>This article explores a fundamental reimagining of how layers communicate. We move beyond the traditional &#8220;order-1&#8221; residual connection toward <strong>Manifold-Constrained Hyper-Connections (mHC)</strong>. By reframing network depth through the lens of <strong>Information Theory</strong> and <strong>Neural ODEs</strong>, we can view the hidden states of a model not just as static vectors, but as trajectories through a high-dimensional manifold.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-He-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-He-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 424w, https://substackcdn.com/image/fetch/$s_!-He-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 848w, https://substackcdn.com/image/fetch/$s_!-He-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 1272w, https://substackcdn.com/image/fetch/$s_!-He-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-He-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png" width="326" height="492.912" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:756,&quot;width&quot;:500,&quot;resizeWidth&quot;:326,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-He-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 424w, https://substackcdn.com/image/fetch/$s_!-He-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 848w, https://substackcdn.com/image/fetch/$s_!-He-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 1272w, https://substackcdn.com/image/fetch/$s_!-He-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F650b72d9-9011-4a72-9aae-a4541f4855b7_500x756.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The challenge with &#8220;wide&#8221; or &#8220;N-order&#8221; connections has always been instability, like noise accumulation and mode collapse that pull these trajectories off course. We will examine how <strong>DeepSeek</strong> utilizes <strong>Optimal Transport</strong>; specifically the <strong>Sinkhorn-Knopp algorithm</strong> to impose mathematical constraints that preserve signal integrity. In doing so, mHC doesn&#8217;t just add more &#8220;lanes&#8221; to the residual highway; it ensures that every lane carries unique, orthogonal information, turning neural scaling into a controlled, optimization-driven process rather than a stochastic gamble.</p><p><em>To give you a flavor of what you are going to see, we won't just toss around buzzwords like "Birkhoff Polytope", &#8220;sinkhorn-knopp&#8221; or &#8220;Hyper-connection&#8221; as mere labels. Instead, we will peel back the layers to understand their <strong>functional meaning</strong>: why a specific geometric shape can act as a "physical" guardrail for a signal, why and how a mathematical algorithm from the 1960s serves as the perfect traffic controller for a trillion-parameter highway. You&#8217;ll see how this framework shifts the paradigm from "brute-force scaling" to "intelligent routing", essentially giving models the ability to manage their own internal bandwidth (quality and diversity) without losing their mind (instability).</em></p><div><hr></div><h1>2. Dense Residual Connections</h1><p>To understand the leap toward <strong>mHC</strong>, we must first deconstruct the &#8220;Standard Residual&#8221;:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y = x + f(x)&quot;,&quot;id&quot;:&quot;PQNXBDRBLH&quot;}" data-component-name="LatexBlockToDOM"></div><p>not just as a training trick, but as a fundamental mathematical necessity for signal preservation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gim_%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gim_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 424w, https://substackcdn.com/image/fetch/$s_!gim_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 848w, https://substackcdn.com/image/fetch/$s_!gim_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 1272w, https://substackcdn.com/image/fetch/$s_!gim_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gim_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png" width="450" height="243.75" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:650,&quot;width&quot;:1200,&quot;resizeWidth&quot;:450,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Residual neural network - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Residual neural network - Wikipedia" title="Residual neural network - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!gim_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 424w, https://substackcdn.com/image/fetch/$s_!gim_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 848w, https://substackcdn.com/image/fetch/$s_!gim_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 1272w, https://substackcdn.com/image/fetch/$s_!gim_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac93da59-9b40-44ee-86ea-f3d3b6b4cae1_1200x650.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>The Information Theoretic View: Mutual Information</h3><p>At its core, a neural network is a Markov Chain of transformations: X &#8594; H_1 &#8594; H_2  &#8594; Y. </p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7nu1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 424w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 848w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 1272w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%217nu1%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5128180c-be8a-457a-898f-491dae257613_330x233.png" width="256" height="180.75151515151515" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5128180c-be8a-457a-898f-491dae257613_330x233.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:233,&quot;width&quot;:330,&quot;resizeWidth&quot;:256,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Mutual information - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Mutual information - Wikipedia" title="Mutual information - Wikipedia" srcset="https://substackcdn.com/image/fetch/$s_!7nu1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 424w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 848w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 1272w, https://substackcdn.com/image/fetch/$s_!7nu1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5128180c-be8a-457a-898f-491dae257613_330x233.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>According to the Data Processing Inequality (DPI), mutual information can only be lost as it passes through these transformations:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;I(X; H_t) \\geq I(X; H_{t+1})&quot;,&quot;id&quot;:&quot;TVYYFGJPXI&quot;}" data-component-name="LatexBlockToDOM"></div><p>Residual connections exist to fight this entropy. By providing an identity path, they ensure that the Mutual Information between the input and the deep hidden states is preserved. In information theory terms, the residual acts as a &#8220;bypass&#8221; that prevents the transformation <em>f(x)</em> from completely overwriting the original signal, allowing the network to learn only the incremental information (the &#8220;innovation&#8221;) needed at each step.</p><h3>Alignment with Neural ODEs</h3><p>Residual connections are the discrete realization of Continuous Ordinary Differential Equations (ODEs). If we consider the limit where the step size between layers becomes infinitesimally small, the residual update:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_{t+1} = h_t + f(h_t, \\theta_t)&quot;,&quot;id&quot;:&quot;OPSAOHBFZP&quot;}" data-component-name="LatexBlockToDOM"></div><p>becomes the Euler discretization of:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{dh(t)}{dt} = f(h(t), t, \\theta)&quot;,&quot;id&quot;:&quot;GTLBADMLIQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Under this view, a forward pass is a trajectory in a continuous feature space. The &#8220;residual&#8221; is essentially the velocity field guiding that trajectory. This perspective is vital: it suggests that a model isn&#8217;t just a stack of filters, but a dynamical system where stability (preventing the trajectory from diverging) is paramount.</p><h3>Generalizing the Connection</h3><p>We can define a generalized residual function <code>G</code> that combines the current state x and the transformation f(x):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y = G(f(x), x)&quot;,&quot;id&quot;:&quot;HPCZHUTGIP&quot;}" data-component-name="LatexBlockToDOM"></div><p>While G is typically addition (ResNet), it could mathematically be concatenation or a gated fusion. If we look across i preceding layers, the generalized summation equation for the l-th layer becomes:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_l = \\sum_{i=0}^{l-1} W_{l,i} \\cdot f_i(h_i)&quot;,&quot;id&quot;:&quot;RWZWQITAPW&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where W represents the weighting or &#8220;connection&#8221; matrix between any two layers.</p><h3>Defining Connection Orders</h3><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yoka!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 424w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 848w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 1272w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Yoka%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png" width="581" height="180.61048689138576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:332,&quot;width&quot;:1068,&quot;resizeWidth&quot;:581,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Graph Neural Network and Some of GNN Applications&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Graph Neural Network and Some of GNN Applications" title="Graph Neural Network and Some of GNN Applications" srcset="https://substackcdn.com/image/fetch/$s_!Yoka!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 424w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 848w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 1272w, https://substackcdn.com/image/fetch/$s_!Yoka!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9df49229-d650-40cf-ba10-894d4c82adae_1068x332.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The &#8220;Order&#8221; of a connection defines the lookback window and complexity of this graph:</p><ul><li><p><strong>Order-0 (No Residual):</strong> </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_l = f(h_{l-1})&quot;,&quot;id&quot;:&quot;MASADULRQW&quot;}" data-component-name="LatexBlockToDOM"></div><p>This is the classic VGG-style feed-forward network. Without the identity path, gradients vanish exponentially, and mutual information decays rapidly.</p></li><li><p><strong>Order-1 (Conventional Residual):</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_l = h_{l-1} + f(h_{l-1})&quot;,&quot;id&quot;:&quot;IGEZMZWZNF&quot;}" data-component-name="LatexBlockToDOM"></div><p>The ResNet/Transformer standard. Information flows from exactly one step behind. It solves the vanishing gradient but forces all information through a single-lane &#8220;summation&#8221; bottleneck.</p></li><li><p><strong>Order-N Residual Connections (</strong>The Generalized DAG):</p><p>An <strong>Order-N connection</strong> (or Hyper-Connection) fundamentally breaks the &#8220;chain&#8221; topology of deep learning, transforming the model into a <strong>Directed Acyclic Graph (DAG)</strong>. In this regime, the state <code>h_l</code> is no longer a simple successor of <code>h_{l-1}</code>, but an aggregation of a sliding window of N previous states:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_l = \\text{Aggregate}\\left( f(h_{l-1}), \\{h_{l-1}, h_{l-2}, \\dots, h_{l-N}\\} \\right)&quot;,&quot;id&quot;:&quot;XSKSYCXJGK&quot;}" data-component-name="LatexBlockToDOM"></div><p>This generalization is powerful because it allows the model to satisfy different structural assumptions about the data and the learning process:</p><ul><li><p><strong>Locality and Graph Convolutional Logic:</strong> Much like a <strong>Graph Convolutional Network (GCN)</strong> assumes that a node&#8217;s identity is defined by its immediate neighborhood, an Order-N connection assumes that the &#8220;feature neighborhood&#8221; of a specific depth is relevant. </p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5e8w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 424w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 848w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 1272w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215e8w%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png" width="433" height="172.8907142857143" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1400,&quot;resizeWidth&quot;:433,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Graph Convolutional Networks (GCN) &amp; Pooling | by Jonathan Hui | Medium&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Graph Convolutional Networks (GCN) &amp; Pooling | by Jonathan Hui | Medium" title="Graph Convolutional Networks (GCN) &amp; Pooling | by Jonathan Hui | Medium" srcset="https://substackcdn.com/image/fetch/$s_!5e8w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 424w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 848w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 1272w, https://substackcdn.com/image/fetch/$s_!5e8w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F276762ba-9c76-401a-8a64-b0296ca726d2_1400x559.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fjonathan-hui.medium.com%2Fgraph-convolutional-networks-gcn-pooling-839184205692">https://jonathan-hui.medium.com/graph-convolutional-networks-gcn-pooling-839184205692</a></figcaption></figure></div><p>By aggregating multiple preceding layers, the model can perform a form of <strong>temporal smoothing</strong> across the depth dimension, ensuring that no single layer&#8217;s transformation can radically deviate the feature trajectory.</p></li><li><p><strong>Temporal and Feature-Level Integration:</strong> In architectures like <strong>Graph Transformer Networks</strong>, edges are not just connections; they are learnable weights that determine the importance of distant nodes. Similarly, in Order-N residuals, the model can learn to &#8220;weigh&#8221; the importance of <code>h_{l-10}</code> versus <code>h_{l-1}</code>. This is crucial for preserving <strong>low-level structural features</strong> (which often vanish in deep Order-1 chains) while simultaneously processing <strong>high-level semantic abstractions</strong>.</p></li><li><p><strong>Expansion of the Capacity Bottleneck:</strong> In Order-1 models, all information must be compressed into a single vector x to be passed to the next layer. This &#8220;narrow-pipe&#8221; problem means the model must constantly decide what to forget. Order-N connections create a <strong>broad-band information highway</strong>, allowing the model to maintain multiple versions of a feature&#8217;s evolution simultaneously.</p></li></ul><p>We need more of these connections because as models scale in depth, the &#8220;discretization error&#8221; of the continuous Neural ODE trajectory accumulates. Order-N connections act as a <strong>higher-order ODE solver</strong> (similar to Runge-Kutta methods), providing multiple look-back points to calculate a more accurate and stable velocity field for the feature state. However, as we increase N, we introduce the risk of a &#8220;collision&#8221; between these signals leading us to the critical problems of noise and mode collapse.</p></li></ul><div><hr></div><h1>3. Problems with the N-Residual Connection</h1><p>While the transition from a single-lane residual to an Order-N &#8220;broadband&#8221; highway is mathematically appealing, the transition is fraught with architectural instability. If Order-1 connections are a simple conversation, Order-N connections are a crowded room where everyone is shouting at once.</p><h3>The Information Theoretic Demand for N-Steps</h3><p>Revisiting the <strong>Mutual Information</strong> perspective, why do we even want N steps? In a deep Order-1 chain, the signal x must survive L successive additions. Each addition <code>x + f(x)</code> introduces a small amount of &#8220;innovation&#8221; but also a small amount of &#8220;noise&#8221; or numerical drift. Over 100 layers, the original input signal becomes buried under a mountain of residual updates.</p><p>By using an <strong>Order-N connection</strong>, we essentially increase the &#8220;signal-to-noise&#8221; ratio of the depth dimension. The model can &#8220;pull&#8221; the original, cleaner features from <code>h_{l-k}</code> directly into <code>h_l</code>, effectively shortening the path between the input and the deep output.</p><h3>Transformers as Dense N-to-N Graphs</h3><p>Interestingly, modern Transformers already hint at this dense connectivity. When we look at <strong>Self-Attention</strong>, specifically with a sliding window or global context, the model is essentially building a dynamic adjacency matrix. Every token (node) looks at K previous tokens.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21BMXZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BMXZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 424w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 848w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 1272w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21BMXZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png" width="1456" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:435,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;How to Build Graph Transformers with O(N) Complexity | Towards Data Science&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="How to Build Graph Transformers with O(N) Complexity | Towards Data Science" title="How to Build Graph Transformers with O(N) Complexity | Towards Data Science" srcset="https://substackcdn.com/image/fetch/$s_!BMXZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 424w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 848w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 1272w, https://substackcdn.com/image/fetch/$s_!BMXZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59322ebb-ebc3-4470-957d-9a06cb575bda_1726x516.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Ftowardsdatascience.com%2Fhow-to-build-graph-transformers-with-o-n-complexity-d507e103d30a%2F">https://towardsdatascience.com/how-to-build-graph-transformers-with-o-n-complexity-d507e103d30a/</a></figcaption></figure></div><ul><li><p>In the <strong>spatial/temporal dimension</strong>, attention is an N-to-N graph.</p></li><li><p>However, in the depth dimension, Transformers remain stubbornly Order-1.</p><p>The attention visuals we see (the heatmaps of adjacency) show how tokens interact across time, but the &#8220;residual stream&#8221; that carries these interactions upward is a narrow, single-track line. Expanding this stream to an N-order connection would mean the attention at layer L could directly influence the residual sum at layer L+5, creating a truly multi-dimensional graph.</p></li></ul><h3>The Failure Modes of High-Order Residuals</h3><p>When we attempt to implement these multiple residual terms </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_l = \\sum \\alpha_i h_i&quot;,&quot;id&quot;:&quot;AEFYQXATZO&quot;}" data-component-name="LatexBlockToDOM"></div><p>the system often breaks down due to three critical issues:</p><ul><li><p><strong>Accumulated Noise and Signal Variance:</strong> Each added residual term brings its own variance. Without strict control, the variance of the hidden state <code>h_l</code> can grow exponentially with depth. If each <code>h_i</code> has a variance of 1, a simple sum of N terms could result in a variance of N, quickly leading to activation values that saturate layers or cause gradient explosion.</p></li><li><p><strong>Mode Collapse and Trivial Solutions:</strong> In an unconstrained N-residual system, the model often finds &#8220;lazy&#8221; solutions where it simply ignores the new transformations and copies old states. Alternatively, multiple residual lanes might end up carrying redundant, highly correlated information. This is <strong>mode collapse in depth</strong>; the model has 10 lanes but only uses one effectively, wasting the extra compute.</p></li><li><p><strong>Trajectory Deviation (The Drift Problem):</strong> Returning to the <strong>Neural ODE</strong> view, if the &#8220;velocity&#8221; vectors <code>f(x)</code> from multiple preceding layers are summed without alignment, they can pull the feature trajectory into &#8220;off-manifold&#8221; space. The model loses its &#8220;identity mapping&#8221; property; the fundamental guarantee that <code>h_l </code>remains a recognizable evolution of <code>h_{l-1}</code>. Instead of a smooth curve, the trajectory becomes a chaotic, jagged path that the optimizer cannot follow.</p></li></ul><p>To solve this, we cannot just add more lanes; we need a <strong>traffic controller</strong> that ensures each lane is distinct, bounded, and mathematically stable.</p><div><hr></div><h1>4. How to Control the Issues Ideally?</h1><p>If we want to reap the benefits of N-order connectivity without the chaotic interference of noise and drift, we need a rigorous control mechanism. We need a way to ensure that the multiple lanes of information are both <strong>stable</strong> and <strong>diverse</strong>.</p><h3>The Limits of Simple Scaling</h3><p>The most obvious way to prevent signal explosion in an N-residual system is to simply rescale the sum (e.g., dividing by <code>sqrt{N}</code>). However, this is a &#8220;dumb&#8221; fix. Frequent rescaling acts like a lossy compressor; it shrinks the variance but doesn&#8217;t preserve the structural quality of the &#8220;innovation&#8221; in the signal. Much like a <strong>Variational Autoencoder (VAE)</strong> that suffers from &#8220;posterior collapse&#8221; if the regularization is too strong, aggressive rescaling forces the model into a safe but low-information state where all the complex nuances of the features are flattened into white noise.</p><h3>Borrowing from Discrete Representations (VQ-VAE logic)</h3><p>A more sophisticated approach is to treat the residual connection as a resource allocation problem. Instead of letting the signal drift into any arbitrary value, we could bound it to a discrete manifold.</p><p>Consider Vector Quantized (VQ) networks or Prototypical Networks. These models maintain a &#8220;codebook&#8221; of representative vectors. By forcing features to align with a codebook, you preserve the variance of the feature set while preventing it from exploding into infinity. This is how models like DALL-E manage high-dimensional complexity: they don&#8217;t allow the signal to be &#8220;anything&#8221;; they force it to be a &#8220;structured something.&#8221;</p><h3>Preserving Information Diversity (Anti-Mode Collapse)</h3><p>The next challenge is ensuring that our N residual lanes aren&#8217;t just carbon copies of each other (mode collapse). To prevent trivial solutions, each &#8220;lane&#8221; or vector in our connection must hold unique, ideally orthogonal, information.</p><p>This requires a mapping function that ensures the &#8220;source&#8221; (previous layers) is distributed across the &#8220;codebook&#8221; (current residual slots) efficiently. If the mapping is poor, all information might crowd into a single lane, leaving the others as dead weight.</p><h3>The Allocation Problem and Optimal Transport</h3><p>The goal is to ensure that there is an <strong>equal and fair chance</strong> for every previous feature to align with a unique &#8220;slot&#8221; in the current layer&#8217;s summation. This is a classic <strong>allocation problem</strong> in mathematics.</p><p>How do you move mass from A to B with minimum effort while ensuring the distribution is balanced? This is the domain of <strong>Optimal Transport (OT)</strong>. We need a metric function that can take N noisy incoming signals and &#8220;transport&#8221; them into a stable, constrained manifold where they are normalized but distinct.</p><p>This is where <strong>mHC</strong> introduces its secret weapon: the <strong>Sinkhorn-Knopp algorithm</strong>. By applying this specific <em><strong>Optimal Transport</strong></em> solver, DeepSeek can force the connection weights into a &#8220;doubly stochastic&#8221; state; essentially a mathematical &#8220;traffic circle&#8221; that ensures every incoming layer gets an equal opportunity to contribute to the current state without any single signal dominating or vanishing.</p><div><hr></div><h1>5. Some pre-requisites</h1><h3>Breaking the Complexity: Deconstructing &#8220;mHC&#8221;</h3><p>To understand the methodology, we must first unpack the abbreviation <strong>mHC</strong> (<strong>Manifold-constrained Hyper-Connections</strong>), as each word represents a specific mathematical pillar of the system:</p><ul><li><p><strong>Manifold (m):</strong> In mathematics, a manifold is a topological space that locally resembles Euclidean space. In this context, it refers to the <strong>Doubly Stochastic Manifold </strong><em>(also known as the Birkhoff polytope)</em>. The <strong>Birkhoff polytope</strong> is the set of all square matrices with non-negative real entries where every row and every column sums exactly to 1. Geometrically, it represents a convex hull whose vertices are all possible <strong>permutation matrices</strong>, serving as a stable &#8220;neighborhood&#8221; that ensures information is perfectly conserved and redistributed without loss or explosion.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OgOZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 424w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 848w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 1272w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OgOZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png" width="225" height="225" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:225,&quot;width&quot;:225,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Birkhoff polytope - Polytope Wiki&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Birkhoff polytope - Polytope Wiki" title="Birkhoff polytope - Polytope Wiki" srcset="https://substackcdn.com/image/fetch/$s_!OgOZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 424w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 848w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 1272w, https://substackcdn.com/image/fetch/$s_!OgOZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a1dce39-8dda-441b-bbc0-0fde667217d4_225x225.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">Birkhoff polytope</figcaption></figure></div><p>DeepSeek restricts the &#8220;mixing&#8221; weights of the residual connections to this specific geometric surface (normalized space to 1). By forcing the weights to stay on this &#8220;manifold,&#8221; the model ensures that signals never explode or vanish, regardless of depth. If you want to learn more about this; refer to the <a href="iframe.php?url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPLTBqohhFNBE_09L0i-lf3fYXF5woAbrzJ">this playlist.</a></p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-6NT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-6NT%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg" width="504" height="154.35" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:196,&quot;width&quot;:640,&quot;resizeWidth&quot;:504,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Neural Manifolds &#8212; Linear Algebra and Topology in Neuroscience | by  Niranjan Rajesh | Bits and Neurons | Medium&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Neural Manifolds &#8212; Linear Algebra and Topology in Neuroscience | by  Niranjan Rajesh | Bits and Neurons | Medium" title="Neural Manifolds &#8212; Linear Algebra and Topology in Neuroscience | by  Niranjan Rajesh | Bits and Neurons | Medium" srcset="https://substackcdn.com/image/fetch/$s_!-6NT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-6NT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88ab8291-40a6-41f7-9b22-9c81b4531fc1_640x196.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>Hyper-Connections (HC):</strong> A &#8220;Hyper-Connection&#8221; is a connection that goes beyond the standard 1-to-1 layer mapping. While a normal connection is an &#8220;order-1&#8221; link (Layer L &#8594; Layer L+1), a <strong>Hyper-Connection</strong> is an N-to-1 link (which we saw in section 2). It allows a single layer to receive a &#8220;broadband&#8221; of information from many previous layers simultaneously, creating a dense web of information flow.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bF2v%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bF2v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 424w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 848w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 1272w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bF2v%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png" width="241" height="365.25659472422063" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:632,&quot;width&quot;:417,&quot;resizeWidth&quot;:241,&quot;bytes&quot;:117216,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bF2v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 424w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 848w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 1272w, https://substackcdn.com/image/fetch/$s_!bF2v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0322884c-20d1-441c-ac83-9fb211ebada7_417x632.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h4>What is Optimal Transport?</h4><p>Optimal Transport is a branch of mathematics originally proposed by Gaspard Monge in 1781 that asks: <em>What is the most efficient way to move a &#8220;pile of mass&#8221; from one configuration to another?</em> In the context of Residual connection:</p><ul><li><p><strong>The &#8220;Mass&#8221;:</strong> Information or feature energy from previous layers.</p></li><li><p><strong>The &#8220;Target&#8221;:</strong> The input requirements of the current layer.</p></li><li><p><strong>The &#8220;Cost&#8221;:</strong> The distortion or noise introduced when you mix different features.</p></li></ul><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HgBa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 424w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 848w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 1272w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HgBa%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png" width="294" height="220.040625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:479,&quot;width&quot;:640,&quot;resizeWidth&quot;:294,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Measuring dataset similarity using optimal transport - Microsoft Research&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Measuring dataset similarity using optimal transport - Microsoft Research" title="Measuring dataset similarity using optimal transport - Microsoft Research" srcset="https://substackcdn.com/image/fetch/$s_!HgBa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 424w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 848w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 1272w, https://substackcdn.com/image/fetch/$s_!HgBa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a837547-d11e-4f69-bc41-156a574e7a0a_640x479.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>In a standard model, features are simply summed (<code>x + f(x)</code>). This is like throwing all your cargo into one pile; it&#8217;s fast, but it&#8217;s messy and creates &#8220;traffic jams&#8221; (signal interference). <strong>Optimal Transport</strong> instead finds a &#8220;plan&#8221; (a transport matrix) that moves the mass from the source to the target with minimum &#8220;effort,&#8221; ensuring that every bit of information finds its optimal place in the new layer. <em>Remember WGANs?; one of the biggest breakthroughs in OG image generation algorithm employed Wasserstein distance (also known as the Earth Mover&#8217;s Distance). Wasserstein distance is the specific value resulting from that optimal plan, which we try to optimize.</em></p><h4>From where Sinkhorn-knopp comes?</h4><p>Calculating the perfect &#8220;optimal plan&#8221; is a <strong>Linear Programming</strong> problem. While mathematically beautiful, it is computationally expensive (O(N^3) complexity). For a 27B parameter model like DeepSeek-V2, running a full OT solver at every single layer would make training impossible.</p><p>To make OT viable for deep networks, we use the <strong>Sinkhorn-Knopp algorithm</strong>. This method traditionally addresses the &#8220;matrix scaling&#8221; problem: given a non-negative matrix A, find diagonal matrices D_1 and D_2 such that S = D_1 A D_2 is doubly stochastic.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AKea%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AKea!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 424w, https://substackcdn.com/image/fetch/$s_!AKea!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 848w, https://substackcdn.com/image/fetch/$s_!AKea!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 1272w, https://substackcdn.com/image/fetch/$s_!AKea!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AKea%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png" width="615" height="307.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1456,&quot;resizeWidth&quot;:615,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A Short Introduction to Optimal Transport and Wasserstein Distance &#183; Its  Neuronal&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A Short Introduction to Optimal Transport and Wasserstein Distance &#183; Its  Neuronal" title="A Short Introduction to Optimal Transport and Wasserstein Distance &#183; Its  Neuronal" srcset="https://substackcdn.com/image/fetch/$s_!AKea!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 424w, https://substackcdn.com/image/fetch/$s_!AKea!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 848w, https://substackcdn.com/image/fetch/$s_!AKea!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 1272w, https://substackcdn.com/image/fetch/$s_!AKea!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef1b3bb-56b9-42a3-a0c7-fea083c35f67_2400x1200.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It works by adding <strong>Entropic Regularization</strong> to the transport problem. This &#8220;blurs&#8221; the optimal plan slightly, turning the rigid linear program into a strictly convex problem that is much smoother and faster to solve. The algorithm transforms a raw, chaotic weight matrix into a <strong>Doubly Stochastic Matrix</strong> (where every row and column sums to 1) using a simple iterative process:</p><ol><li><p><strong>Row Normalization:</strong> Divide every element in a row by that row&#8217;s total sum.</p></li><li><p><strong>Column Normalization:</strong> Divide every element in a column by that column&#8217;s total sum.</p></li><li><p><strong>Repeat:</strong> Iterate this k times.</p></li></ol><h3>The Reparameterization trick and Why Normalization Works?</h3><p>In modern Deep Learning, the Sinkhorn-Knopp operator acts as a <strong>differentiable surrogate</strong> for discrete operations, similar to how the <strong>Softmax</strong> is a differentiable surrogate for the argmax function.</p><h4>Connection to the Reparameterization Trick</h4><p>In models like Gumbel-Sinkhorn, this operator implements a version of the reparameterization trick for latent permutations or matchings. Just as a VAE uses the reparameterization trick to flow gradients through a Gaussian sampling process, mHC uses Sinkhorn to flow gradients through the &#8220;selection&#8221; of residual paths.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YXb3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YXb3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 424w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 848w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 1272w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YXb3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png" width="757" height="293" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ee23268-204c-411a-8a58-619530aae8c0_757x293.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:293,&quot;width&quot;:757,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;The Reparameterization Trick - Clearly Explained | Dilith Jayakody&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The Reparameterization Trick - Clearly Explained | Dilith Jayakody" title="The Reparameterization Trick - Clearly Explained | Dilith Jayakody" srcset="https://substackcdn.com/image/fetch/$s_!YXb3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 424w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 848w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 1272w, https://substackcdn.com/image/fetch/$s_!YXb3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee23268-204c-411a-8a58-619530aae8c0_757x293.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>By treating the connection weights as a &#8220;transport plan,&#8221; the model can learn to &#8220;route&#8221; information across depth without the gradients getting stuck on discrete choices (like &#8220;layer A is on, layer B is off&#8221;). The iterative normalization is fully differentiable, allowing the &#8220;traffic plan&#8221; of the network to be optimized end-to-end.</p><h4>Why Normalization is the Secret Weapon</h4><p>Why does forcing the rows and columns to sum to 1 actually help?</p><ul><li><p><strong>Conservation of Energy (Stability):</strong> If the rows sum to 1, the total input energy to a layer is fixed. This prevents <strong>Signal Explosion</strong>. If the columns sum to 1, the total output energy of any previous layer is conserved. This prevents <strong>Signal Decay</strong>.</p></li><li><p><strong>Forced Diversity (Feature Selection):</strong> Column-wise normalization is a powerful anti-mode-collapse tool. It forces the current layer to utilize <em>all</em> the information being sent from the past. A layer cannot simply &#8220;over-focus&#8221; on the immediate predecessor while ignoring the rest of the broadband highway; the math forces it to allocate its &#8220;attention budget&#8221; across the entire manifold.</p></li><li><p><strong>Geometric Robustness:</strong> Doubly stochastic matrices live on the <strong>Birkhoff Polytope</strong>, a specific geometric space whose vertices are permutation matrices. By keeping the weights in this space, mHC ensures that the network&#8217;s internal transformations are always &#8220;well-conditioned&#8221; meaning they don&#8217;t distort the data so much that the optimizer can no longer find the way back to the global minimum.</p></li></ul><p>By using Sinkhorn-Knopp as the <strong>&#8220;Arrangement Gate&#8221;</strong> for the residual highway, mHC ensures that the deep signal remains clean, structured, and informative, no matter how many &#8220;roads&#8221; (layers) are merging into the intersection.</p><div><hr></div><h1>6. Methodology</h1><p>The <em><strong>mHC</strong> methodology is a rigorous attempt to solve the &#8220;summation instability&#8221;</em> of deep networks. While previous architectures treated residual connections as a passive addition, mHC treats them as an <strong>active, constrained resource</strong>. It transforms the network from a simple chain into a <strong>sophisticated, manifold-bound graph</strong>. To appreciate the architecture of <strong>mHC</strong>, we must view it as the logical conclusion of <strong>&#8220;depth-wise message passing.&#8221;</strong> In the traditional paradigm, layers are stacked like bricks : discrete and isolated. By reframing neural depth through the lens of graph theory, we can treat the entire model as a single, fluid dynamical system where information flows across a complex topology.</p><h4>The GCN Foundation: Self-Connection and the Identity Crisis</h4><p>The conceptual journey begins with the <strong>Graph Convolutional Network (GCN)</strong>. In a GCN, the state of a node is determined by its neighbourhood. However, a pure neighbourhood aggregation often leads to the <strong>vanishing signal problem</strong>, where the node&#8217;s own original information is washed out by its neighbours. To solve this, GCNs introduce a <strong>self-connection</strong> mathematically adding the identity matrix (I) to the adjacency matrix A.</p><p>In the matrix formulation, the propagation rule for a GCN layer is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H^{(l+1)} = \\sigma \\left( \\tilde{D}^{-\\frac{1}{2}} \\tilde{A} \\tilde{D}^{-\\frac{1}{2}} H^{(l)} W^{(l)} \\right)&quot;,&quot;id&quot;:&quot;UWLXIDMYEX&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where:</p><ul><li><p><em>A = A + I</em> is the adjacency matrix augmented with self-loops.</p></li><li><p>D is the diagonal degree matrix used for normalization to keep the signal variance stable.</p></li></ul><p>If we zoom into the node-level (normal) formulation, the update for a specific node i looks like this:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_i^{(l+1)} = \\sigma \\left( \\sum_{j \\in \\mathcal{N}(i) \\cup \\{i\\}} \\frac{1}{c_{ij}} h_j^{(l)} W^{(l)} \\right)&quot;,&quot;id&quot;:&quot;ATWKTZPZMC&quot;}" data-component-name="LatexBlockToDOM"></div><p>In this view, we can interpret a deep neural network as a specialized graph where each &#8220;layer&#8221; is a node. In a standard Transformer or ResNet, the &#8220;adjacency&#8221; is restricted strictly to the immediate predecessor (i &#8594; i+1). This creates a <strong>chain graph</strong>, which is the most restrictive form of depth-wise communication.</p><h4>Transitioning to Hyper-Connections (HC): The Broadband Highway</h4><p>The <strong>Hyper-Connection (HC)</strong> framework, introduced by the DeepSeek team, was designed to break this one-to-one chain bottleneck. Instead of a passive addition (<code>x + f(x)</code>), HC treats the connection as a <strong>learnable operator</strong> that acts as a broadband gate between layers.</p><p>For a single-layer propagation, the HC update is defined as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{l+1} = H_{res}^l x_l + H_{post}^{l \\top} \\mathcal{F}(H_{pre}^l x_l, W_l)&quot;,&quot;id&quot;:&quot;TIYNYVBQIU&quot;}" data-component-name="LatexBlockToDOM"></div><p>This equation decomposes the &#8220;residual update&#8221; into three distinct, learnable components:</p><ol><li><p><strong>The Pre-mapping (H_pre):</strong> This acts as an <strong>input filter</strong>. It projects the incoming residual stream x_l into a specific manifold optimal for the non-linear transformation F (the Attention or MLP block). This ensures the &#8220;innovation&#8221; part of the layer isn&#8217;t fighting against the raw signal.</p></li><li><p><strong>The Innovation Function (F):</strong> This is the core engine of the layer. It processes the filtered input to generate new semantic insights.</p></li><li><p><strong>The Post-mapping (H_post):</strong> This acts as an <strong>output gate</strong>. It determines how much of the new &#8220;innovation&#8221; should be allowed back into the main residual stream.</p></li><li><p><strong>The Residual Mapping (H_res):</strong> This is the most critical part. Unlike a standard ResNet where this is a hard-coded 1, in HC, <em>H_{res}</em> is a learnable matrix. It essentially &#8220;learns&#8221; its own identity path, deciding how much of the original signal should be preserved or modulated as it moves forward.</p></li></ol><h4>The mHC Refinement: Manifold-Constrained Evolution</h4><p>While vanilla HC provides unprecedented flexibility, it introduces a new set of problems: <strong>mathematical drift/instability and mode collapse</strong>. Without constraints, the learnable <em>H_res </em>matrix can deviate too far or too less from an identity mapping, causing the same vanishing/exploding gradient problems that ResNets were designed to fix.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P5FL%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P5FL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 424w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 848w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 1272w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P5FL%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png" width="1076" height="735" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:735,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:161478,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!P5FL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 424w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 848w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 1272w, https://substackcdn.com/image/fetch/$s_!P5FL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be63cbf-83de-441e-844f-3cf3bbc628d8_1076x735.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>mHC (Manifold-constrained Hyper-Connections)</strong> restores this stability by locking these mappings to a specific mathematical manifold. To achieve this, we first vectorize the input hidden matrix, ensuring the model can capture global context across both sequence length and feature depth.</p><p>We then derive the raw, unconstrained mappings using learnable projections(phi) and scaling factors (alpha):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{cases} \\tilde{H}_{pre}^l = \\alpha_{pre}^l \\cdot (\\vec{x}&#8217;_l \\phi_{pre}^l) + b_{pre}^l \\\\ \\tilde{H}_{post}^l = \\alpha_{post}^l \\cdot (\\vec{x}&#8217;_l \\phi_{post}^l) + b_{post}^l \\\\ \\tilde{H}_{res}^l = \\alpha_{res}^l \\cdot \\text{mat}(\\vec{x}&#8217;_l \\phi_{res}^l) + b_{res}^l \\end{cases}&quot;,&quot;id&quot;:&quot;VSNETQPKFZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>To turn these raw &#8220;suggestions&#8221; into stable connections, mHC applies two levels of manifold projection:</p><p><strong>A. Linear Stability (The Sigmoid Gates):</strong></p><p>The pre and post mappings are passed through a Sigmoid activation:</p><ul><li><p><em>H_pre = sigma * H_pre</em></p></li><li><p><em>H_post = 2*sigma * H_post</em></p><p>The factor of 2 in <em>H_post</em> is a clever trick to allow the innovation to potentially &#8220;double&#8221; the signal strength while still maintaining a hard upper bound, preventing the runaway amplification seen in unconstrained networks.</p></li></ul><p><strong>B. Structural Stability (The Sinkhorn-Knopp Manifold):</strong></p><p>The residual mapping <em>H_res</em> is forced onto the Doubly Stochastic Manifold via the Sinkhorn-Knopp operator (which we discussed above):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H_{res}^l = \\text{Sinkhorn-Knopp}(\\exp(\\tilde{H}_{res}^l))&quot;,&quot;id&quot;:&quot;NZEMRYSCXS&quot;}" data-component-name="LatexBlockToDOM"></div><p>By applying Sinkhorn-Knopp, mHC ensures that H_res is a matrix where every row and column sums to 1. In the language of GCNs, this means the <strong>&#8220;self-connection&#8221; is perfectly normalized.</strong> This creates a <strong>guaranteed identity mapping path</strong>: at the start of training, H_res acts as a perfect pass-through. As the model learns, H_res can &#8220;shift&#8221; the signal across the manifold, but it can never &#8220;lose&#8221; the signal or let it explode. The &#8220;highway&#8221; remains wide, but the traffic is perfectly balanced by the laws of Optimal Transport.</p><p>Beyond the graph-theoretic view, the <strong>mHC</strong> architecture can be interpreted as a dynamic, depth-wise denoising <strong>Autoencoder</strong>. In a standard Transformer, each layer&#8217;s residual path is a static identity; in mHC, the residual path is a <strong>learnable manifold projection</strong>.</p><h4>The Constraint as a Discrete Bottleneck (VQ-VAE Logic)</h4><p>You can think about this from this perspective as well; In a <strong>Vector Quantized Variational Autoencoder (VQ-VAE)</strong>, the model is forced to map continuous features to a discrete &#8220;codebook.&#8221; This bottleneck prevents the model from simply copying noise and forces it to extract the most salient, meaningful features.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21X4Da%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X4Da!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 424w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 848w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 1272w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21X4Da%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png" width="1456" height="620" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:620,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Understanding VQ-VAE (DALL-E Explained Pt. 1)&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Understanding VQ-VAE (DALL-E Explained Pt. 1)" title="Understanding VQ-VAE (DALL-E Explained Pt. 1)" srcset="https://substackcdn.com/image/fetch/$s_!X4Da!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 424w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 848w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 1272w, https://substackcdn.com/image/fetch/$s_!X4Da!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e37c4cc-f94a-49b0-8b5b-ca87c231ca96_1600x681.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>mHC</strong> implements a similar logic but in a continuous, differentiable space:</p><ul><li><p><strong>The &#8220;Codebook&#8221; of Lanes:</strong> If we have N potential residual lanes, the <strong>Sinkhorn-Knopp</strong> algorithm acts as the &#8220;codebook assigner.&#8221;</p></li><li><p><strong>Hard Diversity Constraint:</strong> By forcing the connection matrix to be doubly stochastic, the model cannot map all information into a single high-variance lane (mode collapse). It is mathematically forced to distribute feature importance across the available connection slots.</p></li><li><p><strong>Latent Regularization:</strong> Just as a VAE uses a KL-Divergence term to keep the latent space near a prior distribution, mHC uses the <strong>Manifold Constraint</strong> to keep the layer-to-layer &#8220;transport&#8221; near a stable, identity-preserving prior.</p></li></ul><h4>Dynamic Feature Selection and Signal Denoising</h4><p>We can view the triplet of H_pre&#8203;, H_post&#8203;, and H_res&#8203; as a <strong>constrained</strong> <strong>feature selection engine as well</strong>:</p><ol><li><p><strong>Selection (H_pre&#8203;):</strong> The model &#8220;decides&#8221; which previous features are relevant for the current transformation.</p></li><li><p><strong>Innovation (H_res&#8203;):</strong> This is the residual &#8220;delta.&#8221; Because it is constrained by the Sinkhorn operator, the model cannot inject arbitrary magnitude. It must select the &#8220;innovation&#8221; that is most orthogonal to the existing signal.</p></li><li><p><strong>Denoising via Optimal Transport:</strong> In high-dimensional spaces, noise grows exponentially. Optimal Transport (Sinkhorn) acts as a <strong>denoising filter</strong>. By finding the &#8220;minimum effort&#8221; path to transport mass from input to output, the model naturally ignores high-frequency noise that doesn&#8217;t contribute to the global feature distribution.<br>[DAE image]</p></li></ol><p>In this setup, training an LLM shifts from a process of <strong>accumulation</strong> (adding layer after layer) to a process of <strong>allocation</strong>. The model learns to manage its internal &#8220;bandwidth.&#8221;</p><p>If a certain feature is no longer useful, the Sinkhorn-Knopp weights will naturally &#8220;transport&#8221; its importance toward zero, freeing up that manifold capacity for new innovations. This makes mHC not just a deeper architecture, but a <strong>sparser, more efficient one</strong>, it performs feature selection <em>at the architectural level</em> rather than relying solely on the weights of the MLP. </p><p><em><strong>That said, we covered a lot of core topics, but, in one line; mHC relies on smoothening (sigmoid) and constraining (optimal transport) to tackle the issues with drift, stability and feature quality. ;-D</strong></em></p><div><hr></div><h1>7. Results</h1><p>The transition from theory to practice is where <strong>mHC</strong> proves its worth. DeepSeek evaluated this architecture across three model scales : <strong>3B, 9B, and 27B parameters</strong>; comparing the standard Transformer baseline, the unconstrained Hyper-Connection (HC), and the proposed Manifold-Constrained version (mHC).</p><h3>The Stability Breakthrough</h3><p>The most immediate and dramatic result was the restoration of numerical stability. In deep networks, we measure the <strong>Amax Gain Magnitude</strong>, which tracks how much the signal is amplified as it passes through the residual stacks.</p><ul><li><p><strong>The HC Crisis:</strong> In a 27B parameter model, unconstrained HC signals reached an amplification factor of <strong>~3000x</strong>. This caused catastrophic divergence, manifesting as massive loss spikes and gradient explosions around the 12,000th training step.</p></li><li><p><strong>The mHC Solution:</strong> By forcing the mixing matrices into the Birkhoff Polytope (doubly stochastic manifold), mHC kept the total gain magnitude bounded at <strong>~1.6x</strong>.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KBSd%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KBSd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 424w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 848w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 1272w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KBSd%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png" width="1072" height="463" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:463,&quot;width&quot;:1072,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:162847,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KBSd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 424w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 848w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 1272w, https://substackcdn.com/image/fetch/$s_!KBSd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc54ec8ee-b5f9-4179-8496-f7b7d4fa7a8e_1072x463.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This three-order-of-magnitude reduction in signal amplification allowed mHC to train with the smooth, well-behaved gradients of a classic ResNet, but with the representational richness of an N-order system.</p><h3>Benchmark Performance: Reasoning Gains</h3><p>Beyond stability, mHC delivered tangible improvements across downstream tasks. The gains were most pronounced in <strong>reasoning-intensive</strong> benchmarks, where the &#8220;multi-lane&#8221; information flow allows the model to maintain more complex internal states.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21sqIW%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sqIW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 424w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 848w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 1272w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21sqIW%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png" width="1072" height="360" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:1072,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:100668,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sqIW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 424w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 848w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 1272w, https://substackcdn.com/image/fetch/$s_!sqIW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a8f687-818c-47ae-a1f8-c13e2ff91bf8_1072x360.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The <strong>7.2-point jump in BBH</strong> is particularly significant; it suggests that mHC enables the model to handle multi-step logical chains more effectively than standard residual streams.</p><h3>Infrastructure Efficiency: The &#8220;Negligible&#8221; Overhead</h3><p>One of the most impressive results is that this mathematical complexity costs almost nothing in terms of speed. Through custom CUDA kernels (using <strong>TileLang</strong>) and <strong>Kernel Fusion</strong>, DeepSeek minimized the memory wall.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fv7M%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fv7M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 424w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 848w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 1272w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fv7M%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png" width="1262" height="368" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:368,&quot;width&quot;:1262,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:119355,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fv7M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 424w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 848w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 1272w, https://substackcdn.com/image/fetch/$s_!fv7M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa555f5f9-42bc-4931-b8a5-d34573527897_1262x368.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Training Overhead:</strong> Despite the iterative Sinkhorn-Knopp calculations, mHC (at expansion rate n=4) added only <strong>6.7% overhead</strong> to total training time.</p></li><li><p><strong>Memory Management:</strong> Using selective recomputation and communication overlapping (extending the <strong>DualPipe</strong> scheduler), the model maintained high GPU utilization even with the expanded residual streams.</p></li></ul><h3>The Scaling Axis</h3><p>Traditionally, we scale models by adding more layers (depth) or more neurons (width). mHC introduces a third axis of scaling: Connectivity.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GVcO%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GVcO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 424w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 848w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 1272w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GVcO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png" width="1072" height="534" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:534,&quot;width&quot;:1072,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:160751,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GVcO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 424w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 848w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 1272w, https://substackcdn.com/image/fetch/$s_!GVcO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd807172-b7d4-44ce-bb2d-15b585860130_1072x534.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The results show that the performance gap between mHC and the baseline actually widens as the model size increases. This indicates that mHC is not just a &#8220;small-model trick&#8221; but a robust architecture for the next generation of trillion-parameter foundation models.</p><div><hr></div><h1>Thoughts</h1><p>While <strong>mHC</strong> represents a significant leap in architectural design, its introduction raises several subtle questions and theoretical challenges that go beyond simple benchmark numbers. To truly understand its place in the AI landscape, we must examine its limitations and the unique trade-offs it imposes.</p><ul><li><p><strong>The Birkhoff Polytope as a &#8220;Soft&#8221; Identity:</strong> In traditional ResNets, the identity mapping is a &#8220;hard&#8221; constraint (1.0). In mHC, the identity is &#8220;distributed.&#8221; Because the matrices are doubly stochastic, the model can potentially learn to &#8220;scatter&#8221; a signal across multiple parallel streams. While this increases bandwidth, it also means the signal becomes more diffused. The model must learn not just to process data, but to <strong>re-assemble it</strong> correctly after each hyper-connection junction.</p></li><li><p><strong>The &#8220;Write-Only&#8221; Memory Problem:</strong> A recent criticism (the <em>Geometric and Dynamic Scaling</em> theory) suggests that while mHC prevents signal explosion, it still operates as a <strong>monotonic accumulator</strong>. The additive nature of <em>X + F(X)</em> makes it mathematically difficult for a network to &#8220;erase&#8221; or &#8220;forget&#8221; outdated information once it has been written into the residual stream. This suggests that future iterations of mHC might need an &#8220;erasure&#8221; mechanism to prevent representational redundancy in extremely deep networks.</p></li><li><p><strong>Initialization Sensitivity:</strong> Even with Sinkhorn-Knopp, the starting point matters. If the initial raw weights are poorly distributed, the Sinkhorn process can start in a region of the manifold that is distant from the identity mapping, leading to slow early convergence. DeepSeek mitigates this with <strong>Manifold-Targeted Initialization</strong>, essentially &#8220;forcing&#8221; the model to start as a standard ResNet before it is allowed to explore more complex connectivity.</p></li></ul><ul><li><p><strong>The Engineering Tax:</strong> Although the training time overhead is reported at only <strong>6.7%</strong>, this figure is achieved through extreme optimization (Custom CUDA kernels, TileLang, and DualPipe). For smaller labs or teams without the specialized infrastructure to &#8220;fuse&#8221; these operations, the memory access overhead of a widened residual stream could easily become a bottleneck, making mHC impractical for generalized use outside of well-funded AI labs.</p></li><li><p><strong>Expansion Rate (n) Saturation:</strong> There is an open question regarding the &#8220;diminishing returns&#8221; of connectivity. At n=4, the gains are clear. However, as n increases (e.g., n=16 or 32), the complexity of the Sinkhorn-Knopp iterations and the memory traffic for the parallel streams scale linearly. It is likely that there is a &#8220;sweet spot&#8221; of connectivity beyond which the added complexity does not translate into better reasoning performance.</p></li><li><p><strong>Hardware-Algorithm Misalignment:</strong> Modern GPUs are optimized for large, dense matrix multiplications. mHC introduces many smaller, structured operations (Sinkhorn iterations, row/column scaling). This creates a tension between the <strong>mathematical elegance</strong> of the algorithm and the <strong>brute-force nature</strong> of current hardware, which might require a rethink of how we design AI accelerators.</p></li><li><p>The most profound implication of mHC is the formalization of <strong>Connectivity</strong> as a third axis for scaling LLMs, alongside <strong>Depth</strong> and <strong>Width</strong>. </p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iuyb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 424w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 848w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 1272w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21iuyb%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png" width="842" height="118" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:118,&quot;width&quot;:842,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31779,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183776837?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iuyb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 424w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 848w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 1272w, https://substackcdn.com/image/fetch/$s_!iuyb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3de43db5-00a6-40a4-829f-42d82c68193b_842x118.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>As we look toward <strong>DeepSeek-V4</strong> or similar trillion-parameter architectures, mHC provides a blueprint for models that aren't just bigger, but <strong>better connected</strong>. It suggests a future where LLMs function less like a conveyor belt and more like a fluid, self-organizing network that can dynamically route information through a high-bandwidth, manifold-constrained highway.</p></li></ul><div><hr></div><h1>Conclusion</h1><p>In its final form, <strong>mHC</strong> reframes the problem of neural depth as a dynamic allocation of information rather than a static accumulation of layers. By moving beyond the rigid, single-lane &#8220;identity&#8221; path of the past and introducing a manifold-constrained broadband highway, we gain the ability to navigate the complex landscape of high-dimensional features with mathematical precision rather than just empirical hope.</p><p>In this exploration, we began by tracing the lineage of residual connections, from the foundational &#8220;Skip-Connections&#8221; of ResNet to the &#8220;Broadband Highways&#8221; of Hyper-Connections. We then identified the <strong>&#8220;Signal Chaos&#8221; due to instability at scale and feature diversity retention</strong>; the critical limitation where unconstrained Order-N links lead to numerical explosion and mode collapse. We revisited the spectrum of graph-theoretic updates and saw how mHC unifies them by treating neural depth as a <strong>Directed Acyclic Graph (DAG)</strong>. We dissected the methodology, highlighting the <strong>Sinkhorn-Knopp algorithm</strong> as the global traffic controller and the <strong>Doubly Stochastic Manifold</strong> as the geometric safeguard that preserves the soul of the identity mapping. Finally, we looked at the results, where this rigorous &#8220;Traffic Management&#8221; translated into significant jumps in reasoning benchmarks like BBH and GSM8K, proving that a better-connected model is inherently a more capable one.</p><p>Hence, the key takeaway is that mHC is not just an incremental optimization; it is a serious attempt to <strong>integrate Optimal Transport directly into the architectural backbone of LLMs.</strong> It proves that when we move from passive summation to active, manifold-constrained allocation, we don&#8217;t just get more stable training, we get a model that truly maximizes its &#8220;thinking bandwidth.&#8221; Personally, I&#8217;m excited about the possibilities that emerge when a model no longer just stacks layers, but intelligently routes information through a perfectly balanced network of knowledge.</p><p><strong>References</strong></p><p><strong>mHC paper</strong> : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2512.24880">https://arxiv.org/pdf/2512.24880</a><br><strong>GCN</strong> : <a href="iframe.php?url=https%3A%2F%2Fjonathan-hui.medium.com%2Fgraph-convolutional-networks-gcn-pooling-839184205692">https://jonathan-hui.medium.com/graph-convolutional-networks-gcn-pooling-839184205692</a><br><strong>Optimal Transport</strong><br> - <a href="iframe.php?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FTransportation_theory_%28mathematics%29">https://en.wikipedia.org/wiki/Transportation_theory_(mathematics)</a><br> - <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2505.06589">https://arxiv.org/abs/2505.06589</a><br><strong>Sinkhorn-knopp</strong> : <a href="iframe.php?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSinkhorn%2527s_theorem">https://en.wikipedia.org/wiki/Sinkhorn%27s_theorem</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today.<br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p><p></p>]]></content:encoded></item><item><title><![CDATA[How does ACT (Action Chunking with Transformers) actually work?]]></title><description><![CDATA[Understanding the ACT architecture from scratch]]></description><link>https://vizuara.substack.com/p/how-does-act-action-chunking-with</link><guid isPermaLink="false">https://vizuara.substack.com/p/how-does-act-action-chunking-with</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Sat, 10 Jan 2026 09:52:11 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09f32c7f-ed4a-4bf4-a1c0-df044e912768_1586x646.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The ACT architecture was first described in a paper which came out in 2023:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21szkr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!szkr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 424w, https://substackcdn.com/image/fetch/$s_!szkr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 848w, https://substackcdn.com/image/fetch/$s_!szkr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 1272w, https://substackcdn.com/image/fetch/$s_!szkr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21szkr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png" width="1446" height="898" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:898,&quot;width&quot;:1446,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:943943,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!szkr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 424w, https://substackcdn.com/image/fetch/$s_!szkr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 848w, https://substackcdn.com/image/fetch/$s_!szkr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 1272w, https://substackcdn.com/image/fetch/$s_!szkr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1147de1-1dd0-4e9d-8aac-897518d6671e_1446x898.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Why did it gain attention?</h3><p>This paper showed that for the first time, AI policies can be implemented in low-cost hardware for achieving complex tasks. </p><p>Some tasks which were completed using the ACT policy included:</p><p>(1) Opening a ZipLoc bag:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!F761!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 424w, https://substackcdn.com/image/fetch/$s_!F761!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 848w, https://substackcdn.com/image/fetch/$s_!F761!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 1272w, https://substackcdn.com/image/fetch/$s_!F761!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21F761%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png" width="1456" height="260" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:260,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:627448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!F761!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 424w, https://substackcdn.com/image/fetch/$s_!F761!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 848w, https://substackcdn.com/image/fetch/$s_!F761!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 1272w, https://substackcdn.com/image/fetch/$s_!F761!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45d4c703-4337-4305-a412-a5f0b2cfd08f_1570x280.png 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><p>(2) Slot Battery:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xTTJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 424w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 848w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 1272w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xTTJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png" width="1456" height="257" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:257,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:540869,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xTTJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 424w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 848w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 1272w, https://substackcdn.com/image/fetch/$s_!xTTJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfb78f80-7276-4489-8916-ceab149d21c0_1552x274.png 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><p>(3) Open Cup:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B57_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 424w, https://substackcdn.com/image/fetch/$s_!B57_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 848w, https://substackcdn.com/image/fetch/$s_!B57_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 1272w, https://substackcdn.com/image/fetch/$s_!B57_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21B57_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png" width="1456" height="244" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:244,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:585218,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!B57_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 424w, https://substackcdn.com/image/fetch/$s_!B57_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 848w, https://substackcdn.com/image/fetch/$s_!B57_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 1272w, https://substackcdn.com/image/fetch/$s_!B57_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F663ab90e-7f5f-4965-ae64-7cc639e4d619_1538x258.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>All of these are tasks which require fine manipulation.</p><p>Have a look at the gains the policy achieved compared to other policies! Naturally, it caught attention of the Robotics community.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211kJs%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1kJs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 424w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 848w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 1272w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211kJs%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png" width="1456" height="417" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:417,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:161285,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1kJs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 424w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 848w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 1272w, https://substackcdn.com/image/fetch/$s_!1kJs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd0612d2-b156-4571-a316-cf77b01003d0_2174x622.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are innovations in both the hardware and the software side. An example of low-cost hardware, where ACT can be successfully implemented in the SO-101 Robot (a practical on this is coming soon!)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21f9q0%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f9q0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 424w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 848w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21f9q0%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg" width="900" height="506" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:506,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Hugging Face Launches the SO-101, an Upgraded Low-Cost 3D-Printable  Autonomous Robot Arm - Hackster.io&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Hugging Face Launches the SO-101, an Upgraded Low-Cost 3D-Printable  Autonomous Robot Arm - Hackster.io" title="Hugging Face Launches the SO-101, an Upgraded Low-Cost 3D-Printable  Autonomous Robot Arm - Hackster.io" srcset="https://substackcdn.com/image/fetch/$s_!f9q0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 424w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 848w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!f9q0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30c010e7-de39-4ff6-becc-c897c7d631c1_900x506.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In this article, we are going to focus on the software side of the innovation.</p><p>Once you read the paper, you realize that there are 3 things on the software side which make this policy unique:</p><p>(1) <strong>It used a Conditional Variational AutoEncoder</strong></p><p>(2) <strong>It uses a DETR-inspired Transformer Decoder</strong></p><p>(3) <strong>It uses Action Chunking</strong></p><p>Don&#8217;t worry if these words sound a bit complex, we are going to go over everything in detail!</p><div class="pullquote"><p>We will cover the architecture of the ACT policy in a series of Architecture Versions, where we will think from first principles and understand how the architecture evolves.</p></div><p>First, let us understand what we want to do:</p><blockquote><p>We want to predict the distribution of the variation of the joint angles, given the state of the robot.</p></blockquote><p><strong>Architecture Version 0:</strong></p><p>So, our first thought is that, we need the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A7AS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A7AS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 424w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 848w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 1272w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A7AS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png" width="1456" height="571" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:571,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:396599,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A7AS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 424w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 848w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 1272w, https://substackcdn.com/image/fetch/$s_!A7AS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd54842fa-00dc-48e0-8585-b65774e464c6_2426x952.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Have a look at our article on Variational AutoEncoders here to understand the above diagram properly: https://vizuara.substack.com/p/variational-autoencoders-explained</em></p><p>This is a great start, but we can immediately see there is one major drawback of this approach.</p><p>Even if we manage to train this Variation AutoEncoder, at the end of it, we will get different actions which are the joint configurations sampled from the action space. So, the robot will move randomly.</p><p>We do not want that. We want the robot to move in a specific way for a specific robot configuration.</p><p><strong>Architecture Version 1:</strong></p><p>We want to model the distribution of the joints given the current state of the robot.</p><p>This is how we will modify our architecture:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zz4r%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zz4r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 424w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 848w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 1272w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21zz4r%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png" width="2570" height="1411" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1411,&quot;width&quot;:2570,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:685225,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f67c2e1-379d-419b-82e5-1945f80675f2_2570x1614.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zz4r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 424w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 848w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 1272w, https://substackcdn.com/image/fetch/$s_!zz4r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b945092-ae73-436a-ade4-f18cf9a4c4d7_2570x1411.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This looks like a decent setup. Just so that we can be clear, the following diagram visually represents the distribution that we are trying to predict.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-IgQ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-IgQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 424w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 848w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 1272w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-IgQ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:355077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-IgQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 424w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 848w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 1272w, https://substackcdn.com/image/fetch/$s_!-IgQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a207ffe-25ff-4925-b1c2-cc64b43aecf5_2828x1414.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There is another crucial point which comes to mind at this stage.</p><p>Don&#8217;t you think that the distribution of the joint angles not only depends on the current state of the robot but also the environment around it?</p><p>For example, if the task of the robot is to pick and place an object, then the distributions will greatly change if the robot is close to the object or not.</p><p><strong>Architecture Version 2:</strong></p><p>The environment around the robot is captured with the help of cameras. So we have images which are obtained from by these cameras.</p><p>So the final architecture that we are thinking about looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21I1fN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!I1fN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 424w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 848w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 1272w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21I1fN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png" width="1456" height="1030" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1030,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:636168,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!I1fN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 424w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 848w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 1272w, https://substackcdn.com/image/fetch/$s_!I1fN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F256ac67c-00ab-4697-bfd5-1cbda33693fb_2424x1714.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We are trying to predict the variations in the joint angles conditioned on the position of the joints as well as the images collected from the camera feeds.</p><p>This architecture is also called a <strong>Conditional Variational Autoencoder</strong>.</p><p>Now, let us understand the encoder and the decoder separately.</p><p>First, we start with the encoder.</p><p>Let us start with what first comes to our mind regarding the encoder architecture.</p><p>The following is the first architecture that comes to my mind:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dzOj%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dzOj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dzOj%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2034250,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dzOj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!dzOj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae130ae-2cba-43ca-8e95-b6f1473b5c2b_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Note that here we have conveniently ignored the input images from the camera feed.</p><p><em>This is a great start, but this is not the architecture which is used in the ACT paper.</em></p><p>The main reason is that in the ACT paper, they do not consider one single action, rather they consider a sequence of actions for a given state.</p><div class="pullquote"><p>The process of predicting a sequence of actions instead of one is called chunking.</p></div><blockquote><p>This is inspired by a neuroscience concept where individual actions are grouped together and executed as one unit, making them more efficient to store and execute.</p></blockquote><p>Intuitively, a chunk of actions could correspond to grasping a corner of the candy wrapper or inserting a battery into the slot.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219o8o%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9o8o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219o8o%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png" width="1024" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:956198,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9o8o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!9o8o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7a36472-0d8f-408b-8293-324cb7e4855e_1024x559.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This means that the encoder pipeline looks something as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFIs%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uFIs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 424w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 848w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 1272w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uFIs%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png" width="1456" height="897" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:897,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:790464,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uFIs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 424w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 848w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 1272w, https://substackcdn.com/image/fetch/$s_!uFIs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7429f43-d9ff-4bf4-aa44-443f0e236066_2728x1680.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Architecture Version 3:</strong></p><p><strong>How an MLP sees it: </strong>An MLP sees the whole sequence as one giant, flat bag of numbers. It doesn't inherently understand that Action 1 comes before Action 2. It has to learn these relationships from scratch using brute force (massive amounts of data and weights).</p><p>Hence we don't use a multi-layer perceptron. Instead, we use a transformer encoder.</p><p>So, broadly speaking, our encoder-architecture looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21G4Dm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G4Dm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 424w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 848w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 1272w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21G4Dm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png" width="1999" height="719" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:719,&quot;width&quot;:1999,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:984927,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1f956d9-0bd6-4311-a2f6-2647ad58c119_1999x1999.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!G4Dm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 424w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 848w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 1272w, https://substackcdn.com/image/fetch/$s_!G4Dm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb69567a-8517-4aea-92fd-0a4e25d9b27f_1999x719.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The transformer encoder has the following architecture:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eaAI%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eaAI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 424w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 848w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 1272w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21eaAI%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png" width="426" height="431.85164835164835" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1476,&quot;width&quot;:1456,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:378809,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eaAI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 424w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 848w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 1272w, https://substackcdn.com/image/fetch/$s_!eaAI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9d3f84-5ee1-4598-b667-c4e6928dadc7_1986x2013.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>First, the current state and the action chunk are tokenized. In this process, embedding vectors are created for each state and action vector.</p><p>These embedding vectors are then passed to the subsequent layers.</p><p>The most important layer is the attention layer, which understands the relationship between each token and generates attention scores for each pair of tokens.</p><p>These attention scores are then used to modify the values of the embedding vectors.</p><p>To generate the latent vector, all we need to focus on is the <strong>CLS token</strong> and the values which are present inside the <strong>CLS token</strong>.</p><p>Let us look at an interactive visualization to understand all the steps in detail:</p><p><a href="iframe.php?url=https%3A%2F%2Factencoder.vizuara.ai%2F">https://actencoder.vizuara.ai/</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21TxDE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TxDE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 424w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 848w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 1272w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21TxDE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif" width="1411" height="732" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:732,&quot;width&quot;:1411,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2538892,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TxDE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 424w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 848w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 1272w, https://substackcdn.com/image/fetch/$s_!TxDE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45939ebf-d9e7-41a1-8ed8-428e8b630472_1411x732.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now that we have understood how the encoder looks like, let us understand numerically what happens to the tokens as they pass through the encoder.</p><p><strong>ACT Decoder</strong></p><p>We want our ACT decoder to do something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uEGD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uEGD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 424w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 848w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 1272w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21uEGD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png" width="1456" height="972" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:972,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:164742,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uEGD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 424w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 848w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 1272w, https://substackcdn.com/image/fetch/$s_!uEGD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa15a6c42-60b0-4e3e-9c67-b483bf87fcc0_1758x1174.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You might realize that there is a problem with the above architecture.</p><p><strong>Architecture Version 4:</strong></p><p>To understand the next time steps for the robotic joints, we need the current joint positions and the inputs from the camera feeds as well.</p><p>The modified architecture looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VmAn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VmAn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 424w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 848w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 1272w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VmAn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png" width="1456" height="855" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:855,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:380516,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VmAn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 424w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 848w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 1272w, https://substackcdn.com/image/fetch/$s_!VmAn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F267d5635-025a-468c-8e05-a12ab939b2a9_2254x1324.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let us imagine a scenario, where a robot arm is positioned to pour coffee, with visual representations of both an overhead camera view and a wrist-mounted camera view.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-BQL%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-BQL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 424w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 848w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 1272w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-BQL%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png" width="298" height="298" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:298,&quot;bytes&quot;:2913318,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-BQL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 424w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 848w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 1272w, https://substackcdn.com/image/fetch/$s_!-BQL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ec1822-b3cd-46d6-9744-fa903259c5ba_2000x2000.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The robot has two eyes:</p><p><strong>(1) Overhead Camera:</strong> Looks down at the table.</p><p><strong>(2) Wrist Camera:</strong> Mounted on the robot&#8217;s hand, looking closely at the gripper.</p><p>Now consider the following situation: The robot is about to pour its arm moves over the mug:</p><p>The <strong>Overhead Camera</strong> is now blocked by the robot&#8217;s own arm (it can&#8217;t see the mug anymore).</p><p>The <strong>Wrist Camera</strong> is the only one that can see the mug now.</p><p>To understand where the mug is <em>in 3D space</em>, the robot needs to combine the information from both cameras instantly.</p><p>This is not happening in the above architecture!</p><p><strong>Architecture Version 5:</strong></p><p>This fusing of information is exactly what an encoder does.</p><p>So now we can modify the architecture of the decoder as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lA3p%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lA3p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 424w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 848w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 1272w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lA3p%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png" width="1456" height="541" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:541,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:299584,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lA3p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 424w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 848w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 1272w, https://substackcdn.com/image/fetch/$s_!lA3p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24ad6b23-437d-46d7-bacf-dd3db412b9ed_2664x990.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>First, let us understand how the fusing of this information happens, which is passed as an input to the encoder.</p><p>Let us start by focusing on the images.</p><p>Let us consider that the robot is pouring coffee from a mug. Here are the four images collected from the four cameras:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b86m%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b86m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!b86m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!b86m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!b86m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21b86m%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3599678,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b86m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!b86m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!b86m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!b86m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F43b55060-92de-4e89-bcd0-d92e9e91165d_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These 4 images are then passed through a CNN, which reduces the spatial dimension of the image to 15x20 and increases the depth to 512 dimensions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R2Pu%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!R2Pu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R2Pu%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3062874,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!R2Pu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!R2Pu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60e3ebbb-cc6a-48c0-bd4b-2573369875e3_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>An example feature map can look as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AMx7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AMx7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21AMx7%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1892138,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AMx7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!AMx7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc2eaa49-3caa-4ea0-b086-c0f06e86b873_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Next, we convert these feature maps into one single list. For that, we need to flatten the 15x20 vector into a single vector of 300 dimensions.</p><p>The flattening process looks like this. Imagine the same transformation happening for the size of 15x20.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Bs-K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Bs-K%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png" width="430" height="234.7870879120879" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:430,&quot;bytes&quot;:1182946,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Bs-K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!Bs-K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9940e9db-7cfa-43f9-9f1b-514f6b778ad8_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>So, our architecture is modified to look as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Km1F%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Km1F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Km1F%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2231648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Km1F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!Km1F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe114d1c2-a49d-43c7-9a47-37d305687589_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, totally 1200 vectors with dimensions 512 are passed to the encoder.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21owdt%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!owdt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 424w, https://substackcdn.com/image/fetch/$s_!owdt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 848w, https://substackcdn.com/image/fetch/$s_!owdt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!owdt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21owdt%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png" width="643" height="383.3269230769231" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:868,&quot;width&quot;:1456,&quot;resizeWidth&quot;:643,&quot;bytes&quot;:181505,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!owdt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 424w, https://substackcdn.com/image/fetch/$s_!owdt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 848w, https://substackcdn.com/image/fetch/$s_!owdt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!owdt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe76fb56f-0517-4f96-93a0-02c76aa11f06_1680x1002.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let us move on to understanding how the inputs for the joint positions are created.</p><p>We use a linear layer for this purpose:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21abk6%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!abk6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!abk6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!abk6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!abk6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21abk6%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1190932,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!abk6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!abk6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!abk6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!abk6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c258f40-d1c4-4838-acbe-03150e5ee0d7_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This completes the processing of the inputs which are passed to the encoder.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SVsH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SVsH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 424w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 848w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 1272w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21SVsH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png" width="1456" height="789" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:789,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:191142,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SVsH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 424w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 848w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 1272w, https://substackcdn.com/image/fetch/$s_!SVsH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff13f5108-eed0-4c51-a32a-a4850ced5011_1834x994.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What about the encoder?</p><p>As discussed before, we need the encoder because it has to synthesize all three different types of data:</p><p><strong>Visual Data (High dimensional):</strong> Pixels/Features from 4 cameras.</p><p><strong>Proprioceptive Data (Low dimensional):</strong> Precise numbers for joint angles.</p><p><strong>Latent Style (z):</strong> A abstract &#8220;instruction&#8221; on how to behave (e.g., &#8220;move fast&#8221;).</p><p>Now, all these data types are very different, and if we just stack them side-by-side, the model wouldn&#8217;t know how they relate.</p><p>So, we need some mechanism to force these modalities to talk with each other.</p><p><em>Example:</em> It links the <strong>&#8220;Gripper Token&#8221;</strong> (from Joint data) with the <strong>&#8220;Mug Handle Token&#8221;</strong> (from Camera 1).</p><p><em>Result:</em> It creates a new understanding: <em>&#8220;The gripper is currently 2cm away from the handle.&#8221;</em></p><p>This is exactly what the self-attention mechanism in the transformer architecture does. Hence, we use a transformer encoder for this.</p><p><strong>Architecture Version 6:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HXxD%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HXxD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 424w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 848w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HXxD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png" width="1408" height="1336" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1336,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:580921,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HXxD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 424w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 848w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!HXxD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66234c9c-04fa-4cad-b8c0-9dd56ae16504_1408x1336.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Have a look at the visualization below to understand this in detail:</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;6a42de17-fe04-4a89-ae0d-c49ead4728bb&quot;,&quot;duration&quot;:null}"></div><p>Now let us look at our original architecture for the ACT decoder.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210Q2v%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0Q2v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 424w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 848w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 1272w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210Q2v%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png" width="1456" height="564" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:564,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:198730,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0Q2v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 424w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 848w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 1272w, https://substackcdn.com/image/fetch/$s_!0Q2v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1065eb3f-335f-47d6-96c0-7fcfbfaf6b5a_2122x822.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now let us look at the Decoder:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218u29%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8u29!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 424w, https://substackcdn.com/image/fetch/$s_!8u29!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 848w, https://substackcdn.com/image/fetch/$s_!8u29!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 1272w, https://substackcdn.com/image/fetch/$s_!8u29!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218u29%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png" width="1456" height="703" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:703,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:117204,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8u29!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 424w, https://substackcdn.com/image/fetch/$s_!8u29!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 848w, https://substackcdn.com/image/fetch/$s_!8u29!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 1272w, https://substackcdn.com/image/fetch/$s_!8u29!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F198edd1c-d697-4f86-bb69-a88cdb71d6b0_1542x744.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But what about the keys and values?</p><p>Let us revisit the encoder architecture again:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216iIc%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6iIc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 424w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 848w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216iIc%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png" width="1456" height="794" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:794,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2439711,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6iIc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 424w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 848w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!6iIc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa958ef65-3a40-45b9-9322-aa9023fe908f_2707x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here, we can clearly see that the output of the encoder is the keys and the values which will be used by the decoder.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mK9n%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mK9n!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 424w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 848w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 1272w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mK9n%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png" width="1456" height="864" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:864,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96563,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mK9n!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 424w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 848w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 1272w, https://substackcdn.com/image/fetch/$s_!mK9n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92defcf0-df20-40ee-ae0e-1b98fdfe6587_1560x926.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, we will perform the cross-attention.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XpY3%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XpY3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 424w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 848w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 1272w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XpY3%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png" width="1456" height="816" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:816,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115571,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XpY3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 424w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 848w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 1272w, https://substackcdn.com/image/fetch/$s_!XpY3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62ec7466-7d10-49f7-8a75-42820ae85bf2_1464x820.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Once we calculate the attention scores, we will use the values to compute the context vectors.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YuxH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YuxH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 424w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 848w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 1272w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21YuxH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png" width="1456" height="741" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:741,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:148951,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YuxH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 424w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 848w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 1272w, https://substackcdn.com/image/fetch/$s_!YuxH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca6600ae-33a5-42ef-b6c3-fd04601294ab_1858x946.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These context vectors will now be updated by passing them through an MLP layer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21O5qX%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O5qX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 424w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 848w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 1272w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21O5qX%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png" width="474" height="417.32608695652175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:972,&quot;width&quot;:1104,&quot;resizeWidth&quot;:474,&quot;bytes&quot;:69807,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O5qX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 424w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 848w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 1272w, https://substackcdn.com/image/fetch/$s_!O5qX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7849e46c-168a-46b5-96fc-83f30feb9f87_1104x972.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the final step, this will be passed through a projection layer, where the 512 values will be converted to the 6 joint values. This will happen for the number of timesteps included in the action chunk (e.g: 6).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mP0u%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mP0u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 424w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 848w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 1272w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21mP0u%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png" width="1456" height="937" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:937,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:565265,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mP0u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 424w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 848w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 1272w, https://substackcdn.com/image/fetch/$s_!mP0u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f363692-ec61-4240-b05c-16752a71f402_2042x1314.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kkj9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kkj9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 424w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 848w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 1272w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21kkj9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png" width="1456" height="927" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:927,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:567622,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kkj9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 424w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 848w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 1272w, https://substackcdn.com/image/fetch/$s_!kkj9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39f589d9-014f-4cb2-a8e4-e4f7113c9d54_2044x1302.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, let us piece all of this together and see how the final architecture for the ACT Variational AutoEncoder looks like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yRLv%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yRLv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 424w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 848w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yRLv%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png" width="1456" height="457" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:457,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1381512,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yRLv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 424w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 848w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!yRLv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a276d0b-ff40-4a9a-a1c1-d80c9f74e324_3569x1120.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><strong>How is the Decoder similar to DETR?</strong></h3><p>In a standard setup, the inputs at the base of the decoder are word-token embeddings corresponding to the text the transformer is trained to generate.</p><p>By analogy with the original transformer architecture, one option would be to feed in a start-of-sequence token followed by embeddings of the actions to be predicted, effectively casting the task as next-action prediction.</p><p>However, this formulation comes with a key constraint: it requires causal attention. As a result, when predicting the action at time <em>t</em>, the model can only attend to actions up to <em>t&#8211;1</em>.</p><p>To avoid this limitation, the authors take a clever alternative route by borrowing ideas from DETR (DEtection TRansformer). This design allows the decoder to reason over the entire output sequence at once, free from the restrictions imposed by causal masking.</p><p>Have at look at this video, which talks about the intuition behind DETR:</p><div id="youtube2-WGlXhQKXh5c" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;WGlXhQKXh5c&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="iframe.php?url=https%3A%2F%2Fwww.youtube-nocookie.com%2Fembed%2FWGlXhQKXh5c%3Frel%3D0%26amp%3Bautoplay%3D0%26amp%3Bshowinfo%3D0%26amp%3Benablejsapi%3D0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><div class="pullquote"><p>During training, both the transformer encoder and decoder networks are trained. However, during testing, we discard the encoder and only use the transformer decoder. </p></div><p>The value of the latent variable (z) is set to 0 during inference, for deterministic trajectories.</p><p>It&#8217;s like telling the encoder&#8211;decoder transformer at inference time: <em>you&#8217;ve already learned from a vast range of trajectories&#8212;now just focus on taking me from point A to point B. The uniqueness of the path no longer matters.</em></p><p>The training loop for the ACT Policy looks as follows:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2WbD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 424w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 848w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 1272w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212WbD%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif" width="1098" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:213,&quot;width&quot;:1098,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:963879,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183635076?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2WbD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 424w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 848w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 1272w, https://substackcdn.com/image/fetch/$s_!2WbD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cde59c4-bb0d-4567-a3dd-eb0c1b1f1f61_1098x213.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>That&#8217;s it! </p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: https://robotlearningbootcamp.vizuara.ai/</p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>:  <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[What exactly is Denoising Score Matching? ]]></title><description><![CDATA[What is Denoising Score Matching? Why is it central to Diffusion Models?]]></description><link>https://vizuara.substack.com/p/what-exactly-is-denoising-score-matching</link><guid isPermaLink="false">https://vizuara.substack.com/p/what-exactly-is-denoising-score-matching</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Wed, 07 Jan 2026 09:48:47 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A9a-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the previous article, we had looked at the technique of score matching where the objective was to match the predicted score function with the true score function.</p><p>Here is the link to the article: <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fenergy-based-models-score-matching">https://vizuara.substack.com/p/energy-based-models-score-matching</a></p><p>We encountered a challenge where we thought that since we do not know the true score function, how can we ever match our predicted score with it?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j5CW%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j5CW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 424w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 848w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 1272w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21j5CW%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png" width="1456" height="1280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1561160,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j5CW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 424w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 848w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 1272w, https://substackcdn.com/image/fetch/$s_!j5CW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8306e37d-07a3-4346-b2f3-e0a101b15643_2132x1875.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This paper came to the rescue where we found an alternative loss function that only requires the data samples.</p><p>This loss function looked as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{L_{SM}}(\\phi) = Tr (\\nabla_{x}s_{\\phi}(x)) + \\frac{1}{2}||s_{\\phi}(x)||^{2}&quot;,&quot;id&quot;:&quot;HCPYYHVWQN&quot;}" data-component-name="LatexBlockToDOM"></div><p>We looked at an example where, for a given set of data samples, we learned to find a score function using the above formulation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21TECE%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TECE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 424w, https://substackcdn.com/image/fetch/$s_!TECE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 848w, https://substackcdn.com/image/fetch/$s_!TECE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!TECE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21TECE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png" width="1456" height="617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:617,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1438780,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TECE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 424w, https://substackcdn.com/image/fetch/$s_!TECE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 848w, https://substackcdn.com/image/fetch/$s_!TECE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!TECE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbcd2b8d-34d6-4b8b-b46a-13704de09c8a_2424x1028.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is excellent, but this technique is not used in practice. Let us understand why.</p><p>To calculate the trace of a matrix of dimension D, we need to calculate all the elements of the matrix which are D x D.</p><p>The order of complexity scales as the square of the dimension of the matrix. This becomes extremely computationally expensive for larger matrices.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wgeV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wgeV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 424w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 848w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 1272w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wgeV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png" width="1456" height="1361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1361,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:997004,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wgeV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 424w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 848w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 1272w, https://substackcdn.com/image/fetch/$s_!wgeV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93d83bea-f72c-48bf-8d1d-47aa03db48c7_2068x1933.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This technique was introduced by Pascal Vincent in 2010.</p><p>What Pascal Vincent said was very interesting. To understand what he said, let us take a practical example:</p><blockquote><p>Imagine you have a tabletop. There are invisible magnets hidden at specific spots on this table. These magnets represent your <strong>Real Data.</strong></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JYJO%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JYJO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 424w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 848w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 1272w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JYJO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png" width="1456" height="613" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:613,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2059075,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JYJO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 424w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 848w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 1272w, https://substackcdn.com/image/fetch/$s_!JYJO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F658cd6ae-28b0-4303-8265-6eda0980b95d_2142x902.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Your goal is to draw a map of the magnetic field that tells you, for any point on the table, which direction the nearest magnet is pulling.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R9b-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!R9b-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 424w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 848w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 1272w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21R9b-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png" width="1456" height="597" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:597,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2064184,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!R9b-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 424w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 848w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 1272w, https://substackcdn.com/image/fetch/$s_!R9b-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb76e91df-8314-485c-9391-feb63d4d8c27_2122x870.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you just look at the empty table, you can't calculate the magnetic field. You don't know where the magnets are or how strong they are.  For example, there might be more magnets than you see and you do not know the magnetic field at all places.</p><p>Okay, now we do a small trick:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A9a-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A9a-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21A9a-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5250892,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A9a-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!A9a-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2852bb17-d200-42c2-a24d-f9fdf8dc7fae_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We place a metal ball exactly on top of a hidden magnet. We flick the ball in a random direction. It rolls away and stops at a new, random spot. This is the <strong>Noisy Data.</strong></p><p>Next, we bring in a student:</p><ul><li><p>We show the student the ball&#8217;s new location</p></li><li><p>We hide the original magnet location</p></li><li><p>We ask the student, &#8220;Draw an arrow representing the force needed to pull this ball back to where it started.&#8221;</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tk3Z%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tk3Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tk3Z%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3686151,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tk3Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!tk3Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c60e7e5-bb82-416b-94de-ed2a91f9b724_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The student has no idea where this noisy data came from.</p><p>But we know where it came from.</p><div class="pullquote"><p>So if we can give the student feedback based on the student's prediction and our knowledge, we can teach the student how to draw the force to pull the ball back to the starting point for every possible noisy data in the field.</p></div><p>So through this process, wouldn't the student learn the magnetic field at all points in the field?</p><p>Now, let us look at how this analogy relates to Vincent's ideas in his paper.</p><p>The hidden magnets in the analogy represent the real, clean data points. This is denoted by the following symbol:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{data}(x)&quot;,&quot;id&quot;:&quot;GVZRZKLAZO&quot;}" data-component-name="LatexBlockToDOM"></div><p>The "flick" represents noise added to the clean data points. The noisy data (ball's new spot) is represented as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{x}&quot;,&quot;id&quot;:&quot;CYZCXDGMOT&quot;}" data-component-name="LatexBlockToDOM"></div><p>The probability distribution of the noisy data is represented as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\sigma}(\\tilde{x})&quot;,&quot;id&quot;:&quot;CXQHRZYLID&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, sigma represents the noise added to the data.</p><p>The student represents the neural network trying to guess the direction back to the magnet. This is represented as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s_{\\phi}(\\tilde{x})&quot;,&quot;id&quot;:&quot;GYTUSNPIZB&quot;}" data-component-name="LatexBlockToDOM"></div><p>The correct arrow from the original data to the noisy data denotes the score function for the distribution of noisy data, it is denoted as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\nabla_{x}\\text{log}p_{\\sigma}(\\tilde{x} | x)&quot;,&quot;id&quot;:&quot;WNAFJHYHJS&quot;}" data-component-name="LatexBlockToDOM"></div><p>Hence the loss function boils down to the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L_{DSM} = \\frac{1}{2}||s_{\\phi}(x) - \\nabla_{x}\\text{log}p_{\\sigma}(\\tilde{x} | x)||^{2}&quot;,&quot;id&quot;:&quot;SPXRQWMWBX&quot;}" data-component-name="LatexBlockToDOM"></div><p><em>The conditioning technique (probability of the noisy data, given the original data) also appears in the variational view of diffusion models in DDPM.</em></p><p>We can actually simplify this further to get a very simple loss formulation:</p><p>If we assume that the noise is Gaussian, we can simplify the score function, which we want to learn.</p><p>If we add a Gaussian noise with variance &#963;^2 to each data point, then we can write the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{x} = x + \\sigma \\epsilon&quot;,&quot;id&quot;:&quot;JSXHTHJHEE&quot;}" data-component-name="LatexBlockToDOM"></div><p>Let us consider the Batman example, which we have looked at in some of the previous articles as well:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OU-d%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OU-d!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 424w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 848w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 1272w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OU-d%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png" width="1444" height="1462" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1462,&quot;width&quot;:1444,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:529285,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OU-d!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 424w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 848w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 1272w, https://substackcdn.com/image/fetch/$s_!OU-d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1f60ddd-4a68-4071-9b57-ae5738851280_1444x1462.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="pullquote"><p>In this image, what we have done is we have taken a pixel from the Batman image and then added noise to that pixel. The addition of noise is done by sampling using a Gaussian distribution with the same mean as the pixel value and the standard deviation as the noise level. </p></div><p>We do a sequence of mathematical steps below to calculate the target for our loss function (it is not complicated, trust me!)</p><p>First, we write down the probability distribution for noisy sample, given the original sample as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\sigma}(\\tilde{x}|x) = \\frac{1}{\\sqrt{2\\pi}}e^{-\\frac{(\\tilde{x} - x)^{2}}{2\\sigma^{2}}}&quot;,&quot;id&quot;:&quot;CWOTGSCXBV&quot;}" data-component-name="LatexBlockToDOM"></div><p>This formula comes from the Gaussian distribution formula.</p><p>Now, if we take the logarithm of the above and then take the derivative, we get the following: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\nabla_{x}\\text{log}p_{\\sigma}(\\tilde{x} | x) = \\frac {x - \\tilde{x}}{\\sigma^{2}}&quot;,&quot;id&quot;:&quot;DIVDHLMKZE&quot;}" data-component-name="LatexBlockToDOM"></div><p>Hence the Denoising Score Matching loss simplifies to:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L_{DSM} = \\frac{1}{2}||s_{\\phi}(x) - \\frac{x - \\tilde{x}}{\\sigma^{2}}||^{2}&quot;,&quot;id&quot;:&quot;DSMFBVJRYO&quot;}" data-component-name="LatexBlockToDOM"></div><p><em>This objective function tells you that you are training your score function to predict the noise which is added to create the noisy distribution.</em></p><p>In the context of our previous example, this means that you are trying to guess the direction of the flick.</p><p>Doesn't this remind you of Denoising Diffusion Probabilistic Models (DDPM) where we came to the same conclusion towards the end? [Refer to this article written by us: <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fwhat-exactly-are-diffusion-models">https://vizuara.substack.com/p/what-exactly-are-diffusion-models</a>]</p><p>Let us take a practical example to understand how this is implemented:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215C7E%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5C7E!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 424w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 848w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 1272w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215C7E%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png" width="1456" height="445" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:445,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:173869,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5C7E!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 424w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 848w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 1272w, https://substackcdn.com/image/fetch/$s_!5C7E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56b0b21d-8377-41b5-9fb0-6f8c2d22054c_2288x700.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We will be using the method of Denoising Score Matching to predict the score function for this data distribution:</p><p>Here is the link to the Google Colab notebook which is used for this practical:</p><p><a href="iframe.php?url=https%3A%2F%2Fmiro.com%2Fapp%2Fboard%2FuXjVGV4CZTM%3D%2F%3Fshare_link_id%3D761394004969">Google Colab Notebook for Denoising Score Matching</a> </p><p>This is how our learned score function behaves after the training is completed:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rM1X%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rM1X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 424w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 848w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rM1X%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png" width="1456" height="818" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:818,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:356758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rM1X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 424w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 848w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!rM1X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff93576e3-a7b1-4fbc-b13e-0324753517c5_2667x1499.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This looks correct because the arrows are pointing towards the direction of the data.</p><p>You might have guessed what we are about to do next.</p><p>Once the score function is learned, let us sample from it using Langevin Dynamics.</p><p>We have already seen the formula for this, which looks as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{x}_{n+1} = \\tilde{x}_{n} + \\eta s_{\\phi}(\\tilde{x}_{n}) + \\sqrt{2\\eta} \\epsilon_{n}&quot;,&quot;id&quot;:&quot;OUQOPTNRUH&quot;}" data-component-name="LatexBlockToDOM"></div><p> This is our &#8220;drunker hiker&#8221; who is taking steps to move towards the data samples. See the image below:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rnGB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rnGB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 424w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 848w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1272w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rnGB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png" width="1456" height="831" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:831,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rnGB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 424w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 848w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1272w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p> On applying Langevin Dynamics to the above example, this is what we get:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21h5T4%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!h5T4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 424w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 848w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 1272w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21h5T4%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png" width="1456" height="787" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:787,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:419269,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183768823?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!h5T4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 424w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 848w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 1272w, https://substackcdn.com/image/fetch/$s_!h5T4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5324ccb4-9260-41a2-a048-277597309c04_2720x1470.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The generated distribution does not match the true distribution perfectly with the density, but you can see the two peaks located at the same location as that of the true data distribution, which is exactly what we want.</p><p>That&#8217;s it! </p><p>Here is the link to the original paper which introduced <em>DSM (Denoising Score Matching): <a href="iframe.php?url=https%3A%2F%2Fwww.iro.umontreal.ca%2F%7Evincentp%2FPublications%2Fsmdae_techreport.pdf">https://www.iro.umontreal.ca/~vincentp/Publications/smdae_techreport.pdf</a></em></p><p>For more detailed proofs, please refer to the book: <em>The Principles of Diffusion Models From Origins to Advances (<a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2510.21890">https://arxiv.org/abs/2510.21890</a>) [Pages 68-79]</em></p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: https://robotlearningbootcamp.vizuara.ai/</p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[The Transformer Architecture - Application to Robotics]]></title><description><![CDATA[We have a detailed look at the transformer encoder and decoder architecture. Then we will look at Vision Transformers and their importance in the field of Robotics.]]></description><link>https://vizuara.substack.com/p/the-transformer-architecture-application</link><guid isPermaLink="false">https://vizuara.substack.com/p/the-transformer-architecture-application</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Sat, 03 Jan 2026 08:22:10 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Grys%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Let us say that our task is to teach AI a simple rule: Swap the adjective and the noun.</p><p>For example:</p><p><strong>Input</strong>: red car</p><p><strong>Output</strong>: car red</p><p>How will you solve this problem?</p><p>Let us understand how we can do this using the transformer architecture.</p><p>First we look at the Transformer Encoder.</p><h3>Transformer Encoder</h3><p><strong>Step 1: Our Vocabulary</strong></p><p>First, we will create our vocabulary:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dbQG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 424w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 848w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 1272w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dbQG%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png" width="1456" height="100" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2563f294-ba69-4219-a38c-0809994279d1_7615x525.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:100,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:542805,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dbQG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 424w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 848w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 1272w, https://substackcdn.com/image/fetch/$s_!dbQG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2563f294-ba69-4219-a38c-0809994279d1_7615x525.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>It looks like we have, 8+8=16 words (tokens) in our vocabulary space.</p><p>However, we need to some more tokens known as &#8220;special tokens&#8221;</p><p>These are the special tokens which we will use:</p><p><em>&lt;bos&gt;: Tells the decoder to start generating</em></p><p><em>&lt;eos&gt;: Tells the decoder to stop generating</em></p><p><em>&lt;pad&gt;: Used to make all sentences in a batch of same length</em></p><p><strong>Step 2: Create Embeddings</strong></p><p>Next, we create embeddings for our tokens. There are two types of embeddings - position embeddings and token embeddings.</p><p>For example, if we consider the token &#8220;red&#8221;, after applying the embedding transformation, it might look as follows (we are assuming an embedding dimension of 3):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pHBV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pHBV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 424w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 848w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 1272w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pHBV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png" width="448" height="318.2145922746781" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:662,&quot;width&quot;:932,&quot;resizeWidth&quot;:448,&quot;bytes&quot;:27448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pHBV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 424w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 848w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 1272w, https://substackcdn.com/image/fetch/$s_!pHBV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dcf8217-26dd-4836-ba2b-996511304a75_932x662.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Step 3: Convert each embeddings to queries, keys and values</strong></p><p>Every embedding is converted to queries, keys, and values. This can be represented visually as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ZH1_%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZH1_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 424w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 848w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 1272w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ZH1_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png" width="1456" height="437" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:437,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:90925,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZH1_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 424w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 848w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 1272w, https://substackcdn.com/image/fetch/$s_!ZH1_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae36186a-85d1-4da7-ae74-4b5669b2f9da_2204x662.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Step 4: Calculate the attention matrix</strong></p><p>We can represent the attention matrix schematically as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219WrM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9WrM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 424w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 848w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 1272w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219WrM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png" width="292" height="340.1871921182266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:946,&quot;width&quot;:812,&quot;resizeWidth&quot;:292,&quot;bytes&quot;:70969,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9WrM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 424w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 848w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 1272w, https://substackcdn.com/image/fetch/$s_!9WrM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9efee8f9-bcc4-46d5-bf3a-5d44b33fd16d_812x946.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The color of the circle represents the magnitude of the attention scores. So, a brighter color means a larger attention score, and a lighter color means a lower attention score. These values lie between 0 and 1.</p><p><strong>Step 5: Getting the context vectors</strong></p><p>Once we have obtained the attention scores, we can now combine them with the values for all the tokens to get the context vector representing each token.</p><p>This can be represented schematically as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yJBi%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yJBi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 424w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 848w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 1272w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yJBi%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png" width="1364" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1364,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:80647,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yJBi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 424w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 848w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 1272w, https://substackcdn.com/image/fetch/$s_!yJBi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32645011-382c-4708-82c8-fb8b5c5d9f89_1364x728.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Observe what we are doing here very closely. For the token corresponding to the word &#8220;The,&#8221; we are adding all the attention values corresponding to the query &#8220;The&#8221;, and then multiplying each of them with the value vectors.</p><p> The final context vectors for all the tokens would look visually as something as follows (assuming the dimension is three):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216Pc0%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Pc0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 424w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 848w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 1272w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216Pc0%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png" width="1456" height="664" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:664,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:69388,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6Pc0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 424w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 848w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 1272w, https://substackcdn.com/image/fetch/$s_!6Pc0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8d7c6f6-c97d-4db5-9391-39b576b3f165_1654x754.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Step 6: Passing the context vectors to the Feed-Forward Neural Network</strong></p><p>In the next step, we pass all these context vectors to a feed-forward neural network which first increases the dimensions of these vectors and then again brings it down.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lB14%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lB14!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 424w, https://substackcdn.com/image/fetch/$s_!lB14!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 848w, https://substackcdn.com/image/fetch/$s_!lB14!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 1272w, https://substackcdn.com/image/fetch/$s_!lB14!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lB14%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png" width="1456" height="798" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:798,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:107024,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lB14!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 424w, https://substackcdn.com/image/fetch/$s_!lB14!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 848w, https://substackcdn.com/image/fetch/$s_!lB14!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 1272w, https://substackcdn.com/image/fetch/$s_!lB14!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F052312c8-fee0-44e2-adb4-2519725ea17e_2076x1138.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We can see here that first we increase the dimensions for all the tokens to 6, and then again bring them down to 3.</p><p>Here is how we can visualize these steps in a single diagram:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KLUB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KLUB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 424w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 848w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 1272w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KLUB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png" width="486" height="436.9326923076923" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1309,&quot;width&quot;:1456,&quot;resizeWidth&quot;:486,&quot;bytes&quot;:185644,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KLUB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 424w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 848w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 1272w, https://substackcdn.com/image/fetch/$s_!KLUB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe86c0f9c-82b2-4cf6-b8ca-9742b47be8b9_1628x1464.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What we have until now is the Transformer Encoder. The goal of the Encoder is to read the source sentence (red car) and create a rich numerical representation of it, that understands the context of each word.</p><p>In the paper &#8220;Attention is All You Need&#8221;, which introduced Transformers to the world, they used the following schematic to represent the encoder:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NkM9%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NkM9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 424w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 848w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 1272w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21NkM9%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png" width="232" height="413.27457627118645" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1051,&quot;width&quot;:590,&quot;resizeWidth&quot;:232,&quot;bytes&quot;:244091,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc57b5628-5687-4ca6-9a1f-6c559fac1e55_624x1100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NkM9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 424w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 848w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 1272w, https://substackcdn.com/image/fetch/$s_!NkM9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45735aaa-f07b-403a-ba71-04ef51505998_590x1051.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But just encoding the sentences is not enough, we need something which gives us the desired output: &#8220;Swapping the adjective and noun&#8221;, in our case.</p><p>Which brings us to the Transformer Decoder.</p><h3>Transformer Decoder</h3><p> Let us say the input to the decoder is the following:</p><p>&lt;bos&gt; car</p><p>We know that the next word it should predict it red, because we want to swap the input (red car).</p><p><strong>Step 1: Self Attention</strong></p><p>In this step, every token in the input sequence attends to itself. </p><p>First, we calculate the query, keys and values for all tokens:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Euzi%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Euzi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 424w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 848w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 1272w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Euzi%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png" width="1456" height="551" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:551,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:59022,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Euzi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 424w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 848w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 1272w, https://substackcdn.com/image/fetch/$s_!Euzi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b609808-7a98-4963-a91b-84e65e9df7e3_1506x570.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The next step is to calculate the attention matrix:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M4DF%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M4DF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 424w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 848w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 1272w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21M4DF%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png" width="372" height="284.84057971014494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:634,&quot;width&quot;:828,&quot;resizeWidth&quot;:372,&quot;bytes&quot;:51275,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!M4DF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 424w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 848w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 1272w, https://substackcdn.com/image/fetch/$s_!M4DF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ffeee3c-8064-4247-a8ae-b22575f144c4_828x634.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Then we find the context vector for the &#8220;car&#8221; token by using its attention values and multiplying them by the value vectors:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lNfE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 424w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 848w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 1272w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lNfE%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png" width="528" height="120.89236790606654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7515775-e990-4018-a923-a3c205fa795d_1022x234.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:234,&quot;width&quot;:1022,&quot;resizeWidth&quot;:528,&quot;bytes&quot;:18756,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lNfE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 424w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 848w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 1272w, https://substackcdn.com/image/fetch/$s_!lNfE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7515775-e990-4018-a923-a3c205fa795d_1022x234.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p> We have already seen these steps in the Transformer Encoder.</p><p> After this comes a very unique step, which is called &#8220;cross-attention&#8221;</p><p><strong>Step 2: Cross-Attention</strong></p><p>In the cross-attention layer, the query comes from the decoder side, but the keys and values come from the encoder side. </p><p>In the above example, we will use the context vector for the &#8220;car&#8221; token to calculate the query, but the keys and values will come from the encoder. Let us look at the visualization below to understand this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21031M%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!031M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 424w, https://substackcdn.com/image/fetch/$s_!031M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 848w, https://substackcdn.com/image/fetch/$s_!031M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!031M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21031M%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png" width="1456" height="706" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:706,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127181,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!031M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 424w, https://substackcdn.com/image/fetch/$s_!031M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 848w, https://substackcdn.com/image/fetch/$s_!031M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!031M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9f0e3147-7f88-4fd3-b32b-c6cab07e9cbd_2364x1146.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Once the query, keys and values have been computed, we can calculate the attention scores:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!49PO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 424w, https://substackcdn.com/image/fetch/$s_!49PO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 848w, https://substackcdn.com/image/fetch/$s_!49PO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 1272w, https://substackcdn.com/image/fetch/$s_!49PO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2149PO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png" width="440" height="177.18120805369128" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:894,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:33139,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!49PO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 424w, https://substackcdn.com/image/fetch/$s_!49PO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 848w, https://substackcdn.com/image/fetch/$s_!49PO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 1272w, https://substackcdn.com/image/fetch/$s_!49PO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93457deb-4462-4073-94d3-e6cb4fc6b876_894x360.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Note that here we are trying to understand how much the token &#8220;car&#8221; relates to all the tokens in the input sentence. This is important for us because we know that the attention score for the token &#8220;red&#8221; is going to be high, since we want to swap the adjective and the nouns.</p><p>After this, we again calculate the context vector in a similar fashion like we have done a couple of times before:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0d2I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 424w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 848w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 1272w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%210d2I%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png" width="1352" height="278" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:278,&quot;width&quot;:1352,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26072,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0d2I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 424w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 848w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 1272w, https://substackcdn.com/image/fetch/$s_!0d2I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe59303dc-73c6-4ed4-99db-c5e2d3544c22_1352x278.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Note that here the values are coming from the encoder tokens.</p><p>You might have guessed what happens next. We pass it through the feed-forward network, just as we did with the encoder, where we increase the dimensions and then decrease them again:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219m0B%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9m0B!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 424w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 848w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 1272w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219m0B%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png" width="528" height="298.72583201267827" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:714,&quot;width&quot;:1262,&quot;resizeWidth&quot;:528,&quot;bytes&quot;:38119,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9m0B!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 424w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 848w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 1272w, https://substackcdn.com/image/fetch/$s_!9m0B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aafbf1a-e011-4d01-9b90-6a0443cd7fd5_1262x714.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The Decoder&#8217;s job is to generate the translation one word at a time, using the memory created by the Encoder.</p><p>What next? How do we generate the next token? </p><p>One last step is remaining:</p><p><strong>Step 3: Projection into the Vocabulary Space</strong></p><p>In this step, what we do is, we take the context vector from the previous step and then we project it into the entire vocabulary space. We look at which token has the maximum value, and we choose that as our next token. This can be visually presented as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214ZCO%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4ZCO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 424w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 848w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%214ZCO%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png" width="1456" height="930" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:930,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:145622,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4ZCO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 424w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 848w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 1272w, https://substackcdn.com/image/fetch/$s_!4ZCO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48bb146-eb4c-4746-a32e-9e0b23f33af2_1954x1248.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the paper &#8220;Attention is All You Need&#8221;, which introduced Transformers to the world, they used the following schematic to represent the decoder:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RLAj%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RLAj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 424w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 848w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 1272w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RLAj%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png" width="186" height="530.5573770491803" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1044,&quot;width&quot;:366,&quot;resizeWidth&quot;:186,&quot;bytes&quot;:169712,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RLAj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 424w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 848w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 1272w, https://substackcdn.com/image/fetch/$s_!RLAj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5a1f3ca-83b6-4d80-b6db-1aa1bdf3db50_366x1044.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We have explained the example which we started out with from scratch in a Google Colab notebook which you can use to understand the entire architecture. Here is a link to the notebook:  </p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F1Ev4Y1hfvQTPXVygz6hEMf4Bla3Wa7oXy">Google Colab Notebook: Designing Transformer Encoder and Decoder for Swapping Adjective and Nouns</a></p><p>Here is the sample output which we get:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212RzL%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2RzL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 424w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 848w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 1272w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212RzL%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png" width="1214" height="418" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:418,&quot;width&quot;:1214,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58764,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2RzL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 424w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 848w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 1272w, https://substackcdn.com/image/fetch/$s_!2RzL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b774f39-84fd-4d42-91be-79366d40401e_1214x418.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hmm..Not bad!</p><p>In the field of robotics, we will be mostly working with image-based data.</p><p>We should develop a method which can look at images and understand the context from the images.</p><p>This brings us to the topic of vision transformers.</p><h3>Vision Transformers:</h3><p>Let us understand what happens inside a Vision Transformer:</p><p>We will take an example of one of the observations collected from our robot (we use an SO-101 Robot in our company). Let us say the observation looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21szA2%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!szA2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 424w, https://substackcdn.com/image/fetch/$s_!szA2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 848w, https://substackcdn.com/image/fetch/$s_!szA2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!szA2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21szA2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png" width="1456" height="818" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:818,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3752838,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!szA2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 424w, https://substackcdn.com/image/fetch/$s_!szA2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 848w, https://substackcdn.com/image/fetch/$s_!szA2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!szA2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48a5747a-9741-4b28-aa76-2917a6dd37b2_2667x1499.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From this image, we can probably guess that the camera is mounted somewhere in front of the robotic arm, and the task that the robot is trying to perform is to place the golf ball into the orange cup.</p><p><strong>Step 1: Dividing the image into patches</strong></p><p>In the first step, we will take the image and divide it into a specific number of patches. Let us visually see how this looks like for the above observation:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vOJB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vOJB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 424w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 848w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vOJB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png" width="1456" height="821" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:821,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1667903,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vOJB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 424w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 848w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!vOJB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F454935d6-0e23-4c23-ab35-d5c628d85c48_1776x1002.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Okay, we have divided the image into 9 patches, what next?</p><p>Remember that in the transformer architecture, which we discussed before, we had a layer that converted the token into token embeddings.</p><p>But we do not have tokens here. So, what do we do instead?</p><p>What if we take the patches and convert them to patch embeddings?</p><p><em>Let us look at how exactly patch embeddings are created</em></p><p><strong>Step 2: Creating Patch Embeddings</strong></p><p>Let us say the dimensions for each of our patches is 28x28x3, so totally we have 2352 values.</p><p>Now imagine a neural network which takes these 2352 values as an input and produces an output of dimension 512.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KHio%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KHio!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 424w, https://substackcdn.com/image/fetch/$s_!KHio!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 848w, https://substackcdn.com/image/fetch/$s_!KHio!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 1272w, https://substackcdn.com/image/fetch/$s_!KHio!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21KHio%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png" width="282" height="302.4990176817289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1092,&quot;width&quot;:1018,&quot;resizeWidth&quot;:282,&quot;bytes&quot;:139947,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KHio!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 424w, https://substackcdn.com/image/fetch/$s_!KHio!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 848w, https://substackcdn.com/image/fetch/$s_!KHio!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 1272w, https://substackcdn.com/image/fetch/$s_!KHio!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5484e99b-d2e1-4fc0-9a85-0dde82703373_1018x1092.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is what is visually happening in the creation of the patch embeddings.</p><p>So, the process till now can be visually represented as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2188Hg%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!88Hg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 424w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 848w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 1272w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2188Hg%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png" width="1456" height="463" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:463,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:461858,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!88Hg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 424w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 848w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 1272w, https://substackcdn.com/image/fetch/$s_!88Hg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08f6c303-b255-4a00-9e89-0a06874d17ba_2234x710.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This looks good for now, but we are forgetting something!</p><p><strong>Step 3: Creating Position Embeddings</strong></p><p>Imagine that you have the following pictures:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qLin%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qLin!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!qLin!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!qLin!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!qLin!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qLin%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png" width="1456" height="795" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3552884,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qLin!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!qLin!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!qLin!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!qLin!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F960ca55a-5f80-4078-a512-9a7635b31a59_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Both the images contain the same patches. The only difference is that they are rearranged.</p><p>Now, if we continue with the above architecture, our model would treat both these images as the same. It would not understand the importance of the ordering of the patches inside these images.</p><p>This is why, along with patch embeddings, we need position embeddings as well.</p><p>We had done the same thing for the Transformer architecture when applied to language data, where the position embeddings were calculated for the tokens that come in a sequence.</p><p>When we add the position embeddings, our modified architecture looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gDDZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gDDZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 424w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 848w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 1272w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21gDDZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png" width="1456" height="466" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:466,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:466539,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gDDZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 424w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 848w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 1272w, https://substackcdn.com/image/fetch/$s_!gDDZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5d0cb0b-16f1-4905-be29-2ba677e45c44_2230x714.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, we simply pass this as an input to the transformer encoder.</p><p><strong>Step 4: Pass this as an input to Transformer Encoder</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WZbu%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WZbu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 424w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 848w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WZbu%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png" width="1456" height="673" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:673,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:503132,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WZbu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 424w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 848w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!WZbu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46d095b8-8afd-4d0e-96a2-a8ad3153f075_2246x1038.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Are we done?</p><p>Question: What is the output of the transformer encoder?</p><p>How do we use it to classify the images?</p><p>Remember that the output of the transformer encoder are the context vectors for all tokens.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216png%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6png!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 424w, https://substackcdn.com/image/fetch/$s_!6png!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 848w, https://substackcdn.com/image/fetch/$s_!6png!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 1272w, https://substackcdn.com/image/fetch/$s_!6png!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216png%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png" width="1456" height="691" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:691,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:553744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6png!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 424w, https://substackcdn.com/image/fetch/$s_!6png!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 848w, https://substackcdn.com/image/fetch/$s_!6png!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 1272w, https://substackcdn.com/image/fetch/$s_!6png!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f9c42b0-9c5f-48f8-987d-d8921c6e2b2e_2618x1242.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, what next? How do we classify this image?</p><p> This is where we come to an important concept.</p><p><strong>Step 5: Classification Token [CLS]</strong></p><p>We add a learnable embedding to the sequence of embedded patches whose state at the output of the Transformer encoder serves as the image representation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212ygC%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2ygC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 424w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 848w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 1272w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212ygC%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png" width="1456" height="681" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:681,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:509067,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2ygC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 424w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 848w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 1272w, https://substackcdn.com/image/fetch/$s_!2ygC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4796c9bf-6a67-419c-925c-ec83ae2a2e4b_2284x1068.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>This learnable token is also called the "class" token or the "classification" token.  </p><p>To understand what the CLS token does, let us calculate the attention matrix and the role of this token in the attention matrix.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HQfm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HQfm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 424w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 848w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 1272w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HQfm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png" width="426" height="467.4262560777958" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1354,&quot;width&quot;:1234,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:325937,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HQfm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 424w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 848w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 1272w, https://substackcdn.com/image/fetch/$s_!HQfm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5651f15-3653-4ba9-9d54-348fcc8c33b8_1234x1354.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From the above attention matrix, we can see that the CLS token is attending to itself and also the other 9 patches.</p><p>So, the CLS token can be thought of as something which contains a summary of the entire image.</p><p><strong>Question: Can we think of how do we move from here to how the context vector is generated for the CLS token?</strong></p><p>This brings us to the next step:</p><p><strong>Step 6: The Classification Head</strong></p><p><em>The last step is the classification head. Here, the context vector corresponding to the CLS token is passed through a multi-layer perceptron with the output dimensions which are equal to that of the number of classes which we have.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p6kx%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p6kx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 424w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 848w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21p6kx%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png" width="1456" height="773" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:773,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:152317,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!p6kx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 424w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 848w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 1272w, https://substackcdn.com/image/fetch/$s_!p6kx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432fb8db-67f9-4edc-86d0-a9ab3dd8ab40_2110x1120.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The final Vision Transformer Architecture looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Grys%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Grys!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 424w, https://substackcdn.com/image/fetch/$s_!Grys!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 848w, https://substackcdn.com/image/fetch/$s_!Grys!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 1272w, https://substackcdn.com/image/fetch/$s_!Grys!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Grys%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png" width="1456" height="801" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:801,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:550713,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Grys!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 424w, https://substackcdn.com/image/fetch/$s_!Grys!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 848w, https://substackcdn.com/image/fetch/$s_!Grys!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 1272w, https://substackcdn.com/image/fetch/$s_!Grys!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa2c94a7-afd3-4af9-bfd7-8534d9bc27c0_2318x1276.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let us look at a practical example to understand how ViT is implemented in practice:</p><p>We will look at the following dataset:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-4DS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-4DS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 424w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 848w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 1272w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-4DS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png" width="1456" height="1479" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1479,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-4DS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 424w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 848w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 1272w, https://substackcdn.com/image/fetch/$s_!-4DS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d8f29f8-33e9-410c-a83e-4bbf91ab7855_1466x1489.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are 3 classes here: </p><p>(1) angular_leaf_spot (A fungal disease causing angular spots on leaves)</p><p>(2) bean_rust (A fungal disease causing rust-colored pustules)</p><p>(3) healthy (No disease detected)</p><p>We will use a pretrained Vision Transformer as our base model and then fine-tune it for our specific task.</p><p>We will use the following Transformer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215Yol%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Yol!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 424w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 848w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 1272w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215Yol%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png" width="1456" height="841" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:841,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:595891,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Yol!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 424w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 848w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 1272w, https://substackcdn.com/image/fetch/$s_!5Yol!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa4f797-21d0-4858-a8e1-e04629ed0b56_2698x1558.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>This model was pretrained on a large collection of images in a supervised fashion, namely ImageNet-21k, at a resolution of 224x224 pixels. Next, the model was fine-tuned on ImageNet (also referred to as ILSVRC2012), a dataset comprising 1 million images and 1,000 classes, also at resolution 224x224.</em></p><p>We use the following pipeline for our task:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-36y%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-36y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!-36y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!-36y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!-36y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-36y%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png" width="1024" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:651983,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/183031673?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-36y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!-36y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!-36y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!-36y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7282c0a-3630-4933-aec4-b15960eb3d9f_1024x559.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>After training for 3 epochs, we get an accuracy of 96%. See the result below:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21l9fn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!l9fn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 424w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 848w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 1272w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21l9fn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png" width="1445" height="1489" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1489,&quot;width&quot;:1445,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!l9fn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 424w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 848w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 1272w, https://substackcdn.com/image/fetch/$s_!l9fn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23acc9ca-dfd1-4a50-b732-aeacb61d016c_1445x1489.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here is the link to the Google Colab Notebook:</p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F101A2TRFfH-fHX--aNQfmqBU39sSEYjyu%3Fusp%3Dsharing">Google Colab Notebook: Implementing Vision Transformer on a Practical Dataset</a>  </p><p>Here is the link to the original paper which introduced <em>Transformers: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F1706.03762">https://arxiv.org/abs/1706.03762</a></em></p><p>Here is the link to the original paper which introduced <em>Vision</em> <em>Transformers: <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2010.11929">https://arxiv.org/pdf/2010.11929</a></em></p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: <a href="iframe.php?url=https%3A%2F%2Frobotlearningbootcamp.vizuara.ai%2F">https://robotlearningbootcamp.vizuara.ai/</a></p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p> </p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Energy Based Models - Score Matching]]></title><description><![CDATA[Modeling probability distributions using energy functions.]]></description><link>https://vizuara.substack.com/p/energy-based-models-score-matching</link><guid isPermaLink="false">https://vizuara.substack.com/p/energy-based-models-score-matching</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Thu, 01 Jan 2026 09:51:21 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wemw%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>EBMs define a probability density via an energy function which assigns lower energy to more likely configurations.</p><p>The Energy Function is represented as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;E_{\\phi}(x)&quot;,&quot;id&quot;:&quot;ZCMTQEEYZX&quot;}" data-component-name="LatexBlockToDOM"></div><p>Let us look at a simple example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212_cQ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2_cQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%212_cQ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png" width="1456" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:679638,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2_cQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!2_cQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9762309-1c0a-41f8-86c6-6c010604274e_2679x1492.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, let us understand how do we think of converting this energy function into a probability distribution. </p><p>Some things which we understand intuitively are:</p><p><em>The points with low energy should have a higher probability.</em></p><p><em>The points with high energy should have a lower probability.</em></p><p>This is inspired from physics, where we see that the systems always reach a point of the lowest energy value. Think of an apple which is dropped from a height. The reason it settles on the ground is because the potential energy there is the minimum. </p><p>So, the probability curve should look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ThSN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ThSN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ThSN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png" width="1456" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:830802,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ThSN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!ThSN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F947c65d4-5877-4a0b-ab87-1c61d3c97ed8_2679x1492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let us superimpose both the curves now:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218Ukx%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8Ukx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218Ukx%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png" width="1456" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1153248,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8Ukx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!8Ukx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d534ed8-f091-4200-bcc4-9d9ed588c037_2679x1492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is what we want.</p><p><em>Can we think of a mathematical function which takes us from this energy curve to the probability curve?</em></p><p>The function should satisfy the following properties:</p><ul><li><p>Higher energy should have lower probabilities</p></li><li><p>Lower energy should have higher probabilities</p></li><li><p>Should have only positive values</p></li><li><p>Should lie between 0 and 1</p></li></ul><blockquote><p>People use an exponential function to relate the energy to the probability since it satisfies all these properties.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jkXy%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jkXy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 424w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 848w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jkXy%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png" width="1456" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:245821,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jkXy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 424w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 848w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!jkXy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1ea068b-49b5-4a65-9e07-41e30fabb2be_2593x1542.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From the above graph, we can relate the energy to the probability using the following equation:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\phi}(x) = e^{-E_{\\phi}(x)}&quot;,&quot;id&quot;:&quot;DYRHSRCMPM&quot;}" data-component-name="LatexBlockToDOM"></div><p>Okay, this looks great, until it is not..</p><p>Let us look at an example:</p><p>Let us take an example. Suppose that we have a set of discrete states which are -3, -2, -1, 0, 1, 2, and 3.</p><p>Now, let us say we use the above formula and calculate the probability densities for all these states.</p><p>It will look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GYi_%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GYi_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21GYi_%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png" width="1456" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:223058,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GYi_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!GYi_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc67c956b-0d1d-44de-801e-918cf0bab4df_2679x1492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here, we are assuming that the energy function for all these states is known to us, and we are simply converting them into probability using the exponential formula, which we looked at before. </p><p>The sum of all these probabilities is 2.5066.</p><p>This is not what we want. We want the summation of all the probabilities to be 1, so that it is an actual probability density function.</p><p>However, there is a simple solution to this. We can simply normalize the probabilities by dividing it by 2.5066.</p><p>It will look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lL7g%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lL7g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lL7g%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png" width="1456" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:240023,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lL7g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 424w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 848w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!lL7g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5f40f99-a4f5-4797-9474-226c3687263d_2679x1492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, these probabilities do sum up to 1!</p><p>The number 2.5066 is called as the partition function.</p><p>Hence the final relation between energy and the probability density function will look as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\phi}(x) = \\frac{e^{-E_{\\phi}(x)}}{\\int e^{-E_{\\phi}(x)} dx }&quot;,&quot;id&quot;:&quot;WYGWHRGQLN&quot;}" data-component-name="LatexBlockToDOM"></div><p>The partition function, which is the denominator in the above equation is also denoted by the symbol &#8220;Z&#8221;.</p><p>This is great, but how do we train Energy-based models?</p><h3>Training Energy-Based Models</h3><p> Conceptually, we want to do something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bJq6%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bJq6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 424w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 848w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 1272w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21bJq6%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png" width="1456" height="581" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:581,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:794935,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bJq6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 424w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 848w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 1272w, https://substackcdn.com/image/fetch/$s_!bJq6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02d44293-a5d3-4d83-813f-9ec377a08393_3166x1263.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="pullquote"><p>We start with the random energy configuration and slowly modify the energy landscape, so that the bad data have a lower probability and the good data have a higher probability.</p></div><p>We will again use the maximum likelihood which we have seen before multiple times.</p><p>We want to maximize the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; \\text{log}p_{\\phi}(x)&quot;,&quot;id&quot;:&quot;FSJQWNCLSG&quot;}" data-component-name="LatexBlockToDOM"></div><p>Using the above formula, which relates the energy to the probability, we can rewrite the above equation as follows: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; \\text{log}p_{\\phi}(x) = -E_{\\phi}(x) - log(Z)&quot;,&quot;id&quot;:&quot;QCRQVFSNIG&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, Z denotes the partition function.</p><p>The main challenge with the above equation is that the partition function is intractable, i.e., it is impossible to calculate it. The reason is that we do not know the energy function for all the states in the distribution, and calculating an integral over all of them is impossible.</p><p>Remember we had faced this same issue while training variational autoencoders and diffusion models as well.</p><p>We had solved those issues by formulating an ELBO term and then maximizing that ELBO term. This worked for us because the ELBO term is always less than the maximum likelihood.</p><blockquote><p>For energy-based methods, we don't use the ELBO approach, but instead we introduce the notion of the score function and present score matching as a tractable training objective which bypasses the partition function.</p></blockquote><h3>What is the &#8220;Score&#8221;?</h3><p>The score function is the gradient of the log density, given by the following equation:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = \\nabla_{x}\\text{log}p(x)&quot;,&quot;id&quot;:&quot;DAVIUHORGK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, p(x) denotes the probability distribution of the data.</p><div class="pullquote"><p>Intuitively, the score forms a vector field that points toward regions of higher probability, providing a local guide to where the data is most likely to occur </p></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wemw%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wemw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 424w, https://substackcdn.com/image/fetch/$s_!wemw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 848w, https://substackcdn.com/image/fetch/$s_!wemw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 1272w, https://substackcdn.com/image/fetch/$s_!wemw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wemw%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png" width="508" height="302.49725274725273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:867,&quot;width&quot;:1456,&quot;resizeWidth&quot;:508,&quot;bytes&quot;:4306581,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wemw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 424w, https://substackcdn.com/image/fetch/$s_!wemw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 848w, https://substackcdn.com/image/fetch/$s_!wemw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 1272w, https://substackcdn.com/image/fetch/$s_!wemw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f27f7fa-7558-480a-9516-1ed18ab43b47_2592x1543.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the above figure, the arrows represent the score field which are pointed towards the direction where the density of the data is the maximum.</p><p>The score function acts as a compass, guiding you towards areas where the probability of the data being from the distribution is the maximum.</p><p><strong>Let us look at a simple practical example to build our intuition about the score function. </strong></p><p>Let us assume that the probability density curve is Gaussian.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Yg3g%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yg3g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 424w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 848w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Yg3g%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png" width="523" height="311.07005494505495" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:343722,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Yg3g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 424w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 848w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!Yg3g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b89e29d-9981-44f8-8745-28d522a69ead_2593x1542.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>First, let us write down the mathematical functional form for the Gaussian:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p(x) = \\frac{1}{\\sqrt{2\\pi}}e^{-x^{2}/2}&quot;,&quot;id&quot;:&quot;BDDDJLBSEB&quot;}" data-component-name="LatexBlockToDOM"></div><p>We can verify whether this makes sense. If we substitute x = 0, we get a positive value for the probability, and for very high values (positive or negative), the probability becomes 0, which matches the graph above.</p><p>Now, let us calculate the score function.</p><p>First, let us calculate the logarithm of the probability:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{log}(p(x)) = \\text{log}(\\frac{1}{\\sqrt{2\\pi}}) - \\frac{x^{2}}{2}&quot;,&quot;id&quot;:&quot;LLDJXZGVUE&quot;}" data-component-name="LatexBlockToDOM"></div><p> Now, we will take the gradient. The gradient of the constant will vanish.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = \\nabla_{x}\\text{log}(p(x)) = -x &quot;,&quot;id&quot;:&quot;GQXKKVKQFI&quot;}" data-component-name="LatexBlockToDOM"></div><p> Let us visualize this score function superimposed on the probability density curve:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OyBQ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OyBQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 424w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 848w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21OyBQ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png" width="1456" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0275457-6360-4531-8b79-91045e050fa7_2592x1542.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:326788,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OyBQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 424w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 848w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 1272w, https://substackcdn.com/image/fetch/$s_!OyBQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0275457-6360-4531-8b79-91045e050fa7_2592x1542.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><em>In this example, we can clearly see that all the score vectors are pointed towards the center because the origin has the maximum probability density.</em></p></blockquote><blockquote><p><em>The further you are from the center, the magnitude of the arrows increases because it is farther away, and it will require more force to pull it back to the center.</em></p></blockquote><h3><strong>But why model scores instead of densities?</strong></h3><p>Modeling the score offers both theoretical and practical benefits:</p><p><strong>Freedom from Partition Function:</strong></p><p>We had seen before that calculating the partition function was intractable.</p><p>Because of this, we could not find an expression for maximizing the probability density likelihood.</p><p>Now, let us see how this formulation changes for the score function.</p><p>Let us write down the formula for the score function and substitute the probability with the energy function.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = \\nabla_{x}\\text{log}(p(x)) =  \\nabla_{x}\\text{log}(\\frac{e^{-E_{\\phi}(x)}}{Z})&quot;,&quot;id&quot;:&quot;PJYGWHNCWS&quot;}" data-component-name="LatexBlockToDOM"></div><p>This can be simplified to the following. Remember the log of the exponential of a value is the value itself.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = -\\nabla_{x}E_{\\phi}(x) - \\nabla_{x} \\text{log}Z&quot;,&quot;id&quot;:&quot;LMMYCUFFRJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Now the second term here involves calculating the gradient of the partition function, which does not depend on x. So that gradient will become zero, and this is exactly why we get the freedom from the partition function.</p><p>So, we can write the score function as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = -\\nabla_{x}E_{\\phi}(x)&quot;,&quot;id&quot;:&quot;NQHOGXNFSW&quot;}" data-component-name="LatexBlockToDOM"></div><p>Now that we have understood the meaning of the score function, let us use this formulation of the score function for training energy-based models.</p><p><em>Before we go to the training of energy-based models using the score function, let us first understand how can we get samples from our distribution if we only know the score function. </em></p><h3>Sampling using the Score Function</h3><p>The question that we will address is, "How do you sample the data if you have the score function?"</p><p>Let us start with an example:</p><p>Imagine that you are dropped into a thick fog on a vast landscape. Your goal is to find the deepest valley because that is where the treasure is hidden.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jXu7%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jXu7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21jXu7%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png" width="485" height="264.8179945054945" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:795,&quot;width&quot;:1456,&quot;resizeWidth&quot;:485,&quot;bytes&quot;:3024354,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jXu7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 424w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 848w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!jXu7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6647b30-5166-4bcb-9add-529475fa6f37_2706x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Ideally, you want to trace the route which goes something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HfmN%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HfmN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 424w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 848w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21HfmN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png" width="487" height="265.57554945054943" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:794,&quot;width&quot;:1456,&quot;resizeWidth&quot;:487,&quot;bytes&quot;:3013381,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HfmN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 424w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 848w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 1272w, https://substackcdn.com/image/fetch/$s_!HfmN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64d57d28-6f9d-4272-90d9-6948186532f7_2707x1477.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What is the strategy that you will use?</p><p><em>Since you know that the treasure is in the valley somewhere, you know that going down is good and going up is bad.</em></p><div class="pullquote"><p>To reach the valley in the quickest possible time, you will go in the direction where the downward slope is the maximum.</p></div><p>Let us say the slope is given by the symbol "q".</p><p>If x(t) is your current position and x(t+1) is your next position, then you can write the next position in terms of the current position using the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{t+1} = x_{t} + \\eta q&quot;,&quot;id&quot;:&quot;AHTSECFFKU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, n is the step size.</p><p>In this analogy, our vast landscape is the energy function landscape. So, we are trying to find the point where the energy landscape achieves a minima.</p><p>So, the slope &#8220;q&#8221; can be expressed as the gradient of the energy function as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q = - \\nabla_{x} E_{\\phi}(x_{t})&quot;,&quot;id&quot;:&quot;XCEWGJTJNG&quot;}" data-component-name="LatexBlockToDOM"></div><p>Note that we have used a negative sign because we want to find the minima, and not the maxima.</p><p> Now we can write the final update rule as follows:  </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{t+1}= x_{t} - \\eta \\nabla_{x} E_{\\phi}(x_{t})&quot;,&quot;id&quot;:&quot;XWUGYKTQBL&quot;}" data-component-name="LatexBlockToDOM"></div><p>If we go according to the above rule, we are guaranteed to move towards regions where the energy function is minimum.</p><p>This would remind you of the &#8220;Gradient Descent Algorithm&#8221; in Machine Learning, where we have a very similar update rule.</p><p>We are not done yet :(</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iebn%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iebn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iebn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png" width="399" height="266.09134615384613" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:399,&quot;bytes&quot;:2261863,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Iebn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iebn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe4a09c6-45de-4120-b323-7c9f2f5e6376_1536x1024.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Consider this scenario:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21S1ay%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F79314648-74b4-402e-9723-707daf7b2738_1934x846.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S1ay!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 424w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 848w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 1272w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21S1ay%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F79314648-74b4-402e-9723-707daf7b2738_1934x846.png" width="1456" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79314648-74b4-402e-9723-707daf7b2738_1934x846.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2196860,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S1ay!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 424w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 848w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 1272w, https://substackcdn.com/image/fetch/$s_!S1ay!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79314648-74b4-402e-9723-707daf7b2738_1934x846.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We are at a point where the slope of the mountain is 0, i.e, the gradient is also 0.</p><p>This means that we are at a local minima and we are stuck there.</p><p>Now, what if there is another minima further down the road which is even below where we are sitting right now? Because of our algorithm, we will never find this minima.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-H92%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-H92!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 424w, https://substackcdn.com/image/fetch/$s_!-H92!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 848w, https://substackcdn.com/image/fetch/$s_!-H92!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!-H92!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-H92%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png" width="1456" height="746" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:746,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2129021,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-H92!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 424w, https://substackcdn.com/image/fetch/$s_!-H92!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 848w, https://substackcdn.com/image/fetch/$s_!-H92!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 1272w, https://substackcdn.com/image/fetch/$s_!-H92!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee9fcea1-5165-4a93-8cdd-26d3eac26b52_2092x1072.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To solve this issue, we need to provide a shake which gives you just enough random energy to kick you out of those small potholes so you can keep moving toward the <em>true</em> bottom of the valley (the Global Minimum).</p><p>Remember in the lecture on diffusion, we had discussed about adding noise to the data and we had written a simple expression to add noise which looks as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{i+1} = x_{i} + \\beta \\epsilon &quot;,&quot;id&quot;:&quot;OKLWKGNXJH&quot;}" data-component-name="LatexBlockToDOM"></div><p>Refer to the Diffusion article here: <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fwhat-exactly-are-diffusion-models">https://vizuara.substack.com/p/what-exactly-are-diffusion-models</a></p><p>The above expression also means that we will sample from a Gaussian distribution with a mean, same as that of x(i), and a standard deviation of beta.</p><p>With this same understanding in mind, we will  modify our &#8220;walking&#8221; algorithm as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{t+1}= x_{t} - \\eta \\nabla_{x} E_{\\phi}(x_{t}) + \\sqrt{2\\eta}\\epsilon_{t}&quot;,&quot;id&quot;:&quot;EYXNUAMLZQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Note that here epsilon represents a random variable which adds an element of stochasticity to the above equation.</p><div class="pullquote"><p>This means that even if we are at a local minima where the gradient of the energy function is zero, we will not remain stationary and we will be pulled out of that hole because of that shake provided by the noise term. This will allow us to explore other areas where we might find a global minima.  </p></div><p>This equation is also called as <strong>Discrete-Time Langevin Update</strong></p><p>Now, as we have looked at before, the gradient of the energy function is the negative of the score function. So we can rewrite the above equation as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{t+1}= x_{t} + \\eta s_{\\phi}(x) + \\sqrt{2\\eta}\\epsilon_{t}&quot;,&quot;id&quot;:&quot;QJXJEMQDBG&quot;}" data-component-name="LatexBlockToDOM"></div><p>Note that, here we are assuming that we already have a trained score function, and we are understanding how we can sample images from the trained score function using the Discrete-Time Langevin Update. </p><p>Sampling using the Langevin update tool might visually look as follow</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rnGB%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rnGB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 424w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 848w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1272w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21rnGB%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png" width="1456" height="831" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:831,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2275834,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rnGB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 424w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 848w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1272w, https://substackcdn.com/image/fetch/$s_!rnGB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a9155e2-0ffd-4ae6-be2f-31ac7cc25617_2647x1510.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can see here the <strong>zig-zag lines</strong> which are the trajectories take from the starting point to the end point. This is exactly because of the<strong> stochastic term</strong> that we have added in the <strong>update rule</strong>. It almost looks like a <strong>hiker who is drunk</strong> and trying to navigate their way in the terrain. </p><p>Let us understand this using a practical example. We will use Langevin dynamics to sample from a known probability distribution.  </p><h3>Practical example: Sampling using the Score Function</h3><p> We will use the following the probability distribution as the known probability distribution:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%213whp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3whp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 424w, https://substackcdn.com/image/fetch/$s_!3whp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 848w, https://substackcdn.com/image/fetch/$s_!3whp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 1272w, https://substackcdn.com/image/fetch/$s_!3whp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%213whp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png" width="446" height="338.48214285714283" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1105,&quot;width&quot;:1456,&quot;resizeWidth&quot;:446,&quot;bytes&quot;:415870,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3whp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 424w, https://substackcdn.com/image/fetch/$s_!3whp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 848w, https://substackcdn.com/image/fetch/$s_!3whp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 1272w, https://substackcdn.com/image/fetch/$s_!3whp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F08ea8da7-f211-4944-9bf6-ed8cf324d4a8_2295x1742.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We can see that the distribution has two peaks. There are two regions where the probability of finding the data is the maximum. Then, the probability slowly tapers off as you move away from those peaks.</p><p> So, if we start from any point in the grid, our update rule should take us to the areas which appear in yellow color in the contour plot.</p><p> This would mean that our update rule has worked successfully, and we have learned to arrive at places where sampling from the probability distribution is the maximum.</p><p>Here is the link to the Google Colab Notebook, where we have used the score function in the Langevin update rule to estimate the trajectories.</p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F1pu-RD0BmoTweeloruoa667tjuAaW-OL5%3Fusp%3Dsharing">Google Colab Notebook: Langevin Dynamics - Sampling using a known Score Function  </a></p><p> An example trajectory looks as follows:  </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wym1%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wym1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 424w, https://substackcdn.com/image/fetch/$s_!wym1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 848w, https://substackcdn.com/image/fetch/$s_!wym1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 1272w, https://substackcdn.com/image/fetch/$s_!wym1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21wym1%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png" width="439" height="460.1057692307692" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1526,&quot;width&quot;:1456,&quot;resizeWidth&quot;:439,&quot;bytes&quot;:735760,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wym1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 424w, https://substackcdn.com/image/fetch/$s_!wym1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 848w, https://substackcdn.com/image/fetch/$s_!wym1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 1272w, https://substackcdn.com/image/fetch/$s_!wym1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26354949-1dae-486d-b6fb-fd4b50f28315_1953x2047.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can see here that using our update rule, we are reaching towards areas where the probability is the maximum, which is exactly what we want.</p><p> So, it looks like we have solved the sampling part. However, this is only 50% of the story. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iy05%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iy05!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iy05%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png" width="440" height="293.4340659340659" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:520623,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Iy05!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We are yet to understand how to train our score function so that it matches the true score function as close as possible.</p><p>This brings us to Score-based Generative Models.</p><h3>Score-based Generative Models  </h3><div class="pullquote"><p>The key idea is that since sampling with Langevin dynamics needs only the score, we can learn it directly with a neural network. This shift, from modeling energies to modeling scores, forms the foundation of score-based generative models</p></div><p> Let us look at a sample example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Pd5L%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Pd5L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 424w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 848w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 1272w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Pd5L%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png" width="478" height="291.1991758241758" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1456,&quot;resizeWidth&quot;:478,&quot;bytes&quot;:2456254,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Pd5L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 424w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 848w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 1272w, https://substackcdn.com/image/fetch/$s_!Pd5L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2bfd701-6e47-409f-bdc3-bb85feea6794_2562x1560.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The neural network score (blue) is trained to match the ground truth score (black) using a MSE loss. Both are represented as vector fields.</p><p> The true score function is denoted as follows: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s(x) = \\nabla_{x}\\text{log}p_{data}(x)&quot;,&quot;id&quot;:&quot;XBLIIJPJFA&quot;}" data-component-name="LatexBlockToDOM"></div><p>The predicted score function is denoted as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;s_{\\phi}(x) = \\nabla_{x}\\text{log}p_{\\phi}(x)&quot;,&quot;id&quot;:&quot;AWOEUXGLEL&quot;}" data-component-name="LatexBlockToDOM"></div><blockquote><p>Score matching works by minimizing the mean squared error (MSE) between the true and estimated scores.</p></blockquote><p> The mean squared error loss is given as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;L_{SM}(\\phi) = \\frac{1}{2}||s_{\\phi}(x) - s(x)||^{2}&quot;,&quot;id&quot;:&quot;QUSCSQCUTJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>One of the main problems with this approach is that the true score function is unknown. If we do not know the true probability distribution, then how can we possibly find the gradient of the probability distribution.</p><h3>Tractable Score Matching:</h3><p>At first glance, this objective seems infeasible because the true score s(x), which serves as the regression target, is unknown.</p><p>Fortunately, Hyvrinen and Dayan (2005) showed that integration by parts yields an equivalent objective that depends only on the model and the data samples, without requiring access to the true score.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XxLr%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XxLr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 424w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 848w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 1272w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XxLr%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png" width="516" height="457.1703296703297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1290,&quot;width&quot;:1456,&quot;resizeWidth&quot;:516,&quot;bytes&quot;:1539035,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XxLr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 424w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 848w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 1272w, https://substackcdn.com/image/fetch/$s_!XxLr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59b4bdb5-107f-407e-a75e-a440476b145d_2124x1882.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="pullquote"><p>This example really highlights the value of research. A paper released 20 years back serves as the backbone of score-based diffusion models. This is truly amazing. </p></div><p>The modified tractable loss function looks as follows: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\tilde{L_{SM}}(\\phi) = Tr (\\nabla_{x}s_{\\phi}(x)) + \\frac{1}{2}||s_{\\phi}(x)||^{2}&quot;,&quot;id&quot;:&quot;HTHGKKLSLQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, Tr(.) means the trace of the matrix.</p><p>Using this objective, we train the score model solely from observed samples, eliminating the need for the true score function.</p><p>Let us understand the logic behind both of these terms separately:</p><p><strong>Term 1: </strong></p><p>This term measures divergence of your arrows. It measures if the arrows are spreading out (exploding) or converging (imploding) at a specific point. Since we are minimizing this loss, we want this value to be extremely negative.</p><p><em><strong>Intuition:</strong></em></p><ul><li><p><em><strong>Positive Trace:</strong> Arrows are exploding outward (like a bomb went off).</em></p></li><li><p><em><strong>Negative Trace:</strong> Arrows are sucking inward (like a black hole or a sink drain).</em></p></li></ul><p><em>By forcing the trace to be negative at the data points, it forces all the arrows to point INWARD towards the data.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P6Vl%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P6Vl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 424w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 848w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 1272w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21P6Vl%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png" width="1456" height="624" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:624,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2282863,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P6Vl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 424w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 848w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 1272w, https://substackcdn.com/image/fetch/$s_!P6Vl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb42c0506-8713-444f-b2b1-38014dd4a65b_3054x1309.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Term 2:</strong></p><p>This term measures the length (or strength) of your arrows. It wants the arrows to be as small (short) as possible, ideally zero.</p><p>Regions where the probability of the data is high will have more score and contribute more to this term.</p><p>This term drives the score to be zero in high probability areas, so that these locations become stationary.</p><div class="pullquote"><p>To summarize, the first term makes the high probability areas look as sinks, so that if you take out a compass and want to navigate, you are forced to move inwards towards the high probability areas. Once you are near the high probability areas, you probably don&#8217;t want to move too much, and this is achieved through the second term, which makes these points stationary.   </p></div><p>Let us look at a practical example where this formulation is used to learn the score function.</p><p><strong>Practical Example: Score Matching</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iy05%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iy05!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Iy05%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png" width="400" height="266.75824175824175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:400,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Iy05!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Iy05!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb956cce8-d298-4e86-a0c3-47421aef0ec5_1536x1024.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In this example, we will solve both parts of the puzzle:</p><ol><li><p>We will train the score function</p></li><li><p>We will sample from it</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2187zK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!87zK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 424w, https://substackcdn.com/image/fetch/$s_!87zK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 848w, https://substackcdn.com/image/fetch/$s_!87zK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 1272w, https://substackcdn.com/image/fetch/$s_!87zK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2187zK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png" width="398" height="398" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1528f031-5649-4179-8567-26d06681ff20_1999x1999.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:398,&quot;bytes&quot;:1107313,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!87zK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 424w, https://substackcdn.com/image/fetch/$s_!87zK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 848w, https://substackcdn.com/image/fetch/$s_!87zK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 1272w, https://substackcdn.com/image/fetch/$s_!87zK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1528f031-5649-4179-8567-26d06681ff20_1999x1999.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p> We will learn to predict the score function for this data.</p><p>Here is the link to the Google Colab notebook which uses the tractable score matching loss formulation to solve this problem:</p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F1bf3NehKTzk7kMuqkY05u7n3fz3l8VeN9%3Fusp%3Dsharing">Google Colab Notebook - Using the tractable Score Matching Loss Formulation</a>  </p><p>This is final learnt score function which we get:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m_fi%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m_fi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 424w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 848w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 1272w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21m_fi%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png" width="432" height="439.7142857142857" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d5220092-d312-4538-90c0-f82af86e5074_1982x2017.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1482,&quot;width&quot;:1456,&quot;resizeWidth&quot;:432,&quot;bytes&quot;:3056170,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!m_fi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 424w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 848w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 1272w, https://substackcdn.com/image/fetch/$s_!m_fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5220092-d312-4538-90c0-f82af86e5074_1982x2017.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From the above image, we can see that how this score function acts like a compass which points us to the region where the data is located. </p><p>We can also see some regions like sinks which are created near the data which pull you inside and so you are close to those regions.</p><p>So, it looks like we have managed to train our score function properly :)</p><p><em>Once this score field is learned, we can also sample from it using Langevin Dynamics, exactly as we have learned before:</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211Xnm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1Xnm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 424w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 848w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 1272w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%211Xnm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png" width="440" height="445.1373626373626" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1473,&quot;width&quot;:1456,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:2004732,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182938742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1Xnm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 424w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 848w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 1272w, https://substackcdn.com/image/fetch/$s_!1Xnm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3facc3c0-e62b-4d45-b958-f2bee60c9581_1988x2011.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We start from the &#8220;green point&#8221; and end in the &#8220;blue point&#8221;. This trajectory is calculated using the Langevin Dynamics update rule which we looked at before.</p><p>Our &#8220;drunk hiker&#8221; does quite well in ending up close to the area where the probability density of the data is high :)</p><p>That&#8217;s it! This was the score matching formulation as one of techniques in Deep Generative Modeling.</p><div class="pullquote"><p>It is very interesting to note that these two tracks of diffusion models and score-based models appear very distinct, but they converge very nicely together. We can understand both of them using a single unified framework</p></div><p>We will look at this in the next chapter, where we will examine the foundational role of the score function in modern diffusion models.</p><p>Initially introduced to enable efficient training of EBMs, the score function has evolved into a central component of a new generation of generative models.</p><p>Here is the link to the original paper which introduced <em>the tractable Score Matching formulation): <a href="iframe.php?url=https%3A%2F%2Fjmlr.org%2Fpapers%2Fvolume6%2Fhyvarinen05a%2Fhyvarinen05a.pdf">https://arxiv.org/abs/2006.11239</a></em></p><p>For further reading, please refer to the book: <em>The Principles of Diffusion Models From Origins to Advances (<a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2510.21890">https://arxiv.org/abs/2510.21890</a>) [Pages 56-68]</em></p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: <a href="iframe.php?url=https%3A%2F%2Frobotlearningbootcamp.vizuara.ai%2F">https://robotlearningbootcamp.vizuara.ai/</a></p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[What exactly are Diffusion Models?]]></title><description><![CDATA[How do diffusion models work?]]></description><link>https://vizuara.substack.com/p/what-exactly-are-diffusion-models</link><guid isPermaLink="false">https://vizuara.substack.com/p/what-exactly-are-diffusion-models</guid><dc:creator><![CDATA[Vizuara AI]]></dc:creator><pubDate>Tue, 23 Dec 2025 09:01:48 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fEKX%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Diffusion is the natural tendency of particles (like molecules, heat, or even information) to <strong>move and spread out</strong> until they are evenly distributed.</p><p>Some examples are as follows:</p><ol><li><p>Smell of perfume spreading across the room:</p></li></ol><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tc20!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 424w, https://substackcdn.com/image/fetch/$s_!tc20!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 848w, https://substackcdn.com/image/fetch/$s_!tc20!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!tc20!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tc20%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png" width="360" height="202.25274725274724" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:818,&quot;width&quot;:1456,&quot;resizeWidth&quot;:360,&quot;bytes&quot;:3435787,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tc20!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 424w, https://substackcdn.com/image/fetch/$s_!tc20!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 848w, https://substackcdn.com/image/fetch/$s_!tc20!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 1272w, https://substackcdn.com/image/fetch/$s_!tc20!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6937bcc4-fc6c-4d56-8da4-366b72c2ac92_2668x1499.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></div></figure></div><ol start="2"><li><p>Sugar dissolving and spreading uniformly in water:</p></li></ol><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!z44k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 424w, https://substackcdn.com/image/fetch/$s_!z44k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 848w, https://substackcdn.com/image/fetch/$s_!z44k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 1272w, https://substackcdn.com/image/fetch/$s_!z44k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21z44k%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif" width="320" height="180.57142857142856" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:158,&quot;width&quot;:280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:972812,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!z44k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 424w, https://substackcdn.com/image/fetch/$s_!z44k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 848w, https://substackcdn.com/image/fetch/$s_!z44k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 1272w, https://substackcdn.com/image/fetch/$s_!z44k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92af1820-58e2-4102-9063-ee7c69dabf80_280x158.gif 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><p>There are some properties which the diffusion process carries:</p><ol><li><p>Structure slowly disappears</p></li><li><p>Things become more uniform and noisy over time</p></li></ol><p>But why are we discussing about this now?</p><p>The main question is that can we do something similar with our data as well?</p><p>Remember that in the variational autoencoder, our encoder took the data as the input and then converted that into a representation in the latent space.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yhSb%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yhSb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 424w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 848w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 1272w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21yhSb%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png" width="1456" height="679" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/affd6886-1812-484b-b397-c9814f1c7d47_1912x892.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:679,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:175230,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yhSb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 424w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 848w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 1272w, https://substackcdn.com/image/fetch/$s_!yhSb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faffd6886-1812-484b-b397-c9814f1c7d47_1912x892.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Refer to this article on Variational AutoEncoders: <a href="iframe.php?url=https%3A%2F%2Fvizuara.substack.com%2Fp%2Fvariational-autoencoders-explained">https://vizuara.substack.com/p/variational-autoencoders-explained</a></p><p>What if we think of our encoder as a machine which diffuses the data?</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XWqH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 424w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 848w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 1272w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XWqH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png" width="1456" height="362" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:362,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65414,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XWqH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 424w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 848w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 1272w, https://substackcdn.com/image/fetch/$s_!XWqH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc79bc21f-8b8c-4246-8dfa-02de521bb6d5_1602x398.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>And the diffuser works such that it converts the data into pure noise.</p><p>Let us take an example</p><p>Consider this image:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21aKD-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aKD-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 424w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 848w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 1272w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21aKD-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png" width="221" height="291.125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1918,&quot;width&quot;:1456,&quot;resizeWidth&quot;:221,&quot;bytes&quot;:1888133,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aKD-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 424w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 848w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 1272w, https://substackcdn.com/image/fetch/$s_!aKD-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1b8c358-0f94-4711-90c8-910dd193d9a9_1742x2295.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Yes, we are taking Batman as our example :)</p><p>The encoder will do something as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VShm%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VShm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 424w, https://substackcdn.com/image/fetch/$s_!VShm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 848w, https://substackcdn.com/image/fetch/$s_!VShm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 1272w, https://substackcdn.com/image/fetch/$s_!VShm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VShm%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png" width="1456" height="494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:413104,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VShm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 424w, https://substackcdn.com/image/fetch/$s_!VShm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 848w, https://substackcdn.com/image/fetch/$s_!VShm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 1272w, https://substackcdn.com/image/fetch/$s_!VShm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5cf134d-c897-464b-8e8b-8fe035b64ece_1622x550.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We will make one additional change, instead of directly transforming the image into noise, we will make the transformation gradual.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8_Mb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 424w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 848w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 1272w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218_Mb%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png" width="728" height="113.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:227,&quot;width&quot;:1456,&quot;resizeWidth&quot;:728,&quot;bytes&quot;:663758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8_Mb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 424w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 848w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 1272w, https://substackcdn.com/image/fetch/$s_!8_Mb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4727e538-b474-4944-b66d-da43a9d68fa5_2704x422.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>So, there are multiple encoders which we need to train? </p><div class="pullquote"><p>Remember, this was one of the drawbacks of VAEs, where both the encoder and decoder had to be trained simultaneously</p></div><p><strong>What if we fix these encoders/diffusers?</strong></p><p>Let us say we modify our Batman image by adding a fixed Gaussian Kernel.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vJ7E%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vJ7E!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vJ7E%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png" width="217" height="325.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1536,&quot;width&quot;:1024,&quot;resizeWidth&quot;:217,&quot;bytes&quot;:2725335,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vJ7E!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!vJ7E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d0e0ad-2032-4dd3-a143-488c089ffe24_1024x1536.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We can represent our image first a grid of pixels.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pcEJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pcEJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 424w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 848w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 1272w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21pcEJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png" width="250" height="314.76683937823833" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:486,&quot;width&quot;:386,&quot;resizeWidth&quot;:250,&quot;bytes&quot;:122609,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pcEJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 424w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 848w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 1272w, https://substackcdn.com/image/fetch/$s_!pcEJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb5fff96d-273c-48bf-aee4-d27acd7455ad_386x486.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These pixels have some fixed values.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xyPS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5ef30989-9857-44b6-8916-226589d69444_376x456.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xyPS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 424w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 848w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 1272w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xyPS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F5ef30989-9857-44b6-8916-226589d69444_376x456.png" width="254" height="308.0425531914894" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5ef30989-9857-44b6-8916-226589d69444_376x456.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:456,&quot;width&quot;:376,&quot;resizeWidth&quot;:254,&quot;bytes&quot;:28010,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xyPS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 424w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 848w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 1272w, https://substackcdn.com/image/fetch/$s_!xyPS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ef30989-9857-44b6-8916-226589d69444_376x456.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, for each pixel, we will sample from a Gaussian with the mean fixed to be the pixel value and a small variance (beta).</p><p>This will look something like below:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215HMq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5HMq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 424w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 848w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 1272w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215HMq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png" width="1448" height="1116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1116,&quot;width&quot;:1448,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:323272,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5HMq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 424w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 848w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 1272w, https://substackcdn.com/image/fetch/$s_!5HMq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F759e92e6-4636-4f41-8f08-f34cfb9ad33e_1448x1116.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>What will happen if we do this for all the pixels?</strong></p><p>If we do this process to all the pixels, we will get something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FDcT%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FDcT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 424w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 848w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 1272w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21FDcT%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png" width="206" height="271.78983516483515" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1921,&quot;width&quot;:1456,&quot;resizeWidth&quot;:206,&quot;bytes&quot;:3065856,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FDcT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 424w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 848w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 1272w, https://substackcdn.com/image/fetch/$s_!FDcT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F965ce3f6-0735-4e6f-9ee8-bdeb593df8c5_1741x2297.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is a &#8220;noisy version&#8221; of the original Batman image.</p><div class="pullquote"><p>What we did is also called as adding Gaussian Noise to the image</p></div><p>The mathematical representation for this can be written as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{1} = x_{0} + \\beta \\epsilon&quot;,&quot;id&quot;:&quot;JBAJJJACXQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, x0, x1 and beta represent the original image, transformed image and the standard deviation respectively. Epsilon denotes a random variable which can take any value between 0 and 1.</p><p><strong>Now, what will happen if you do this a large number of times?</strong></p><p>This is what you get:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fwRK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fwRK!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 424w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 848w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 1272w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fwRK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_lossy%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif" width="269" height="354.54052197802196" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1919,&quot;width&quot;:1456,&quot;resizeWidth&quot;:269,&quot;bytes&quot;:17693096,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fwRK!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 424w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 848w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 1272w, https://substackcdn.com/image/fetch/$s_!fwRK!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F800da212-d368-4303-b6f9-f25726f596f3_1554x2048.gif 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There is one problem with the above method though. If you observe the animation closely, you will realize that we are adding a lot of noise, but the original image is preserved as it is.</p><p>This is different from the definition of &#8220;Diffusion&#8221; which we started out with:</p><ol><li><p>Structure slowly disappears</p></li><li><p>Things become more uniform and noisy over time</p></li></ol><div class="pullquote"><p>This happens because we are preserving the mean value of the pixels. The structure will slowly break down when the mean also changes and move towards 0.</p></div><p>Remember that we want to achieve this:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9-qk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 424w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 848w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 1272w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%219-qk%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png" width="1456" height="230" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:230,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:675479,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9-qk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 424w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 848w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 1272w, https://substackcdn.com/image/fetch/$s_!9-qk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7c6138d-e850-4926-b0f4-12a4dd2aa6c2_2746x434.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Our current &#8220;diffuser&#8221; does not achieve this. </p><p>Let us do this: For each &#8220;diffuser&#8221;, we will also scale the mean down by some factor along with injecting noise.</p><p>Something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IaEt%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IaEt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 424w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 848w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 1272w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IaEt%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png" width="1456" height="1164" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1164,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:366179,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IaEt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 424w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 848w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 1272w, https://substackcdn.com/image/fetch/$s_!IaEt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8442bf1-02c5-442d-83b2-7aa3cfa3e77c_1564x1250.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Notice how for the 2 pixels, we are sampling from a distribution with a mean which is scaled down (such that it moves towards zero).</p><p>The mathematical representation for this can be written as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{1} = \\alpha x_{0} + \\beta \\epsilon&quot;,&quot;id&quot;:&quot;WUBPRCVQAQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Okay, this is looking good. But, we have multiple diffusers (4 in the diagram above). Let us how we transform the original image to the final image mathematically:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{2} = \\alpha x_{1} + \\beta \\epsilon&quot;,&quot;id&quot;:&quot;DPACVJLKOE&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{3} = \\alpha x_{2} + \\beta \\epsilon&quot;,&quot;id&quot;:&quot;IGIDSDUMSE&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{4} = \\alpha x_{3} + \\beta \\epsilon&quot;,&quot;id&quot;:&quot;ANZZSAUEYY&quot;}" data-component-name="LatexBlockToDOM"></div><p>Okay this makes sense.</p><p>But there is one small thing left:</p><p>The noise is not kept constant for all transitions.  The noise schedule is kept such that it increases as we transform the clean image to noise.</p><p> Also, the mean is chosen such that the square of the mean and the standard deviation is equal to 1.  This is done so that the total variance at every step remains constant and also to ensure numerical stability across time steps.</p><p>So, the transitions can now be written as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{1} = \\sqrt{1-\\beta_{1}^{2}} x_{0} + \\beta_{1} \\epsilon&quot;,&quot;id&quot;:&quot;WNRMBGIZUY&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{2} = \\sqrt{1-\\beta_{2}^{2}} x_{1} + \\beta_{2} \\epsilon&quot;,&quot;id&quot;:&quot;AHBNFNWGAL&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{3} = \\sqrt{1-\\beta_{3}^{2}} x_{2} + \\beta_{3} \\epsilon&quot;,&quot;id&quot;:&quot;UPODZDWFPT&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;x_{4} = \\sqrt{1-\\beta_{4}^{2}} x_{3} + \\beta_{4} \\epsilon&quot;,&quot;id&quot;:&quot;RRLZZHLJEZ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Now, what will happen if you do the same thing large number of times?</p><p>This is what you get:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fo3p%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fo3p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 424w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 848w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 1272w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fo3p%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png" width="208" height="276.4878048780488" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:436,&quot;width&quot;:328,&quot;resizeWidth&quot;:208,&quot;bytes&quot;:197276,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fo3p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 424w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 848w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 1272w, https://substackcdn.com/image/fetch/$s_!fo3p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F779264d8-21cd-449b-96fa-6a29b80737ca_328x436.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is exactly what we want!</p><p>Reiterating our approach, we can now express this diffusion process as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218g9D%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8g9D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 424w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 848w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 1272w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218g9D%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png" width="1452" height="660" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:660,&quot;width&quot;:1452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:412792,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8g9D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 424w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 848w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 1272w, https://substackcdn.com/image/fetch/$s_!8g9D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F724023b4-4dfd-4cbb-83df-3175d2a18e11_1452x660.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="pullquote"><p>&#8220;For every pixel in the image, sample from a Gaussian distribution. The mean of the Gaussian distribution should be scaled by a factor of alpha, and the standard deviation should be beta.&#8221;</p></div><p>We do this for every transition. So, our forward diffusion process looks as follows:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21v5mJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v5mJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 424w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 848w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 1272w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21v5mJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png" width="420" height="624.9800796812749" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1494,&quot;width&quot;:1004,&quot;resizeWidth&quot;:420,&quot;bytes&quot;:856949,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!v5mJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 424w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 848w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 1272w, https://substackcdn.com/image/fetch/$s_!v5mJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c61e604-2f60-45a8-abb4-d0569b190c6f_1004x1494.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let us take a look at a practical example of applying the forward diffusion process to simple English Letters.</p><p>We will transform the letter &#8220;T&#8221; to noise using the forward diffusion process.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IP1-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 424w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 848w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 1272w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21IP1-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png" width="1456" height="200" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1771737,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IP1-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 424w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 848w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 1272w, https://substackcdn.com/image/fetch/$s_!IP1-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40e4a074-36f3-4449-afd5-bdb62f9d9d7d_5390x742.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Here is the link to the Google Colab notebook:</p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F1xb2QF9j5RuLQjvCx0ap2bb9jLjr9_zsk%3Fusp%3Dsharing">Application of the forward diffusion process to a practical example</a></p><p>So our choice of the Gaussian transition kernel actually works!</p><p>Remember we started out with the following:</p><p>What if we think of our encoder as a machine which diffuses the data?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21INfp%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!INfp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 424w, https://substackcdn.com/image/fetch/$s_!INfp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 848w, https://substackcdn.com/image/fetch/$s_!INfp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 1272w, https://substackcdn.com/image/fetch/$s_!INfp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21INfp%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png" width="1456" height="377" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:377,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67245,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!INfp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 424w, https://substackcdn.com/image/fetch/$s_!INfp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 848w, https://substackcdn.com/image/fetch/$s_!INfp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 1272w, https://substackcdn.com/image/fetch/$s_!INfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93542dcd-1394-4915-bb6a-acf0d4bcde96_1636x424.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, we have completely defined the above process which looks as follows:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vC-G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 424w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 848w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 1272w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21vC-G%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png" width="1456" height="352" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:352,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60693,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vC-G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 424w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 848w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 1272w, https://substackcdn.com/image/fetch/$s_!vC-G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff235544f-34f1-4cc2-b218-9a5501312c7b_1620x392.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>But the main question remains:</p><p><strong>(1) What about the decoder? How does it look like?</strong></p><p><strong>(2) And how can we learn the original data distribution?</strong></p><p></p><h3>The Learnable Decoder</h3><blockquote><p><em>Our objective is to starting from pure, unstructured noise and to progressively denoise this randomness, step by step, until a coherent and meaningful data sample emerges.</em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UgDq%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UgDq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 424w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 848w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 1272w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21UgDq%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png" width="1456" height="676" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/30e59239-804a-474a-91fd-77a3788c037d_1914x888.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:676,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115433,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UgDq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 424w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 848w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 1272w, https://substackcdn.com/image/fetch/$s_!UgDq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30e59239-804a-474a-91fd-77a3788c037d_1914x888.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>For example, if the true data distribution is that of cats, then this process would look something as follows:</em></p><p>The decoder distribution is denoted as:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;p_{\\theta}(x)&quot;,&quot;id&quot;:&quot;ZYVLUMJFKV&quot;}" data-component-name="LatexBlockToDOM"></div><p>Whatever we do in this reverse process, the final goal is to maximize the probability of sampling the images from the true data distribution.</p><p>So, our objective is the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;max[p_{\\theta}(x_{0})]&quot;,&quot;id&quot;:&quot;UYJXXBCJCI&quot;}" data-component-name="LatexBlockToDOM"></div><p>This also means that we want to maximize the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;max[\\text{log}(p_{\\theta}(x_{0}))]&quot;,&quot;id&quot;:&quot;COYQCCCDVG&quot;}" data-component-name="LatexBlockToDOM"></div><p> Just as we did for VAEs, we can calculate the lower bound for this quantity as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{log}(p_{\\theta}(x_{0})) > E&quot;,&quot;id&quot;:&quot;OZVFTMUZMJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>It can proved that, here E is given by the following expression:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;E = \\text{log}p_{\\theta}(x_{0}|x_{1}) - D_{KL} (p(x_{T})|q(x_{T}|x_{0})) - D_{KL}[p_{\\theta}(x_{t-1}|x_{t}) | q(x_{t-1}|x_{t},x_{0})]&quot;,&quot;id&quot;:&quot;TMHFQPHRDC&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, &#8216;T&#8217; denotes the last time-step in the forward diffusion process, when the data becomes noise.</p><p>&#8220;q&#8221; denotes the true posterior, which means the <strong>actual conditional distribution implied by the real generative process</strong>, not an approximation made by your model.</p><p>The three terms can be denoted as &#8220;<strong>Reconstruction</strong>&#8221;, &#8220;<strong>Regularization</strong>&#8221; and &#8220;<strong>Matching the Reverse Distribution</strong>&#8221;</p><p>The first 2 terms are very similar to what we saw in the variational autoencoders. For the training of diffusion models, we ignore the first two terms and only focus on the third term.  </p><p>The third term is an extra term here, which basically means that the predicted reverse transition distribution should match as close as possible to the true transition distribution (also known as the true posterior).</p><p>Let&#8217;s take an example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fEKX%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fEKX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 424w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 848w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 1272w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21fEKX%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png" width="445" height="293.76953125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:676,&quot;width&quot;:1024,&quot;resizeWidth&quot;:445,&quot;bytes&quot;:889202,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fEKX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 424w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 848w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 1272w, https://substackcdn.com/image/fetch/$s_!fEKX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf553fa5-43b1-4201-a708-0fb00a8cdffa_1024x676.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the above image, you can see an example of a handwritten note which is smudged because of the rain.</p><p>Now, the main question is the follows?</p><p><strong>Can we predict the image at the previous time step, x(t-1)?</strong></p><p>The problem here is that, we do not know the reverse process? We cannot just go back in time :(</p><p>Now consider another case: Suppose you knew the image which you started out with, the original image. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xcKF%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xcKF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 424w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 848w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 1272w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21xcKF%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png" width="1456" height="475" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:475,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1763509,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xcKF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 424w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 848w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 1272w, https://substackcdn.com/image/fetch/$s_!xcKF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd054cc7c-a5a7-44e2-91c4-d816286d054a_2070x676.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, suddenly it becomes much easier to find the image at the previous time step, which is x(t-1).  This is because we have access to the original image.</p><p>Okay, still, how can do this, even if we have the original image?</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RgtK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 424w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 848w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 1272w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21RgtK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png" width="1456" height="277" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:277,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:595734,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RgtK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 424w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 848w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 1272w, https://substackcdn.com/image/fetch/$s_!RgtK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e0c0db9-24d2-4300-845f-0a18a85f4237_2552x486.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The question we are asking is:  </p><blockquote><p>If we knew the image of the Batman at one time step and we knew the original image, can we find the image of the Batman at a previous time step?</p></blockquote><p>We want to find the true posterior, given by (if we consider the third time step):</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;q(x_{2}|x_{3},x_{0})&quot;,&quot;id&quot;:&quot;GNYEVZMBKL&quot;}" data-component-name="LatexBlockToDOM"></div><p>The way I think about it is that:</p><p>In three time steps, I have to reduce the noise by this much. So in one time step, I will reduce the noise by one-third of that amount.</p><p>It turns out that this reverse process can be approximated by a Gaussian distribution with a mean and a variance.</p><p>Intuitively, we expect the mean to depend on the original image as well as the image at the current time step.</p><p>Hence, we can write the mean of the true posterior as follows: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mu (x_{i},x_{0}) = A_{1}x_{0} + A_{2} x_{i}&quot;,&quot;id&quot;:&quot;BBYEHWWRRH&quot;}" data-component-name="LatexBlockToDOM"></div><p> Here, xi denotes the current image and x0 denotes the original image.</p><p> Here, A1 and A2 are functions of the standard deviations in the forward transition process.  I will include a book in the resources section where you can find the derivation for these values.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A_{1} = f(\\beta_{1},\\beta_{2},\\beta_{3}...)&quot;,&quot;id&quot;:&quot;VFILQBDBTF&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A_{2} = g(\\beta_{1},\\beta_{2},\\beta_{3}...)&quot;,&quot;id&quot;:&quot;PKIPANSQPS&quot;}" data-component-name="LatexBlockToDOM"></div><p>The standard deviation of the true posterior can also be written as a function of all the standard deviations, which can be denoted as follows </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sigma(i) = A_{3}&quot;,&quot;id&quot;:&quot;VKTVXOXRSB&quot;}" data-component-name="LatexBlockToDOM"></div><p>Let us look at a practical example where we apply the mathematical form for the true posterior to transform a noisy image into an original image, given the original image as the input.</p><p> Here, we will take the example of handwritten digits.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216Pss%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Pss!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 424w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 848w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 1272w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%216Pss%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png" width="1456" height="770" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:770,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128088,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6Pss!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 424w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 848w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 1272w, https://substackcdn.com/image/fetch/$s_!6Pss!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F030ac8e0-6d67-4253-89db-2540b5e1e235_1494x790.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here is the link to the Google Colab notebook:</p><p><a href="iframe.php?url=https%3A%2F%2Fcolab.research.google.com%2Fdrive%2F1J3AQEgxmsryrDQ6YIDja6oeCAkh5KtA3%3Fusp%3Dsharing">Application of the true posterior gaussian distribution formula to a practical example</a></p><p><em>A question for all of you to think about: How does A1 and A2 change as the reverse transition process proceeds? Do they increase or decrease in magnitude as we go closer to the true image?</em></p><p><strong>A thought might come to your mind which says that we know the entire reverse process now: So are we done?</strong></p><p>Well, not quite. The reason is that we have calculated the reverse transition kernel conditioned on the original image.</p><p>In our application, we have to generate the image from the noise, so the original given image will not be known to us.</p><p>Look at the third term in our objective function, which we want to maximize:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;- D_{KL}[p_{\\theta}(x_{t-1}|x_{t}) | q(x_{t-1}|x_{t},x_{0})]&quot;,&quot;id&quot;:&quot;JOCTNUQCNW&quot;}" data-component-name="LatexBlockToDOM"></div><p> This means that we need to minimize the KL divergence between our model prediction and the true posterior.</p><p> Our true posterior is a Gaussian, and we will assume that our model prediction is also a Gaussian distribution.  The mean of our model distribution is not known to us. However, we will assume that our model has the same variance as that of the true posterior.</p><p> This means that our task is to minimize the KL divergences between two Gaussians with the same variance and different means.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Cqie%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cqie!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 424w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 848w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 1272w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21Cqie%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png" width="1456" height="749" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:749,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:532198,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/181969460?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cqie!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 424w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 848w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 1272w, https://substackcdn.com/image/fetch/$s_!Cqie!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa26ceba6-9eba-4a85-baeb-4eecefda37e9_2787x1434.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It turns out that this is equivalent to minimizing the mean square error between both the means: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; D_{KL}[p_{\\theta}(x_{t-1}|x_{t}) | q(x_{t-1}|x_{t},x_{0})] = \\frac {1}{2\\sigma^{2}}||\\mu_{\\phi}(x_{i}) - \\mu(x_{i},x_{0})||^{2}&quot;,&quot;id&quot;:&quot;NEFGHHSIWA&quot;}" data-component-name="LatexBlockToDOM"></div><p>Now, let us see how we can simplify this loss:</p><p>  We already know the mean of the true posterior:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mu (x_{i},x_{0}) = A_{1}x_{0} + A_{2} x_{i}&quot;,&quot;id&quot;:&quot;LPRYEPQJVE&quot;}" data-component-name="LatexBlockToDOM"></div><p> Let us approximate the mean of our model to be as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mu_{\\phi} (x_{i}) = A_{1}\\hat{x_{0}} + A_{2} x_{i}&quot;,&quot;id&quot;:&quot;FLKTZZKOJP&quot;}" data-component-name="LatexBlockToDOM"></div><p> Now our loss function can be written as follows: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; D_{KL}[p_{\\theta}(x_{t-1}|x_{t}) | q(x_{t-1}|x_{t},x_{0})] = \\frac {A_{1}^{2}}{2\\sigma^{2}}||\\hat{x_{0}} - x_{0}||^{2}&quot;,&quot;id&quot;:&quot;FUAYKPTCBE&quot;}" data-component-name="LatexBlockToDOM"></div><p>This means that: </p><div class="pullquote"><p>To make our one-step reverse distribution match the true one, it&#8217;s enough to make our predicted clean sample&#8203; close to the real one.</p></div><p>So training becomes a <strong>simple supervised regression</strong> problem: predict the clean thing from the noisy thing.</p><p> Now, we can do one more simplification to make it even more intuitive. </p><blockquote><p>The real clean sample can be predicted from the real current image by removing noise. </p></blockquote><blockquote><p> The predicted clean sample can be predicted from the predicted current image by removing the predicted noise. </p></blockquote><div class="pullquote"><p> This means that we can express the real clean sample and the predicted clean sample in terms of the real noise and the predicted noise</p></div><p> After doing this, the last term simplifies to the following:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;D_{KL}[p_{\\theta}(x_{t-1}|x_{t}) | q(x_{t-1}|x_{t},x_{0})] = C||\\hat{\\epsilon} - \\epsilon||^{2}&quot;,&quot;id&quot;:&quot;KQWLIDMBTI&quot;}" data-component-name="LatexBlockToDOM"></div><p>Here, C is a constant.</p><p>This means that: </p><div class="pullquote"><p>To make our one-step reverse distribution match the true one, it&#8217;s enough to make our predicted noise&#8203; close to the real noise.</p></div><p>That&#8217;s it!</p><p>Here is the link to the original paper which introduced <em>DDPM (Denoising Diffusion Probabilistic Models): <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2006.11239">https://arxiv.org/abs/2006.11239</a></em></p><p>For more detailed proofs, please refer to the book: <em>The Principles of Diffusion Models From Origins to Advances (<a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2510.21890">https://arxiv.org/abs/2510.21890</a>) [Pages 43-55]</em></p><p>If you like this content, please check out our bootcamps on the following topics:</p><p><strong>Modern Robot Learning</strong>: <a href="iframe.php?url=https%3A%2F%2Frobotlearningbootcamp.vizuara.ai%2F">https://robotlearningbootcamp.vizuara.ai/</a></p><p><strong>GenAI</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fgen-ai-professional-bootcamp">https://flyvidesh.online/gen-ai-professional-bootcamp</a></p><p><strong>RL</strong>: <a href="iframe.php?url=https%3A%2F%2Frlresearcherbootcamp.vizuara.ai%2F">https://rlresearcherbootcamp.vizuara.ai/</a></p><p><strong>SciML</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-bootcamp">https://flyvidesh.online/ml-bootcamp</a></p><p><strong>ML-DL</strong>: <a href="iframe.php?url=https%3A%2F%2Fflyvidesh.online%2Fml-dl-bootcamp">https://flyvidesh.online/ml-dl-bootcamp</a></p><p><strong>CV</strong>: <a href="iframe.php?url=https%3A%2F%2Fcvresearchbootcamp.vizuara.ai%2F">https://cvresearchbootcamp.vizuara.ai/</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[SAM 3: Segment Anything with Concepts]]></title><description><![CDATA[Imagine if your SAM could understand semantics without external code/involvement, SAM3 by Meta provides a unified method to detect, segment and tracks all instances of a specific concept in images.]]></description><link>https://vizuara.substack.com/p/sam-3-segment-anything-with-concepts</link><guid isPermaLink="false">https://vizuara.substack.com/p/sam-3-segment-anything-with-concepts</guid><dc:creator><![CDATA[Siddhant Rai]]></dc:creator><pubDate>Mon, 22 Dec 2025 03:30:35 GMT</pubDate><enclosure url="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21q4_a%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of contents</h1><ol><li><p><em>Introduction</em></p></li><li><p><em>The Segmentation Tasks: Semantic, Instance, and Panoptic</em></p></li><li><p><em>Why a Foundation Model for Segmentation is so Hard?</em></p></li><li><p><em>The SAM Model (SAM 1 and SAM 2)</em></p></li><li><p><em>The Bottleneck of PVS</em></p></li><li><p><em>Ideal case</em></p></li><li><p><em>Methodology</em></p><ol><li><p><em>Promptable Concept Segmentation (PCS)</em></p></li><li><p><em>Data and Data Engine</em></p></li><li><p><em>Metrics</em></p></li><li><p><em>Model architecture</em></p></li><li><p><em>Training pipeline</em></p></li><li><p><em>Inference</em></p></li></ol></li><li><p><em>Results/Outcome</em></p></li><li><p><em>SAM 3 Agent (Visual)</em></p></li><li><p><em>Thoughts</em></p></li><li><p><em>Conclusion</em></p></li></ol><div><hr></div><h2>1. Introduction</h2><p>Object segmentation is the &#8220;holy grail&#8221; of computer vision. It&#8217;s the task of giving an AI a pair of scissors and asking it to cut out every individual item in an image not just seeing a &#8220;blob&#8221; of a car, but tracing every tire, window, and door handle with surgical precision.</p><p>For a long time, this was dominated by human-intervention-based, generalized image-processing methods like <strong>Watershed</strong> (frequently used in cell analysis) or <strong>GrabCut</strong>. While the era of Deep Learning eventually brought us models capable of providing robust masks, they were &#8220;specialized&#8221;; meaning they only worked on specific classes or labels they had seen during training. If you trained it on cats, it was blind to chairs.</p><p>Then came the original <strong>Segment Anything Model (SAM)</strong>. It broke this barrier by providing a generalized model for segmentation tasks without the restrictions of the past. It combined the &#8220;segment anything&#8221; flexibility of old image-processing methods with the high-quality, robust masks of deep learning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21q4_a%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q4_a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 424w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 848w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 1272w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 1456w" sizes="100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21q4_a%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png" width="577" height="433" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:433,&quot;width&quot;:577,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q4_a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 424w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 848w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 1272w, https://substackcdn.com/image/fetch/$s_!q4_a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c80a43-3e81-4e05-b831-2c4303c6f911_577x433.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But even with SAM, there was a catch.</p><p>Have you ever tried to describe a &#8220;vintage red leather chair&#8221; to someone using only your finger? You point, they look; you point again, they see. From the first <strong>SAM 1</strong> to its video-savvy successor <strong>SAM 2</strong>, the game was simple: <em>Give me a point or a box, and I&#8217;ll give you a mask.</em> It was a masterpiece of geometry (essentially a digital finger pointing at pixels). But, <em>it&#8217;s like asking a blind-folded artist to fill in paint in your sketch, which he/she has no idea at all.</em></p><p>But what if you don&#8217;t want to point? What if you want to say, &#8220;Find every yellow school bus in this 10-minute video,&#8221; and just walk away to grab a coffee?</p><p>Well, bear with me, because we are entering a new era. <strong>SAM 3</strong> isn&#8217;t just about <em>where</em> things are; it&#8217;s finally starting to understand <em>what</em> they are.</p><p>In this article, we&#8217;re going to glide through the transition from <strong>Promptable Visual Segmentation (PVS)</strong>; where we essentially played &#8220;tag&#8221; with pixels, to the much more powerful <strong>Promptable Concept Segmentation (PCS)</strong>. We&#8217;ll see how Meta moved from geometry to semantics, and why &#8220;understanding&#8221; an object is much harder (and much more rewarding) than just &#8220;tracing&#8221; it.</p><div><hr></div><h2>2. The Segmentation Tasks: Semantic, Instance, and Panoptic</h2><p>Before SAM 3 can &#8220;understand concepts,&#8221; we need to define the three traditional ways AI has been taught to look at a scene. Imagine a photo of a street with five people, three cars, and a large patch of sky.</p><h3>1. Semantic Segmentation (The What)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qhWL%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qhWL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21qhWL%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png" width="1010" height="278" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:278,&quot;width&quot;:1010,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:276896,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qhWL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!qhWL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53f8e2d-5a73-4c33-a865-4fd584f686e9_1010x278.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is the &#8220;categorical&#8221; view. The model looks at the image and assigns every <em><strong>single pixel to a class</strong></em>.</p><ul><li><p><strong>The Logic:</strong> &#8220;All these pixels are &#8216;Person,&#8217; and all those pixels over there are &#8216;Car.&#8217;&#8221;</p></li><li><p><strong>The Flaw:</strong> It doesn&#8217;t care about individuals. In our street photo, the five people would be merged into one giant, multi-limbed &#8220;Person blob.&#8221; It sees the <em>material</em>, not the <em>object</em>.</p></li></ul><h3>2. Instance Segmentation (The Who)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21g3d8%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!g3d8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21g3d8%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png" width="1010" height="278" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:278,&quot;width&quot;:1010,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:247832,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!g3d8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!g3d8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F62193b7f-7e4a-424b-b5dd-8ae3176566c2_1010x278.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is the &#8220;individual&#8221; view. The model only cares about things it can <em><strong>count</strong></em> (often called &#8220;things&#8221; in research papers).</p><ul><li><p><strong>The Logic:</strong> &#8220;Here is Person #1, Person #2, and Car #1.&#8221;</p></li><li><p><strong>The Catch:</strong> It usually ignores the background. The sky, the road, and the grass are left as &#8220;nothingness&#8221; because you can&#8217;t really have &#8220;one instance of sky.&#8221;</p></li></ul><h3>3. Panoptic Segmentation (The Everything)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XvxV%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XvxV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21XvxV%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png" width="1010" height="278" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:278,&quot;width&quot;:1010,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:278192,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XvxV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 424w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 848w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 1272w, https://substackcdn.com/image/fetch/$s_!XvxV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c63b637-f00d-4941-a7ab-9c6d28bb48fe_1010x278.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Panoptic is the &#8220;<em><strong>unified</strong></em>&#8221; view. It combines the two above. It identifies every individual person (instances) <strong>and</strong> classifies the background sky and road (semantics). Here, every object gets a semantic ID and an instance ID, hence maintaining class and individuality information both.</p><h3>Where does SAM lie?</h3><p>This is where it gets interesting. The original <strong>SAM 1 and 2</strong> didn&#8217;t perfectly fit into any of these boxes. Why? Because they were <strong>class-agnostic</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lR2U%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lR2U!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 424w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 848w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 1272w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21lR2U%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png" width="1456" height="839" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:839,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lR2U!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 424w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 848w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 1272w, https://substackcdn.com/image/fetch/$s_!lR2U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7dcadeb-4b82-453b-a65e-137de74ecd85_9700x5588.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you clicked a person, SAM would give you an <strong>Instance</strong> mask, but it didn&#8217;t know the label &#8220;Person.&#8221; It was like a master tailor who can perfectly cut a suit but doesn&#8217;t know the word &#8220;suit.&#8221; It was purely a <strong>Geometric Segmenter</strong>.</p><p><strong>SAM 3 is the bridge.</strong> By introducing <strong>Promptable Concept Segmentation (PCS)</strong>, SAM 3 effectively performs <strong>Open-Vocabulary Panoptic Segmentation</strong>.</p><ul><li><p><strong>It&#8217;s Semantic:</strong> Because it understands the &#8220;Concept&#8221; (e.g., &#8220;Sky&#8221; or &#8220;Grass&#8221;).</p></li><li><p><strong>It&#8217;s Instance-based:</strong> Because it can distinguish between &#8220;Yellow Bus #1&#8221; and &#8220;Yellow Bus #2.&#8221;</p></li><li><p><strong>It&#8217;s Unified:</strong> It can handle both &#8220;stuff&#8221; (backgrounds) and &#8220;things&#8221; (objects) across images and videos.</p></li></ul><p><em>If older models were specialists in &#8220;Who&#8221; or &#8220;What,&#8221; SAM 3 is the first generalist that understands <strong>&#8220;Who, What, and Where&#8221;</strong> all at once. It takes the &#8220;Universal Scissors&#8221; of SAM 1 and hands them to a model that has actually read the encyclopedia.</em></p><div><hr></div><h2>3. The &#8220;Holy Grail&#8221; Problem: Why a Foundation Model for Segmentation is so Hard (and So Vital)</h2><p>Before we look at the &#8220;how,&#8221; we have to address the &#8220;why.&#8221; You might think, <em>&#8220;We have GPT-4 for text and Sora for video; why was a &#8216;Foundation Model&#8217; for pixels so late to the party?&#8221;</em> Well, bear with me, because pixels are much &#8220;messier&#8221; than words.</p><h3>1. The Infinite Variety of Things</h3><p>In language, a &#8220;word&#8221; is a discrete unit. But in a photo of a forest, where does one leaf end and another begin? Is the tree one object, or is every branch, twig, and lichen-covered patch of bark a separate entity?</p><p>Creating a foundation model means the AI can&#8217;t just memorize 1,000 categories (like the famous ImageNet). It must understand the very <strong>concept of &#8220;objectness.&#8221;</strong> It has to look at a shape it has never seen before; lets say, a piece of alien machinery or a microscopic cell and instinctively know its boundaries. This is the difference between a student who memorizes the textbook and a scientist who understands the laws of physics.</p><h3>2. The Annotation Tax</h3><p>This is where it gets physically painful. Training a text model is &#8220;easy&#8221; in one sense: the internet is a giant pile of free text. But to train a segmentation model, a human usually has to sit down and painstakingly trace the outline of objects.</p><ul><li><p><strong>The Math of Labor:</strong> Tracing a single complex object can take a human 10 to 60 seconds. To get to the scale of a &#8220;Foundation Model,&#8221; you need <strong>billions</strong> of masks. If we relied purely on manual labor, we&#8217;d still be waiting for SAM 1 in the year 2050!</p></li></ul><h3>3. Why It&#8217;s the &#8220;Bedrock&#8221; of Vision</h3><p>So, why go through all this trouble? Because segmentation is the &#8220;eyes&#8221; for every other task.</p><ul><li><p><strong>Robotics:</strong> A robot can&#8217;t pick up a mug if it can&#8217;t tell where the handle ends and the table begins.</p></li><li><p><strong>Medicine:</strong> A surgeon needs to know exactly where a tumor stops and healthy tissue starts.</p></li><li><p><strong>Self-Driving:</strong> It&#8217;s not enough to know there is a &#8220;blob&#8221; in the road; the car needs to know if that blob is a cardboard box or a small child.</p></li></ul><p><em>Without a Foundation Model for segmentation, every AI developer has to &#8220;re-invent the wheel&#8221; for their specific task. SAM 3 aims to be the <strong>Base/fine-grained Information extraction layer</strong>; the universal layer that understands the physical structure of our world so we don&#8217;t have to (atleast at the pixel level).</em></p><div><hr></div><h2>2. The Great Divide: Why Segmenting &#8220;Anything&#8221; Used to be a Zero-Sum Game</h2><p>For years, if you wanted to segment an image, you had to pick a side. You were either using <strong>Image Processing</strong> or <strong>Deep Learning Specialists</strong>. You couldn&#8217;t have both quality and generality.</p><h3>Camp A: The Smart Specialists (Deep Learning)</h3><p>When Deep Learning arrived, we finally got &#8220;robust&#8221; masks. These models didn&#8217;t just look at color; they looked at <strong>Semantics</strong>. They understood that a &#8220;wheel&#8221; belongs to a &#8220;car.&#8221;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JOqZ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JOqZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 424w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 848w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 1272w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JOqZ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png" width="393" height="262.601607347876" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:582,&quot;width&quot;:871,&quot;resizeWidth&quot;:393,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Object Detection Using Mask R-CNN with TensorFlow 1.14 and Keras |  DigitalOcean&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Object Detection Using Mask R-CNN with TensorFlow 1.14 and Keras |  DigitalOcean" title="Object Detection Using Mask R-CNN with TensorFlow 1.14 and Keras |  DigitalOcean" srcset="https://substackcdn.com/image/fetch/$s_!JOqZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 424w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 848w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 1272w, https://substackcdn.com/image/fetch/$s_!JOqZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12550cc4-942c-4132-a2b4-dd7e8df0f9dd_871x582.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>The Power:</strong> They provided surgical, high-quality masks that could handle shadows and overlaps.</p></li><li><p><strong>The Catch:</strong> They were &#8220;Closed-World.&#8221; They only worked on the specific classes (e.g., &#8220;Person,&#8221; &#8220;Dog,&#8221; &#8220;Chair&#8221;) they saw during training. Show a medical-grade specialist model a picture of a &#8220;corrugated cardboard box,&#8221; and it might see nothing at all. They were incredibly smart, but they were essentially &#8220;specialized doctors&#8221; who couldn&#8217;t identify a common cold outside their field.</p></li></ul><h3>Camp B: The Shallow Generalists (Image Processing)</h3><p>On the other side, we had <strong>Generalist</strong> methods like <strong>GrabCut</strong> or <strong>Watershed</strong>. These didn&#8217;t care about labels, so they could technically segment &#8220;anything.&#8221; But they were &#8220;Shallow.&#8221;</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CVbJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CVbJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 424w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 848w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 1272w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21CVbJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png" width="363" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:685,&quot;width&quot;:685,&quot;resizeWidth&quot;:363,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A novel deep learning-based 3D cell segmentation framework for future image- based disease detection | Scientific Reports&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A novel deep learning-based 3D cell segmentation framework for future image- based disease detection | Scientific Reports" title="A novel deep learning-based 3D cell segmentation framework for future image- based disease detection | Scientific Reports" srcset="https://substackcdn.com/image/fetch/$s_!CVbJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 424w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 848w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 1272w, https://substackcdn.com/image/fetch/$s_!CVbJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed978921-b3ab-49aa-ad0e-0ee2301435b2_685x685.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="iframe.php?url=https%3A%2F%2Fwww.nature.com%2Farticles%2Fs41598-021-04048-3">https://www.nature.com/articles/s41598-021-04048-3</a></figcaption></figure></div><ul><li><p><strong>The Logic:</strong> &#8220;Is the color/texture of Patch A mathematically similar to Patch B?&#8221;</p></li><li><p><strong>The Flaw:</strong> This is a <strong>Shallow Representation</strong>. It relies on local features like color gradients.</p></li></ul><p> <em>In the world of text, this is like using &#8220;Frequency-based&#8221; methods (counting words) versus &#8220;Semantics-based&#8221; methods (understanding meaning). A frequency-based model knows the word &#8220;Apple&#8221; appears twice, but it doesn&#8217;t know if it&#8217;s a fruit or a trillion-dollar tech company. Similarly, these older vision methods saw the &#8220;count&#8221; of red pixels, but lost the &#8220;semantics&#8221; of the apple.</em></p><h3>The Architectural Dead-End</h3><p>The real &#8220;bottleneck&#8221; wasn&#8217;t just the math; it was the <strong>Data and Representation</strong>.</p><ol><li><p><strong>Semantic Loss:</strong> Because image processing relied on local features, it had no &#8220;Visual Vocabulary.&#8221; It couldn&#8217;t connect a &#8220;wing&#8221; and a &#8220;beak&#8221; because they look nothing alike at a pixel level.</p></li><li><p><strong>No Intervention:</strong> There was almost no room for manual intervention at the model level. Because there was no learned &#8220;latent space,&#8221; you couldn&#8217;t &#8220;teach&#8221; the model to be better. You were stuck with the limitations of your hand-crafted kernel.</p></li></ol><p>To bridge this gap, we needed a model that had the <strong>robust semantics</strong> of a specialist but the <strong>limitless vocabulary</strong> of a generalist. We needed a model that could see a shape it had never seen before and say, &#8220;I don&#8217;t know what that is, but I know exactly where it ends.&#8221;</p><div><hr></div><h2>4. The SAM Model: Bridging the Gap with PVS</h2><p>How did SAM break the bottleneck? It didn&#8217;t just try to be a better &#8220;classifier&#8221;; it redefined the interface between humans and pixels through <strong>Promptable Visual Segmentation (PVS)</strong>.</p><h3>The Power of the &#8220;Prompt&#8221;</h3><p>SAM&#8217;s &#8220;secret sauce&#8221; was its ability to take a <strong>Visual Prompt</strong> (a point, a box, or a rough mask) and treat it as a command.</p><p>Remember our toddler analogy? SAM acted like a highly trained assistant who is watching your finger. When you click a pixel, the model doesn&#8217;t just look at that color; it projects that point into a high-dimensional <strong>Feature Space</strong>. It asks: <em>&#8220;What is the most likely &#8216;object-like&#8217; structure that contains this point?&#8221;</em></p><h3>Why It Works So Well: The Region-Based Assumption</h3><p>Under the hood, SAM operates on a sophisticated version of <strong>Region-Based Segmentation</strong>.</p><p>Instead of the old &#8220;Macro-pixel&#8221; approach where we compared Patch A to Patch B using a fixed kernel, SAM uses a <strong>Vision Transformer (ViT)</strong> backbone to create a rich, semantic map of the entire image.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EV7k%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EV7k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 424w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 848w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 1272w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EV7k%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png" width="1456" height="463" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:463,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:236187,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EV7k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 424w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 848w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 1272w, https://substackcdn.com/image/fetch/$s_!EV7k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c6e877e-0555-426d-b8b7-079b471ff878_1661x528.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>The Representation:</strong> Unlike GrabCut, which only saw color gradients, SAM&#8217;s representation is &#8220;deep.&#8221; It understands edges, textures, and even parts of objects.</p></li><li><p><strong>The Ambiguity Solver:</strong> If you click on a person&#8217;s arm, are you segmenting the arm, the shirt sleeve, or the whole person? SAM handles this by producing multiple valid masks (sub-part, part, and whole) and assigning a confidence score to each.</p></li></ul><h3>Connecting the Dots: Ambiguity as a Feature, Not a Bug</h3><p>In older architectures, ambiguity was a failure. If the math was 51% sure it was a leaf and 49% sure it was a frog, the result was a messy, flickering mask.</p><p>SAM embraces this. By moving from a simple kernel to a <strong>Prompt-based Decoder</strong>, it allows for &#8220;Interactive Refinement.&#8221; If the first click doesn&#8217;t get the whole object, the second click acts as a &#8220;correction.&#8221; </p><p>It&#8217;s like sculpting with clay. Older methods gave you a fixed mold; if the mold was wrong, the sculpture was ruined. SAM gives you the clay and a set of tools (points/boxes) to refine the shape until it&#8217;s perfect.</p><h3>The &#8220;Generalization&#8221; Miracle</h3><p>The reason SAM feels like magic is that it was trained on <strong>1.1 Billion masks</strong> (the SA-1B dataset). This massive scale allowed it to learn a &#8220;Universal Concept of Objectness.&#8221;</p><p>It doesn&#8217;t need to know what a &#8220;microscope&#8221; is to segment one perfectly. It just recognizes that the metal, the glass, and the base form a coherent, self-contained <strong>Region</strong>. It combined the <strong>Robustness</strong> of Deep Learning with the <strong>Flexibility</strong> of Image Processing, effectively ending the &#8220;Zero-Sum Game&#8221; we talked about in the last section.</p><p>To truly appreciate the leap to <strong>SAM 3</strong>, we have to understand the architectural &#8220;DNA&#8221; it inherited from its ancestors. Both SAM 1 and SAM 2 were masterpieces of engineering, but they were built for a different kind of conversation.</p><h3>SAM 1: The Foundation of Interactive Geometry</h3><p>SAM 1 introduced the world to the <strong>Decoupled Image-Prompt Architecture</strong>.<sup>1</sup> It split the task into two distinct speeds:</p><ol><li><p><strong>The Heavy Lifter (Image Encoder):</strong> A massive Vision Transformer (ViT) that processes the image once. It&#8217;s slow, but it creates a rich &#8220;feature map&#8221; a high-dimensional representation of every pixel.</p></li><li><p><strong>The Sprinter (Prompt Encoder &amp; Mask Decoder):</strong> This is the magic part. It takes your &#8220;points&#8221; or &#8220;boxes&#8221; and merges them with the feature map in real-time.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215gh-%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5gh-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 424w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 848w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 1272w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215gh-%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png" width="1456" height="368" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:368,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;What is Meta's Segment Anything Model(SAM)?&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="What is Meta's Segment Anything Model(SAM)?" title="What is Meta's Segment Anything Model(SAM)?" srcset="https://substackcdn.com/image/fetch/$s_!5gh-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 424w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 848w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 1272w, https://substackcdn.com/image/fetch/$s_!5gh-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87390023-d7de-4bfa-b4d8-d08fe3ccdb66_1504x380.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Because the heavy image encoding happens only once, you can click anywhere in the image and get a mask in <strong>~50ms</strong>. It turned a complex optimization problem into a simple &#8220;lookup&#8221; table.</p><h3>SAM 2: Adding the &#8220;Time Dimension&#8221;</h3><p>SAM 2 took that same foundation and added <strong>Memory</strong>. If SAM 1 was a photographer taking a still shot (evaluating/processing a single frame), SAM 2 was a filmmaker (operating over a group of frames).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-KLT%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-KLT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 424w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 848w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 1272w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21-KLT%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png" width="1105" height="279" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:279,&quot;width&quot;:1105,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:173888,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-KLT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 424w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 848w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 1272w, https://substackcdn.com/image/fetch/$s_!-KLT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd341f50-e7a2-44be-9509-ed070cbf7c2f_1105x279.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It introduced a <strong>Memory Bank</strong> and a <strong>Memory Attention</strong> layer. Instead of seeing every video frame as a new image, it asked: <em>&#8220;How does the current frame relate to what I saw 5 frames ago?&#8221;</em> It allowed the model to &#8220;remember&#8221; the mask of a dolphin even as it splashed through water, effectively bridging the gap between images and video.</p><h3>The Missing Link: The Semantic &#8220;Brain&#8221;</h3><p>So, if SAM 1 and 2 were so good, what was missing? <strong>The Prompt Encoder was too simple.</strong></p><ul><li><p>In SAM 1 and 2, the Prompt Encoder only understood <strong>Geometry</strong> (coordinates x, y). It had no idea what a &#8220;dog&#8221; or &#8220;chair&#8221; was.</p></li><li><p>They were <strong>Content-Agnostic</strong>. To them, every &#8220;point&#8221; was just a coordinate on a grid, not a concept in a dictionary.</p></li></ul><p>SAM 3&#8217;s architecture finally takes the decoder and gives it a <strong>Semantic Vocabulary</strong>. It&#8217;s the same fast, efficient engine, but it finally knows how to read the map it&#8217;s looking at.</p><div><hr></div><p>While SAM 1 and SAM 2 felt like magic, even magic has its limits. If you&#8217;ve ever used SAM to annotate a long video or a complex scene, you&#8217;ve likely hit a wall : the <strong>PVS Bottleneck</strong>.</p><h1>4. The Bottleneck of PVS</h1><p>The original SAM methodology was built on <strong>Promptable Visual Segmentation (PVS)</strong>. It relied on &#8220;Visual Guidance.&#8221; But as amazing as it was to have a model that could segment &#8220;anything,&#8221; we realized that &#8220;anything&#8221; is a lot of work when you have to point at it yourself.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2178eM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!78eM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 424w, https://substackcdn.com/image/fetch/$s_!78eM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 848w, https://substackcdn.com/image/fetch/$s_!78eM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 1272w, https://substackcdn.com/image/fetch/$s_!78eM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2178eM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png" width="394" height="385.4007936507937" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:493,&quot;width&quot;:504,&quot;resizeWidth&quot;:394,&quot;bytes&quot;:231034,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!78eM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 424w, https://substackcdn.com/image/fetch/$s_!78eM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 848w, https://substackcdn.com/image/fetch/$s_!78eM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 1272w, https://substackcdn.com/image/fetch/$s_!78eM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce71f6b1-af96-4bfe-a55a-8ccfe172d005_504x493.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Human dependency</h3><p>The primary issue with PVS is that it is <strong>human-dependent</strong>. To get a mask, you must provide a click, a box, or a scribble.</p><p>Imagine you are a researcher studying traffic patterns. You have 48 hours of high-definition footage, and you need to segment every &#8220;delivery truck.&#8221;</p><ul><li><p><strong>The PVS Workflow:</strong> You have to click the truck in frame 1. Then, if the truck goes behind a tree or the lighting changes in SAM 2, you might need to &#8220;correct&#8221; it with more clicks.</p></li><li><p><strong>The Scale Problem:</strong> If there are 50 trucks, that&#8217;s hundreds, if not thousands, of manual interventions.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JOBt%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JOBt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 424w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 848w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 1272w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21JOBt%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png" width="1266" height="470" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:470,&quot;width&quot;:1266,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:176214,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JOBt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 424w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 848w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 1272w, https://substackcdn.com/image/fetch/$s_!JOBt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33da8f44-ba76-4cc1-93ac-3b868d7ae3fc_1266x470.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>The Semantic Gap</h3><p>The second bottleneck is that PVS is <strong>Semantically Silent (as we discussed above)</strong>.</p><p>SAM is a master of geometry, but it&#8217;s &#8220;conceptually illiterate.&#8221; It knows that <em>this</em> group of pixels belongs together, but it doesn&#8217;t know it&#8217;s a &#8220;cell membrane&#8221; or a &#8220;yellow school bus.&#8221; This leads to two major frustrations:</p><ol><li><p><strong>Lack of Identity:</strong> In a video, SAM might track an object, but if that object leaves the frame and comes back, SAM has no way of knowing it&#8217;s the <em>same</em> &#8220;concept&#8221; unless you point at it again.</p></li><li><p><strong>The Hallucination of Shape:</strong> Because it only follows your &#8220;point,&#8221; it doesn&#8217;t use the <em>meaning</em> of the object to refine the mask. If you click a white shirt, it might accidentally include a white wall behind it because, geometrically, the boundary is fuzzy. It lacks the &#8220;common sense&#8221; to say, &#8220;Wait, walls aren&#8217;t made of cotton.&#8221;</p></li></ol><h3>The Search for the <em>Auto-Pilot</em></h3><p>We reached a point where we didn&#8217;t just want a model that could <strong>trace</strong> what we pointed at; we wanted a model that could <strong>recognize</strong> what we named.</p><p>We needed to move from the &#8220;Digital Finger&#8221; (Geometry) to the &#8220;Digital Brain&#8221; (Concepts). We needed a system that could take a natural language prompt like <em>&#8220;Find all rusted bolts&#8221;</em> and handle the rest without a single human click.</p><div><hr></div><h2>5. The Ideal Case</h2><p>In an ideal world, the interaction between a human and an AI shouldn&#8217;t be a tedious game of &#8220;connect the dots.&#8221; It should be a high-level conversation. The &#8220;Ideal Case&#8221; for segmentation rests on three pillars all of which were the driving force behind SAM 3.</p><ol><li><p><strong>Semantic Autonomy</strong></p><p>In the ideal case, we shouldn&#8217;t have to point. We should be able to provide a <strong>Concept Prompt</strong>; i.e. a phrase like <em>&#8220;damaged roof shingles&#8221;</em> or <em>&#8220;rare tropical birds&#8221;</em> and the model should have enough &#8220;world knowledge&#8221; to find every instance of that concept automatically. <strong>Here the Goal is</strong> Moving from <strong>&#8220;Where is this?&#8221;</strong> to <strong>&#8220;What is this?&#8221;</strong></p></li><li><p><strong>Temporal Consistency </strong></p><p>The ideal system wouldn&#8217;t just see an image; it would understand a <strong>Timeline</strong>. If a &#8220;red backpack&#8221; disappears behind a person and reappears three seconds later, the model shouldn&#8217;t treat it as a new &#8220;mystery object.&#8221; It should maintain a <strong>Unique Identity</strong> for that concept across the entire video, without needing a human to &#8220;re-point&#8221; it out.</p></li><li><p><strong>Decoupled Intelligence</strong></p><p>The most annoying part of current AI is &#8220;hallucination.&#8221; If you ask an old model to find &#8220;fire hydrants&#8221; in a room full of furniture, it might get confused and mask a red stool just because it&#8217;s trying to be helpful.</p><p>The model should first ask, <em>&#8220;Is there a fire hydrant here?&#8221;</em> If the answer is no, it shouldn&#8217;t even attempt to draw a mask. This is the <strong>Recognition vs. Localization</strong> split. We need a &#8220;Presence Check&#8221; to ensure the AI only speaks when it actually sees something.</p></li></ol><p>This is where SAM 3 from Meta walks into the picture. It solves the problems we&#8217;ve discussed by introducing something which they call as <strong>Promptable Concept Segmentation (PCS)</strong> along with already existing PVS.</p><div><hr></div><h1>Methodology</h1><p>Now we understand what our problems are with older SAM variants and specialized segmentation models as well as how our ideal setup would look like to solve them. Lets see how it has been actually done in SAM 3 paper.</p><h3>Promptable Concept Segmentation (PCS)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ycxM%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ycxM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 424w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 848w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 1272w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ycxM%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png" width="1037" height="493" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:493,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:662830,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ycxM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 424w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 848w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 1272w, https://substackcdn.com/image/fetch/$s_!ycxM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F98919b59-e66d-4072-b6f7-c0ea95a1bcce_1037x493.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The move from SAM 2 to <strong>SAM 3</strong> is defined by the transition from &#8220;pointing&#8221; at pixels to &#8220;naming&#8221; concepts. This shift is formalized through a new task called <strong>Promptable Concept Segmentation (PCS)</strong>.</p><p>Unlike previous versions that relied on geometric cues (PVS) to segment a single object, PCS allows the model to understand and isolate an entire class of objects across an entire scene or video.</p><ul><li><p><strong>Task Definition:</strong> Given an image or a short video (&lt;= 30 seconds), the model must <strong>detect, segment, and track</strong> every instance of a visual concept.</p></li><li><p><strong>Concept Specification:</strong> Users define the target concept through:</p><ul><li><p><strong>Text Phrases:</strong> Simple noun phrases (NPs) consisting of a noun and optional modifiers (e.g., <em>&#8220;vintage red truck&#8221;</em>).</p></li><li><p><strong>Image Exemplars:</strong> Providing a bounding box around a specific example to show the model exactly what to look for.</p></li><li><p><strong>Hybrid Prompts:</strong> A combination of both text and visual examples for maximum precision.</p></li></ul></li><li><p><strong>Global vs. Local Context:</strong></p><ul><li><p><strong>Noun Phrases</strong> act as global instructions, applying to all frames in a video.</p></li><li><p><strong>Exemplars</strong> can be provided on individual frames as positive or negative boxes to iteratively refine the target masks.</p></li></ul></li><li><p><strong>Prompt Consistency:</strong> Prompts must remain consistent in their category definition. For example, if the prompt is <em>&#8220;fish,&#8221;</em> you cannot refine it with an exemplar of just a <em>&#8220;tail.&#8221;</em> To change the scope, the text prompt itself must be updated.</p></li><li><p><strong>Open-Vocabulary Nature:</strong> The task is fundamentally <strong>open-vocabulary</strong>, meaning the model can segment any noun phrase that is visually &#8220;groundable.&#8221; It is not restricted to a pre-defined list of classes like &#8220;cat&#8221; or &#8220;car.&#8221;</p></li><li><p><strong>Inherent Ambiguity:</strong> Because language is flexible, the task faces several types of ambiguity:</p><ul><li><p><strong>Polysemy:</strong> Words with multiple meanings (e.g., <em>&#8220;mouse&#8221;</em> as an animal vs. a computer device).</p></li><li><p><strong>Subjectivity:</strong> Descriptors like <em>&#8220;cozy&#8221;</em> or <em>&#8220;large&#8221;</em> that vary by person.</p></li><li><p><strong>Vagueness:</strong> Concepts like <em>&#8220;brand identity&#8221;</em> that may be hard to ground visually.</p></li><li><p><strong>Boundary Issues:</strong> Uncertainty about whether an object like a <em>&#8220;mirror&#8221;</em> includes its frame.</p></li></ul></li><li><p><strong>Ambiguity Resolution:</strong> To handle these challenges, SAM 3 utilizes:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2159iJ%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!59iJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 424w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 848w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 1272w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%2159iJ%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png" width="1273" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:1273,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:536075,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!59iJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 424w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 848w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 1272w, https://substackcdn.com/image/fetch/$s_!59iJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49da339d-39a1-4c42-ab85-6158fffe19d7_1273x365.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Interactive Refinement:</strong> Users can add positive/negative clicks or boxes to clarify their intent.</p></li><li><p><strong>Ambiguity Module:</strong> An internal architectural component designed to predict multiple valid mask interpretations.</p></li><li><p><strong>Expert Calibration:</strong> The evaluation protocol and data pipeline were designed using multiple expert annotations to account for various valid interpretations of a single prompt.</p></li></ul><p></p></li></ul><h2>Data (Data engine and SA-co dataset)</h2><p>To significantly improve Phrase-conditioned Segmentation (PCS), SAM 3 is trained using a large-scale, iterative <strong>data engine</strong> that combines human annotators, AI annotators, and model feedback. The system actively mines failure cases where SAM 3 performs poorly and prioritizes them for annotation, enabling rapid scaling and quality improvement. By introducing AI annotators for verification tasks that match or exceed human accuracy, the pipeline more than doubles annotation throughput compared to a human-only setup.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dEWK%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dEWK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 424w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 848w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 1272w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21dEWK%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png" width="1456" height="432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:432,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:313805,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dEWK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 424w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 848w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 1272w, https://substackcdn.com/image/fetch/$s_!dEWK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6275e4e5-4818-4be6-acaf-2ba5d9bc2799_1576x468.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The data engine operates in <strong>four phases</strong>:</p><ol><li><p><strong>Phase 1 &#8211; Human Verification:</strong><br>Images and noun phrases (NPs) are sampled, masks are proposed using earlier models, and humans verify quality and exhaustivity. This produces the initial SA-Co/HQ dataset (4.3M image&#8211;NP pairs), used to train the first version of SAM 3.</p></li><li><p><strong>Phase 2 &#8211; Human + AI Verification:</strong><br>AI verifiers (fine-tuned Llama models) take over most mask quality and exhaustivity checks, with humans focusing on hard cases. NP mining is improved with adversarial hard negatives. This phase adds 122M image&#8211;NP pairs and roughly doubles data collection throughput.</p></li><li><p><strong>Phase 3 &#8211; Scaling and Domain Expansion:</strong><br>The pipeline expands to 15 visual domains and long-tail, fine-grained concepts using a large ontology. AI verifiers handle most cases, with limited human supervision for new domains. This phase adds 19.5M image&#8211;NP pairs.</p></li><li><p><strong>Phase 4 &#8211; Video Annotation:</strong><br>The engine is extended to video, producing spatio-temporal masks (&#8220;masklets&#8221;). Humans are concentrated on difficult video scenarios such as crowded scenes and tracking failures. The resulting SA-Co/VIDEO dataset contains 52.5K videos and 467K masklets.</p></li></ol><p>The outcome is the <strong>Segment Anything with Concepts (SA-Co)</strong> dataset suite:</p><ul><li><p><strong>SA-Co/HQ:</strong> 5.2M images, 4M unique noun phrases (largest high-quality open-vocabulary segmentation dataset).</p></li><li><p><strong>SA-Co/SYN:</strong> Fully synthetic annotations generated by the mature data engine.</p></li><li><p><strong>SA-Co/EXT:</strong> External datasets enriched with hard negatives.</p></li><li><p><strong>SA-Co/VIDEO:</strong> 52.5K videos with 24.8K unique noun phrases.</p></li></ul><h2>Metrics</h2><p>An accompanying <strong>SA-Co benchmark</strong> evaluates open-vocabulary segmentation across images and videos using carefully designed splits and hard negatives. Evaluation emphasizes <strong>calibrated, practical performance</strong>, combining localization (pmF1) and classification (IL_MCC) into a single metric, <strong>classification-gated F1 (cgF1)</strong>, and explicitly accounts for annotation ambiguity via multiple ground truths.</p><p><strong>Localization Metrics</strong></p><ul><li><p><strong>F&#185;&#964;</strong>: local F1 score at threshold &#964; for one datapoint</p></li><li><p><strong>pmF&#185;&#964;</strong>: positive micro F1 at threshold &#964; (aggregated over all datapoints)</p></li><li><p><strong>pmF1</strong>: average of pmF&#185;&#964; over all &#964; &#8712; [0.5, 0.95]</p></li></ul><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tT-i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 424w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 848w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 1272w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21tT-i%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png" width="991" height="100" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:100,&quot;width&quot;:991,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18882,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tT-i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 424w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 848w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 1272w, https://substackcdn.com/image/fetch/$s_!tT-i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F013261fe-91f0-4438-8ffb-7bd5fdaa747b_991x100.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><strong>Classification (Image-level)</strong></p><ul><li><p><strong>IL_TP</strong>: image-level true positives (object present and predicted)</p></li><li><p><strong>IL_FP</strong>: image-level false positives (object absent but predicted)</p></li><li><p><strong>IL_TN</strong>: image-level true negatives (object absent and not predicted)</p></li><li><p><strong>IL_FN</strong>: image-level false negatives (object present but not predicted)</p></li><li><p><strong>IL_MCC</strong>: image-level Matthews Correlation Coefficient, measuring binary classification quality with class imbalance</p></li></ul><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QWhf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 424w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 848w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 1272w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21QWhf%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png" width="1150" height="100" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:100,&quot;width&quot;:1150,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16304,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QWhf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 424w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 848w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 1272w, https://substackcdn.com/image/fetch/$s_!QWhf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12527886-a8ff-4586-92e4-7e342bea1e66_1150x100.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption"></figcaption></figure></div><p>combining both; we get cgF1 (classification-gated F1):</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5vMu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 424w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 848w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 1272w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215vMu%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png" width="361" height="49" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:49,&quot;width&quot;:361,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6284,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5vMu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 424w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 848w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 1272w, https://substackcdn.com/image/fetch/$s_!5vMu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fabad78-54e0-4c64-b9f2-afdaa31466a0_361x49.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><h2>Model Architecture</h2><p>SAM 3 is a generalization of SAM 2, supporting the new PCS task as well as the PVS task. It takes concept prompts (simple noun phrases, image exemplars) or visual prompts (points, boxes, masks) to define the objects to be (individually) segmented spatio-temporally. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215JeR%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5JeR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 424w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 848w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 1272w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215JeR%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png" width="1273" height="416" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:416,&quot;width&quot;:1273,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:255054,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5JeR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 424w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 848w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 1272w, https://substackcdn.com/image/fetch/$s_!5JeR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff310189d-7e37-4cde-896d-b7ee89048f2d_1273x416.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>SAM 3&#8217;s architecture is divided into two new primary modules: a <strong>Detector</strong> for identifying concepts in space and a <strong>Tracker</strong> for maintaining them in time.</p><h3>I. Detector Architecture (Solution to Where)</h3><p>The detector follows the <strong>DETR (DEtection TRansformer)</strong> paradigm, where object detection is treated as a set-prediction problem.</p><ul><li><p><strong>Input Encoding:</strong> The image and text prompts are processed by the <strong>Perception Encoder (PE)</strong>. If image exemplars (visual examples) are provided, they are processed by a dedicated <strong>Exemplar Encoder</strong>.</p></li><li><p><strong>Fusion &amp; Condition:</strong> A <strong>Fusion Encoder</strong> takes the raw image embeddings and conditions them using cross-attention with the &#8220;prompt tokens&#8221; (text + exemplars). This ensures the image features are &#8220;aware&#8221; of what the user is looking for.</p></li><li><p><strong>Object Queries:</strong> Learned object queries then cross-attend to these conditioned image embeddings. For each query, the model predicts:</p><ul><li><p><strong>Classification Logit:</strong> A binary label indicating if the query matches the prompt.</p></li><li><p><strong>Bounding Box Delta:</strong> A refinement of the object&#8217;s spatial location.</p></li></ul></li><li><p><strong>Dual Heads:</strong> The detector features both a <strong>Mask Head</strong> (MaskFormer-style) for instance-level shapes and a <strong>Semantic Segmentation Head</strong> for pixel-level categorical labels.</p></li></ul><h3>II. The Presence Token (Solution to What)</h3><p>One of SAM 3&#8217;s most significant innovations is the <strong>Presence Token</strong>, which solves the &#8220;Hallucination Problem&#8221; discussed earlier.</p><ul><li><p><strong>Decoupling Strategy:</strong> Traditional models force every object query to figure out <em>what</em> an object is and <em>where</em> it is simultaneously. SAM 3 decouples this.</p></li><li><p><strong>Global Gatekeeper:</strong> A learned global <strong>Presence Token</strong> is solely responsible for a single binary question: <em>&#8220;Is the target concept present in this frame at all?&#8221;</em></p></li><li><p>Mathematical Filtering: The final score for any object query (q_i) is a product:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;S_{final} = p(\\text{NP present}) \\times p(q_i \\text{ matches NP } | \\text{ NP present})&quot;,&quot;id&quot;:&quot;QDIBUZHIYG&quot;}" data-component-name="LatexBlockToDOM"></div><p>By separating global recognition from local localization, the model achieves much higher calibration and avoids drawing &#8220;phantom masks&#8221; on background noise.</p></li></ul><h3>III. Image Exemplars and Interactivity</h3><p>Unlike SAM 1 and 2, where a click yielded only one instance, SAM 3 uses <strong>Exemplars</strong> to define a category.</p><ul><li><p><strong>Categorical Guidance:</strong> If you provide a bounding box around one dog, SAM 3 uses it to find <em>all</em> dogs in the image.</p></li><li><p><strong>Exemplar Encoding:</strong> Each exemplar (box + label) is encoded using ROI-pooled visual features, positional embeddings, and label embeddings. These are then fused with the text tokens to create a unified conceptual prompt.</p></li><li><p><strong>Iterative Refinement:</strong> Users can add negative exemplars (e.g., &#8220;not this&#8221;) to remove false positives or positive exemplars to recover missed instances.</p></li></ul><h3>IV. Tracker and Video Architecture (The &#8220;When&#8221;)</h3><p>For video, SAM 3 uses a <strong>&#8220;Detect-then-Propagate&#8221;</strong> strategy. It shares the <strong>PE backbone</strong> with the detector to minimize computational overhead.</p><ul><li><p><strong>Spawning New Masklets:</strong> On each frame, the detector identifies new objects (O_t) that correspond to the concept prompt.</p></li><li><p><strong>SAM 2 Style Propagation:</strong> For objects already being tracked, the model uses a <strong>Memory Bank</strong> and <strong>Memory Encoder</strong> (inherited from SAM 2). It propagates the previous &#8220;masklet&#8221; (M_t-1) to its new location (M_t) using self-attention across frames.</p></li><li><p><strong>The Matching Function:</strong> The system uses an <strong>IoU-based matching function</strong> to associate propagated masklets with new detections. This helps the model:</p><ul><li><p>Recover from <strong>occlusions</strong> (e.g., a car going behind a tree).</p></li><li><p>Suppress <strong>tracking drift</strong> by periodically &#8220;re-prompting&#8221; the tracker with high-confidence detections from the detector.</p></li></ul></li><li><p><strong>Ambiguity Handling:</strong> For every tracked object, the decoder predicts <strong>three candidate masks</strong>. It selects the most confident one to handle uncertainty in complex scenes.</p></li></ul><p><em>By sharing a backbone but decoupling the <strong>Recognition (Presence Head)</strong> from the <strong>Temporal Identity (Tracker)</strong>, SAM 3 achieves a 2x performance gain over previous systems. It is the first model in the series where &#8220;knowing&#8221; the object is just as important as &#8220;tracing&#8221; it.</em></p><h2>Training</h2><p>The model consists of approximately <strong>840 million parameters</strong>, with a vision encoder (<strong>450M</strong>) and text encoder (<strong>300M</strong>) forming the &#8220;Perception Encoder&#8221; (PE) backbone, while the remaining <strong>100M</strong> are distributed across the detector and tracker.</p><h3>Stage 1: Perception Encoder (PE) Pre-training</h3><p>The foundation is built by pre-training the image and text encoders on a massive scale.</p><ul><li><p><strong>Data:</strong> 5.4 billion image-text pairs.</p></li><li><p><strong>Objective:</strong> Establishing broad concept coverage and robust visual-language alignment.</p></li><li><p><strong>Architecture:</strong> Transformers of &#8220;L+&#8221; size are used to balance performance and efficiency. Unlike SAM 2, this stage avoids distillation or video-specific fine-tuning, focusing purely on raw embedding quality.</p></li></ul><h3>Stage 2: Detector Pre-training (Open-Vocabulary Foundations)</h3><p>This stage transitions the model from &#8220;seeing&#8221; to &#8220;localizing&#8221; by training the DETR-based detector.</p><ul><li><p><strong>Data:</strong> A mix of human-annotated and pseudo-labeled data, treating video frames as static images.</p></li><li><p><strong>Task Training:</strong> </p><ul><li><p><strong>PCS Task:</strong> Randomly converting (image, noun phrase) pairs into visual queries or augmented bounding boxes to teach the model open-vocabulary detection.</p></li><li><p><strong>PVS Task:</strong> Pre-training for traditional SAM tasks (points/clicks) using four specific decoder queries.</p></li></ul></li><li><p><strong>Optimization:</strong> Uses <strong>AdamW</strong> with a reciprocal square-root schedule. The loss function is a weighted combination of <strong>L1</strong>, <strong>gIoU</strong>, <strong>Focal</strong>, and <strong>Dice</strong> losses to ensure both bounding box accuracy and mask quality.</p></li></ul><h3>Stage 3: Fine-tuning and Interactivity (The Precision Stage)</h3><p>This stage polishes the detector with the highest-quality data and introduces the model&#8217;s &#8220;Common Sense&#8221; gatekeeper.</p><ul><li><p><strong>Data:</strong> Strictly high-quality, exhaustivity-verified data (SA-Co/HQ); synthetic data is dropped to maximize precision.</p></li><li><p><strong>Presence Token &amp; Loss:</strong> The <strong>Presence Token</strong> is introduced here with a binary cross-entropy loss (weight: 20). This forces the model to explicitly predict whether a concept exists in a scene before attempting to segment it.</p></li><li><p><strong>Active Interactivity:</strong> The training mimics real-world usage by sampling <strong>Positive Boxes</strong> (from false negative errors) and <strong>Negative Boxes</strong> (from false positive predictions). This iterative loop (5 iterations) teaches the model how to correct its own mistakes based on user feedback.</p></li></ul><h3>Stage 4: Video Tracker Training (Temporal Stability)</h3><p>The final stage extends the model&#8217;s capabilities into the time dimension while keeping the backbone frozen.</p><ul><li><p><strong>Backbone Freezing:</strong> The PE backbone is frozen to preserve the spatial grounding learned in Stage 3.</p></li><li><p><strong>Masklet Supervision:</strong> The tracker is trained on video segments (up to 32 frames) to propagate &#8220;masklets.&#8221;</p></li><li><p><strong>Multi-Mask Logic:</strong> To handle ambiguity, the model predicts three masks per object, but only the mask with the lowest loss is supervised.</p></li><li><p><strong>Occlusion Handling:</strong> A dedicated cross-entropy loss is applied to the <strong>Occlusion Prediction Head</strong>, ensuring the model knows when an object has disappeared and should no longer be tracked, even if it cannot see the object to supervise a mask.</p></li></ul><p>In summary,</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8fds!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 424w, https://substackcdn.com/image/fetch/$s_!8fds!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 848w, https://substackcdn.com/image/fetch/$s_!8fds!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 1272w, https://substackcdn.com/image/fetch/$s_!8fds!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%218fds%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png" width="779" height="171" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/21459726-0774-4f16-bb74-a10c44ca33df_779x171.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:171,&quot;width&quot;:779,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41614,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8fds!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 424w, https://substackcdn.com/image/fetch/$s_!8fds!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 848w, https://substackcdn.com/image/fetch/$s_!8fds!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 1272w, https://substackcdn.com/image/fetch/$s_!8fds!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F21459726-0774-4f16-bb74-a10c44ca33df_779x171.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><div><hr></div><h2>Inference: Real-Time Concept Grounding</h2><p>During inference, SAM 3 functions as a real-time, unified engine that reconciles global conceptual understanding with local geometric tracking. On an <strong>H200 GPU</strong>, it processes a single image with over 100 objects in <strong>~30ms</strong> and maintains near real-time performance in video for approximately 5 concurrent objects.</p><p>The inference pipeline is designed for high-speed interactivity, allowing users to switch between high-level text commands and precise visual refinements on the fly.</p><h3>I. Image-Level Inference</h3><p>When processing a single image, SAM 3 follows a &#8220;<em>Filter-then-Localiz</em>e&#8221; logic:</p><ul><li><p><strong>The Decision Gate:</strong> The <strong>Presence Token</strong> is the first to be evaluated. It calculates the probability of the concept appearing in the image. If this score is below a predefined threshold (typically 0.5), the model can terminate the process immediately, preventing hallucinations.</p></li><li><p><strong>Open-Vocabulary Detection:</strong> The object queries interact with the conditioned image features to produce candidate bounding boxes and masks. Unlike SAM 1 and 2, which yielded one object per click, a single text prompt in SAM 3 (e.g., <em>&#8220;car&#8221;</em>) can trigger the <strong>simultaneous segmentation</strong> of every instance of that concept in the scene.</p></li><li><p><strong>Interactive Refinement:</strong> If the initial detection is imperfect, the user provides <strong>Positive/Negative Exemplars</strong> (bounding boxes). These are encoded into &#8220;Prompt Tokens&#8221; and reinjected into the Fusion Encoder, allowing the model to update all masks across the image in one pass.</p></li></ul><h3>II. Video-Level Inference</h3><p>Video inference leverages a <strong>streaming memory design</strong> that ensures temporal consistency without re-detecting every object from scratch in every frame.</p><ul><li><p><strong>Detection &amp; Initialization:</strong> On the starting frame, the detector initializes masklets for all matching objects.</p></li><li><p><strong>Propagation vs. Matching:</strong> For each subsequent frame (t):</p><ul><li><p><strong>Propagate:</strong> The tracker moves existing masklets (M_{t-1}) forward using the SAM 2-style memory bank.</p></li><li><p><strong>Detect:</strong> The detector identifies &#8220;new&#8221; objects (O_t) that may have just entered the frame.</p></li><li><p><strong>Match &amp; Update:</strong> An IoU-based matching function determines if a detection belongs to an existing tracked identity or represents a new instance.</p></li></ul></li><li><p><strong>Temporal Disambiguation:</strong> To handle &#8220;drift&#8221; (where a mask slowly slides off an object), SAM 3 calculates a <strong>Masklet Detection Score (MDS)</strong>. If an object isn&#8217;t matched to a high-confidence detection within a certain temporal window, the masklet is suppressed.</p></li><li><p><strong>Periodic Re-prompting:</strong> To solve occlusion issues, high-confidence detector outputs are used to <strong>periodically reset</strong> the tracker&#8217;s memory. This &#8220;cleans&#8221; the tracker with fresh, verified visual data, preventing errors from accumulating over long sequences.</p></li></ul><h3>III. Ambiguity Resolution</h3><p>Since natural language is polysemous (e.g., <em>&#8220;mouse&#8221;</em> can be an animal or a tool), the inference logic supports <strong>Multi-Mask Output</strong>:</p><ul><li><p>For every query, the model predicts <strong>three valid masks</strong> representing different levels of granularity (e.g., &#8220;handle,&#8221; &#8220;door,&#8221; &#8220;car&#8221;).</p></li><li><p>During tracking, the model selects the most confident mask based on the temporal context, ensuring the identity remains stable even if the visual appearance changes drastically (e.g., a car turning a corner).</p></li></ul><div><hr></div><h1>Results/Outcome</h1><p>The results for SAM 3 demonstrate a paradigm shift in computer vision, where the model transitions from a simple geometric tool to a sophisticated &#8220;Conceptual Agent.&#8221; By every metric, SAM 3 sets a new state-of-the-art (SOTA) in zero-shot segmentation, often outperforming specialist models trained on niche datasets.</p><h2>Image Segmentation: Setting the New Standard</h2><p>SAM 3 was evaluated on the <strong>PCS task</strong> using text prompts across major benchmarks (COCO, LVIS, and SA-Co). The model was tasked with predicting instance masks, bounding boxes, and semantic regions from a single noun phrase.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21BCAH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BCAH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 424w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 848w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 1272w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21BCAH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png" width="1456" height="526" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:526,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:191286,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BCAH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 424w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 848w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 1272w, https://substackcdn.com/image/fetch/$s_!BCAH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e36d44d-a6af-4516-a1e8-7553fbf56d0b_1578x570.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>SOTA Performance:</strong> SAM 3 established new records for zero-shot performance on <strong>COCO</strong> and <strong>LVIS</strong>. Specifically, it achieved significantly higher mask accuracy on LVIS compared to baselines like OWLv2 and GroundingDINO.</p></li><li><p><strong>Closing the Human Gap:</strong> On the <strong>SA-Co/Gold</strong> benchmark, SAM 3 achieved a <strong>cgF1 score of 54.1</strong>, which is more than double the strongest baseline (OWLv2) and represents <strong>74% of estimated human performance</strong>.</p></li><li><p><strong>Semantic Superiority:</strong> In semantic segmentation (labeling every pixel), it outperformed specialist models like APE across datasets like ADE-847 and Cityscapes.</p></li></ul><h2>Interactive PCS and Few-Shot Adaptation</h2><p>One of SAM 3&#8217;s greatest strengths is its ability to learn from <strong>Exemplars</strong> (visual examples) faster than previous &#8220;Promptable Visual Segmentation&#8221; (PVS) methods.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WLbN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 424w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 848w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 1272w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WLbN%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png" width="379" height="163.13810483870967" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:427,&quot;width&quot;:992,&quot;resizeWidth&quot;:379,&quot;bytes&quot;:61819,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WLbN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 424w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 848w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 1272w, https://substackcdn.com/image/fetch/$s_!WLbN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ec2da1-952c-4512-85d4-ac32cc372d84_992x427.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><ul><li><p><strong>1-Exemplar Learning:</strong> When given a single image box as a prompt, SAM 3 outperformed <strong>T-Rex2</strong> by massive margins: <strong>+18.3 AP</strong> on COCO and <strong>+20.5 AP</strong> on the ODinW &#8220;in-the-wild&#8221; benchmark.</p></li><li><p><strong>The Power of Generalization:</strong> Unlike SAM 1 or 2 (which only fix the specific object you click), SAM 3 uses an exemplar to <strong>generalize</strong>. If you click one &#8220;rusted bolt,&#8221; it automatically improves its detection for <em>all</em> rusted bolts in the image.</p></li><li><p><strong>Hybrid Gains:</strong> While PCS generalizes, the paper found that after ~4 clicks, a &#8220;Hybrid&#8221; approach, switching back to PVS (manual pixel-fixing) yields the highest possible quality.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21oQlH%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oQlH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 424w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 848w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 1272w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21oQlH%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png" width="307" height="291.2564102564103" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:629,&quot;width&quot;:663,&quot;resizeWidth&quot;:307,&quot;bytes&quot;:115865,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oQlH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 424w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 848w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 1272w, https://substackcdn.com/image/fetch/$s_!oQlH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0829d9dd-707a-4802-b228-fd01fe223d67_663x629.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h2>Video PCS and Tracking</h2><p>In the video domain, SAM 3 was tested on its ability to track concepts through complex motion, occlusions, and long sequences.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ecP2%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ecP2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 424w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 848w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 1272w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21ecP2%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png" width="1456" height="414" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157033,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ecP2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 424w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 848w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 1272w, https://substackcdn.com/image/fetch/$s_!ecP2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81bfa2e2-b524-4859-9d19-494f129b7d96_1594x453.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Benchmark Domination:</strong> On the <strong>SA-Co/VEval</strong> benchmark, SAM 3 reached <strong>80% of human performance (pHOTA)</strong>. It significantly outperformed GLEE and association-based &#8220;Tracking-by-Detection&#8221; baselines.</p></li><li><p><strong>Handling Long-Tail Phrases:</strong> The model excels specifically on benchmarks with a very large number of unique noun phrases (NPs), proving its broad vocabulary is a functional advantage in video.</p></li><li><p><strong>VOS Improvements:</strong> In traditional Video Object Segmentation (VOS), SAM 3 outperformed SAM 2.1 by a substantial <strong>6.5 points</strong> on the challenging MOSEv2 dataset.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cHLi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 424w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 848w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 1272w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21cHLi%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png" width="550" height="177.9204107830552" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:252,&quot;width&quot;:779,&quot;resizeWidth&quot;:550,&quot;bytes&quot;:49032,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cHLi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 424w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 848w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 1272w, https://substackcdn.com/image/fetch/$s_!cHLi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f39da45-232b-4864-b824-75e20dcb5ded_779x252.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li></ul><h2>Specialized Tasks: Counting and MLLM Agents</h2><p>The researchers also explored how SAM 3 could be used as a high-precision tool for larger AI systems.</p><ul><li><p><strong>Object Counting:</strong> Unlike Multimodal Large Language Models (MLLMs), which often struggle with high-count numbers, SAM 3 achieved high accuracy on <strong>CountBench</strong> and <strong>PixMo-Count</strong>. Crucially, it provides the <em>masks</em> for the objects it counts, something most MLLMs cannot do.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WSzn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 424w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 848w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 1272w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21WSzn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png" width="411" height="200.70854922279793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:377,&quot;width&quot;:772,&quot;resizeWidth&quot;:411,&quot;bytes&quot;:65306,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WSzn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 424w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 848w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 1272w, https://substackcdn.com/image/fetch/$s_!WSzn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F412b61a8-d92e-4e26-b920-39420ac68aad_772x377.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div></li><li><p><strong>The SAM 3 Agent:</strong> By combining SAM 3 with a reasoning model (like Llama), the researchers created an &#8220;Agent&#8221; that can handle complex queries (e.g., <em>&#8220;Find the object the person is reaching for&#8221;</em>). This zero-shot agent surpassed prior work on <strong>ReasonSeg</strong> and <strong>RefCOCO+</strong> without any task-specific training.</p></li></ul><h2>Key Ablations: Why SAM 3 Works</h2><p>The &#8220;Ablation&#8221; studies (removing parts of the model to see what breaks) confirmed the importance of the new architecture:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VNII%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VNII!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 424w, https://substackcdn.com/image/fetch/$s_!VNII!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 848w, https://substackcdn.com/image/fetch/$s_!VNII!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 1272w, https://substackcdn.com/image/fetch/$s_!VNII!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21VNII%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png" width="350" height="317.9878048780488" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:656,&quot;resizeWidth&quot;:350,&quot;bytes&quot;:124703,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VNII!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 424w, https://substackcdn.com/image/fetch/$s_!VNII!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 848w, https://substackcdn.com/image/fetch/$s_!VNII!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 1272w, https://substackcdn.com/image/fetch/$s_!VNII!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F609a6a89-3669-45b1-b5ea-84fb615eb2c5_656x596.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>The Presence Head:</strong> Adding this gatekeeper boosted the <strong>IL_MCC</strong> (Presence Score) by <strong>+0.05</strong>, directly reducing hallucinations.</p></li><li><p><strong>Hard Negatives:</strong> Training the model on things that <em>look</em> like the target but aren&#8217;t (e.g., a wolf vs. a dog) was the single biggest factor in precision, jumping the IL_MCC from <strong>0.44 to 0.68</strong>.</p></li><li><p><strong>Synthetic Scaling:</strong> The researchers proved that <strong>Synthetic Data (SYN)</strong> generated by SAM 3 + AI Verifiers is almost as effective as human-annotated data. This allows for massive domain adaptation (e.g., medical or industrial) without the cost of human experts.</p></li></ol><div><hr></div><h1>The SAM 3 Agent</h1><p>Out of all the sections in the very long yet descriptive (42 pages) paper; something that caught my eye was SAM3 Agent. The SAM 3 Agent is designed to handle queries that require visual common sense and relationship understanding. Instead of segmenting a phrase directly, the MLLM plans a multi-step strategy to arrive at the correct mask.</p><h3>I. The Perception-Action Loop</h3><p>The agent operates through a dynamic feedback loop:</p><ol><li><p><strong>Analysis:</strong> The MLLM analyzes the image and the complex user request.</p></li><li><p><strong>Tool Call:</strong> The MLLM invokes SAM 3 using specific &#8220;tools&#8221; to generate or filter masks.</p></li><li><p><strong>Visual Feedback:</strong> The environment returns a &#8220;Set-of-Marks&#8221; (SoM) image, the original image with colored, numbered masks rendered on it.</p></li><li><p><strong>Revision:</strong> The MLLM inspects the results and either refines the plan or finalizes the output.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EENS%21%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EENS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 424w, https://substackcdn.com/image/fetch/$s_!EENS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 848w, https://substackcdn.com/image/fetch/$s_!EENS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 1272w, https://substackcdn.com/image/fetch/$s_!EENS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%21EENS%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png" width="1117" height="422" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:422,&quot;width&quot;:1117,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:143774,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!EENS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 424w, https://substackcdn.com/image/fetch/$s_!EENS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 848w, https://substackcdn.com/image/fetch/$s_!EENS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 1272w, https://substackcdn.com/image/fetch/$s_!EENS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66a56d37-a7e8-4310-b7b7-fed6086d025a_1117x422.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>II. The Agent&#8217;s Toolset</h3><p>The MLLM has access to four primary tools to manipulate the environment:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5xkn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 424w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 848w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 1272w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 1456w" sizes="auto, 100vw"><img src="iframe.php?url=https%3A%2F%2Fsubstackcdn.com%2Fimage%2Ffetch%2F%24s_%215xkn%21%2Cw_1456%2Cc_limit%2Cf_auto%2Cq_auto%3Agood%2Cfl_progressive%3Asteep%2Fhttps%253A%252F%252Fsubstack-post-media.s3.amazonaws.com%252Fpublic%252Fimages%252Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png" width="1456" height="164" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:164,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56945,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://vizuara.substack.com/i/182067064?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5xkn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 424w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 848w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 1272w, https://substackcdn.com/image/fetch/$s_!5xkn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1dc19c5-048d-413d-829b-0481453c89c2_1505x170.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><h3>III. Context Engineering &amp; Memory</h3><p>Complex reasoning tasks often require extensive trial and error; sometimes up to <strong>60 steps</strong>. This creates two technical challenges:</p><ul><li><p><strong>Context Exhaustion:</strong> Storing dozens of high-resolution images can exceed the MLLM&#8217;s context limit.</p></li><li><p><strong>Visual Clutter:</strong> Overlapping masks from multiple rounds make the image unreadable.</p></li></ul><p>Meta implemented <strong>Aggressive Context Engineering</strong>. After each new <code>segment_phrase</code> call, the system prunes the intermediate history and deletes all previous masks. To ensure the agent doesn&#8217;t repeat mistakes, it maintains a <strong>continuously updated list of previously used prompts</strong>, allowing it to learn from its &#8220;failures&#8221; without needing the full visual history.</p><h3>IV. Outcome: Zero-Shot Reasoning</h3><p>Because SAM 3 is so robust at the &#8220;concept&#8221; level, the SAM 3 Agent can perform high-level reasoning tasks <strong>zero-shot</strong>. It surpasses prior state-of-the-art models on benchmarks like <strong>ReasonSeg</strong> and <strong>RefCOCOg</strong> without ever being specifically trained on &#8220;referring expressions.&#8221; It simply uses the MLLM&#8217;s logic to break a complex thought down into the 4 million concepts SAM 3 already understands.</p><h3>Why is this interesting/important?</h3><p>The <strong>SAM 3 Agent</strong> represents the transition from a &#8220;passive tool&#8221; to an &#8220;active problem solver.&#8221; It is important for three primary reasons:</p><ul><li><p>It solves the &#8220;semantic gap&#8221; by allowing the model to handle complex, abstract queries (e.g., <em>&#8220;the object that caused the spill&#8221;</em>) that cannot be captured by simple noun phrases.</p></li><li><p>Unlike traditional models that produce a single &#8220;one-shot&#8221; output, the Agent can <strong>self-correct</strong>. It inspects the masks SAM 3 generates and, if they are incorrect, revises its strategy by mimicking human-like trial and error.</p></li><li><p>Because it combines the planning of an MLLM with the 4-million-concept vocabulary of SAM 3, it achieves SOTA results on reasoning benchmarks (like <strong>ReasonSeg</strong>) without requiring any task-specific fine-tuning.</p></li><li><p>It introduces a novel way to manage AI memory. By &#8220;pruning&#8221; visual history but &#8220;retaining&#8221; a list of failed text prompts, it can perform long-horizon reasoning (up to 60 steps) without exceeding the MLLM&#8217;s memory limits.</p></li></ul><p>You can read more about it <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2511.16719%23page%3D55%26amp%3Bzoom%3D100%2C94%2C85">here</a>.</p><div><hr></div><h2>Thoughts</h2><ul><li><p><strong>The End of the &#8220;Specialist vs. Generalist&#8221; Dilemma:</strong> For decades, researchers had to choose between a model that was deep but narrow (specialists) or broad but shallow (image processing). SAM 3 effectively collapses this divide. By encoding 4 million concepts into a universal backbone, it provides the robustness of a specialist with the limitless vocabulary of a generalist.</p></li><li><p>The introduction of the <strong>Presence Head</strong> is a profound architectural lesson. It acknowledges that &#8220;Where is it?&#8221; is a secondary question to &#8220;Is it there?&#8221;. By decoupling recognition from localization, SAM 3 solves the hallucination problem that plagued previous zero-shot models, ensuring the AI only segments when it actually &#8220;sees&#8221; the concept.</p></li><li><p><strong>The Power of Synthetic Scaling:</strong> SAM 3 proves that we are entering an era of &#8220;Self-Correcting Data.&#8221; The fact that synthetic data (SYN) generated by the model itself, when verified by AI-verifiers, scales as effectively as human data suggests that the path to segmenting the next 40 million concepts won&#8217;t require 40 million more human hours (which is HUGE!).</p></li><li><p>The <strong>SAM 3 Agent</strong> is perhaps the most exciting frontier. It demonstrates that the future of vision isn&#8217;t just a better model, but a <strong>perception-action loop</strong>. By giving an MLLM the ability to &#8220;query&#8221; the visual world through SAM 3, we move toward AI that can perform complex reasoning tasks (like insurance Adjusting or surgical assistance) through a dialogue rather than a single static command.</p></li><li><p>By supporting text, image exemplars, and traditional clicks in a single unified model, SAM 3 lowers the barrier to entry for complex industries. A biologist can now &#8220;show&#8221; the model one rare cell type, and the model can find all others; effectively turning a state-of-the-art segmentation tool into a personalized, real-time assistant for any domain.</p></li><li><p><strong>Hierarchical Concept Reasoning:</strong> Currently, SAM 3 treats 4 million concepts as a &#8220;flat&#8221; list of noun phrases. Integrating a <strong>differentiable taxonomy</strong> (e.g., knowing a &#8220;Golden Retriever&#8221; is a subset of &#8220;Dog&#8221; which is a subset of &#8220;Animal&#8221;) directly into the Presence Head would allow the model to share features across related classes, improving performance on rare, &#8220;long-tail&#8221; concepts.</p></li><li><p><strong>Token-Efficient Video Memory:</strong> The current &#8220;Detect-then-Propagate&#8221; strategy is effective but computationally expensive for long videos. Implementing <strong>Compressed Latent Memory (in a recurrent setup or something like Titan from Google)</strong> where past frames/tokens are summarized into high-level semantic tokens rather than raw feature maps would allow the model to maintain object identity over minutes of footage rather than just 30-second clips.</p></li></ul><div><hr></div><h1>Conclusion</h1><p>At its core, <strong>Promptable Concept Segmentation</strong> reframes computer vision as a semantic dialogue rather than a geometric exercise. By moving beyond the silent &#8220;click&#8221; of previous models and introducing a 4-million-concept vocabulary, we gain the ability to navigate the visual world through the lens of human language rather than just pixel-level coordinates.</p><p>In this article, we began by tracing the lineage of the <strong>Segment Anything</strong> series, from the foundational geometry of SAM 1 to the temporal memory of SAM 2. We then identified the &#8220;Semantic Gap&#8221;; the critical limitation where previous models could trace an object but had no idea what it actually was. We revisited the spectrum of segmentation tasks (Semantic, Instance, and Panoptic) and saw how SAM 3 unifies them through <strong>Open-Vocabulary Panoptic Segmentation</strong>. We explored the methodology of the <strong>SA-Co Data Engine</strong>, diving into its four-phase evolution from human-only labeling to synthetic scaling. We dissected the architecture, highlighting the <strong>Presence Head</strong> as a global gatekeeper and the <strong>Shared Backbone</strong> that brings efficiency to video tracking. Finally, we discussed the <strong>SAM 3 Agent</strong>, a perception-action loop that treats an MLLM as the &#8220;brain&#8221; and SAM 3 as the &#8220;hands,&#8221; enabling the system to solve complex reasoning queries zero-shot.</p><p>Hence, the key takeaway is that SAM 3 is not just an incremental update; it is the first serious attempt to <strong>integrate deep semantic understanding directly into the segmentation process.</strong> It proves that when we decouple the &#8220;what&#8221; from the &#8220;where,&#8221; we don&#8217;t just get better masks, we get a model that truly recognizes the world it sees. Personally, I&#8217;m excited about the possibilities that emerge when a vision model no longer just sees pixels, but understands concepts.</p><p>References:</p><p>SAM 3 : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fpdf%2F2511.16719">https://arxiv.org/pdf/2511.16719</a><br>SAM : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2304.02643">https://arxiv.org/abs/2304.02643</a><br>SAM 2 : <a href="iframe.php?url=https%3A%2F%2Farxiv.org%2Fabs%2F2408.00714">https://arxiv.org/abs/2408.00714</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://vizuara.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vizuara&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>That's all for today.<br>Follow me on <a href="iframe.php?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fsiddhant-rai%2F">LinkedIn</a> and Substack for more such posts and recommendations, till then happy Learning. Bye&#128075;</p>]]></content:encoded></item></channel></rss>