<?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[The AiEdge Newsletter]]></title><description><![CDATA[A newsletter for continuous learning about Machine Learning applications, Machine Learning System Design, MLOps, the latest techniques and news. 
Subscribe and receive a free Machine Learning book PDF!]]></description><link>https://newsletter.theaiedge.io</link><image><url>https://substackcdn.com/image/fetch/$s_!kRD-!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Ff6e9c582-b22b-45c5-a64e-a9105824fb01_1067x1067.png</url><title>The AiEdge Newsletter</title><link>https://newsletter.theaiedge.io</link></image><generator>Substack</generator><lastBuildDate>Sat, 17 Oct 2026 21:42:44 GMT</lastBuildDate><atom:link href="https://newsletter.theaiedge.io/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[AiEdge]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[damienb@theaiedge.io]]></webMaster><itunes:owner><itunes:email><![CDATA[damienb@theaiedge.io]]></itunes:email><itunes:name><![CDATA[Damien Benveniste]]></itunes:name></itunes:owner><itunes:author><![CDATA[Damien Benveniste]]></itunes:author><googleplay:owner><![CDATA[damienb@theaiedge.io]]></googleplay:owner><googleplay:email><![CDATA[damienb@theaiedge.io]]></googleplay:email><googleplay:author><![CDATA[Damien Benveniste]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[How Hybrid LLMs Combine Memory, Attention, and Experts]]></title><description><![CDATA[Follow Mamba-2, Gated DeltaNet and KDA from state updates to the costs that active parameter counts miss.]]></description><link>https://newsletter.theaiedge.io/p/how-hybrid-llms-combine-memory-attention-and</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-hybrid-llms-combine-memory-attention-and</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Fri, 16 Oct 2026 15:00:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/507df679-3e9e-4b54-b364-dfb0ce3b7f34_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A hybrid LLM processes a sequence with more than one kind of memory. Some layers update a compact running state as tokens arrive. Other layers retain representations of individual positions and consult them through attention. The model can also use a mixture of experts, selecting a few feedforward networks for each token instead of evaluating one large dense network everywhere.</p><p>Released architectures from Qwen, Moonshot AI and NVIDIA now combine these mechanisms, making the meaning of &#8220;model size&#8221; depend on both how history is stored and which parameters actually execute.</p><p>Why combine them? <strong>They separate three resources: memory of the sequence, access to individual positions, and capacity to transform a token.</strong> Improving one resource does not automatically improve the others.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oO6d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oO6d!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oO6d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1141050,&quot;alt&quot;:&quot;Attention retains separate position entries; recurrence folds successive inputs into a fixed-size current state.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Attention retains separate position entries; recurrence folds successive inputs into a fixed-size current state." title="Attention retains separate position entries; recurrence folds successive inputs into a fixed-size current state." srcset="https://substackcdn.com/image/fetch/$s_!oO6d!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!oO6d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F55da9df9-60c6-4d7d-8f58-966a5545bb06_1774x887.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">A hybrid combines access to individual positions with a compact state that is updated as the sequence advances.</figcaption></figure></div><p>The recurrent sequence mixers belong to a recognizable family, but their writes differ:</p><ul><li><p><strong>Mamba-2</strong> selectively fades a running state and adds new information.</p></li><li><p><strong>Gated DeltaNet</strong> also checks what its memory predicts, then writes a correction.</p></li><li><p><strong>Kimi Delta Attention</strong>, or <strong>KDA</strong>, adds finer control over which state coordinates fade.</p></li></ul><p>Retained attention gives these compact memories a complementary path through position-indexed history. Mixture of experts, or <strong>MoE</strong>, changes a different component: the feedforward computation applied to each token representation.</p><p>That distinction already lets you read a hybrid architecture more accurately. In Qwen3-Next, a hybrid language model with a 3:1 mixer design, three recurrent mixers are followed by an attention mixer along the model's depth. Every token runs through that configured sequence. The model does not wait three generated tokens before using attention, and it does not decide at runtime whether a particular token deserves an attention layer.</p><p>The expert router does make a per-token choice. Mixer placement is fixed; expert selection depends on the current representation. Calling both &#8220;conditional computation&#8221; without this qualification hides how the model actually runs.</p><p>We will follow those two design decisions from the original decoder block to the memory updates, then put them back together. The payoff is practical: given another hybrid model, you should be able to explain what grows with context, what remains fixed, and why its active parameter count cannot tell you its serving cost.</p><p><strong>Contents</strong></p><ul><li><p>Two jobs inside a Transformer</p></li><li><p>Mamba-2 keeps a running state</p></li><li><p>Delta memory corrects what it stores</p></li><li><p>Why hybrids retain attention</p></li><li><p>Sparse experts change the other half</p></li><li><p>When the combination is better</p></li></ul>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-hybrid-llms-combine-memory-attention-and">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Persistent Agents Keep Working]]></title><description><![CDATA[Reconstruct a coding task&#8217;s context, preserve accepted work, and recover safely when a worker disappears.]]></description><link>https://newsletter.theaiedge.io/p/how-persistent-agents-keep-working</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-persistent-agents-keep-working</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 12 Oct 2026 15:00:33 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f1faa5ef-5f71-4170-a382-fdea7abc4b8d_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A persistent agent keeps a task moving after the model's current context, the worker process, or the execution environment has ended. It does that by saving enough information outside those components to reconstruct the next valid step. Remembering a user's preferences helps future conversations; recovering a half-finished job requires a different set of guarantees.</p><p>OpenAI's managed Agents API now exposes durable sessions, context compaction, recovery, and separate execution environments, making the boundary between a saved conversation and a recoverable task a concrete platform decision. <a href="https://developers.openai.com/api/docs/guides/agents-api/overview">Agents API overview</a>.</p><p>What actually allows an agent to continue tomorrow?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_YZ1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_YZ1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_YZ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1395540,&quot;alt&quot;:&quot;A worker disappears while task state, a saved artifact and an external receiver record remain available to a replacement.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A worker disappears while task state, a saved artifact and an external receiver record remain available to a replacement." title="A worker disappears while task state, a saved artifact and an external receiver record remain available to a replacement." srcset="https://substackcdn.com/image/fetch/$s_!_YZ1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!_YZ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50fcac19-6307-4a67-8546-841f77a211ee_1774x887.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">A replacement needs evidence from several resources, not the old process stack.</figcaption></figure></div><p>The familiar agent loop is straightforward: receive a goal, ask the LLM for an action, execute a tool, return the observation, and repeat. A short demonstration can keep almost everything in one process. Stretch that task across several hours and the assumptions change. The agent may edit files, wait for approval, lose a network response, and outlive its container. Its next prompt cannot reconstruct facts that were never durably recorded.</p><p>The useful mental model is a distributed system with a probabilistic planner inside it. The model proposes what to do. The surrounding runtime records accepted decisions, preserves evidence, executes actions, and determines what can safely happen next.</p><p>One consequence is immediately useful: <strong>a missing result is different from a failed action</strong>. An external service may have completed the request before the worker disappeared. A saved task record saying &#8220;no result recorded&#8221; tells us about the worker's knowledge. It does not tell us whether the world changed. Recovering the job means closing that gap, not asking the model to guess.</p><p>We will separate the kinds of state, reconstruct a bounded context, and work through the commit boundaries. Then we will build a local runtime, continue a code repair in a fresh context, and terminate a process between an external effect and its saved acknowledgement.</p><p><strong>Table of contents</strong></p><ul><li><p>Separate the state that must survive</p></li><li><p>Rebuild context from durable evidence</p></li><li><p>Recover execution across a crash</p></li><li><p>Resume workspaces, approvals, and delegated work</p></li><li><p>Connect the complete runtime</p></li><li><p>Build the durable runtime</p></li><li><p>Continue a coding task across context windows</p></li><li><p>Break it and compare recovery strategies</p></li></ul>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-persistent-agents-keep-working">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Self-Improving Agents Learn from Experience]]></title><description><![CDATA[How executable tasks and adaptive curricula turn production failures into useful practice.]]></description><link>https://newsletter.theaiedge.io/p/how-self-improving-agents-learn-from-experience</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-self-improving-agents-learn-from-experience</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Fri, 09 Oct 2026 15:03:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a55da6d7-048b-4060-829a-929bd75b2a5a_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A <strong>self-improving agent</strong> uses evidence from earlier tasks to change something retained for later tasks, then demonstrates better behavior on new runs. The change might be a prompt, a tool, a reusable procedure, or the model&#8217;s weights. Criticizing an answer and trying again can help finish today&#8217;s task. Persistent improvement changes what happens when tomorrow&#8217;s task begins.</p><p>OpenAI&#8217;s Tax AI deployment turns practitioner corrections into evaluated product changes, making the quality of this feedback loop a concrete engineering problem.</p><p>The interesting question is how to turn those failures into useful practice, then retain what helps on future tasks.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xzf4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xzf4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xzf4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1217323,&quot;alt&quot;:&quot;A retry loops inside one task, while a checked version change is loaded by a later task.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A retry loops inside one task, while a checked version change is loaded by a later task." title="A retry loops inside one task, while a checked version change is loaded by a later task." srcset="https://substackcdn.com/image/fetch/$s_!Xzf4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Xzf4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b1e68f-79a9-4ee8-ab8a-b3171f3082c9_1774x887.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">Persistence requires a retained artifact and a later execution that uses it.</figcaption></figure></div><p>The answer has two paths. One repairs the <strong>agent system</strong>: its code, instructions, tools, retrieval, or stored skills. The other improves the <strong>model</strong> using selected demonstrations or rewards from fresh attempts. Both need a way to decide whether a proposed change actually helps.</p><p>That is where <strong>environments</strong> become important. An environment supplies a task, a starting state, tools that change that state, and a way to evaluate the consequences. It can produce new experience when the agent tries a different action. A saved conversation contains only the experience that already happened.</p><p>This distinction changes what we should scale. More failure logs can reveal recurring defects. More executable environments can let an agent practice different decisions. Neither produces improvement until an update is made and tested on future behavior.</p><p>A useful first check is to ask what survives the run. A reflection left in a discarded conversation changes nothing for the next user. A saved skill changes future behavior only if another run retrieves and executes it. A newly trained checkpoint changes nothing until the application serves it. Persistence needs an actual connection to the next execution.</p><p>We will follow that connection through traces, three ways to construct executable environments, training, curriculum, and deployment.</p><p><strong>Contents</strong></p><ul><li><p>What persists after a run</p></li><li><p>Turn traces into testable failures</p></li><li><p>An environment produces new experience</p></li><li><p>How executable environments are built</p></li><li><p>Check what the environment rewards</p></li><li><p>Convert experience into an agent update</p></li><li><p>Build a curriculum from agent outcomes</p></li><li><p>Promote improvements on independent evidence</p></li></ul>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-self-improving-agents-learn-from-experience">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How DeepSeek V4.1 Flash Separates Reading and Generation]]></title><description><![CDATA[How a shorter input path, shared attention memory, and selective reconstruction change the cost of long conversations.]]></description><link>https://newsletter.theaiedge.io/p/how-deepseek-v4-1-flash-separates-reading-and</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-deepseek-v4-1-flash-separates-reading-and</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Wed, 07 Oct 2026 15:00:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/347ca444-69c1-4f29-bd01-de4963a09be4_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>DeepSeek V4.1 Flash generates text one <strong>token</strong> at a time. A token is a piece of text, often a word or part of one. To choose what comes next, the model transforms the text already available through successive processing stages called <strong>layers</strong>. Its unusual feature is that most supplied text can take a shorter path through those stages than a token being used to generate the next one.</p><p>DeepSeek's <a href="https://arxiv.org/html/2609.19969">technical report</a> motivates this design with agents that repeatedly receive long tool results and accumulated history, making the cost of reading and retaining that information a major part of running the model. Why should preparing old text for later use require the same computation as deciding what to write next?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s7qx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s7qx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s7qx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1060771,&quot;alt&quot;:&quot;Most supplied positions pass through the first 20 layers to prepare memory. The final 128 also prepare recent context in the next 20 layers. Each chosen answer token uses both halves and earlier memory to predict the following token.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Most supplied positions pass through the first 20 layers to prepare memory. The final 128 also prepare recent context in the next 20 layers. Each chosen answer token uses both halves and earlier memory to predict the following token." title="Most supplied positions pass through the first 20 layers to prepare memory. The final 128 also prepare recent context in the next 20 layers. Each chosen answer token uses both halves and earlier memory to predict the following token." srcset="https://substackcdn.com/image/fetch/$s_!s7qx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!s7qx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c40d6fa-0499-46aa-ac38-866b0f52b443_1774x887.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 shorter route prepares memory for later use. Recent input still enters the upper half before generation, and each chosen answer token uses both halves.</figcaption></figure></div><p>The design divides 40 layers into two halves. The first 20 prepare reusable memory of the input. Most input positions can stop there; a final slice of up to 128 positions also passes through the upper half to prepare its recent context. Once generation begins, each newly chosen token goes through both halves to predict the following token. The architecture is called a <strong>causal encoder-decoder</strong>, or <strong>CED</strong>. We will unpack those roles, then trace how sharing memory, selecting what to read, storing fewer bits, and rebuilding recent state change different costs.</p><p>The useful distinction is already visible: preparing a record of earlier text and using that record to choose a new token need not follow identical paths. The shorter input route matters most when there is much more new text to read than text to generate.</p><p><strong>Table of contents</strong></p><ul><li><p>Why one causal stack reads and writes</p></li><li><p>Why agent workloads change the budget</p></li><li><p>Prefill, decode, and the cache between them</p></li><li><p>How CED changes the old-token dependency</p></li><li><p>Why generated tokens still use the full model</p></li><li><p>Why this is a different encoder-decoder</p></li><li><p>How CSA2 shares global history</p></li><li><p>Why sparse search needs a hierarchy</p></li><li><p>How the cache bytes add up</p></li><li><p>What bounded replay rebuilds</p></li><li><p>Putting the architecture together</p></li><li><p>What the quality evidence establishes</p></li><li><p>What this means for agent architectures</p></li></ul>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-deepseek-v4-1-flash-separates-reading-and">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Build a Jev-Supervised AI Agent]]></title><description><![CDATA[Typed decisions, guarded tools, and a measured comparison with LLM supervisors]]></description><link>https://newsletter.theaiedge.io/p/build-a-jev-supervised-ai-agent-218605208</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/build-a-jev-supervised-ai-agent-218605208</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Sat, 03 Oct 2026 15:02:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/73d933ba-a75a-4f7f-80be-67272008fb19_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An AI agent does more than write its final answer. It chooses a tool, reads the result, decides whether to continue, and sometimes has to admit that an action's outcome is unknown. TypeSafe released Jev in September 2026 as a model for typed decisions inside software, which makes those small transitions a practical design choice.</p><p>Here is the agent we will build: a generative model plans and writes; Jev chooses among named next actions using the current state; Python checks hard rules, executes a local tool, and records what actually happened. The central question is where a fast decision belongs when the task still needs open-ended reasoning and real effects. The short answer is <strong>between observations and permitted transitions</strong>. Jev can judge the state, but its choice cannot itself refund an account or prove that a refund settled.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-VLK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-VLK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-VLK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png" width="1942" height="809" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:809,&quot;width&quot;:1942,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1279431,&quot;alt&quot;:&quot;Agent loop in which an LLM plans, Jev proposes a next action, code guards and executes a tool, observations update state, and an LLM writes the answer.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Agent loop in which an LLM plans, Jev proposes a next action, code guards and executes a tool, observations update state, and an LLM writes the answer." title="Agent loop in which an LLM plans, Jev proposes a next action, code guards and executes a tool, observations update state, and an LLM writes the answer." srcset="https://substackcdn.com/image/fetch/$s_!-VLK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!-VLK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F095f2c53-358d-477c-8b8d-3924a52be8a6_1942x809.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">Jev sits inside the state transition loop; the executor and observation record determine what actually changed.</figcaption></figure></div><p>We will make one Jev call first, then connect it to a small support agent. Then we will compare Jev with two structured-output LLMs using our experiments on support and document-research tasks. The experiment is useful because it records both proposed actions and actual local effects.</p><p><strong>In this guide</strong></p><ul><li><p>What Jev decides</p></li><li><p>Give the agent observable state</p></li><li><p>Build the guarded loop</p></li><li><p>Run support and research tasks</p></li><li><p>Compare three supervisors</p></li><li><p>Read probabilities and disagreements</p></li><li><p>Decide where Jev belongs</p></li></ul><p>One distinction will keep the rest of the build honest. A tool returning HTTP 202 says a request was accepted for processing. It does not say the requested business outcome happened. That gap is exactly where a supervisor needs evidence, and where code must resist an unsafe retry.</p>
      <p>
          <a href="https://newsletter.theaiedge.io/p/build-a-jev-supervised-ai-agent-218605208">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Jev Turns Questions Into Decisions]]></title><description><![CDATA[Inside the state, typed-output, probability, and application-policy contracts of a decision model]]></description><link>https://newsletter.theaiedge.io/p/how-jev-turns-questions-into-decisions</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-jev-turns-questions-into-decisions</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Wed, 30 Sep 2026 15:02:22 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f25bb621-bfb9-43ff-afd5-ab71ff0ac615_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Jev is a decision model whose interface asks bounded questions about a supplied state and returns probabilities over the allowed answers. A support system might ask which queue should receive a ticket, whether a tool result actually resolved it, and how urgent it is. The application, rather than the model, decides what to do with those answers. In September 2026, TypeSafe introduced Jev for this kind of typed decision request, making an old systems question concrete: when the useful output is a small distribution, why generate a sentence to carry it?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kHLg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kHLg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 424w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 848w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 1272w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kHLg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png" width="1912" height="823" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/accfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:823,&quot;width&quot;:1912,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1221157,&quot;alt&quot;:&quot;One state feeds several typed questions, each returning a bounded probability distribution; code uses the answers to choose actions.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="One state feeds several typed questions, each returning a bounded probability distribution; code uses the answers to choose actions." title="One state feeds several typed questions, each returning a bounded probability distribution; code uses the answers to choose actions." srcset="https://substackcdn.com/image/fetch/$s_!kHLg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 424w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 848w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.png 1272w, https://substackcdn.com/image/fetch/$s_!kHLg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faccfeb76-a169-4b6d-847a-ee9507fa373a_1912x823.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 external contract: state and typed questions produce distributions; the application retains control.</figcaption></figure></div><p>The short answer is that Jev moves the boundary. A conventional language model can certainly emit <code>{"route":"billing"}</code>; strict structured output can make that object parse. Jev instead accepts the answer space as part of the question and returns the chosen answer <em>and its distribution</em> as the native result. Several questions can refer to one supplied state. That makes semantic judgments easier to place inside software, but it does not make their probabilities self-validating or authorize any action.</p><p>This is a model category worth understanding even if a particular workload ends up using rules, a fine-tuned classifier, or a constrained LLM. We will follow the interfaces first, then the computation they may avoid, the architecture that is and is not disclosed, and finally the policy that turns a judgment into a safe system decision.</p><p><strong>In this deep dive</strong></p><ol><li><p>What Jev receives and returns</p></li><li><p>Why a separate decision model might help</p></li><li><p>What can be inferred about Jev's architecture</p></li><li><p>Calibration, RLCD, and action thresholds</p></li><li><p>Where Jev fits among existing tools</p></li><li><p>A system with generation and decision separated</p></li></ol><p>One useful rule already follows from the interface: a model's answer should be treated as evidence about a defined outcome, while the application's code retains the choice of action. The rest of the article explains exactly what must be defined, computed, and checked before that rule is useful.</p>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-jev-turns-questions-into-decisions">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[The Complete Guide to Evaluation Pipelines for AI Agents]]></title><description><![CDATA[From production traces and isolated trials to evidence you can use for release decisions]]></description><link>https://newsletter.theaiedge.io/p/how-to-build-an-evaluation-pipeline-fo-217656816</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-to-build-an-evaluation-pipeline-fo-217656816</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 28 Sep 2026 15:04:25 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/efc7964b-db00-4133-9ab7-0231adb5b628_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An agent can say that a refund is complete while the customer's account shows no refund. For an agent that can use tools, a convincing reply is only one piece of evidence. A production evaluation has to check the actions the agent took and the world those actions left behind.</p><p>Teams are already using production conversations and human labels to build agent evaluations, as <a href="https://dropbox.tech/machine-learning/how-we-turned-ai-evaluations-into-better-responses-in-dash-chat">Dropbox's engineering account</a> illustrates; the durable problem is deciding whether an agent actually completed an authorized task. How do we turn that question into a pipeline that can test a new agent version before release and keep learning afterward?</p><p>The compact answer is a loop: <strong>observed request &#8594; reviewed case &#8594; isolated trial &#8594; trace and final state &#8594; graders &#8594; version comparison &#8594; release decision &#8594; production feedback</strong>. A case describes the starting world and acceptable outcomes. A trial runs one agent attempt against that world. Graders inspect independent evidence, and the comparison asks whether the new version improves the tasks that matter without breaking important slices. The loop is reusable; the meaning of success changes with the agent's job.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hJJ7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hJJ7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hJJ7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1464243,&quot;alt&quot;:&quot;Agent claims a refund is complete, while the tool only accepted the request and the ledger has no refund.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Agent claims a refund is complete, while the tool only accepted the request and the ledger has no refund." title="Agent claims a refund is complete, while the tool only accepted the request and the ledger has no refund." srcset="https://substackcdn.com/image/fetch/$s_!hJJ7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!hJJ7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb912402-de63-4ce2-9f13-113df6ae0158_1536x1024.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">An answer, a tool acknowledgment and a committed state are different evidence.</figcaption></figure></div><p>The first useful rule is to give a completed action its own proof. If a support agent says &#8220;refunded,&#8221; a ledger record or service commit is the proof, subject to the service's consistency contract. If the record is absent, the polished sentence cannot rescue the task. That single separation prevents an answer-only judge from turning a failed action into a pass.</p><p>The second rule is to test the task from a known starting point. The same request can require a refund when the customer verifies identity, a clarifying question when they cannot, or a refusal when policy forbids it. An evaluation case must carry those starting facts and accepted branches. Otherwise a grader may punish a careful agent for asking or reward a reckless one for acting.</p><p>Before trusting a score, ask what its grader can observe. If it sees only messages, the score measures answer quality. If it sees tool calls but no final state, it can verify attempted actions without proving durable effects. Reserve &#8220;task success&#8221; for a test whose evidence covers the task's actual outcome. This distinction is useful even before the full pipeline exists.</p><p><strong>Table of contents</strong></p><ol><li><p><a href="#define-what-success-must-prove">Define what success must prove</a></p></li><li><p><a href="#turn-production-evidence-into-cases">Turn production evidence into cases</a></p></li><li><p><a href="#run-isolated-observable-trials">Run isolated, observable trials</a></p></li><li><p><a href="#grade-the-evidence">Grade the evidence</a></p></li><li><p><a href="#compare-agent-versions-fairly">Compare agent versions fairly</a></p></li><li><p><a href="#operate-the-pipeline-and-close-the-loop">Operate the pipeline and close the loop</a></p></li></ol>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-to-build-an-evaluation-pipeline-fo-217656816">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How AI Agent Memory Updates a Changed Preference]]></title><description><![CDATA[Follow one correction from a user message to the active fact a future task retrieves.]]></description><link>https://newsletter.theaiedge.io/p/how-ai-agent-memory-updates-a-changed-preference</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-ai-agent-memory-updates-a-changed-preference</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Fri, 25 Sep 2026 15:04:28 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/66908f83-ab4a-4bd8-b3a3-f60d09768c5c_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An AI coding assistant can remember that you use Python for deployment scripts and still get the next deployment wrong after you switch to Go. The problem is not that it forgot everything. It may remember <strong>both</strong> instructions and have no reliable way to tell which one is current.</p><p>Persistent agent memory tools now let applications carry stored information across sessions and update it, making the quality of that update consequential for later tasks. The question is: when a user changes a standing preference, what must happen so an agent acts on the new one? A useful memory system treats the new message as a proposed change to stored state. It identifies the fact, finds the existing fact about the same thing, reconciles the two, commits the active version, and retrieves that version when the next task needs it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lKkE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lKkE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lKkE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1359304,&quot;alt&quot;:&quot;Two conflicting remembered script-language preferences converge on one later task.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Two conflicting remembered script-language preferences converge on one later task." title="Two conflicting remembered script-language preferences converge on one later task." srcset="https://substackcdn.com/image/fetch/$s_!lKkE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!lKkE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c4eadc1-4906-4596-b74f-9407734b1e42_1536x1024.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 future request needs one current preference, but a transcript can offer two.</figcaption></figure></div><p>That differs from appending messages to a transcript. We can see why by following one preference from its first instruction through a correction and a later task. The same failure can affect a project decision or customer preference.</p><h2>What changes when an agent has memory?</h2><p>The model receives a limited working context with each request. A conversation transcript can be placed in that context, but it grows, contains incidental remarks, and may contain claims that no longer hold. <strong>Persistent memory</strong> here means an external store that keeps selected information beyond one request or session. A write operation changes that store; a later read returns a useful part of it to the model. The model's weights are not being retrained every time a preference changes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fH45!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fH45!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!fH45!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!fH45!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!fH45!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fH45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1292665,&quot;alt&quot;:&quot;A fact is written outside the model and read into a later session.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A fact is written outside the model and read into a later session." title="A fact is written outside the model and read into a later session." srcset="https://substackcdn.com/image/fetch/$s_!fH45!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!fH45!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!fH45!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!fH45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a72a9ec-af95-4d21-b1d7-eb77479a4853_1536x1024.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><figcaption class="image-caption">Persistent memory changes external state, then supplies selected context later.</figcaption></figure></div><p>Suppose a user tells a coding assistant, &#8220;For the Atlas repository, write deployment scripts in Python.&#8221; The assistant might store a compact record with four parts: the user, the Atlas repository, the subject <em>deployment-script language</em>, and the current value <em>Python</em>. The message that supplied the preference is its source. This is more useful than an unqualified memory such as &#8220;prefers Python,&#8221; because the latter could affect unrelated work.</p><p>The store has two distinct paths. On the <strong>write path</strong>, a message or tool result is examined for information worth retaining, then compared with what is already stored. On the <strong>read path</strong>, the next task retrieves applicable memory and places it where the model can use it. If the write path is wrong, fast retrieval brings back a mistake. If the read path misses the right record, a perfect update sits unused.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YZUN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YZUN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YZUN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1159703,&quot;alt&quot;:&quot;A write path maintains stored facts; a read path returns applicable facts to the model.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A write path maintains stored facts; a read path returns applicable facts to the model." title="A write path maintains stored facts; a read path returns applicable facts to the model." srcset="https://substackcdn.com/image/fetch/$s_!YZUN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!YZUN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F615048b0-ae1b-4698-a677-4d0d2de23091_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 good write is useful only when the later read selects it.</figcaption></figure></div><p>Now the user says, &#8220;For Atlas, use Go for deployment scripts from now on.&#8221; Adding that sentence as a second, equally active memory would leave the future assistant to arbitrate a contradiction each time. A better result is an active Atlas deployment-language preference of <em>Go</em>, with the former Python preference no longer active. The old statement may remain in an audit history, but it should not be presented as another current instruction.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!n67r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!n67r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!n67r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!n67r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!n67r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!n67r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1054108,&quot;alt&quot;:&quot;Appending leaves two candidate instructions; updating leaves one active value.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Appending leaves two candidate instructions; updating leaves one active value." title="Appending leaves two candidate instructions; updating leaves one active value." srcset="https://substackcdn.com/image/fetch/$s_!n67r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!n67r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!n67r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!n67r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc56e100f-5ee5-4498-ad99-da38b8fde01b_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 correction must change what the next read sees.</figcaption></figure></div><p><strong>Remembering a correction means changing the state that future reads see</strong>, not merely remembering that a correction was said. The change has to preserve the subject and scope of the fact, or it will solve one task by creating a wider error.</p><div id="youtube2-5HgG6_K4DYo" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;5HgG6_K4DYo&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/5HgG6_K4DYo?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-ai-agent-memory-updates-a-changed-preference">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How LLM Routers Balance Cache Reuse and Queue Time]]></title><description><![CDATA[Four routing strategies, one repeated prompt, and the point where a cold replica wins]]></description><link>https://newsletter.theaiedge.io/p/how-cache-aware-routing-chooses-between-warm-and</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-cache-aware-routing-chooses-between-warm-and</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Wed, 23 Sep 2026 15:03:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0523da2d-4b65-4099-911d-4712db320d9c_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An LLM request router sits in front of several replicas of the same model and chooses which replica should receive each prompt. <strong>Cache-aware routing</strong> makes that placement decision before execution by considering reusable prompt state at each replica, not only how busy it looks. The surprising part is that replicas stop being interchangeable after they begin serving traffic: one may already hold reusable computation for the prompt, while another may have a shorter queue.</p><p>Prefix-aware routing became a managed endpoint option in September 2026, a sign that cache locality has moved from an engine detail into a deployment decision.</p><p>So where should the next request go: to the warm replica or the idle one? The compact answer is to send it where the saved prompt computation is worth more than the extra work already waiting there. A useful router therefore needs two views at once: <strong>what can be reused</strong> and <strong>what must still be processed</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T8m-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T8m-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!T8m-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1091918,&quot;alt&quot;:&quot;One LLM request faces two destinations: a warm replica with a queue and a cold replica with no queue, making the faster choice ambiguous.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="One LLM request faces two destinations: a warm replica with a queue and a cold replica with no queue, making the faster choice ambiguous." title="One LLM request faces two destinations: a warm replica with a queue and a cold replica with no queue, making the faster choice ambiguous." srcset="https://substackcdn.com/image/fetch/$s_!T8m-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!T8m-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d246b2c-fdb6-474d-9b13-7b616e92218a_1774x887.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 cached destination is not automatically the fastest destination.</figcaption></figure></div><p>To see why, start with the work a cached prefix actually removes. Then we will keep one support prompt fixed while four routing policies make different placement decisions. That comparison will expose the useful rule, its failure modes, and the state a production router has to keep current.</p><h2>What a warm prefix actually saves</h2><p>Before routing makes sense, we need one piece of transformer serving machinery.</p><p>An incoming prompt is a sequence of tokens. During <strong>prefill</strong>, the model processes those input tokens through every transformer layer. In each attention layer it derives a key vector and a value vector for every position. Those vectors are the processed state that later tokens attend to. The first generated token can appear only after this prompt work has finished.</p><p>During <strong>decode</strong>, the model generates one new token, appends its new key and value state, and repeats. Decode can reuse the state for all earlier positions instead of rebuilding it. The stored collection is called the <strong>KV cache</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XLMl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XLMl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 424w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 848w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 1272w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XLMl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png" width="1923" height="817" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:817,&quot;width&quot;:1923,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1198485,&quot;alt&quot;:&quot;Prefill processes all prompt tokens into KV state before the first output token, while decode reuses that state and adds one token at a time.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Prefill processes all prompt tokens into KV state before the first output token, while decode reuses that state and adds one token at a time." title="Prefill processes all prompt tokens into KV state before the first output token, while decode reuses that state and adds one token at a time." srcset="https://substackcdn.com/image/fetch/$s_!XLMl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 424w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 848w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 1272w, https://substackcdn.com/image/fetch/$s_!XLMl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d71ed3b-080e-4f22-b562-573ec9d91339_1923x817.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Routing can save prefill work; it cannot make unknown output tokens exist early.</figcaption></figure></div><p>Now consider a support assistant whose prompt begins with 3,200 tokens of policies, tool descriptions, and response rules. Only the short customer question at the end changes. If the engine has already processed the same beginning, it can reuse the matching KV state and prefill only the new suffix.</p><p>Prefix caching does not mean that the model remembers a similar idea. The match is structural. Serving engines divide the prompt into token blocks, identify a block using its tokens and the blocks before it, and reuse only an unbroken matching prefix. If block three changes, later blocks no longer describe the same model state, even if much of their text looks familiar.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!w2th!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w2th!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!w2th!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!w2th!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!w2th!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!w2th!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1041065,&quot;alt&quot;:&quot;A prompt split into ordered token blocks reuses only the consecutive cached blocks from the beginning, stopping at the first changed block.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A prompt split into ordered token blocks reuses only the consecutive cached blocks from the beginning, stopping at the first changed block." title="A prompt split into ordered token blocks reuses only the consecutive cached blocks from the beginning, stopping at the first changed block." srcset="https://substackcdn.com/image/fetch/$s_!w2th!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!w2th!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!w2th!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!w2th!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff76bb78d-091d-48c2-8ce1-1ba972743c4f_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Prefix reuse is an unbroken chain from the first token, not a bag of similar passages.</figcaption></figure></div><p>That distinction gives prefix caching an honest boundary. It skips model computation already performed for the input prefix. It does not skip the generation of new output tokens, because those tokens do not exist yet. A workload with long repeated inputs and short answers can gain a lot; a workload with unrelated prompts or very long answers may gain little.</p><p>Within one replica, the rule is simple: reuse every valid prefix block that is still resident, prefill the remaining input, then decode normally.</p>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-cache-aware-routing-chooses-between-warm-and">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Test-Time Scaling Allocates LLM Reasoning Across Depth, Width, and Feedback]]></title><description><![CDATA[Why the same inference budget can finish one path, explore alternatives, or learn from a failure]]></description><link>https://newsletter.theaiedge.io/p/how-test-time-scaling-allocates-llm-reasoning</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-test-time-scaling-allocates-llm-reasoning</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 21 Sep 2026 15:01:16 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d66a9ed7-efcb-487b-a0fa-160ac44e596b_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Test-time compute</strong> is the work an already-trained model performs for one request while producing, checking, or revising its answer. <strong>Test-time scaling</strong> means giving the model more of that request-time work, or allocating it differently, without retraining the model. The extra budget can extend one line of reasoning, generate alternative answers, or use an observation to try again. Those choices are often bundled under &#8216;let it think longer,&#8217; but they do not buy the same thing.</p><p>That distinction is now practical because current OpenAI and Anthropic APIs expose reasoning-effort controls while Google offers an Extended Thinking model for complex live-agent tasks, turning &#8220;let it think&#8221; into a quality, latency, and cost decision for each request.</p><p>The useful question is not simply, &#8220;How much thinking should I buy?&#8221; It is: <strong>where should the extra compute go?</strong> Test-time scaling allocates it to depth, width, or feedback. Depth extends one attempt. Width creates separate attempts. Feedback evaluates work and changes the next attempt. Each repairs a different failure, and none guarantees correctness.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RYXr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RYXr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RYXr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1228899,&quot;alt&quot;:&quot;The same reasoning model receives one coding task and can spend extra compute on a longer path, parallel paths, or a test-and-revise loop.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The same reasoning model receives one coding task and can spend extra compute on a longer path, parallel paths, or a test-and-revise loop." title="The same reasoning model receives one coding task and can spend extra compute on a longer path, parallel paths, or a test-and-revise loop." srcset="https://substackcdn.com/image/fetch/$s_!RYXr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!RYXr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faca30f23-9cd4-41df-bfe4-203d621f5bda_1536x1024.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">One budget can buy three different information flows, so &#8220;more thinking&#8221; is not a complete system description.</figcaption></figure></div><h2>What test-time compute actually is</h2><p>Start with an ordinary request. Training is already over, and the model begins with learned weights that stay fixed while it answers. At each step, the model processes the request and the tokens generated so far to choose the next token. That ordinary generation already consumes test-time compute: computation performed after training for one particular input.</p><p>The term covers more than the model's hidden reasoning tokens. It includes the work the model and its surrounding system perform to produce, inspect, and improve this one answer. Continuing the generation adds more token-level operations to the current history. Starting another generation creates a separate candidate history. Running a test or verifier creates an observation that a later attempt can use. Revising with that observation performs another generation under changed conditions.</p><p><strong>Test-time scaling</strong> is the deliberate decision to increase or reallocate that per-request work relative to a baseline answer. The extra work can matter because it changes the transient information available to a later choice: a longer prefix, a genuinely different candidate, or new evidence about an error. If the added work does not change that state or evidence, it may increase latency and cost without improving the answer.</p><p>This is not training or fine-tuning. Training changes reusable model weights for future requests. Test-time compute leaves those weights alone and is paid again for each request. It is also not synonymous with selecting a larger model or producing a longer visible answer. A system may spend substantial compute on candidates, checks, and revisions that never appear in the final response.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!snz-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!snz-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!snz-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!snz-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!snz-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!snz-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1dce9978-aa0b-4390-b0fb-3e64295b6179_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;:null,&quot;bytes&quot;:1490843,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/216478399?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_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_!snz-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!snz-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!snz-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!snz-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1dce9978-aa0b-4390-b0fb-3e64295b6179_1536x1024.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Training changes reusable model weights. Test-time scaling leaves those weights fixed and increases or reallocates the work performed for one request.</figcaption></figure></div><p>We will follow one realistic coding task through all three choices. An agent must repair <code>invoice_total</code>, a function that sums prices, applies tax, and returns integer cents. Its contract requires exact decimal arithmetic, an 8 percent tax applied after aggregation, round-half-up once to the nearest cent, then conversion to integer cents. The visible invoice contains items priced at $12.49, $7.25, and $3.10. Hidden tests vary the inputs to expose half-cent rounding, multiple-item accumulation, zero tax, and binary floating-point drift.</p><p>First we need to see why one uninterrupted generation can fail. Then we can spend the same request-time budget on a deeper path, a wider candidate set, or a feedback loop and see what actually changes.</p><h2>Before scaling, identify the one-shot failure</h2><p>An autoregressive language model generates a response one token at a time. At every position it receives the request plus the tokens already written, then assigns probabilities to possible next tokens. Once a token is chosen, that token becomes part of the state used to predict everything that follows.</p><p>This left-to-right process matters because an early choice can narrow the rest of the answer. Suppose our coding agent begins with the assumption that converting dollars to cents is just <code>int(total * 100)</code>. It can write an elegant explanation and many consistent lines of code after that. The later tokens are coherent with the earlier assumption, but coherence does not repair the assumption.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rmv2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rmv2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rmv2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:841835,&quot;alt&quot;:&quot;A left-to-right token sequence branches at an early assumption, and later tokens remain coherent with either the sound or mistaken branch.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A left-to-right token sequence branches at an early assumption, and later tokens remain coherent with either the sound or mistaken branch." title="A left-to-right token sequence branches at an early assumption, and later tokens remain coherent with either the sound or mistaken branch." srcset="https://substackcdn.com/image/fetch/$s_!rmv2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!rmv2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8cc538e-8925-4ea0-a79e-3e6d4a4bee44_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">An early token becomes part of the state that produces every later token.</figcaption></figure></div><p>A <strong>one-shot attempt</strong> is one uninterrupted generation from request to answer. It may spend many internal reasoning tokens, but it has no separate alternative to compare with and no external result that changes its course. Its success depends on the model entering a useful line of reasoning and staying there.</p><p>For this lesson, a useful accounting unit is a generated reasoning token, a candidate response, a verifier evaluation, or a tool call such as a test run. These units have different hardware costs, so we will not pretend they are perfectly interchangeable. The important constraint is that the system has a finite request-time budget and must decide how to allocate it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gGOe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gGOe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 424w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 848w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 1272w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gGOe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png" width="1919" height="820" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:820,&quot;width&quot;:1919,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:916532,&quot;alt&quot;:&quot;A fixed request-time budget is divided among generated tokens, candidate responses, verifier evaluations, and tool calls.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A fixed request-time budget is divided among generated tokens, candidate responses, verifier evaluations, and tool calls." title="A fixed request-time budget is divided among generated tokens, candidate responses, verifier evaluations, and tool calls." srcset="https://substackcdn.com/image/fetch/$s_!gGOe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 424w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 848w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 1272w, https://substackcdn.com/image/fetch/$s_!gGOe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2fc8f0e-9f0a-4008-9a13-49ef6c3f92df_1919x820.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 units have different costs, but all consume finite work after the request arrives.</figcaption></figure></div><p>There are three places to allocate that budget:</p><ol><li><p><strong>Depth:</strong> continue or enrich the same reasoning trajectory.</p></li><li><p><strong>Width:</strong> sample several separate trajectories from the same starting request.</p></li><li><p><strong>Feedback:</strong> inspect work, then condition the next attempt on what the inspection revealed.</p></li></ol><p>The distinction is about information flow. Extra depth sees the same request and its own growing prefix. Width gives each attempt the request but not the siblings' work. Feedback adds a new observation, such as &#8220;the half-cent test failed,&#8221; before the next generation. Width is logical branching; whether those branches run simultaneously is a separate serving decision.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!r5X5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!r5X5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!r5X5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1098335,&quot;alt&quot;:&quot;Three aligned panels compare depth, width, and feedback by showing which information reaches each new generation step.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Three aligned panels compare depth, width, and feedback by showing which information reaches each new generation step." title="Three aligned panels compare depth, width, and feedback by showing which information reaches each new generation step." srcset="https://substackcdn.com/image/fetch/$s_!r5X5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!r5X5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7261319-ef8c-4aab-b50e-5cf0ddd7dcf4_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Depth extends a prefix, width restarts from the request, and feedback adds a new observation.</figcaption></figure></div><p>That gives us a diagnostic before we spend anything. If the model merely stops before completing a sound plan, buy depth. If different plausible starts lead to different outcomes, buy width. If a checker can reveal what went wrong, buy feedback. A high effort setting may combine these internally, but an application designer still needs this mental model to understand latency, cost, and failure.</p><h2>Depth gives one trajectory room to finish</h2><p>The simplest scaling strategy is to let one attempt run longer. The model can decompose the task, inspect edge cases, and carry intermediate facts farther before committing to the final response. In our invoice task, a deeper trajectory must preserve a specific dependency: represent the prices exactly, sum them to $22.84, apply the 8 percent tax to obtain $24.6672, round that total once to $24.67, then return 2467 cents.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DS5S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DS5S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DS5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1262028,&quot;alt&quot;:&quot;One invoice-patch trajectory moves through numeric representation, rounding order, edge cases, and a final patch.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="One invoice-patch trajectory moves through numeric representation, rounding order, edge cases, and a final patch." title="One invoice-patch trajectory moves through numeric representation, rounding order, edge cases, and a final patch." srcset="https://substackcdn.com/image/fetch/$s_!DS5S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!DS5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa7f929-ebd9-47b3-ac63-143f55ca33d8_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Depth preserves dependent intermediate reasoning inside one trajectory.</figcaption></figure></div><p>The benefit is continuity. Every later step sees the reasoning accumulated earlier. Here, the final integer conversion only makes sense after the representation and rounding policy are settled. Once an earlier step truncates a fraction of a cent, no later step can reconstruct it. Proofs, long calculations, and code changes with dependent invariants have the same shape.</p><p>But depth is not the same as recovery. If the trajectory commits early to binary floating point and treats a failing cent as harmless noise, more tokens can reinforce the wrong frame. The model may repeatedly check arithmetic inside a mistaken representation. It is thinking longer, but within a shrinking part of the solution space.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ef3M!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ef3M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ef3M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:972290,&quot;alt&quot;:&quot;Two long trajectories begin from different early assumptions; one reaches a sound patch while the other elaborates a floating-point mistake.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Two long trajectories begin from different early assumptions; one reaches a sound patch while the other elaborates a floating-point mistake." title="Two long trajectories begin from different early assumptions; one reaches a sound patch while the other elaborates a floating-point mistake." srcset="https://substackcdn.com/image/fetch/$s_!ef3M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!ef3M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f14a22-72bc-46c6-bdb2-f0dd5e0950ea_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 longer path can complete a good approach or entrench a bad one.</figcaption></figure></div><p>That gives us the first useful rule: <strong>depth helps when a sound path is unfinished, not merely when a path is wrong</strong>. A model that often reaches the correct approach and then runs out of room is a good candidate for higher effort. A model that confidently commits to a bad representation needs an alternative or new evidence, not an even longer monologue.</p><div id="youtube2-YlB7_bsk8sI" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;YlB7_bsk8sI&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/YlB7_bsk8sI?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-test-time-scaling-allocates-llm-reasoning">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Constrained Decoding Makes LLM Outputs Follow a Schema]]></title><description><![CDATA[The decoder can guarantee the shape of a tool call while leaving its values completely wrong.]]></description><link>https://newsletter.theaiedge.io/p/how-constrained-decoding-makes-llm-outputs</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-constrained-decoding-makes-llm-outputs</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Fri, 18 Sep 2026 15:04:14 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4efaddf5-61fe-42d3-b4a0-b87ac07812c4_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An LLM can return JSON that parses perfectly, matches every required field, and is still dangerous to execute. That is not a contradiction. It is the exact boundary of <strong>constrained decoding</strong>.</p><p>Normally, a language model can choose any token in its vocabulary at each generation step. Constrained decoding inserts a rule checker into that loop. The checker looks at the text already generated and removes every next token that would make the requested structure impossible to complete. The model then chooses among what remains.</p><p>Structured output has become a common connection layer between LLMs, extraction pipelines, and agent tools, yet a recent developer discussion exposed the practical surprise that matters here: a perfectly shaped object can still contain invented values, so schema-valid is not the same as safe to execute.</p><p>The central question is simple: <strong>what does the decoder actually guarantee?</strong> The compact answer is that it can guarantee membership in a supported output language, such as a JSON Schema, by blocking illegal continuations token by token. It does not prove that a legal value came from the input, reflects reality, satisfies a business rule, or deserves permission to trigger an action.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aQnP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aQnP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aQnP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1354408,&quot;alt&quot;:&quot;Two schema-valid refund objects pass the same grammar check, but only the object containing 4250 cents matches the source message.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Two schema-valid refund objects pass the same grammar check, but only the object containing 4250 cents matches the source message." title="Two schema-valid refund objects pass the same grammar check, but only the object containing 4250 cents matches the source message." srcset="https://substackcdn.com/image/fetch/$s_!aQnP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!aQnP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1085f3f-3983-456c-afd4-f324e3874914_1536x1024.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 grammar can reject a broken object. It cannot distinguish the stated amount from a plausible but false amount. Step by step, we will see why.</figcaption></figure></div><p>We will follow one support request through the complete mechanism. The request says: <code>Please refund order A-17. The charge was $42.50.</code> The desired output is a small object containing a status, an order identifier, and a refund amount in cents. First we need to separate three ideas that are often collapsed into the word &#8220;valid.&#8221; Then we can compile the schema, watch the token mask change, and see exactly where truth leaves the decoder's jurisdiction.</p><h2>Three different promises hide inside &#8220;valid JSON&#8221;</h2><p>JSON is a text format. A JSON parser checks punctuation and nesting: braces balance, keys are quoted, commas occur in legal places, and values have valid JSON forms. This object is valid JSON:</p><p><code>{"status":"ready","order_id":"A-17","refund_cents":4500}
</code></p><p>A <strong>schema</strong> asks a narrower question about the parsed value. It can require an object, name its allowed properties, require selected keys, restrict a field to an integer, or limit a value to an enumeration. If our schema allows any non-negative integer for <code>refund_cents</code>, then <code>4500</code> passes. The schema has no memory of the user's <code>$42.50</code>.</p><p>Finally, the application asks whether the object means something acceptable in its real environment. Does order A-17 exist? Was the charge really $42.50? Is it refundable? Is this user authorized? Those are evidence, policy, and permission questions. They are not punctuation questions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Z8-S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Z8-S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Z8-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1553733,&quot;alt&quot;:&quot;Four sequential gates distinguish parseable JSON, schema validity, grounded values, and an authorized action.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Four sequential gates distinguish parseable JSON, schema validity, grounded values, and an authorized action." title="Four sequential gates distinguish parseable JSON, schema validity, grounded values, and an authorized action." srcset="https://substackcdn.com/image/fetch/$s_!Z8-S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Z8-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae21b19-b913-4fe0-af8f-eb6e44d3ae9b_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 outer check answers a question the inner check cannot answer.</figcaption></figure></div><p>The checks therefore form a hierarchy:</p><ol><li><p><strong>Parseable</strong> means the text is legal JSON.</p></li><li><p><strong>Schema-valid</strong> means the parsed value also obeys the declared structural rules.</p></li><li><p><strong>Grounded and actionable</strong> means the values are supported by evidence and pass application policy.</p></li></ol><p>Each level can remove failures that the previous level accepts. None can be silently substituted for the next.</p><p>Our refund extractor also needs a way to say that the message is incomplete. If a successful decode must complete a contract where every field is required and <code>refund_cents</code> must be an integer, every successful path puts <em>some</em> integer there even when no amount appears in the input. A better output contract exposes two branches:</p><p><code>{
  "anyOf": [
    {
      "status": "ready",
      "order_id": "string",
      "refund_cents": "non-negative integer"
    },
    {
      "status": "insufficient_info",
      "order_id": null,
      "refund_cents": null
    }
  ]
}
</code></p><p>This is a readable sketch of the contract, not a literal complete JSON Schema. The important move is structural: uncertainty is now a legal output rather than an instruction the model must squeeze into fields that forbid it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qTzE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qTzE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qTzE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1101244,&quot;alt&quot;:&quot;A refund schema branches into a ready object with non-null fields and an insufficient-information object with null fields.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A refund schema branches into a ready object with non-null fields and an insufficient-information object with null fields." title="A refund schema branches into a ready object with non-null fields and an insufficient-information object with null fields." srcset="https://substackcdn.com/image/fetch/$s_!qTzE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!qTzE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64ca52c8-6a60-4c7a-bae7-ade45dbd91a3_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 useful contract makes uncertainty a legal destination instead of forcing the model to guess.</figcaption></figure></div><p>Here is the first design rule worth keeping: <strong>a schema should represent the failure states your application expects</strong>. Constrained decoding can only choose paths you make legal. If the contract requires a confident answer, the decoder cannot invent an abstention branch on your behalf.</p><div id="youtube2-zKO3-1JkmJI" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;zKO3-1JkmJI&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/zKO3-1JkmJI?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-constrained-decoding-makes-llm-outputs">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How Sparse Attention Makes Long-Context LLMs Cheaper, and What It Misses]]></title><description><![CDATA[Full reach, sliding windows, and learned selectors turn the same prompt into three different evidence sets.]]></description><link>https://newsletter.theaiedge.io/p/how-sparse-attention-makes-long-context-llms</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-sparse-attention-makes-long-context-llms</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Wed, 16 Sep 2026 15:01:07 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/80097b49-e39a-4fe2-bfb2-60ed2d3e0959_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An LLM can accept a very long prompt without treating every earlier piece the same way. The model represents each piece as an internal token state. Inside each attention layer, an eligibility rule determines which earlier states are available to the current token. Only then does the layer decide how much weight to give the available ones.</p><p>That first decision is the hidden trade-off behind <strong>sparse attention</strong>. The name suggests that the model merely turns down unimportant history. In many designs, it does something more consequential: it prevents most of the history from entering the main attention calculation at all.</p><p>A late-August 2026 Transformers release added Qwen Sparse Attention, while an open-weight Qwen model built on the same block-selection idea prompted immediate questions about long-context latency and cache placement; as more models save work this way, the durable question is which evidence they stop reading.</p><p>So here is the question we will answer: <strong>When sparse attention makes a long context cheaper, what does an LLM stop looking at?</strong></p><p>The compact answer is that every attention pattern creates an eligible set of earlier token states. Full attention admits the whole past. A sliding window admits only nearby history. Content-selected sparse attention uses a cheaper scoring step to choose a small subset that can include distant history, then runs ordinary attention on that subset. Fewer eligible states mean less work, but a clue excluded at this point cannot be rescued by a larger attention weight later.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!83pM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!83pM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!83pM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!83pM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!83pM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!83pM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png" width="1942" height="809" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:809,&quot;width&quot;:1942,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1186630,&quot;alt&quot;:&quot;One question token faces a long row of earlier tokens, but three gates expose all tokens, only nearby tokens, or a few selected distant tokens.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="One question token faces a long row of earlier tokens, but three gates expose all tokens, only nearby tokens, or a few selected distant tokens." title="One question token faces a long row of earlier tokens, but three gates expose all tokens, only nearby tokens, or a few selected distant tokens." srcset="https://substackcdn.com/image/fetch/$s_!83pM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!83pM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!83pM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!83pM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0865d28c-0aa9-4345-ad41-2472076f01ca_1942x809.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 main attention calculation can only weigh the history that its eligibility rule exposes.</figcaption></figure></div><p>We will follow one question through all three patterns. A long incident report contains the deployed database proxy setting, <code>port 6432</code>, near the beginning. Much later, a diagnostic note mentions the default database port, <code>5432</code>. At the end, the reader asks: <strong>Which port did the incident's database proxy actually use?</strong></p><p>This is a useful test because the answer is a tiny exact value separated from the question by a lot of plausible noise. We will hold the tokens, model layer, and question fixed. Only the rule that exposes earlier states to attention will change.</p><h2>Attention makes two decisions, not one</h2><p>An LLM processes text as <strong>tokens</strong>, which are words or pieces of words converted into numerical states. At one layer, every token state is transformed into three useful roles.</p><p>Every token produces all three. When the layer updates the current token, its <strong>query</strong> represents what information it is seeking. The current token and earlier tokens provide <strong>keys</strong>, which can be compared with that query, and <strong>values</strong>, the information that can be carried forward. The query-key comparisons become weights; the weighted values become the context added to the current token's state. The diagram focuses on earlier sources, but causal attention also allows the current token to attend to itself.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jp_y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jp_y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jp_y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png" width="1942" height="809" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:809,&quot;width&quot;:1942,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1050096,&quot;alt&quot;:&quot;A current token becomes a query, earlier token states supply keys and values, and query-key scores control which values are mixed into context.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A current token becomes a query, earlier token states supply keys and values, and query-key scores control which values are mixed into context." title="A current token becomes a query, earlier token states supply keys and values, and query-key scores control which values are mixed into context." srcset="https://substackcdn.com/image/fetch/$s_!jp_y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!jp_y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F854442c8-dbe4-43fd-813c-2bdea8e64620_1942x809.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 query asks, keys are compared, and values carry information forward.</figcaption></figure></div><p>There is a prerequisite hiding before those comparisons. An attention rule supplies a mask or selection pattern that says which keys and values are eligible. A future token is ineligible in a causal language model because generation cannot look ahead. Sparse patterns add more exclusions among the past.</p><p>It helps to separate two questions:</p><ol><li><p><strong>Eligibility:</strong> may the current token connect to this earlier state?</p></li><li><p><strong>Importance:</strong> among eligible states, how much weight should this one receive?</p></li></ol><p>Full, windowed, and content-selected attention mainly differ on the first question. Once a subset is eligible, the main attention operation can still compare queries with keys and mix values in the familiar way.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_eVw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_eVw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_eVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1347856,&quot;alt&quot;:&quot;A two-stage diagram first masks candidate token states as eligible or excluded, then assigns attention weights only to the eligible states.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A two-stage diagram first masks candidate token states as eligible or excluded, then assigns attention weights only to the eligible states." title="A two-stage diagram first masks candidate token states as eligible or excluded, then assigns attention weights only to the eligible states." srcset="https://substackcdn.com/image/fetch/$s_!_eVw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!_eVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F125b523d-f31d-41dc-9142-27299d0f1af8_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Eligibility happens before importance; excluded states never receive an attention weight.</figcaption></figure></div><p>Apply that distinction to our incident report. Full attention places both <code>6432</code> and <code>5432</code> in the candidate set. A four-block sliding window includes only the late diagnostic note and loses the deployed setting. A good content selector reaches back to the configuration block containing <code>6432</code>, while ignoring most of the middle.</p><p>The model still has to interpret the candidates correctly. Full attention could overweight the distracting <code>5432</code>. A selector could choose the wrong block. Eligibility does not guarantee a correct answer; it defines which answer evidence remains possible at this layer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!W76c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W76c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!W76c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!W76c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!W76c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W76c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png" width="1942" height="809" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af39ebba-1020-4699-8605-d1468b5c365b_1942x809.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:809,&quot;width&quot;:1942,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1127772,&quot;alt&quot;:&quot;The same incident-report question sees both port values under full attention, only the late default under a window, and selected early and late evidence under content selection.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The same incident-report question sees both port values under full attention, only the late default under a window, and selected early and late evidence under content selection." title="The same incident-report question sees both port values under full attention, only the late default under a window, and selected early and late evidence under content selection." srcset="https://substackcdn.com/image/fetch/$s_!W76c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 424w, https://substackcdn.com/image/fetch/$s_!W76c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 848w, https://substackcdn.com/image/fetch/$s_!W76c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 1272w, https://substackcdn.com/image/fetch/$s_!W76c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf39ebba-1020-4699-8605-d1468b5c365b_1942x809.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Changing only the eligibility pattern changes which answer evidence remains possible.</figcaption></figure></div><p>That is the first complete mental model: <strong>sparse attention saves work before importance is calculated</strong>. The rest of the article explains how each eligibility rule buys its saving, and the distinct miss it creates.</p><div id="youtube2-E_CLKTsVuE8" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;E_CLKTsVuE8&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/E_CLKTsVuE8?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-sparse-attention-makes-long-context-llms">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Four Retrieval Techniques for Video Search]]></title><description><![CDATA[Why frame rate, change detection, temporal hierarchy, and targeted rewatching fail in different ways]]></description><link>https://newsletter.theaiedge.io/p/how-ai-searches-hours-of-video-without-seeing</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/how-ai-searches-hours-of-video-without-seeing</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 14 Sep 2026 15:21:26 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/12e08956-2a68-43a6-916d-6b266d5d7d63_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Video looks like one input, but an AI cannot inspect it as one indivisible object. A two-hour recording is a sequence of changing images, sound, speech, and timestamps. Before a model can answer a question, some system has to decide which pieces of that sequence deserve space in its limited working context.</p><p>The surprising part is that a longer context window does not remove this decision. Each retained frame expands into many pieces the model must process, each second of audio adds more, and the relationships across time still have to be computed. Keeping more evidence can preserve a brief event, but it can also bury that event inside thousands of irrelevant moments.</p><p>Google's September 2026 agentic video mode now lets a model search a timeline and adjust frame rate, resolution, and modality around promising moments, making evidence selection a practical product choice rather than a hidden preprocessing detail.</p><p>So the useful question is: <strong>How can an AI answer a precise question about hours of video without placing every frame in context?</strong></p><p>The compact answer is to treat long video as a budgeted search for evidence. Fixed-rate sampling buys predictable coverage. Change-aware sampling keeps moments when the picture moves or cuts. A temporal hierarchy narrows a long recording to a few candidate intervals. Query-adaptive rewatching then spends dense frames, higher resolution, or audio only where the question needs them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3K6W!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3K6W!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 424w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 848w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 1272w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3K6W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png" width="2043" height="770" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/996c8990-8097-419c-998b-fab946454f22_2043x770.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:770,&quot;width&quot;:2043,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1308991,&quot;alt&quot;:&quot;A two-hour warehouse timeline is narrowed to a tiny evidence window at 10:04.3 before selected frames enter an evidence packet.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A two-hour warehouse timeline is narrowed to a tiny evidence window at 10:04.3 before selected frames enter an evidence packet." title="A two-hour warehouse timeline is narrowed to a tiny evidence window at 10:04.3 before selected frames enter an evidence packet." srcset="https://substackcdn.com/image/fetch/$s_!3K6W!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 424w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 848w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.png 1272w, https://substackcdn.com/image/fetch/$s_!3K6W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F996c8990-8097-419c-998b-fab946454f22_2043x770.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">Long-video understanding begins by deciding which tiny part of the timeline deserves detailed inspection.</figcaption></figure></div><p>We will follow one realistic request through all four techniques. A warehouse camera records aisle 7 for two hours. A worker enters at 10:00. A red forklift first touches shelf B at 10:04.3, then backs away. The question is not merely whether both objects appeared. It is: <strong>When did the forklift first touch the shelf after the worker entered?</strong></p><p>That wording matters. The answer needs an identity, an order, and a brief physical relation. A transcript may confirm that a worker called for help. A single frame may show the forklift beside the shelf. Only a short sequence can establish the first contact.</p><div id="youtube2-YJyhrfID9u0" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;YJyhrfID9u0&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/YJyhrfID9u0?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><h2>A video becomes a budgeted evidence packet</h2><p>A <strong>frame</strong> is one still image from the video timeline. In a common transformer-based path, a vision encoder splits that image into patches and converts the patches into numerical representations the language model can process. I will call those representations <strong>visual tokens</strong>. One frame is therefore not one token; it expands into a small field of spatial evidence.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!udbN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!udbN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 424w, https://substackcdn.com/image/fetch/$s_!udbN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 848w, https://substackcdn.com/image/fetch/$s_!udbN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 1272w, https://substackcdn.com/image/fetch/$s_!udbN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!udbN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png" width="2020" height="778" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:778,&quot;width&quot;:2020,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1170456,&quot;alt&quot;:&quot;One warehouse video frame is divided into image patches and converted into many visual tokens aligned to a timestamp.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="One warehouse video frame is divided into image patches and converted into many visual tokens aligned to a timestamp." title="One warehouse video frame is divided into image patches and converted into many visual tokens aligned to a timestamp." srcset="https://substackcdn.com/image/fetch/$s_!udbN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 424w, https://substackcdn.com/image/fetch/$s_!udbN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 848w, https://substackcdn.com/image/fetch/$s_!udbN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 1272w, https://substackcdn.com/image/fetch/$s_!udbN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ebea03d-0ad5-4465-b004-0952a2058e1f_2020x778.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 frame expands into multiple visual tokens, so retaining one more image consumes more than one context position.</figcaption></figure></div><p>Video adds a second requirement. The model must connect what appears in one frame with what changes in later frames. That temporal relationship distinguishes "forklift near shelf" from "forklift moves toward shelf, makes contact, then reverses." The model's attention mechanism can compare retained visual tokens across time, but it cannot reconstruct a moment that the input pipeline never kept.</p><p>Audio and transcripts form separate evidence streams. Audio preserves nonverbal signals such as a metallic impact. A transcript is cheaper to search and excellent for spoken names or instructions, but it omits silent motion. Timestamps align the streams so a clue in one can point to a region in another.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eKqq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eKqq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eKqq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1124673,&quot;alt&quot;:&quot;Frames, audio, and transcript appear as aligned evidence tracks connected by shared timestamps.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Frames, audio, and transcript appear as aligned evidence tracks connected by shared timestamps." title="Frames, audio, and transcript appear as aligned evidence tracks connected by shared timestamps." srcset="https://substackcdn.com/image/fetch/$s_!eKqq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!eKqq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F342bd03d-9eae-4c21-8509-de128b053d32_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Timestamps let a clue in one modality point the system toward evidence in another.</figcaption></figure></div><p>Now imagine sampling the warehouse video once each second. The system keeps frames at 10:04.0 and 10:05.0. The actual touch at 10:04.3 may fall between them. Raising the rate to ten frames per second makes the event much more likely to appear, but it multiplies the visual evidence for the entire two-hour recording.</p><p>This is the first useful insight: <strong>temporal detail is purchased with context.</strong> The family of techniques differs mainly in who decides where to spend that detail, and when.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ha22!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ha22!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ha22!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png" width="1774" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:1774,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1255990,&quot;alt&quot;:&quot;The same long video is represented with sparse low-detail samples or dense high-detail samples under a fixed context budget.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The same long video is represented with sparse low-detail samples or dense high-detail samples under a fixed context budget." title="The same long video is represented with sparse low-detail samples or dense high-detail samples under a fixed context budget." srcset="https://substackcdn.com/image/fetch/$s_!Ha22!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 424w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 848w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 1272w, https://substackcdn.com/image/fetch/$s_!Ha22!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7f5a07-d2a6-4e54-81cb-8b8046b99118_1774x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Temporal detail is purchased with context, so the budget must be concentrated somewhere.</figcaption></figure></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/how-ai-searches-hours-of-video-without-seeing">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Deep Dive: How AI Text Watermarks Work]]></title><description><![CDATA[How a language model leaves a detectable pattern in its word choices, and why copying the text preserves it.]]></description><link>https://newsletter.theaiedge.io/p/deep-dive-how-ai-text-watermarks</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/deep-dive-how-ai-text-watermarks</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Fri, 11 Sep 2026 15:01:39 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9cab6be4-8baf-4906-97b3-93cf6ae2c7f7_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An AI text watermark leaves detectable evidence in the words a model chooses. During generation, a secret scoring rule helps select the next piece of text. Later, a detector with the matching key can reconstruct that rule and check whether the finished passage agrees with it unusually often.</p><p>The surprising part is that an exact copy into a plain-text document can preserve the evidence. There is no hidden character to carry along. The ordinary words preserve the choices.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kh9x!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kh9x!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kh9x!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png" width="1536" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1536,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1147291,&quot;alt&quot;:&quot;An exact copy of the support reply preserves the same six reconstructed scores, shown separately from the text.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="An exact copy of the support reply preserves the same six reconstructed scores, shown separately from the text." title="An exact copy of the support reply preserves the same six reconstructed scores, shown separately from the text." srcset="https://substackcdn.com/image/fetch/$s_!kh9x!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!kh9x!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9458877f-92ec-44ef-8db7-4451d6f5c850_1536x1024.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 dots are a detector overlay. Copying the same text preserves the inputs to that check.</figcaption></figure></div><p>If you use AI to draft, proofread, or rewrite, the distinction matters: those operations leave different amounts of freedom for a watermark. And when someone says a passage was &#8220;detected,&#8221; the test matters too. A keyed watermark check measures a deliberately introduced pattern; it does not infer AI use from a writer's style.</p><div id="youtube2-x8SIojReCHI" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;x8SIojReCHI&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/x8SIojReCHI?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/deep-dive-how-ai-text-watermarks">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Deep Dive: How Speculative Decoding Makes LLMs Faster]]></title><description><![CDATA[How a smaller model helps a larger model generate text faster without changing its output distribution.]]></description><link>https://newsletter.theaiedge.io/p/deep-dive-how-speculative-decoding</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/deep-dive-how-speculative-decoding</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Wed, 09 Sep 2026 15:03:10 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e1111f7d-3002-4c50-ba35-7196b33a0eb4_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Speculative decoding can make a coding assistant respond faster by having a small model propose several future tokens for a larger model to check together. The larger model, called the target, still determines the output probabilities. The surprising part is that the small model can guess wrong without changing those probabilities.</p><p>In the two-model version we will follow, the target still does its full computation. The saving comes from arranging that computation differently, so one pass through its layers can advance the answer by several tokens. Whether that saves time depends on how much of the draft survives.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X0oN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X0oN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 424w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 848w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 1272w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X0oN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png" width="1662" height="946" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:946,&quot;width&quot;:1662,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:997329,&quot;alt&quot;:&quot;Two generation paths compare repeated target calls with one full target pass over draft tokens.&quot;,&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Two generation paths compare repeated target calls with one full target pass over draft tokens." title="Two generation paths compare repeated target calls with one full target pass over draft tokens." srcset="https://substackcdn.com/image/fetch/$s_!X0oN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 424w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 848w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.png 1272w, https://substackcdn.com/image/fetch/$s_!X0oN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90090915-2b05-4dd5-8088-8a16541c6418_1662x946.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">A draft makes several conditional predictions available for one full target pass.</figcaption></figure></div>
      <p>
          <a href="https://newsletter.theaiedge.io/p/deep-dive-how-speculative-decoding">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[AI Digest: Model Validation, Agents, and Generative AI]]></title><description><![CDATA[Seven visual lessons on testing models, recovering tool calls, speeding up text generation, detecting watermarks, and checking image and document outputs.]]></description><link>https://newsletter.theaiedge.io/p/ai-digest-model-validation-agents</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/ai-digest-model-validation-agents</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 07 Sep 2026 15:00:49 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4407d92f-f068-4ae0-a65c-4b6afcc7e4a4_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This edition explores how a model can pass validation for the wrong reason, how an agent can earn a reward without completing its task, and what makes a tool retry safe after a crash.</p><p>We'll also look inside speculative decoding and text watermarking, then turn to two visual problems: why a generated image can look convincing while missing the instructions, and why a fluent document answer can still come from the wrong cell.</p><h2>1. Model validation: a random split can preserve the shortcut</h2><p>Can machine learning validation approve a model that learned the wrong feature? It can, if the validation set repeats the same shortcut!</p><p>Imagine a pneumonia classifier trained on chest X-rays from two hospitals. Hospital A contributed most of the positive cases. Hospital B contributed most of the negative cases.</p><p>Each image contains two usable signals: the lung pattern we care about, and a hospital fingerprint from scanner processing, text markers, or acquisition style. The loss function does not know which explanation we intended. It rewards features that predict the label. If recognizing the hospital offers an easier route to lower loss, the model can use it.</p><p>Now randomly split the rows into training and validation sets. Both sets still contain the same hospitals and the same correlation: Hospital A usually means positive; Hospital B usually means negative. Randomization changes which rows land in each set, but it does not change the process that produced them.</p><p><strong>The validation images are unseen, yet the shortcut is familiar.</strong> A high score can accurately describe performance on this source mixture and still mislead us about deployment.</p><p>Move the model to Hospital C. In this toy example, the disease signal remains valid while the old hospital-label correlation disappears. Prediction quality can drop without any bug in the inference code. The diagram follows that change from collection to deployment.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JIZ1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JIZ1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JIZ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1605979,&quot;alt&quot;:&quot;Hospital A supplies mostly positive X-rays and Hospital B mostly negative ones. A random train-validation split preserves their source cues. The same classifier can fail at Hospital C; whole-hospital holdouts and cue swaps probe different dependencies.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Hospital A supplies mostly positive X-rays and Hospital B mostly negative ones. A random train-validation split preserves their source cues. The same classifier can fail at Hospital C; whole-hospital holdouts and cue swaps probe different dependencies." title="Hospital A supplies mostly positive X-rays and Hospital B mostly negative ones. A random train-validation split preserves their source cues. The same classifier can fail at Hospital C; whole-hospital holdouts and cue swaps probe different dependencies." srcset="https://substackcdn.com/image/fetch/$s_!JIZ1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!JIZ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d38fad-e699-4f4e-850d-260303c82b30_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">New rows can preserve the same hospital shortcut. Holding out a hospital tests a change of environment; swapping a cue tests reliance on that feature.</figcaption></figure></div><p>A random row split estimates performance on another row from the same source mixture. It says little about a source absent from that mixture. When the expected novelty is a hospital, camera, customer, region, time period, or device, holding out the entire unit lets validation test that change instead of scattering the unit across both sides.</p><p>I would then ask whether the model is using the particular cue I suspect. Keep the target content fixed, remove or swap the background, marker, source template, or metadata, and watch whether the prediction moves.</p><p>These tests answer different questions. A group holdout tests an environment change. A cue intervention tests dependence on one named feature. Neither proves that the model learned the intended signal: the holdout covers only the environments we chose, and the intervention is trustworthy only if it changes the shortcut without changing the task itself.</p><h2>2. Agent reward hacking: passing the test while leaving the bug</h2><p>Why can AI agent reward hacking produce a perfect score on a task the agent never completed? The reason is simple: the agent optimizes the feedback we expose, not the intention behind it.</p><p>Consider a coding agent asked to fix an invoice calculation. The correct total is $110, but the code returns $100. We use the test suite as the evaluator: a pass earns a reward of +1, and a failure earns 0.</p><p>During reinforcement learning, the agent tries a sequence of actions and receives this reward. The optimizer makes high-reward action sequences more likely in similar situations.</p><p>We expect the agent to fix the calculation, pass the tests, and produce an invoice for $110. But the test suite is also part of the environment. If the agent can modify it, another path becomes available: disable the assertion, pass the tests, and leave the invoice at $100.</p><p>Both paths receive +1. The second path can be reinforced because the remaining failure was never reflected in the score.</p><p>Three different objects matter here:</p><ul><li><p>The <strong>true objective</strong> is a correct invoice.</p></li><li><p>The <strong>proxy reward</strong> is the +1.</p></li><li><p>The <strong>evaluator</strong> is the test suite that decides when to issue it.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NuBf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NuBf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NuBf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1617963,&quot;alt&quot;:&quot;A test suite maps pass to +1 and fail to zero. A coding agent can fix a $100 invoice to the correct $110 or disable an assertion and leave it at $100. Both paths receive +1, illustrating the gap between the objective, evaluator, and reward.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A test suite maps pass to +1 and fail to zero. A coding agent can fix a $100 invoice to the correct $110 or disable an assertion and leave it at $100. Both paths receive +1, illustrating the gap between the objective, evaluator, and reward." title="A test suite maps pass to +1 and fail to zero. A coding agent can fix a $100 invoice to the correct $110 or disable an assertion and leave it at $100. Both paths receive +1, illustrating the gap between the objective, evaluator, and reward." srcset="https://substackcdn.com/image/fetch/$s_!NuBf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!NuBf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb914a173-7a90-4fd3-9fca-d38e76a8f4a8_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Fixing the calculation and changing the test can produce the same reward while leaving different real outcomes. Altering the evaluator is reward tampering.</figcaption></figure></div><p>Exploiting a missing condition in the proxy is usually called specification gaming. Changing the evaluator itself, by editing a test, checklist, log, or scoring process, is the more specific case of reward tampering.</p><p>No human-like intention to cheat is required. From the optimizer's point of view, the two action sequences received the same reward. The number does not contain the missing requirement, so we cannot recover it from the score afterward.</p><p>Greater capability does not settle this problem. Better search can find the correct implementation, but it can also find shortcuts that a weaker agent never discovered. It expands both sets of paths.</p><p>A wrong answer with a low score is ordinary failure. Reward hacking is narrower: the measured score says success while the intended outcome stays unchanged or gets worse. The test suite is another piece of the environment, and its assumptions shape what the agent learns.</p><h2>3. Durable agents: a checkpoint cannot confirm an external payment</h2><p>How can durable execution for AI agents survive a crash and still charge the same invoice twice? The checkpoint remembers where to resume, but it cannot prove whether the outside world already changed!</p><p>Imagine an agent paying a $480 invoice. It records step <code>pay-1</code> as pending, sends the request, and the payment API accepts it. Then the worker crashes before saving the receipt.</p><p>After restart, the execution state still says:</p><p><code>run-42 -&gt; pay-1 -&gt; PENDING</code></p><p>From that saved state alone, the replacement worker cannot tell whether the payment failed or only the acknowledgement failed. We know the API accepted the payment in this example; the worker has no saved receipt to establish that. Retrying may be necessary, but the tool step may execute again.</p><p>An <strong>idempotency key</strong> is a stable identifier that tells the external service that a retry represents the same logical operation. The checkpoint identifies the unfinished step; the key identifies the one external operation that step is allowed to create.</p><p>The diagram uses <code>run-42/pay-1</code> as the key, recorded before the first request. The replacement worker reloads the latest checkpoint, skips completed work, and sends <code>pay-1</code> again with that same key. If the payment service supports idempotency and already processed the key, it returns the original receipt instead of creating another payment. The runtime then saves the receipt, marks the step completed, and continues.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZjIy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZjIy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZjIy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1460361,&quot;alt&quot;:&quot;An agent pays a $480 invoice but crashes before storing the receipt. A replacement worker loads the pending step and retries with key run-42/pay-1. The payment service returns the existing receipt; the worker saves it, marks the step completed, and resumes.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="An agent pays a $480 invoice but crashes before storing the receipt. A replacement worker loads the pending step and retries with key run-42/pay-1. The payment service returns the existing receipt; the worker saves it, marks the step completed, and resumes." title="An agent pays a $480 invoice but crashes before storing the receipt. A replacement worker loads the pending step and retries with key run-42/pay-1. The payment service returns the existing receipt; the worker saves it, marks the step completed, and resumes." srcset="https://substackcdn.com/image/fetch/$s_!ZjIy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!ZjIy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe09ac548-1ee9-4a0e-b090-4434a623914a_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 checkpoint identifies unfinished work. Reusing the same idempotency key lets a supporting payment service return the original receipt without creating another payment.</figcaption></figure></div><p>This is why conversation memory and execution state deserve separate treatment. Conversation memory can hold messages, facts, and user preferences. Execution state needs the run ID, step ID, exact tool arguments, status, approvals, timers, and durable receipts. A sentence saying "the invoice was paid" is not a transaction record.</p><p>The same pattern appears outside payments. A database can reject a duplicate operation through a unique constraint or conditional write. An event consumer can deduplicate using a stable event ID.</p><p>If a tool has no idempotency mechanism, blind retry is the wrong recovery strategy. The agent has to query the external system, run a compensating action that reverses or offsets the first effect, or stop for human review.</p><p>Durable execution preserves progress. It does not make the model correct, permissions safe, or an arbitrary API idempotent. Once an agent can wait for humans, call tools, and run longer than one request, its execution state matters as much as its prompt.</p><h2>4. Speculative decoding: draft several tokens, verify in one pass</h2><p>How can speculative decoding use a smaller language model without inheriting its mistakes? The small model guesses a few tokens ahead, but the large target model verifies the whole guess in one pass and keeps control of the output distribution.</p><p>The usual language-model decoding loop is serial. The target model predicts one token, appends it to the sequence, then runs again. Producing K tokens requires K target-model passes.</p><p>During low-batch decoding, a pass often spends more time moving the model weights than using all the available arithmetic. Scoring a short block can reuse each weight read across several token positions, so it can take close to the time of scoring only one.</p><p>Speculative decoding takes advantage of that opportunity. In the common two-model version, a cheap draft model generates a short continuation one token at a time. The large target model receives the prompt and complete draft, then scores every drafted position in parallel.</p><p>Acceptance still proceeds from left to right. Accepted tokens become final. At the first rejection, every later draft token is discarded because it was conditioned on a prefix the target did not accept. The target samples a correction, and the next drafting round starts from the corrected prefix.</p><p>For the prompt "Water freezes at", imagine the draft proposes:</p><p><code>"0" -&gt; "degrees" -&gt; "Kelvin" -&gt; "."</code></p><p>One target pass can score all four positions. It may accept "0" and "degrees", reject "Kelvin", discard the period, and sample "Celsius" as the correction. That slow pass has finalized three useful tokens instead of one.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ln6R!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ln6R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ln6R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1575217,&quot;alt&quot;:&quot;Serial target decoding is compared with a small model drafting 0, degrees, Kelvin, and a period. One target pass scores the draft, accepts the first two tokens, rejects Kelvin, discards the suffix, and samples Celsius using the residual distribution.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Serial target decoding is compared with a small model drafting 0, degrees, Kelvin, and a period. One target pass scores the draft, accepts the first two tokens, rejects Kelvin, discards the suffix, and samples Celsius using the residual distribution." title="Serial target decoding is compared with a small model drafting 0, degrees, Kelvin, and a period. One target pass scores the draft, accepts the first two tokens, rejects Kelvin, discards the suffix, and samples Celsius using the residual distribution." srcset="https://substackcdn.com/image/fetch/$s_!Ln6R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!Ln6R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7703519b-7c78-4f6a-bf71-557ccfa87590_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 target scores a block in parallel but accepts it from left to right. A rejection invalidates the later draft; the acceptance and correction rules preserve the target distribution.</figcaption></figure></div><p>What I find most interesting is how this works for sampled decoding. We cannot simply keep a token when two independent samples happen to match. If draft and target were identical uniform distributions over 100 tokens, their separate draws would match only 1% of the time, despite perfect agreement between the distributions.</p><p>Call the target distribution <code>p</code> and the draft distribution <code>q</code>. A drafted token <code>x</code> is accepted with probability:</p><p><code>min(1, p(x) / q(x))</code></p><p>If it is rejected, the correction is sampled from the normalized positive part of <code>p - q</code>. To build that distribution, keep the positive differences between target and draft probabilities, set the others to zero, and rescale the remaining values so they sum to one. This is the target probability not already covered by the draft.</p><p>Together, the accepted path and correction path reconstruct <code>p</code>. Under this rule, the draft changes latency without biasing the target distribution.</p><p>The benefit depends on the whole serving setup. A slow draft adds too much overhead. A draft with little overlap with the target causes frequent rejections. Hardware that is already compute-saturated has little parallel capacity left to exploit.</p><p>The useful draft is the one whose acceptance rate is worth its cost on the target model and hardware being served. Accuracy of the small model alone does not determine that tradeoff.</p><h2>5. Text watermarking: small token preferences add up to evidence</h2><p>How can generative text watermarking mark a paragraph without adding hidden characters, metadata, or a visible tag? It changes ordinary token choices, then looks for the accumulated pattern!</p><p>At each decoding step, a large language model (LLM) produces a probability distribution over the next token. Several continuations may fit. A normal sampler chooses among them; a watermarking sampler uses one additional input, a secret key.</p><p>One common construction uses the key and recent tokens to pseudorandomly divide the vocabulary into green and red sets. Plausible green tokens get a small boost. The partition is recomputed after every token, so there is no fixed list of suspicious words.</p><p>Consider a toy passage with 100 positions counted by the detector. Without the watermark, we expect roughly 50 green hits by chance. A watermarked sampler might produce 70. No individual token looks unusual; the pattern appears when we aggregate the choices.</p><p>For this simplified 50/50 construction, a one-proportion test gives:</p><p><code>z = (70 - 50) / sqrt(100 &#215; 0.5 &#215; 0.5) = 4</code></p><p>The numerator is the 20 extra green hits. The denominator is 5, the standard deviation of the count under this simplified chance model. The observed count sits four standard deviations above the expected count.</p><p>Other watermark families use different scoring rules. Here, the detector tokenizes the passage, uses the same key to recreate the green and red sets at each position, and tests whether the excess of green tokens is too large to explain by chance. It measures a statistical pattern rather than judging whether the prose sounds robotic.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_lXi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_lXi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_lXi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1548363,&quot;alt&quot;:&quot;A secret key and recent context partition tokens into green and red sets. Green tokens receive a small sampling boost. A detector replays the rule, observes 70 green hits out of 100, and calculates a toy z score of 4; length, constrained text, and editing affect the evidence.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A secret key and recent context partition tokens into green and red sets. Green tokens receive a small sampling boost. A detector replays the rule, observes 70 green hits out of 100, and calculates a toy z score of 4; length, constrained text, and editing affect the evidence." title="A secret key and recent context partition tokens into green and red sets. Green tokens receive a small sampling boost. A detector replays the rule, observes 70 green hits out of 100, and calculates a toy z score of 4; length, constrained text, and editing affect the evidence." srcset="https://substackcdn.com/image/fetch/$s_!_lXi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!_lXi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bd7f1ee-1a87-4a86-a604-26038be30ca2_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 tiny preference becomes detectable across many token choices. The 70-of-100 example is a simplified statistical test, and a positive result does not establish authorship.</figcaption></figure></div><p>Length supplies evidence. A ten-token answer provides very few weak votes; a long passage supplies many more observations. The model also needs freedom to choose. Open prose may offer several reasonable continuations, while code or familiar fixed phrases can have one dominant next token, leaving little room to embed a preference without damaging the output.</p><p>Editing weakens the signal without predictably erasing it. Replacing a token removes one marked choice. In context-dependent schemes, it can also change the expected partition at positions that use the edited context. A substantial rewrite can reduce the evidence dramatically, yet a long paraphrase may preserve enough unaltered fragments to remain detectable.</p><p>A positive result means the text is statistically consistent with one key's watermarking rule. It does not prove who wrote the ideas, and it cannot identify output from a model that never applied that mark. The detector threshold still trades missed detections against false positives.</p><p>That is why a long, open-ended answer can carry strong watermark evidence while a short code completion from the same model may carry almost none.</p><h2>6. Image generation: realism and exact composition are different tests</h2><p>AI image generation can give you a beautiful campaign image and still ignore the requirement that makes it usable! The problem is that a text prompt is not an engineering drawing.</p><p>Consider this request: "three green bottles to the left of one orange box, with FRESH on the label."</p><p>One sentence carries five kinds of constraints: which objects exist, how many of each, which attributes belong to which objects, where they go, and which exact characters appear.</p><p>In many diffusion systems, a text encoder converts the prompt into vectors. Cross-attention lets the denoising network consult those vectors while turning noise into an image. A few words can influence a large visual field without someone hand-coding the scene.</p><p>But the vectors do not arrive as an explicit object table with separate entries for color, count, and coordinates. During denoising, "green", "bottles", "three", and "left of" must all influence one shared visual representation. The model can form a convincing poster while giving you four bottles, coloring the box green, or letting objects overlap.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pKvb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pKvb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pKvb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1586144,&quot;alt&quot;:&quot;A request for three green bottles left of one orange box with FRESH on the label is decomposed into objects, count, color, position, and text. A diffusion illustration leads to a plausible but incorrect layout, contrasted with explicit layout and count, position, and text checks.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A request for three green bottles left of one orange box with FRESH on the label is decomposed into objects, count, color, position, and text. A diffusion illustration leads to a plausible but incorrect layout, contrasted with explicit layout and count, position, and text checks." title="A request for three green bottles left of one orange box with FRESH on the label is decomposed into objects, count, color, position, and text. A diffusion illustration leads to a plausible but incorrect layout, contrasted with explicit layout and count, position, and text checks." srcset="https://substackcdn.com/image/fetch/$s_!pKvb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!pKvb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe470d93e-c1ab-42b7-820b-a266657cfc27_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 believable image can still violate count, position, color binding, or exact text. Layout guidance and explicit checks help make the requested composition inspectable.</figcaption></figure></div><p>Realism and prompt compliance measure different things. Bottles, an orange box, and text-like marks can all be present while the requested relationships drift. Counting, relative position, and attaching an attribute to the correct object are compositional challenges.</p><p>Saying that image models "cannot count" misses the larger problem. Individually recognizable concepts have to stay attached to the right instance and location throughout generation.</p><p>Sketches, layouts, segmentation maps, and image checks help make some intended state explicit: where an object belongs, how many are needed, and whether a word is exact. The diagram separates guidance from checking: its layout specifies the bottles' positions, while the checks inspect count, position, and the characters in FRESH. These aids do not guarantee a correct result, but they stop the prompt from carrying every constraint alone.</p><p>A creative mood board benefits from the model filling gaps. An asset with exact copy, object counts, or placement can fail precisely when the model fills in a gap you intended to specify.</p><h2>7. Document extraction: connect the answer to the right cell</h2><p>AI document extraction can give you a perfectly grammatical answer that comes from the wrong cell in the document! The reason is that a vision-language model is doing several different jobs before it ever starts reasoning about your PDF.</p><p>Start with a scanned bank statement:</p><ul><li><p>Opening balance: $14,900</p></li><li><p>Deposits: $2,200</p></li><li><p>Closing balance: $17,100</p></li></ul><p>Ask, "How much was deposited?"</p><p>The model does not receive the document as a clean database row. A vision encoder turns pixels into a limited set of visual tokens. Small type, a low-quality scan, and dense tables can make the evidence for a word or nearby number weak or mixed. Some PDF pipelines pass native text separately, which changes the failure mode, but charts, tables, handwriting, and rendered layout still require visual interpretation.</p><p>Then comes binding: "Deposits" must be linked to $2,200. Recognizing all three amounts somewhere on the page is insufficient. The language model uses the visual representations and the question to generate its answer token by token.</p><p>If the deposit label was unclear, or the label-to-value association was wrong, "$17,100" can still be a plausible completion. Fluency tells us the decoder completed a sentence well. It does not tell us which pixels supported the answer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hKiJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hKiJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hKiJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png" width="1080" height="1400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1400,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1520024,&quot;alt&quot;:&quot;A scanned bank statement lists $14,900 opening balance, $2,200 deposits, and $17,100 closing balance. The visual contrasts linking Deposits to $2,200 with a wrong $17,100 answer, then shows checks for reading glyphs, binding layout, and tracing the answer to evidence.&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;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A scanned bank statement lists $14,900 opening balance, $2,200 deposits, and $17,100 closing balance. The visual contrasts linking Deposits to $2,200 with a wrong $17,100 answer, then shows checks for reading glyphs, binding layout, and tracing the answer to evidence." title="A scanned bank statement lists $14,900 opening balance, $2,200 deposits, and $17,100 closing balance. The visual contrasts linking Deposits to $2,200 with a wrong $17,100 answer, then shows checks for reading glyphs, binding layout, and tracing the answer to evidence." srcset="https://substackcdn.com/image/fetch/$s_!hKiJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 424w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 848w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!hKiJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c8bc1d6-e74a-4860-ac48-c0bcebaca573_1080x1400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Reading a number is only one step. The answer must preserve its relationship to the requested label and the correct source region.</figcaption></figure></div><p>I separate document extraction into three questions:</p><ol><li><p>Did the system read the relevant glyphs?</p></li><li><p>Did it preserve the relationship between label, row, column, and value?</p></li><li><p>Did the answer come from that evidence, or from a plausible completion?</p></li></ol><p>Optical character recognition (OCR) and coordinates can make the first two steps inspectable. A vision-language model is useful when the final answer needs a comparison, interpretation, or calculation.</p><p>More visual resolution can improve fine detail, but it also costs tokens and latency. It does not automatically recover a missing label-to-value relationship.</p><p>Chart questions have the same difficulty. Reading "Q4" and "47" is insufficient: the system has to connect the right series, axis, and visual mark before it can reason usefully about them.</p>]]></content:encoded></item><item><title><![CDATA[AdalFlow: A PyTorch-Like Framework to Auto-Optimizing Prompt for your LLM agent]]></title><description><![CDATA[AI Agent frameworks are becoming just as important as model training itself!]]></description><link>https://newsletter.theaiedge.io/p/adalflow-a-pytorch-like-framework</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/adalflow-a-pytorch-like-framework</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 29 Sep 2025 15:01:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!o1BQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>AI Agent frameworks are becoming just as important as model training itself! I am excited to introduce you to <a href="https://www.linkedin.com/in/li-yin-ai/">Li Yin</a>. She is the CEO of <a href="https://github.com/SylphAI-Inc">SylphAI</a> and the founder of <a href="https://github.com/SylphAI-Inc/AdalFlow">AdalFlow</a>, a PyTorch-like open-source library on GitHub that enables developers to build and auto-optimize any Language Model (LM) workflows.</strong></p><p><strong>In this guest post, <a href="https://www.linkedin.com/in/aria-ailearning/">Aria Shi</a>, the Developer Relations lead at SylphAI, walks you through how AdalFlow empowers AI Agent development, highlighting a hands-on example with a <a href="https://github.com/SylphAI-Inc/AdalFlow">LinkedIn Reachout Agent</a>.</strong></p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o1BQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o1BQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o1BQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png" width="554" height="554" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:554,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&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="" title="" srcset="https://substackcdn.com/image/fetch/$s_!o1BQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!o1BQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2431b183-b2fc-4935-87f1-689b6846781a_1024x1024.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><blockquote><p><em>Say goodbye to manual prompt engineering. <strong><a href="https://github.com/SylphAI-Inc/AdalFlow">AdalFlow</a></strong> is the all-in-one, auto-differentiative solution for optimizing prompts, whether you&#8217;re using zero-shot or few-shot learning. Backed by our state-of-the-art research (LLM-AutoDiff and Learn-to-Reason), our framework achieves the highest accuracy among all automatic prompt optimization libraries.</em></p></blockquote><p>The rise of large language models has completely changed the way we build applications&#8212;whether it&#8217;s chatbots, RAG systems, or fully autonomous agents. But as an AI engineer, trying to bring these models into production often feels like stitching together a bunch of experiments, rather than building a stable and reliable system.</p><p>We introduce AdalFlow: a PyTorch-like library designed to bring structure, clarity, and optimization to the world of LLM application development. Built as a community-driven project, AdalFlow is uniting AI research and production engineering into a single ecosystem.</p><div class="pullquote"><p><strong><a href="https://github.com/SylphAI-Inc/AdalFlow">AdalFlow GitHub Repository</a></strong></p></div><h2>Why We Built AdalFlow</h2><p>Modern AI development faces a paradox. On one hand, researchers push the boundaries of model capabilities with new techniques in prompting, evaluation, and optimization. On the other hand, production teams need reproducibility, scalability, and a way to iterate safely on real-world data.</p><p>Most libraries excel at one side of the equation but leave the other underserved. AdalFlow was born to bridge this gap. With 100% control and clarity of source code, it empowers researchers to experiment freely while giving product engineers the tools to build and ship with confidence.</p><h3>Why AdalFlow Matters</h3><p>By treating prompts as first-class citizens and introducing LLM-AutoDiff, AdalFlow provides what&#8217;s been missing in the LLM ecosystem:</p><ul><li><p>For researchers: A familiar PyTorch-like environment to prototype new prompting and training methods.</p></li><li><p>For engineers: Production-ready workflows that are debuggable, reproducible, and optimizable.</p></li><li><p>For teams: A shared framework that unites research and production into one healthy ecosystem.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HKp4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HKp4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 424w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 848w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 1272w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HKp4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png" width="724" height="264.0412087912088" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:531,&quot;width&quot;:1456,&quot;resizeWidth&quot;:724,&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_!HKp4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 424w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 848w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 1272w, https://substackcdn.com/image/fetch/$s_!HKp4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aa8ef86-71f7-493b-b183-44b000d9c1b8_1600x584.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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 overview of AdalFlow</figcaption></figure></div><h2>Core Philosophy: Prompt Is the New Programming Language</h2><p>If PyTorch turned tensors into the lingua franca of deep learning, AdalFlow treats prompts as the new programming primitives.</p><p>Every LLM application boils down to structured prompts and their transformations. AdalFlow embraces this reality by making prompt engineering explicit and optimizable. Behind the scenes, it uses the <a href="https://jinja.palletsprojects.com/en/stable/">Jinja2</a> templating engine to let developers define composable prompt structures, ensuring that LLM apps are both modular and debuggable.</p><h3>Components: The Building Blocks of LLM Workflows</h3><p>At the heart of AdalFlow lies the Component abstraction. Just as <code>nn.Module</code> became the foundation for PyTorch models, Components unify every stage of an LLM pipeline.</p><div class="pullquote"><p><strong><a href="https://adalflow.sylph.ai/new_tutorials/core_concepts.html">AdalFlow Core Concepts</a></strong></p></div><ul><li><p>Component: The base class for all workflows. Handles both training (forward) and inference (call) modes, with bicall bridging the two.</p></li><li><p>GradComponent: Components capable of backpropagation (e.g., Generators, Retrievers).</p></li><li><p>DataComponent: Lightweight components for formatting and parsing data (e.g., DataClassParser).</p></li><li><p>LossComponent: Wraps evaluation metrics and enables gradient-like feedback for text optimization.</p></li></ul><h3>Example 1: Q&amp;A with Object Counting (Component + DataComponent)</h3><div class="pullquote"><p><strong><a href="https://adalflow.sylph.ai/use_cases/question_answering.html?source=post_page-----84f95a03f22b---------------------------------------">Question Answering - Build and Optimize LM Workflows</a></strong></p></div><pre><code>template = r<strong>"""&lt;START_OF_SYSTEM_PROMPT&gt;
{{system_prompt}}
&lt;END_OF_SYSTEM_PROMPT&gt;
&lt;START_OF_USER&gt;
{{input_str}}
&lt;END_OF_USER&gt;"""</strong>

<strong>@adal.func_to_data_component</strong>
<strong>def</strong> parse_integer_answer(answer: <strong>str</strong>):
    numbers = re.findall(r"\d+", answer)
    <strong>return</strong> <strong>int</strong>(numbers[-1])</code></pre><h4>What&#8217;s happening here?</h4><ul><li><p><code>parse_integer_answer</code> is wrapped with <code>@adal.func_to_data_component</code>.</p></li><li><p>This turns a plain Python function into a <code>DataComponent</code>, which handles structured output parsing.</p></li><li><p>In this case, it ensures the model&#8217;s answer ends with a numerical value.</p></li></ul><p>Next, we define a full pipeline:</p><pre><code><strong>class</strong> ObjectCountTaskPipeline(adal.Component):
    <strong>def</strong> __init__(
            <strong>self</strong>, model_client: adal.ModelClient, model_kwargs: Dict
        ):
        <strong>super</strong>().__init__()
        system_prompt = adal.Parameter(
            data=<strong>"You will answer a reasoning question. Think step by step. The last line should be 'Answer: $VALUE'."</strong>,
            role_desc=<strong>"Task instruction for the model"</strong>,
            requires_opt=<strong>True</strong>,
            param_type=ParameterType.PROMPT,
        )
        <strong>self</strong>.llm_counter = adal.Generator(
            model_client=model_client,
            model_kwargs=model_kwargs,
            template=template,
            prompt_kwargs={<strong>"system_prompt"</strong>: system_prompt},
            output_processors=parse_integer_answer,
        )

    <strong>def</strong> bicall(<strong>self</strong>, question: <strong>str</strong>, id: <strong>str</strong> = <strong>None</strong>):
        <strong>return</strong> self.llm_counter(
              prompt_kwargs={<strong>"input_str"</strong>: question}, id=id
        )</code></pre><p><code>ObjectCountTaskPipeline</code> subclasses Component. Inside it, we define:</p><ul><li><p>A Parameter of type <code>PROMPT</code>, which AdalFlow can later auto-optimize.</p></li><li><p>A Generator (a <code>GradComponent</code>) that executes the prompt, then passes the raw LLM output through our <code>parse_integer_answer</code> <code>DataComponent</code>.</p></li></ul><blockquote><p><em>The workflow is:<br>Prompt &#8594; LLM Generation &#8594; Structured Output Parsing &#8594; Final Numerical Answer.</em></p></blockquote><h3>Example 2: Classification with Structured Output (Component + DataClass)</h3><div class="pullquote"><p><strong><a href="https://adalflow.sylph.ai/use_cases/classification.html?source=post_page-----84f95a03f22b---------------------------------------">Classification Optimization - Build and Optimize LM Workflows</a></strong></p></div><p>Classification tasks are a perfect showcase of AdalFlow&#8217;s DataClass feature.</p><pre><code><strong>@dataclass</strong>
<strong>class</strong> TRECExtendedData(adal.DataClass):
    question: <strong>str</strong> = field(
        metadata={<strong>"desc"</strong>: <strong>"The question to be classified"</strong>}
    )
    rationale: <strong>str</strong> = field(
        metadata={<strong>"desc"</strong>: <strong>"Step-by-step reasoning"</strong>}, default=<strong>None</strong>
    )
    class_name: Literal[
        <strong>"ABBR"</strong>, <strong>"ENTY"</strong>, <strong>"DESC"</strong>, <strong>"HUM"</strong>, <strong>"LOC"</strong>, <strong>"NUM"
    </strong>] = field(
        metadata={<strong>"desc"</strong>: <strong>"The class name"</strong>}, default=<strong>None</strong>
    )

    __input_fields__ = [<strong>"question"</strong>]
    __output_fields__ = [<strong>"rationale"</strong>, <strong>"class_name"</strong>]</code></pre><ul><li><p><code>TRECExtendedData</code> extends <code>DataClass</code>, which (like Pydantic) gives us schema enforcement.</p></li><li><p>Input: a question.</p></li><li><p>Output: a rationale (reasoning trace) and a <code>class_name</code> (final label).</p></li></ul><p>Now let&#8217;s plug it into a pipeline:</p><pre><code><strong>class</strong> TRECClassifierStructuredOutput(adal.Component):
    <strong>def</strong> __init__(
        <strong>self</strong>, model_client: adal.ModelClient, model_kwargs: Dict
    ):
        <strong>super</strong>().__init__()
        <em><strong># Task description prompt</strong></em>
        task_desc_str = adal.Prompt(
            template=task_desc_template,
            prompt_kwargs={
                <strong>"classes"</strong>: [
                    {<strong>"label"</strong>: l, <strong>"desc"</strong>: d} 
                    <strong>for</strong> l, d 
                    <strong>in</strong> <strong>zip</strong>(_COARSE_LABELS, _COARSE_LABELS_DESC)
                ]
            }
        )()

        parser = adal.DataClassParser(
            data_class=TRECExtendedData,
            return_data_class=<strong>True</strong>,
            format_type=<strong>"yaml"</strong>
        )

        prompt_kwargs = {
            <strong>"system_prompt"</strong>: adal.Parameter(
                data=task_desc_str,
                role_desc=<strong>"Task description"</strong>,
                requires_opt=<strong>True</strong>,
                param_type=adal.ParameterType.PROMPT,
            ),
            <strong>"output_format_str"</strong>: parser.get_output_format_str(),
        }

        <strong>self</strong>.llm = adal.Generator(
            model_client=model_client,
            model_kwargs=model_kwargs,
            prompt_kwargs=prompt_kwargs,
            template=template,
            output_processors=parser,
        )

    <strong>def</strong> bicall(<strong>self</strong>, question: <strong>str</strong>, id: Optional[<strong>str</strong>] = <strong>None</strong>):
        <strong>return</strong> <strong>self</strong>.llm(prompt_kwargs={"input_str": question}, id=id)</code></pre><ul><li><p>The Prompt defines the system instruction with class definitions.</p></li><li><p><code>DataClassParser</code> enforces structured YAML output that matches <code>TRECExtendedData</code>.</p></li><li><p>Generator (a GradComponent) runs the LLM with prompt + parser.</p></li><li><p>Output is guaranteed to follow the schema: rationale + class name.</p></li></ul><p>This ensures the model never drifts into free-form answers&#8212;it always returns structured classification results.</p><h3>Example 3: Training With LossComponent</h3><p>Finally, how do we train or optimize these components? That&#8217;s where <code>LossComponent</code> comes in:</p><pre><code>eval_fn = AnswerMatchAcc(type=<strong>"exact_match"</strong>).compute_single_item
loss_fn = adal.EvalFnToTextLoss(
    eval_fn=eval_fn,
    eval_fn_desc=<strong>"exact_match: 1 if str(y) == str(y_gt) else 0"</strong>
)</code></pre><ul><li><p><code>AnswerMatchAcc</code> is the evaluation metric.</p></li><li><p><code>EvalFnToTextLoss</code> wraps it as a <code>LossComponent</code>, enabling LLM-AutoDiff to optimize prompts automatically during training.</p></li></ul><blockquote><p><em>By attaching this to your pipeline, you get a full training loop:<br>Forward pass &#8594; Eval metric &#8594; Backward engine &#8594; Prompt optimization.</em></p></blockquote><h2>Agents: Reasoning Meets Action</h2><p>AdalFlow embraces the ReAct paradigm&#8212;combining reasoning (plan) with acting (tool use)&#8212;to build autonomous, auditable AI systems. An agent reasons about the task, selects tools, executes them, observes results, and iterates until it can deliver a final answer.</p><ul><li><p><a href="https://adalflow.sylph.ai/new_tutorials/agents_runner.html">https://adalflow.sylph.ai/new_tutorials/agents_runner.html</a></p></li><li><p><a href="https://colab.research.google.com/github/SylphAI-Inc/AdalFlow/blob/main/notebooks/agents/agent_tutorial.ipynb">https://colab.research.google.com/github/SylphAI-Inc/AdalFlow/blob/main/notebooks/agents/agent_tutorial.ipynb</a></p></li></ul><h3>Architecture at a Glance</h3><ul><li><p>Agent (planner + tool manager)<br>Handles <em>planning and decision-making</em> via a Generator-based planner, and knows what tools are available and how to call them.</p></li><li><p>Runner (executor + conversation loop)<br>Orchestrates <em>multi-step execution</em>, tool calling, observation handling, timeouts, and final answer synthesis.</p></li></ul><p>This separation lets you swap or customize planning vs. execution independently.</p><h3>Execution Flow (ReAct Loop Recap)</h3><ol><li><p>Planning &#8211; The Agent (Generator planner) analyzes input and proposes the next action.</p></li><li><p>Tool Selection &#8211; Chooses a tool from the registered set.</p></li><li><p>Tool Execution &#8211; The Runner invokes the tool with arguments.</p></li><li><p>Observation &#8211; The result is fed back to the planner.</p></li><li><p>Iteration &#8211; Repeat 1&#8211;4 up to max_steps or until confident.</p></li><li><p>Final Answer &#8211; The planner synthesizes the answer (optionally into a structured type).</p></li></ol><h3>Minimal, End-to-End Example</h3><blockquote><p><em>1) Define a Tool (callable or FunctionTool)</em></p></blockquote><pre><code><em><strong># Tool: a plain Python callable works, or wrap with FunctionTool for extras.</strong></em>
<strong>def</strong> calculator(expression: str) -&gt; <strong>str</strong>:
    <em><strong>"""Evaluate a mathematical expression."""</strong></em>
    <strong>try</strong>:
        result = eval(expression)
        return f<strong>"Result: {result}"</strong>
    <strong>except</strong> Exception <strong>as</strong> e:
        <strong>return</strong> f<strong>"Error: {e}"</strong></code></pre><blockquote><p><em>2) Build the Agent (Planner + Tools)</em></p></blockquote><pre><code><strong>from</strong> adalflow <strong>import</strong> Agent, Runner
<strong>from</strong> adalflow.components.model_client.openai_client <strong>import</strong> OpenAIClient

agent = Agent(
    name=<strong>"CalculatorAgent"</strong>,  <em><strong># Agent identifier</strong></em>
    tools=[calculator],  <em><strong># List of tools (callables or FunctionTool)</strong></em>
    <em><strong># LLM client used by the planner (Generator-based)</strong></em>
    model_client=OpenAIClient(),
    model_kwargs={<strong>"model"</strong>: <strong>"gpt-4o"</strong>, <strong>"temperature"</strong>: 0.3},
    max_steps=6,  <em><strong># Upper bound for ReAct loops</strong></em>
)</code></pre><p>What this maps to:</p><ul><li><p>Planner: An internal Generator that decides the next step (think: &#8220;reasoning trace&#8221;).</p></li><li><p><code>ToolManager</code>: The agent&#8217;s registry of permitted tools.</p></li><li><p>max_steps: Safety rail to prevent runaway loops.</p></li></ul><h4>Model Configuration (Swap Backends Easily)</h4><pre><code><em><strong># OpenAI</strong></em>
<strong>from</strong> adalflow.components.model_client.openai_client <strong>import</strong> OpenAIClient
agent = Agent(
    model_client=OpenAIClient(), 
    model_kwargs={<strong>"model"</strong>: <strong>"gpt-4o"</strong>}
)

<strong># Anthropic</strong>
<strong>from</strong> adalflow.components.model_client.anthropic_client <strong>import</strong> (
    AnthropicAPIClient
)
agent = Agent(
    model_client=AnthropicAPIClient(), 
    model_kwargs={<strong>"model"</strong>: <strong>"claude-3-sonnet-20240229"</strong>}
)</code></pre><blockquote><p><em>3) Execute with the Runner (Multi-step Orchestration)</em></p></blockquote><pre><code><em><strong># Manages turns, tool calls, observations, and finalization</strong></em>
runner = Runner(agent=agent) 

result = runner.call(
    prompt_kwargs={<strong>"input_str"</strong>: <strong>"Invoke the calculator tool and calculate 15 * 7 + 23"</strong>}
)

<strong>print</strong>(result.answer)
<em><strong># -&gt; "The result of 15 * 7 + 23 is 128."</strong></em></code></pre><h4>RunnerResult schema (returned by Runner.call)</h4><pre><code># result has:
# - result.step_history: [StepOutput(...)]  # Each step&#8217;s action + observation
# - result.answer: str | structured type     # Final synthesized answer
# - result.error: None | Exception info      # Error if something failed
# - result.ctx: dict | None                  # Optional execution metadata</code></pre><blockquote><p><em>This is the full ReAct loop in action:</em></p><p><em>Plan &#8594; Select Tool &#8594; Execute &#8594; Observe &#8594; Iterate &#8594; Answer.</em></p></blockquote><div><hr></div><h3>Advanced Features (Production-Ready)</h3><blockquote><p><em>1) Streaming Execution (Real-Time Updates)</em></p></blockquote><pre><code><em><strong># Pseudocode: actual API may differ slightly in your version.</strong></em>
stream = runner.stream(
    prompt_kwargs={<strong>"input_str"</strong>: <strong>"Compute 42 * 73 and explain."</strong>}
)
<strong>for</strong> update <strong>in</strong> stream:
    <em><strong># update contains partial thoughts, tool calls, observations, etc.</strong></em>
    <strong>print</strong>(update)</code></pre><p>Use streaming to surface <em>live</em> reasoning/tool progress in UIs.</p><blockquote><p><em>2) Human-in-the-Loop (Permission Management)</em></p></blockquote><pre><code><strong>from</strong> adalflow.permissions <strong>import</strong> PermissionManager

<strong>class</strong> MyPerms(PermissionManager):
    <strong>def</strong> approve(<strong>self</strong>, tool_name: <strong>str</strong>, args: <strong>dict</strong>) -&gt; <strong>bool</strong>:
        <em><strong># Example policy: only allow calculator; prompt user otherwise</strong></em>
        <strong>return</strong> tool_name == <strong>"calculator"</strong>

agent = Agent(
    name=<strong>"GuardedAgent"</strong>,
    tools=[calculator, search_tool],
    model_client=OpenAIClient(),
    model_kwargs={<strong>"model"</strong>: <strong>"gpt-4o"</strong>},
    permission_manager=MyPerms(),  <em><strong># &lt;- Every tool call can be inspected/approved)</strong></em></code></pre><p>Great for tools that hit external systems (files, emails, APIs).</p><blockquote><p><em>3) Custom System Templates (Planner Behavior)</em></p></blockquote><pre><code>custom_role_desc = <em><strong>"""
You are a careful, step-by-step data analyst.
When you use a tool, explain why and what you expect to get.
"""</strong></em>
agent = Agent(
    name="DataAnalyst",
    <em><strong># Custom planner persona and guardrails</strong></em>
    role_desc=custom_role_desc,        
    model_client=OpenAIClient(),
    model_kwargs={<strong>"model"</strong>: <strong>"gpt-4o"</strong>, <strong>"temperature"</strong>: 0.2},
)</code></pre><blockquote><p><em>4) Tracing (Observability)</em></p></blockquote><pre><code><em><strong># Configure tracing once (destination: console, file, or tracing backend)</strong></em>
<strong>from</strong> adalflow.tracing <strong>import</strong> enable_tracing
enable_tracing(project=<strong>"adalflow-agents-demo"</strong>)

result = runner.call(prompt_kwargs={
    <strong>"input_str"</strong>: <strong>"Use the calculator for 88*19."</strong>
})
<em><strong># Inspect step_history, tool IO, latency, errors, etc.</strong></em></code></pre><p>Agent Summary:</p><ul><li><p>Agent = Reasoning + Tool selection (Generator-based planner + ToolManager)</p></li><li><p>Runner = Controlled execution loop (steps, tools, observations, final answer)</p></li><li><p>Tools = Safe, permissioned extensions to the agent&#8217;s capabilities</p></li><li><p>Production = Streaming, human approvals, tracing, structured outputs</p></li></ul><h2>Real-World Use Case: LinkedIn Recruitment Agent with AdalFlow</h2><p>Hiring top talent is one of the most resource-intensive parts of building a company. Recruiters spend hours scrolling LinkedIn, opening profiles, copying notes, and crafting outreach messages.</p><p>What if we could automate that entire workflow&#8212;turning hours of manual searching into minutes of AI-assisted sourcing?</p><p>That&#8217;s exactly what we built using AdalFlow&#8217;s Agent + Runner architecture combined with browser automation via Chrome DevTools Protocol (CDP).</p><h3>&#10024; Before vs. After</h3><p>Traditional Recruiting Workflow (Manual)</p><blockquote><p><em>&#10060; BEFORE: 2&#8211;3 hours per role</em></p><p><em>1. Navigate to LinkedIn people search</em></p><p><em>2. Type in &#8220;Product Manager, San Francisco&#8221;</em></p><p><em>3. Scroll endlessly, click into profiles</em></p><p><em>4. Skim experience, education, skills</em></p><p><em>5. Take notes in spreadsheets</em></p><p><em>6. Write &amp; send DMs manually</em></p><p><em>Automated Workflow with AdalFlow (Agentic)</em></p><p><em>&#9989; AFTER: 10 minutes per role</em></p><p><em>1. Run: linkedin-agent --query &#8220;Product Manager&#8221; --limit 10</em></p><p><em>2. Agent plans and executes:</em></p><p><em>- Smart search strategy</em></p><p><em>- Extract profiles via browser automation</em></p><p><em>- Evaluate candidates with scoring models</em></p><p><em>- Draft personalized outreach messages</em></p><p><em>3. Get structured output: JSON/CSV with names, titles, LinkedIn URLs, evaluation scores, outreach drafts. Recruiters get to focus on talking to people, not copy-pasting data.</em></p></blockquote><h3>How It Works &#8212; Global State Architecture</h3><p>We structured the solution around a global state shared between tools. Each tool contributes partial data (search results, profiles, evaluations, outreach drafts), which the Agent combines into a full pipeline. Agent combines into a full pipeline.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OCV8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OCV8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 424w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 848w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 1272w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OCV8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png" width="1022" height="731" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:731,&quot;width&quot;:1022,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:995168,&quot;alt&quot;:null,&quot;title&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_!OCV8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 424w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 848w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 1272w, https://substackcdn.com/image/fetch/$s_!OCV8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664cc551-6805-4f73-96fe-9e4e1b668a68_1022x731.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Full Pipeline of LinkedInAgent</figcaption></figure></div><h3>Implementation with AdalFlow</h3><p>We implemented the LinkedInAgent by encapsulating:</p><blockquote><p><em>Agent &#8594; Planner + Tools (search, extract, evaluate, outreach)</em></p><p><em>Runner &#8594; Execution loop with error handling and logging</em></p></blockquote><pre><code><strong>class</strong> LinkedInAgent:
<em><strong>    """
    LinkedIn recruitment agent powered by AdalFlow.
    - Encapsulates Agent + Runner
    - Provides default recruitment tools
    - Supports both sync call() and async acall()
    """</strong></em>

    <strong>def</strong> __init__(
        <strong>self</strong>,
        model_client: Optional[OpenAIClient] = <strong>None</strong>,
        model_kwargs: Optional[Dict[<strong>str</strong>, <strong>Any</strong>]] = <strong>None</strong>,
        max_steps: Optional[<strong>int</strong>] = <strong>None</strong>,
        role_desc: Optional[<strong>str</strong>] = <strong>None</strong>,
        **kwargs,
    ):
        <em><strong># Defaults</strong></em>
        model_client = model_client <strong>or</strong> OpenAIClient()
        model_kwargs = model_kwargs <strong>or</strong> {
           <strong>"model"</strong>: <strong>"gpt-4o"</strong>, &#8220;temperature&#8221;: 0.3
        }
        max_steps = max_steps <strong>or</strong> 6

        <em><strong># Recruitment workflow tools</strong></em>
        <strong>self</strong>.tools = [
            <em><strong># 1. Search LinkedIn via CDP</strong></em>
            SmartCandidateSearchTool,
            <em><strong># 2. Extract structured profile data</strong></em>     
            ExtractCandidateProfilesTool, 
            <em><strong># 3. Score candidates</strong></em>   
            CandidateEvaluationTool,
            <em><strong># 4. Draft personalized outreach</strong></em>         
            CandidateOutreachGenerationTool,
            <em><strong># 5. Persist results </strong></em>
            SaveOutreachResultsTool,         
        ]

        <em><strong># Agent role description (personality / instructions)</strong></em>
        role_desc = role_desc <strong>or</strong> <strong>"You are a recruitment assistant that sources and evaluates LinkedIn candidates."</strong>

        <em><strong># Initialize Agent + Runner</strong></em>
        <strong>self</strong>.agent = Agent(
            name=<strong>"LinkedInRecruiter"</strong>,
            tools=<strong>self</strong>.tools,
            model_client=model_client,
            model_kwargs=model_kwargs,
            max_steps=max_steps,
            role_desc=role_desc,
            **kwargs,
        )
        <strong>self</strong>.runner = Runner(agent=<strong>self</strong>.agent, max_steps=max_steps)

    <strong>def</strong> call(
        <strong>self</strong>, query: <strong>str</strong>, context: Optional[Dict[<strong>str</strong>, Any]] = <strong>None</strong>
    ):
        <strong>return</strong> <strong>self</strong>.runner.call(prompt_kwargs={<strong>"input_str"</strong>: query})

    <strong>async</strong> <strong>def</strong> acall(
        <strong>self</strong>, query: <strong>str</strong>, context: Optional[Dict[<strong>str</strong>, Any]] = <strong>None
    </strong>):
        <strong>return</strong> <strong>await</strong> <strong>self</strong>.runner.acall(
            prompt_kwargs={<strong>"input_str"</strong>: query}
        )</code></pre><h4>Full Workflow Execution</h4><p>Here&#8217;s how we stitch the agent into a production workflow:</p><pre><code><strong>def</strong> execute_search_workflow(
    <strong>self</strong>, progress_tracker=None) -&gt; List[Dict[str, Any]]:
    logger = get_logger()
    logger.set_workflow_context(<strong>"workflow_main"</strong>, <strong>"initialization"</strong>)

    log_phase_start(<strong>"WORKFLOW_START"</strong>, f<strong>"Target: {self.limit} candidates for {self.query} in {self.location}"</strong>)

    candidates = []
    <strong>try</strong>:
        log_info(<strong>"&#129302; Initializing LinkedIn agent..."</strong>)
        agent, user_query = <strong>self</strong>.initialize_agent()

        <strong>if</strong> progress_tracker:
            progress_tracker.start_workflow()

        <em><strong># Run full pipeline</strong></em>
        result = agent.call(query=user_query)
        <strong>self</strong>._print_agent_execution_steps(result)

        <em><strong># Collect data from global state</strong></em>
        <strong>from</strong> ..core.workflow_state <strong>import</strong> get_complete_workflow_data
        workflow_data = get_complete_workflow_data()

        candidates = self._build_complete_candidate_data(workflow_data)

        log_info(f<strong>"&#9989; Found {len(candidates)} candidates"</strong>)
        <strong>return</strong> candidates

    <strong>except</strong> Exception <strong>as</strong> e:
        log_error(f<strong>"&#10060; Workflow failed: {e}"</strong>)
        <strong>return</strong> candidates</code></pre><h2>Example Output</h2><p>After running:</p><pre><code>linkedin-agent --query &#8220;Product Manager San Francisco&#8221; --limit 10</code></pre><p>We get structured results like:</p><pre><code>[
  {
    &#8220;name&#8221;: &#8220;Alex Chen&#8221;,
    &#8220;title&#8221;: &#8220;Senior Product Manager @ Stripe&#8221;,
    &#8220;location&#8221;: &#8220;San Francisco Bay Area&#8221;,
    &#8220;profile_url&#8221;: &#8220;https://linkedin.com/in/alexchen&#8221;,
    &#8220;score&#8221;: 0.92,
    &#8220;outreach_message&#8221;: &#8220;Hi Alex, I came across your experience at Stripe...&#8221;
  },
  {
    &#8220;name&#8221;: &#8220;Maria Lopez&#8221;,
    &#8220;title&#8221;: &#8220;PM, Growth @ Airbnb&#8221;,
    &#8220;location&#8221;: &#8220;San Francisco Bay Area&#8221;,
    &#8220;profile_url&#8221;: &#8220;https://linkedin.com/in/marialopez&#8221;,
    &#8220;score&#8221;: 0.88,
    &#8220;outreach_message&#8221;: &#8220;Hi Maria, your background in growth product design really stood out...&#8221;
  }
]</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kb2z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kb2z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 424w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 848w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 1272w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kb2z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png" width="1456" height="806" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.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;: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_!kb2z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 424w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 848w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 1272w, https://substackcdn.com/image/fetch/$s_!kb2z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aba8ac-d751-4aa9-a1f3-e35c581ac506_1600x886.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="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">Screenshot of the LinkedInAgent</figcaption></figure></div><blockquote><p><em>============================================================</em></p><p><em>WORKFLOW COMPLETION SUMMARY</em></p><p><em>============================================================</em></p><p><em>Success: &#9989; Yes</em></p><p><em>Total Candidates: 2</em></p><p><em>Duration: 68.8 seconds</em></p><p><em>Session: 20250909_220617</em></p><p><em>Log Files:</em></p><p><em>&#8226; Main: logs/workflow_20250909_220617.log</em></p><p><em>&#8226; Debug: logs/debug_20250909_220617.log</em></p><p><em>&#8226; Agent Steps: logs/agent_steps_20250909_220617.log</em></p><p><em>&#8226; Errors: logs/errors_20250909_220617.log</em></p><p><em>============================================================</em></p><p><em>&#127937; MAIN &#9989; COMPLETED - Processed 2 candidates</em></p><p><em>[RESULTS] &#9989; Recruitment workflow completed!</em></p><p><em>[RESULTS] &#128202; Final result: Successfully processed 2 candidates</em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FhEb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FhEb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 424w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 848w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 1272w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FhEb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin" width="496" height="333" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:333,&quot;width&quot;:496,&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_!FhEb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 424w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 848w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 1272w, https://substackcdn.com/image/fetch/$s_!FhEb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdbb5d26-0c73-4e5b-99ce-c7f5920e417b_496x333.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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>Looking Ahead</h2><p>As the LLM landscape evolves, frameworks like AdalFlow will become the backbone of application development. Just as PyTorch accelerated deep learning, AdalFlow has the potential to democratize LLM app building&#8212;from chatbots to agents to beyond.</p><p>If you&#8217;re excited about shaping the future of AI workflows, the project is open-source and community-driven. Whether you&#8217;re an AI researcher, product engineer, or just curious about building smarter applications, now&#8217;s the time to get involved.</p><p>&#128640; AdalFlow isn&#8217;t just another library. It&#8217;s a paradigm shift in how we think about programming with language models.</p>]]></content:encoded></item><item><title><![CDATA[Last Week to Register: Build Production-Ready Agentic-RAG Applications From Scratch Course!]]></title><description><![CDATA[Project-Based Course]]></description><link>https://newsletter.theaiedge.io/p/last-week-to-register-build-production</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/last-week-to-register-build-production</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Tue, 23 Sep 2025 15:02:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HM5S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is the last week to register for the <strong><a href="https://maven.com/damien-benveniste/agentic-rag">Build Production-Ready Agentic-RAG Applications From Scratch</a></strong> course! This is a fully hands-on course where we are going to implement step-by-step from scratch a production-ready Agentic-RAG application with LangGraph, FastAPI, and React!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag&quot;,&quot;text&quot;:&quot;Signup!&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://maven.com/damien-benveniste/agentic-rag"><span>Signup!</span></a></p><h2>What we are going to build</h2><p>We are going to build a fun web application where we can demonstrate how to orchestrate a robust RAG application using LangGraph, FastAPI, and React. Here is what we are going to build:</p><ol><li><p>A user can pass a GitHub repository URL</p></li><li><p>The files of the related repository are scraped and indexed in a vector database</p></li><li><p>Now the code is available for the user to ask questions about.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HM5S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HM5S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 424w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 848w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1272w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" width="1456" height="899" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:899,&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;: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_!HM5S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 424w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 848w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1272w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.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>On the frontend, we will need two main functionalities:</p><ul><li><p>A page where we can input the repository URL and start the crawling and indexing processes:</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_!g2u1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 424w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 848w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1272w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png" width="500" height="147.32142857142858" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:429,&quot;width&quot;:1456,&quot;resizeWidth&quot;:500,&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_!g2u1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 424w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 848w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1272w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><ul><li><p>And a chatbot interface to ask questions about the code in the repository:</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!v21m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v21m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 424w, https://substackcdn.com/image/fetch/$s_!v21m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 848w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png" width="498" height="445.3269230769231" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1302,&quot;width&quot;:1456,&quot;resizeWidth&quot;:498,&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_!v21m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 424w, https://substackcdn.com/image/fetch/$s_!v21m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 848w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 the backend, we will need the related endpoints:</p><ul><li><p>The indexing endpoint will respond to the provided GitHub repository URL and the &#8220;crawl&#8220; action to start the crawling and indexing processes.</p></li><li><p>The chat endpoint that will respond to messages sent by the user from the chatbot interface.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fsuq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fsuq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 424w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 848w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1272w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png" width="1456" height="704" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:704,&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_!fsuq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 424w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 848w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1272w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 going to use the following tools:</p><ul><li><p><a href="https://react.dev/">React</a> for the frontend</p></li><li><p><a href="https://fastapi.tiangolo.com/">FastAPI</a> for the backend</p></li><li><p><a href="https://langchain-ai.github.io/langgraph/">LangGraph</a> for the agentic orchestration</p></li><li><p><a href="https://docs.pinecone.io/guides/get-started/overview">Pinecone</a> for the vector database</p></li><li><p><a href="https://www.langchain.com/langsmith">Langsmith</a> for observability</p></li><li><p>Deploy everything on Google Cloud!</p></li></ul><h2>Project-based course</h2><p>We will focus on building the project from the ground up, as we would on the job. Here is how we are going to structure the project development:</p><ul><li><p>Introduction</p><ul><li><p>What we want to build</p></li><li><p>Setting up the environment</p></li></ul></li><li><p>The RAG Application</p><ul><li><p>The Data Parsing Pipeline</p></li><li><p>The Indexing Pipeline</p></li><li><p>The Basic RAG Pipeline</p></li><li><p>Adding Observability to the Pipeline with Langsmith</p></li><li><p>Going Agentic</p></li></ul></li><li><p>The Backend Application</p><ul><li><p>The Indexing API Endpoint</p></li><li><p>Adding Memory</p></li><li><p>Administering the Database Data</p></li></ul></li><li><p>The Frontend Application</p><ul><li><p>The Indexing Page</p></li><li><p>The Chatbot Page</p></li></ul></li><li><p>Deploying to GCP</p></li></ul><p>Each session will be a live, hands-on coding session where we are going to implement every component from scratch</p><h2>Going Agentic </h2><p>&#8220;Agentic&#8221; means that we are going to use an LLM as a decision engine to enhance the quality of our pipeline. We will focus on improving the accuracy of the pipeline at the cost of latency and cost, and discuss the opportunities to reduce those induced negative points with small language models and fine-tuning. In the RAG pipeline, we are going to build a subagent for each of the main components:</p><ul><li><p>Intent router: the entry point of the pipeline that will decide if a RAG pipeline is required. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wJDy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wJDy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 424w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 848w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 1272w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wJDy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png" width="1456" height="597" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.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;:84120,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/174308314?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wJDy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 424w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 848w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 1272w, https://substackcdn.com/image/fetch/$s_!wJDy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf86c946-68f6-44aa-9b75-aea9f8688ee2_1621x665.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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>The retriever: The sub-agent that will extract the right data</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ayDj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ayDj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 424w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 848w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 1272w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ayDj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png" width="1456" height="874" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:874,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127989,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/174308314?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ayDj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 424w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 848w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 1272w, https://substackcdn.com/image/fetch/$s_!ayDj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb186a60e-838d-44ed-9a23-940b84a25fb5_1568x941.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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>The generator: The sub-agent that will generate the response to the user</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nHed!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nHed!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 424w, https://substackcdn.com/image/fetch/$s_!nHed!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 848w, https://substackcdn.com/image/fetch/$s_!nHed!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 1272w, https://substackcdn.com/image/fetch/$s_!nHed!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nHed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png" width="1445" height="967" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:967,&quot;width&quot;:1445,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:122152,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/174308314?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nHed!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 424w, https://substackcdn.com/image/fetch/$s_!nHed!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 848w, https://substackcdn.com/image/fetch/$s_!nHed!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 1272w, https://substackcdn.com/image/fetch/$s_!nHed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97a91147-6c52-460e-972d-c07d99ebbc8f_1445x967.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!e7NK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e7NK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 424w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 848w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1272w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png" width="1452" height="1482" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1482,&quot;width&quot;:1452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:165873,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/172452651?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e7NK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 424w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 848w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1272w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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>Scaling up</h2><p>With this course, I want to focus on what we would need to do to deploy the application to 1M users. We will make sure to design every endpoint to be asynchronous, queue the indexing requests, and deploy the application with elastic load balancing to scale the application horizontally.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NOQR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NOQR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 424w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 848w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1272w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png" width="1456" height="643" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.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;:120017,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/172452651?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NOQR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 424w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 848w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1272w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 going to be a fun ride! Make sure to join us!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag&quot;,&quot;text&quot;:&quot;Signup!&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://maven.com/damien-benveniste/agentic-rag"><span>Signup!</span></a></p><h2><strong>The Real-World AI Engineering Roadblocks You Face Today</strong></h2><p>&#128075; <strong>Prototype &#8594; Production Gap</strong> &#8212; Moving from a notebook demo to a secure, observable, multi-tenant service requires orchestration, evals, guardrails, and ops most teams lack.</p><p>&#128075; <strong>&#8220;Easy RAG&#8221; vs &#8220;Reliable RAG&#8221;</strong> &#8212; Anyone can retrieve-then-generate; making answers faithful, fresh, fast, and cost-controlled under real traffic is the hard part.</p><p>&#128075; <strong>Framework Overload</strong> &#8212; The ecosystem is noisy; you need clear criteria (maturity, extensibility, latency, cost) and reference patterns to choose confidently.</p><p>&#128075; <strong>It&#8217;s Software Engineering First</strong> &#8212; Success hinges on clean interfaces, tests, typed configs, tracing, CI/CD, and change management&#8212;not just prompts and models.</p><p>&#128075; <strong>From Laptop to 1M Users</strong> &#8212; Scaling demands streaming, batching, caching, autoscaling, and SLOs, or your p95 explodes and costs spiral.</p><h3><strong>How this course will help you</strong></h3><p>&#9989; <strong>Ship a real Agentic RAG app, not a demo </strong>&#8212; Stand up an end-to-end stack&#8212;LangGraph &#8594; FastAPI &#8594; React, that runs locally today and deploys via a clean, fork-and-ship monorepo.</p><p>&#9989; <strong>Make retrieval dependable, not lucky</strong> &#8212; Adopt schema-aware chunking, strong dense embeddings with sensible metadata filters, and context packing with citations so answers stay faithful, fresh, and concise.</p><p>&#9989; <strong>Harden agentic workflows</strong> &#8212; Design a typed LangGraph state and build nodes for rewrite &#8594; retrieve &#8594; rerank &#8594; synthesize &#8594; cite &#8594; safety-check, with retries and timeouts so plans don&#8217;t loop or stall.</p><p>&#9989; <strong>Scale the experience, not the headaches</strong> &#8212; Enable server-streaming in FastAPI, cap top-k, trim context budgets, and add early-exit rules; deploy with autoscaling so you can serve real traffic without infra fuss.</p><p>&#9989; <strong>See enough to fix things fast</strong> &#8212; Bake in structured logs (no vendor tracing), per-step timing counters, and UI breadcrumbs/citations to follow <em>query &#8594; context &#8594; answer</em> and spot common failure patterns quickly.</p><p>&#9989; <strong>Choose frameworks with confidence</strong> &#8212; Follow an opinionated reference architecture plus a simple choice rubric (maturity, extensibility, latency, cost, swap effort) so you know when to stick&#8212;and how to swap components without rewrites.</p><p>&#9989; <strong>Write maintainable RAG code</strong> &#8212; Use clean module boundaries (ingest / retrieve / rerank / synthesize), typed configs (Pydantic Settings), and sensible secrets/env management so your team can extend it safely.</p><h3><strong>You&#8217;ll walk away with</strong></h3><p>&#10024; A running <strong>Agentic RAG app</strong> (LangGraph + FastAPI + React) in a <strong>fork-and-ship monorepo</strong>.</p><p>&#10024; An <strong>ingestion/indexing</strong> pipeline with metadata, hybrid retrieval, and optional re-ranking.</p><p>&#10024; A <strong>chat UI</strong> with citations, source previews, and conversation memory that behaves.</p><p>&#10024; <strong>Deploy</strong> scripts and env templates to go live right after class.</p><p>&#10024; A <strong>framework choice memo + adapters</strong> to swap models/vector stores without starting over.</p><p><strong>Bottom line:</strong> this isn&#8217;t a vitamin, it&#8217;s a blueprint you can put in production.</p><h3><strong>What you&#8217;ll get out of this course</strong></h3><ul><li><p><strong>Orchestrate complex RAG pipelines with LangGraph and OpenAI API:</strong> Build a typed LangGraph that routes rewrite &#8594; retrieve &#8594; rerank &#8594; synthesize &#8594; cite &#8594; self-check with retries, timeouts, early-exit rules, and real tool calls, exposed as a clean HTTP API.</p></li><li><p><strong>Build scalable asynchronous applications with FastAPI:</strong> Ship async FastAPI endpoints, well-typed request/response models, input validation, and sensible timeouts, ready to run locally and deploy to production.</p></li><li><p><strong>Implement chatbot interfaces with React:</strong> Create a chat UI that shows citations and source previews, lets users scope queries, preserves safe chat history, and handles transient API errors gracefully.</p></li><li><p><strong>Mitigate hallucinations with LLM judges, structured output, and context engineering:</strong> Cut errors via schema-aware chunking, dedupe and budgeted context packing, plus lightweight LLM checks and schema-constrained outputs to verify claims and enforce citations before responding.</p></li><li><p><strong>Design effective LLM prompts for high-level control on generation output:</strong> Write prompts that steer behavior: system prompts, task decomposition, Pydantic/JSON-schema constraints, and clear rules for tone, citations, and safe refusals.</p></li><li><p><strong>Develop end-to-end RAG applications using the software engineering best practices:</strong> Produce a maintainable codebase: clean module boundaries (ingest/retrieve/rerank/synthesize), typed configs, secrets/env management, reproducible local dev, and deploy that mirrors local.</p></li></ul><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20&quot;,&quot;text&quot;:&quot;Sign Up!&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20"><span>Sign Up!</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Build Production-Ready Agentic-RAG Applications From Scratch Course: What we are going to build ]]></title><description><![CDATA[On Saturday, September 27th, I am launching a new course: Build Production-Ready Agentic-RAG Applications From Scratch! This is a fully hands-on course where we are going to deploy a production-ready Agentic-RAG application with LangGraph, FastAPI, and React! Here is what we are going to build.]]></description><link>https://newsletter.theaiedge.io/p/build-production-ready-agentic-rag</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/build-production-ready-agentic-rag</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Tue, 02 Sep 2025 15:01:39 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HM5S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On Saturday, September 27th, I am launching a new course: <strong><a href="https://maven.com/damien-benveniste/agentic-rag">Build Production-Ready Agentic-RAG Applications From Scratch</a></strong>! This is a fully hands-on course where we are going to deploy a production-ready Agentic-RAG application with LangGraph, FastAPI, and React! Here is what we are going to build.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag&quot;,&quot;text&quot;:&quot;Signup!&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://maven.com/damien-benveniste/agentic-rag"><span>Signup!</span></a></p><h2>What we are going to build</h2><p>We are going to build a fun web application where we can demonstrate how to orchestrate a robust RAG application using LangGraph, FastAPI, and React. Here is what we are going to build:</p><ol><li><p>A user can pass a GitHub repository URL</p></li><li><p>The files of the related repository are scraped and indexed in a vector database</p></li><li><p>Now the code is available for the user to ask questions about.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HM5S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HM5S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 424w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 848w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1272w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png" width="1456" height="899" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:899,&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;: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_!HM5S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 424w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 848w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.png 1272w, https://substackcdn.com/image/fetch/$s_!HM5S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f30f1fd-2bcd-4fc4-8ca6-51b4f969edca_1578x974.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>On the frontend, we will need two main functionalities:</p><ul><li><p>A page where we can input the repository URL and start the crawling and indexing processes:</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_!g2u1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 424w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 848w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1272w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png" width="500" height="147.32142857142858" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:429,&quot;width&quot;:1456,&quot;resizeWidth&quot;:500,&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_!g2u1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 424w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 848w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1272w, https://substackcdn.com/image/fetch/$s_!g2u1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc850272b-747f-42ed-b72a-b4d686a8304e_1526x450.png 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><ul><li><p>And a chatbot interface to ask questions about the code in the repository:</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!v21m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v21m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 424w, https://substackcdn.com/image/fetch/$s_!v21m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 848w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png" width="498" height="445.3269230769231" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1302,&quot;width&quot;:1456,&quot;resizeWidth&quot;:498,&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_!v21m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 424w, https://substackcdn.com/image/fetch/$s_!v21m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 848w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!v21m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff869f440-1d45-4194-aba0-cad9ccfbf4b7_2028x1814.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 the backend, we will need the related endpoints:</p><ul><li><p>The indexing endpoint will respond to the provided GitHub repository URL and the &#8220;crawl&#8220; action to start the crawling and indexing processes.</p></li><li><p>The chat endpoint that will respond to messages sent by the user from the chatbot interface.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fsuq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fsuq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 424w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 848w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1272w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png" width="1456" height="704" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:704,&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_!fsuq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 424w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 848w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1272w, https://substackcdn.com/image/fetch/$s_!fsuq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9b4957a-91e3-4656-90b1-3e02d7e65596_1622x784.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 going to use the following tools:</p><ul><li><p><a href="https://react.dev/">React</a> for the frontend</p></li><li><p><a href="https://fastapi.tiangolo.com/">FastAPI</a> for the backend</p></li><li><p><a href="https://langchain-ai.github.io/langgraph/">LangGraph</a> for the agentic orchestration</p></li><li><p><a href="https://docs.pinecone.io/guides/get-started/overview">Pinecone</a> for the vector database</p></li><li><p><a href="https://www.langchain.com/langsmith">Langsmith</a> for observability</p></li><li><p>Deploy everything on Google Cloud!</p></li></ul><h2>Project-based course</h2><p>We will focus on building the project from the ground up, as we would on the job. Here is how we are going to structure the project development:</p><ul><li><p>Introduction</p><ul><li><p>What we want to build</p></li><li><p>Setting up the environment</p></li></ul></li><li><p>The RAG Application</p><ul><li><p>The Data Parsing Pipeline</p></li><li><p>The Indexing Pipeline</p></li><li><p>The Basic RAG Pipeline</p></li><li><p>Adding Observability to the Pipeline with Langsmith</p></li><li><p>Going Agentic</p></li></ul></li><li><p>The Backend Application</p><ul><li><p>The Indexing API Endpoint</p></li><li><p>Adding Memory</p></li><li><p>Administering the Database Data</p></li></ul></li><li><p>The Frontend Application</p><ul><li><p>The Indexing Page</p></li><li><p>The Chatbot Page</p></li></ul></li><li><p>Deploying to GCP</p></li></ul><p>Each session will be a live, hands-on coding session where we are going to implement every component from scratch</p><h2>Going Agentic </h2><p>&#8220;Agentic&#8221; means that we are going to use an LLM as a decision engine to enhance the quality of our pipeline. We will focus on improving the accuracy of the pipeline at the cost of latency and cost, and discuss the opportunities to reduce those induced negative points with small language models and fine-tuning. In the RAG pipeline, we are going to build a subagent for each of the main components:</p><ul><li><p>Intent router: the entry point of the pipeline that will decide if a RAG pipeline is required. </p></li><li><p>The retriever: The sub-agent that will extract the right data</p></li><li><p>The generator: The sub-agent that will generate the response to the user</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!e7NK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e7NK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 424w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 848w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1272w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png" width="1452" height="1482" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1482,&quot;width&quot;:1452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:165873,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/172452651?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e7NK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 424w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 848w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1272w, https://substackcdn.com/image/fetch/$s_!e7NK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F820cfde6-8e9c-47b2-b3c2-ce10ca086930_1452x1482.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="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>Scaling up</h2><p>With this course, I want to focus on what we would need to do to deploy the application to 1M users. We will make sure to design every endpoint to be asynchronous, queue the indexing requests, and deploy the application with elastic load balancing to scale the application horizontally.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NOQR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NOQR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 424w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 848w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1272w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png" width="1456" height="643" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.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;:120017,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://newsletter.theaiedge.io/i/172452651?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NOQR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 424w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 848w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1272w, https://substackcdn.com/image/fetch/$s_!NOQR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd8a1046-e3fa-446e-bb31-f65b7dce728b_1728x763.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" 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 going to be a fun ride! Make sure to join us!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag&quot;,&quot;text&quot;:&quot;Signup!&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://maven.com/damien-benveniste/agentic-rag"><span>Signup!</span></a></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[New Course: Build Production-Ready Agentic-RAG Applications From Scratch]]></title><description><![CDATA[End-to-end: orchestrate and deploy agentic Retrieval-Augmented Generation with LangGraph, FastAPI, and React frontend in 2 weeks.]]></description><link>https://newsletter.theaiedge.io/p/new-course-build-production-ready</link><guid isPermaLink="false">https://newsletter.theaiedge.io/p/new-course-build-production-ready</guid><dc:creator><![CDATA[Damien Benveniste]]></dc:creator><pubDate>Mon, 25 Aug 2025 15:01:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!pWtL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On Saturday, September 27th, I am launching a new course: <strong><a href="https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20">Build Production-Ready Agentic-RAG Applications From Scratch</a></strong>! This is a fully hands-on course where we are going to deploy a production-ready Agentic-RAG application with LangGraph, FastAPI, and React! <strong>The first 30 people to sign up will get a 20% discount by applying the promo code <a href="https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20">FIRST20</a>!</strong> So make sure to sign up early:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20&quot;,&quot;text&quot;:&quot;Sign Up!&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20"><span>Sign Up!</span></a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pWtL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pWtL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 424w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 848w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 1272w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pWtL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.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;:2377137,&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://newsletter.theaiedge.io/i/171854996?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pWtL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 424w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 848w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.png 1272w, https://substackcdn.com/image/fetch/$s_!pWtL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11f819bf-fb63-4c76-a1e6-521888220f3d_2560x1440.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><h2>From Prototype to Production: Ship Reliable and Scalable RAG Pipelines</h2><h3>The Real-World AI Engineering Roadblocks You Face Today</h3><p>&#128075; <strong>Prototype &#8594; Production Gap</strong> &#8212; Moving from a notebook demo to a secure, observable, multi-tenant service requires orchestration, evals, guardrails, and ops most teams lack.</p><p>&#128075; <strong>&#8220;Easy RAG&#8221; vs &#8220;Reliable RAG&#8221;</strong> &#8212; Anyone can retrieve-then-generate; making answers faithful, fresh, fast, and cost-controlled under real traffic is the hard part.</p><p>&#128075; <strong>Framework Overload</strong> &#8212; The ecosystem is noisy; you need clear criteria (maturity, extensibility, latency, cost) and reference patterns to choose confidently.</p><p>&#128075; <strong>It&#8217;s Software Engineering First</strong> &#8212; Success hinges on clean interfaces, tests, typed configs, tracing, CI/CD, and change management&#8212;not just prompts and models.</p><p>&#128075; <strong>From Laptop to 1M Users</strong> &#8212; Scaling demands streaming, batching, caching, autoscaling, and SLOs, or your p95 explodes and costs spiral.</p><h3>How this course will help you</h3><p>&#9989; <strong>Ship a real Agentic RAG app, not a demo </strong>&#8212; Stand up an end-to-end stack&#8212;LangGraph &#8594; FastAPI &#8594; React, that runs locally today and deploys via a clean, fork-and-ship monorepo.</p><p>&#9989; <strong>Make retrieval dependable, not lucky</strong> &#8212; Adopt schema-aware chunking, strong dense embeddings with sensible metadata filters, and context packing with citations so answers stay faithful, fresh, and concise.</p><p>&#9989; <strong>Harden agentic workflows</strong> &#8212; Design a typed LangGraph state and build nodes for rewrite &#8594; retrieve &#8594; rerank &#8594; synthesize &#8594; cite &#8594; safety-check, with retries and timeouts so plans don&#8217;t loop or stall.</p><p>&#9989; <strong>Scale the experience, not the headaches</strong> &#8212; Enable server-streaming in FastAPI, cap top-k, trim context budgets, and add early-exit rules; deploy with autoscaling so you can serve real traffic without infra fuss.</p><p>&#9989; <strong>See enough to fix things fast</strong> &#8212; Bake in structured logs (no vendor tracing), per-step timing counters, and UI breadcrumbs/citations to follow <em>query &#8594; context &#8594; answer</em> and spot common failure patterns quickly.</p><p>&#9989; <strong>Choose frameworks with confidence</strong> &#8212; Follow an opinionated reference architecture plus a simple choice rubric (maturity, extensibility, latency, cost, swap effort) so you know when to stick&#8212;and how to swap components without rewrites.</p><p>&#9989; <strong>Write maintainable RAG code</strong> &#8212; Use clean module boundaries (ingest / retrieve / rerank / synthesize), typed configs (Pydantic Settings), and sensible secrets/env management so your team can extend it safely.</p><h3>You&#8217;ll walk away with</h3><p>&#10024; A running <strong>Agentic RAG app</strong> (LangGraph + FastAPI + React) in a <strong>fork-and-ship monorepo</strong>.</p><p>&#10024; An <strong>ingestion/indexing</strong> pipeline with metadata, hybrid retrieval, and optional re-ranking.</p><p>&#10024; A <strong>chat UI</strong> with citations, source previews, and conversation memory that behaves.</p><p>&#10024; <strong>Deploy</strong> scripts and env templates to go live right after class.</p><p>&#10024; A <strong>framework choice memo + adapters</strong> to swap models/vector stores without starting over.</p><p><strong>Bottom line:</strong> this isn&#8217;t a vitamin, it&#8217;s a blueprint you can put in production.</p><h3>What you&#8217;ll get out of this course</h3><ul><li><p><strong>Orchestrate complex RAG pipelines with LangGraph and OpenAI API:</strong> Build a typed LangGraph that routes <strong>rewrite &#8594; retrieve &#8594; rerank &#8594; synthesize &#8594; cite &#8594; self-check</strong> with <strong>retries, timeouts, early-exit rules</strong>, and real tool calls, exposed as a clean HTTP API.</p></li><li><p><strong>Build scalable asynchronous applications with FastAPI:</strong> Ship <strong>async</strong> FastAPI endpoints, well-typed request/response models, input validation, and sensible timeouts, ready to run locally and <strong>deploy to production</strong>.</p></li><li><p><strong>Implement chatbot interfaces with React:</strong> Create a<strong> chat UI</strong> that shows citations and source previews, lets users scope queries, preserves <strong>safe chat history</strong>, and handles transient API errors gracefully.</p></li><li><p><strong>Mitigate hallucinations with LLM judges, structured output, and context engineering:</strong> Cut errors via <strong>schema-aware chunking</strong>, dedupe and budgeted context packing, plus <strong>lightweight LLM checks</strong> and <strong>schema-constrained outputs</strong> to verify claims and enforce citations before responding.</p></li><li><p><strong>Design effective LLM prompts for high-level control on generation output:</strong> Write prompts that <strong>steer behavior</strong>: system prompts, task decomposition, <strong>Pydantic/JSON-schema</strong> constraints, and clear rules for tone, citations, and safe refusals.</p></li><li><p><strong>Develop end-to-end RAG applications using the software engineering best practices:</strong> Produce a maintainable codebase: <strong>clean module boundaries</strong> (ingest/retrieve/rerank/synthesize), <strong>typed configs</strong>, secrets/env management, reproducible local dev, and deploy that mirrors local.</p><p></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20&quot;,&quot;text&quot;:&quot;Sign Up!&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://maven.com/damien-benveniste/agentic-rag?promoCode=FIRST20"><span>Sign Up!</span></a></p></li></ul><p></p>]]></content:encoded></item></channel></rss>