<?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[Arya's Substack]]></title><description><![CDATA[My personal Substack]]></description><link>https://aryatafvizi.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!pxD7!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bf23816-25f4-48ee-8e31-b00037da5502_144x144.png</url><title>Arya&apos;s Substack</title><link>https://aryatafvizi.substack.com</link></image><generator>Substack</generator><lastBuildDate>Sat, 30 May 2026 03:48:21 GMT</lastBuildDate><atom:link href="https://aryatafvizi.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Arya Tafvizi]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[aryatafvizi@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[aryatafvizi@substack.com]]></itunes:email><itunes:name><![CDATA[Arya Tafvizi]]></itunes:name></itunes:owner><itunes:author><![CDATA[Arya Tafvizi]]></itunes:author><googleplay:owner><![CDATA[aryatafvizi@substack.com]]></googleplay:owner><googleplay:email><![CDATA[aryatafvizi@substack.com]]></googleplay:email><googleplay:author><![CDATA[Arya Tafvizi]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Iterative Refinement of a Multi-Agent Pipeline: A Case Study]]></title><description><![CDATA[Using counterfactual evaluation to isolate and resolve cascading failures in LLM systems]]></description><link>https://aryatafvizi.substack.com/p/iterative-refinement-of-a-multi-agent</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/iterative-refinement-of-a-multi-agent</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Wed, 13 May 2026 15:52:23 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!zRBt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most of software engineering is an iterative practice of evaluation and debugging. You build a system, measure how it performs, find what&#8217;s broken, fix it, and measure again. We&#8217;ve always had this loop for traditional ML systems: train a model, evaluate on a held-out set, inspect the errors, retrain. For multi-agent systems, the evaluation part is starting to mature, but the <a href="https://aryatafvizi.substack.com/p/beyond-tracing-understanding-multi">debugging part has lagged behind</a>. When a pipeline of 8 LLM-powered agents produces a wrong answer, the trace tells you every agent passed. It doesn&#8217;t tell you which agent to fix.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zRBt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zRBt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zRBt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fee65567-f4be-46f2-876b-0808b386c2da_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;:null,&quot;bytes&quot;:135905,&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://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zRBt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!zRBt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee65567-f4be-46f2-876b-0808b386c2da_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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At Google, we relied on established workflows to make ML systems for Search highly deterministic and controllable. Those tools didn&#8217;t exist at DeepMind, and they are largely missing from today&#8217;s multi-agent ecosystems. I&#8217;m working to create the science and tools to bring that same rigor to AI systems. (For background on why <a href="https://aryatafvizi.substack.com/p/emergent-complex-behavior-in-simple">emergent behavior in multi-agent systems</a> makes this kind of tooling necessary, see the previous posts.) The <a href="https://github.com/counterfact-labs/counterfact">counterfact</a> tool we use below is a step in that direction.</p><p>The key advantage of counterfactual attribution: it analyzes multiple failure modes simultaneously and tells you where to invest your debugging time. Reading a single trace through many agents is already a cumbersome task for an engineer. Reading dozens of traces is worse, and each one may point at a different agent as the culprit. As shown later in this post, standard LLM-based trace analysis fails to identify cascading errors, confusing correlation with causation. Counterfact evaluates every possible combination of agents in minutes and returns a quantitative, causal report: not &#8220;this agent looks suspicious&#8221; but &#8220;this agent degrades precision by 0.236 on average across your eval set.&#8221;</p><p>Below, we walk through this workflow on an 8-agent financial RAG pipeline using <a href="https://github.com/counterfact-labs/counterfact">counterfact</a>: identify the failure, diagnose it with Shapley attribution, apply fixes one at a time, and re-run the diagnosis after each step to verify improvement and re-prioritize.</p><h2>The Pipeline</h2><p>This is a sequential pipeline: each agent receives the output of all previous agents and adds its own contribution to the shared state. The first four agents prepare data (parsing the question, retrieving the document, extracting numbers, adding context). The second four progressively refine a single analysis field (synthesizing an answer, verifying it, editing the tone, formatting the output).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!biH8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!biH8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 424w, https://substackcdn.com/image/fetch/$s_!biH8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 848w, https://substackcdn.com/image/fetch/$s_!biH8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 1272w, https://substackcdn.com/image/fetch/$s_!biH8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!biH8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png" width="1370" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1370,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:150364,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!biH8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 424w, https://substackcdn.com/image/fetch/$s_!biH8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 848w, https://substackcdn.com/image/fetch/$s_!biH8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.png 1272w, https://substackcdn.com/image/fetch/$s_!biH8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd9ac15d-98eb-49a2-9acb-5375655e6f07_1370x866.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Every prompt contains a common practice: relying on the LLM for reasoning or world knowledge. This is a discouraged shortcut that often leads to subtle bugs:</p><ul><li><p><strong>Table Extractor</strong>: <em>&#8220;Present values in a clean, readable format.&#8221;</em></p></li><li><p><strong>Context Enricher</strong>: <em>&#8220;Based on your knowledge, add relevant industry context.&#8221;</em></p></li><li><p><strong>Fact Checker</strong>: <em>&#8220;Minor rounding differences and presentation choices are acceptable.&#8221;</em></p></li><li><p><strong>Tone Editor</strong>: <em>&#8220;Simplify large numbers for readability.&#8221;</em></p></li></ul><p>No obviously wrong instructions. The bugs are in how Claude interprets these subjective terms and in architectural decisions like letting an LLM generate context from training data rather than a verified source.</p><h2>The Failure</h2><p>We ran the pipeline on 5 FinanceBench questions from 3M&#8217;s FY2018 cash flow statement. The correct answer for each is a single dollar figure from the 10-K filing.</p><blockquote><p><strong>Evaluation criteria:</strong> For this evaluation, we enforce strict classification: exact figures, exact units, and zero fabricated claims. Financial figures must be precise enough to audit back to the source document. This strictness eliminates ambiguity in the before-and-after comparison.</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_!GXMY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GXMY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 424w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 848w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 1272w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GXMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png" width="1360" height="882" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:882,&quot;width&quot;:1360,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:210572,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GXMY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 424w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 848w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.png 1272w, https://substackcdn.com/image/fetch/$s_!GXMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7aea235-b683-4009-ac35-4c69278f72c4_1360x882.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Bold = wrong figure. Italics = fabricated claims from Claude&#8217;s training data, not in the source document.</em></p><p>Every answer follows the same pattern: exact figures from the 10-K are rounded and converted from millions to billions, and each response includes fabricated peer comparisons. All eight agents pass in every trace. Nothing indicates which agent introduced the rounding or the fabricated claims.</p><h2>Diagnosis: 5-Query Aggregate Shapley Attribution</h2><p><a href="https://github.com/counterfact-labs/counterfact">Counterfact</a> ablates each agent in every possible coalition, re-runs the pipeline with real Claude calls, and computes Shapley values. Three classifiers score each run:</p><ul><li><p><strong>Accuracy</strong>: Does the output contain the correct dollar figure?</p></li><li><p><strong>Precision</strong>: Are the numbers exact, not rounded?</p></li><li><p><strong>Grounding</strong>: Are all claims traceable to the source document?</p></li></ul><p>Each classifier scores on a 0-to-1 scale. Average quality is the weighted mean of the three: accuracy (weight 2.0), precision (1.5), grounding (1.0). A perfect pipeline scores 1.0.</p><p>36 coalition evaluations per query, 5 queries run in parallel:</p><pre><code><code>Avg baseline quality: 0.378

Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
tone_editor            -0.088  &#9608;          &#8592; most harmful
context_enricher       -0.061  &#9608;
table_extractor        -0.047
query_parser           +0.029
fact_checker           +0.065  &#9608;
output_formatter       +0.134  &#9608;&#9608;
synthesizer            +0.160  &#9608;&#9608;&#9608;
doc_retriever          +0.250  &#9608;&#9608;&#9608;&#9608;       &#8592; most helpful</code></code></pre><h3>Per-Classifier Breakdown</h3><pre><code><code>accuracy  : table_extractor=-0.049    ...  doc_retriever=+0.250
precision : tone_editor=-0.236        ...  doc_retriever=+0.250
grounding : query_parser=-0.224       ...  synthesizer=+0.160</code></code></pre><p>Each classifier surfaces a different bottleneck:</p><ul><li><p><strong>Accuracy</strong>: The <strong>table extractor</strong> is the worst agent (-0.049). Its &#8220;clean, readable format&#8221; instruction rounds source figures before downstream agents see them.</p></li><li><p><strong>Precision</strong>: The <strong>tone editor</strong> is the worst agent (-0.236). &#8220;Simplify large numbers&#8221; triggers M-to-B unit conversion, the single largest source of precision loss.</p></li><li><p><strong>Grounding</strong>: The <strong>query parser</strong> is the worst agent (-0.224). Misclassifying queries as &#8220;estimation&#8221; rather than &#8220;lookup&#8221; causes the synthesizer to approximate rather than cite exact figures.</p></li></ul><p>No single agent is the worst on every classifier. A single-metric evaluation would have prioritized the wrong fix.</p><h2>Iterative Debugging in Action</h2><p>The diagnosis points at three agents to fix. We apply these prompt edits cumulatively, isolating variables and re-running the Shapley diagnosis after each fix to measure the marginal impact.</p><h3>The three prompt edits</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LaeF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LaeF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 424w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 848w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 1272w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LaeF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png" width="1342" height="554" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:554,&quot;width&quot;:1342,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104750,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LaeF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 424w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 848w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.png 1272w, https://substackcdn.com/image/fetch/$s_!LaeF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90158211-28ab-4452-9f00-b4b3d43569c7_1342x554.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Step 0: Broken pipeline</h3><p><strong>Avg Quality: 0.378 &#183; Exact Answers: 0/5</strong></p><pre><code><code>Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
tone_editor            -0.088  &#9608;
context_enricher       -0.061  &#9608;
table_extractor        -0.047
query_parser           +0.029
fact_checker           +0.065  &#9608;
output_formatter       +0.134  &#9608;&#9608;
synthesizer            +0.160  &#9608;&#9608;&#9608;
doc_retriever          +0.250  &#9608;&#9608;&#9608;&#9608;

Per-classifier worst:
  accuracy:   table_extractor  -0.049
  precision:  tone_editor      -0.236
  grounding:  query_parser     -0.224</code></code></pre><h3>Step 1: Fix context enricher</h3><p><strong>Avg Quality: 0.356 &#183; Exact Answers: 0/5</strong></p><p>Quality didn&#8217;t improve. The context enricher fix removed the fabricated benchmarks, but the tone editor is still converting millions to billions, which destroys precision on every query. Removing the fabricated context actually made the synthesizer lean harder on rounded numbers from the table extractor, which the tone editor then amplifies.</p><pre><code><code>Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
tone_editor            -0.107  &#9608;&#9608;   &#8592; worse than before
table_extractor        -0.020
context_enricher       +0.002       &#8592; fixed, now neutral
query_parser           +0.061  &#9608;
synthesizer            +0.069  &#9608;
output_formatter       +0.074  &#9608;
fact_checker           +0.137  &#9608;&#9608;
doc_retriever          +0.183  &#9608;&#9608;&#9608;

Per-classifier worst:
  accuracy:   context_enricher -0.115
  precision:  tone_editor      -0.219  (still dominant)
  grounding:  synthesizer      -0.216</code></code></pre><p>The tool now tells us: fix the tone editor next.</p><h3>Step 2: + Fix tone editor</h3><p><strong>Avg Quality: 0.747 &#183; Exact Answers: 4/5 </strong></p><p>Preventing M-to-B conversion is the primary bottleneck. This single edit improves exact matches from 0/5 to 4/5 and nearly doubles average quality.</p><pre><code><code>Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
context_enricher       -0.057  &#9608;    &#8592; re-emerges
fact_checker           -0.012
query_parser           -0.009
tone_editor            -0.006       &#8592; fixed, now neutral
synthesizer            +0.007
table_extractor        +0.008
output_formatter       +0.092  &#9608;
doc_retriever          +0.163  &#9608;&#9608;&#9608;

Per-classifier worst:
  accuracy:   context_enricher -0.193
  precision:  context_enricher -0.127
  grounding:  synthesizer      -0.259</code></code></pre><p>With tone fixed, the context enricher surfaces again as worst on accuracy and precision. The synthesizer is worst on grounding. One query (OpCF) still returns &#8220;$6.4 billion.&#8221;</p><h3>Step 3: + Fix fact checker</h3><p><strong>Avg Quality: 0.836 &#183; Exact Answers: 4/5 </strong></p><p>The stricter fact checker catches the remaining rounding error on OpCF and corrects fabricated context that slipped through. But Buybacks still returns &#8220;$4.87 billion.&#8221; The per-query Shapley points at the table extractor: its &#8220;clean, readable format&#8221; instruction rounds $4,870 before downstream agents even see it.</p><pre><code><code>Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
context_enricher       -0.015
query_parser           -0.005
synthesizer            +0.012
output_formatter       +0.022
doc_retriever          +0.025
tone_editor            +0.026
fact_checker           +0.032
table_extractor        +0.063  &#9608;

All agents within [-0.015, +0.063]</code></code></pre><h3>Step 4: + Fix table extractor</h3><p><strong>Avg Quality: 0.822 &#183; Exact Answers: 5/5 </strong></p><p>&#8220;Present values in a clean, readable format&#8221; &#8594; &#8220;Present exact values as reported in the source document. Do NOT round.&#8221; Buybacks now returns &#8220;$4,870 million.&#8221; All five queries produce exact answers.</p><pre><code><code>Agent                  Avg Shapley
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
query_parser           -0.061  &#9608;
table_extractor        +0.003
context_enricher       +0.022
tone_editor            +0.026
output_formatter       +0.088  &#9608;
synthesizer            +0.092  &#9608;
fact_checker           +0.103  &#9608;&#9608;
doc_retriever          +0.137  &#9608;&#9608;

No agent degrading quality beyond noise</code></code></pre><h3>Incremental summary</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tiPA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tiPA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 424w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 848w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 1272w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tiPA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png" width="1338" height="586" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:586,&quot;width&quot;:1338,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tiPA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 424w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 848w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.png 1272w, https://substackcdn.com/image/fetch/$s_!tiPA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faafa4c42-dd21-4058-96ba-ee15a4dfe84c_1338x586.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>By addressing the root causal bottlenecks rather than the symptoms, four prompt edits doubled the pipeline&#8217;s overall quality and achieved 5/5 exact answers.</p><h2>Key Takeaways</h2><blockquote><p><strong>Semantic correctness does not guarantee behavioral correctness.</strong> When we rely on LLMs to interpret vague instructions using their own judgment, &#8220;minor rounding differences are acceptable&#8221; and &#8220;simplify large numbers&#8221; become failure modes. The instructions read correctly to a human reviewer, but Claude&#8217;s interpretation at inference time produces systematically wrong outputs.</p></blockquote><ol><li><p><strong>The worst agent varies by query.</strong> On CapEx, the query parser is worst. On Dividends, it&#8217;s the table extractor. On OpCF, it&#8217;s the synthesizer. A single-query evaluation would have prioritized the wrong fix.</p></li><li><p><strong>Agent fixes interact.</strong> Fixing the context enricher alone made quality worse (-0.022), because the tone editor was still converting M to B. The tool detects this: after Step 1, it re-prioritizes tone editor as the worst agent.</p></li><li><p><strong>Diagnosis is state-dependent.</strong> After fixing the tone editor in Step 2, the context enricher re-emerges as the worst agent on accuracy and precision. The diagnostic loop surfaces whatever matters most given the current state of the pipeline.</p></li><li><p><strong>Four prompt edits doubled quality.</strong> The diagnosis identified which four prompts to rewrite, in what order, and which quality dimension each was degrading.</p></li></ol><p>Every failure in this pipeline is local: a single prompt instruction producing unintended behavior. There are no feedback loops, no architectural mismatches, and no emergent interactions between agents beyond simple data propagation. These are the easy cases. Future posts will cover systemic failures, cascading error amplification, conflicting objectives between agents, and architectural bottlenecks, where counterfactual attribution becomes essential rather than merely useful.</p><h2>Baseline: Can an LLM Diagnose This From Traces?</h2><p>We gave Claude Sonnet all 5 execution traces (every agent&#8217;s prompt and output) plus the classifier scores and asked it to rank the agents by severity. Here&#8217;s what it returned:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YJHk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YJHk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 424w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 848w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 1272w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YJHk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png" width="1350" height="592" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:592,&quot;width&quot;:1350,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96400,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://aryatafvizi.substack.com/i/197526909?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YJHk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 424w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 848w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.png 1272w, https://substackcdn.com/image/fetch/$s_!YJHk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdcccbc4-6d8e-44f8-9561-47a738f78a8b_1350x592.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The LLM gets the top two right. After that, it diverges.</p><h3>Where it goes wrong</h3><ol><li><p><strong>Confuses correlation with causation.</strong> The LLM ranks output_formatter #3 because it &#8220;displays rounded numbers.&#8221; But Shapley shows output_formatter has a <em>positive</em> contribution (+0.134). It&#8217;s not causing the rounding; it&#8217;s just receiving already-rounded input from the tone editor. The LLM can&#8217;t distinguish &#8220;this agent received bad data&#8221; from &#8220;this agent caused bad data.&#8221;</p></li><li><p><strong>Misses the table extractor.</strong> Shapley ranks table_extractor #3 because its &#8220;clean, readable format&#8221; instruction rounds $1,577 to $1,600 before any downstream agent sees it. The LLM never flags this because the table extractor&#8217;s output looks reasonable in the trace. You can only detect its impact by removing it and seeing what changes.</p></li><li><p><strong>Can&#8217;t predict interaction effects.</strong> The LLM would suggest fixing context_enricher and tone_editor independently. It has no way to know that fixing context_enricher alone makes quality <em>worse</em> (-0.022) because the tone editor is still converting M to B. Shapley catches this because it tests every combination of agents.</p></li><li><p><strong>Blames agents that are helping.</strong> The LLM flags synthesizer as #5, but Shapley shows synthesizer has a strongly positive contribution (+0.160). Removing it would make the pipeline worse, not better.</p></li></ol><p>The LLM diagnosis is plausible, well-reasoned, and partially correct. That&#8217;s exactly what makes it dangerous: an engineer reading it would feel confident acting on it, but two of the five recommendations would either waste time (output_formatter) or actively degrade the pipeline (synthesizer). Causal attribution avoids this by testing each agent&#8217;s actual marginal contribution rather than reasoning about what <em>looks</em> wrong in a trace.</p><h2>Reproduce It</h2><pre><code><code>pip install "counterfact[anthropic] @ git+https://github.com/counterfact-labs/counterfact.git"
export ANTHROPIC_API_KEY=...

# Diagnose the broken pipeline
python examples/financebench_diagnose.py

# Incremental fix cycle (Steps 0-4)
python examples/financebench_improve_prompts.py</code></code></pre><p>Source: <a href="https://github.com/counterfact-labs/counterfact">counterfact-labs/counterfact</a>. Claude Sonnet 4.6 (synthesizer) + Claude Haiku 4.5 (all other agents).</p><p>Full execution trace (all 8 agents, input/output for each): <a href="https://github.com/counterfact-labs/counterfact/blob/main/reports/blog_report.html">Appendix on GitHub</a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Beyond Tracing: Understanding Multi-Agent Systems Requires Causal Inference]]></title><description><![CDATA[Applying Counterfactual Simulations to Unpredictable Agent Architectures]]></description><link>https://aryatafvizi.substack.com/p/beyond-tracing-understanding-multi</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/beyond-tracing-understanding-multi</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Fri, 08 May 2026 22:07:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!rvXx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As AI architecture trends from monolithic LLMs toward multi-agent pipelines, often featuring ten or more interacting components on frameworks like LangGraph or AutoGen, our diagnostic methods are lagging behind. </p><p>We have robust methods for analyzing traditional machine learning models, like feature importance analysis, and mature interpretability tools for individual LLMs. But for multi-agent systems, standard diagnostic methods simply don&#8217;t exist, making the theoretical promise of &#8220;easier to debug modular systems&#8221; difficult to achieve in production.</p><p>In a modular system, each agent handles a distinct and well-defined responsibility- a researcher gathers context, a synthesizer drafts a summary, and a critic validates the output. Individually, frontier models handle these bounded tasks well. However, because agents pass qualitative natural language between one another, minor misinterpretations tend to compound across the pipeline. The interaction of multiple generative agents yields emergent and unpredictable behavior.</p><p>To solve the debugging challenge this creates, I built the Counterfactual Debugger. It is an open-source causal diagnostic toolkit designed specifically for multi-agent systems. Understanding why such a tool is necessary requires looking at how these systems actually fail.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rvXx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rvXx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rvXx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png" width="1024" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;: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_!rvXx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 424w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 848w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.png 1272w, https://substackcdn.com/image/fetch/$s_!rvXx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044c637-c93f-47f5-beee-36695a9aa94d_1024x559.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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4><strong>The Computational Irreducibility of AI Systems</strong></h4><p>Having guided multi-agent systems from prototype to production, I&#8217;ve noticed they behave much like cellular automata- simple, localized rules that produce highly complex macro-patterns.</p><p>Multi-agent systems are similarly computationally irreducible. You cannot predict the system&#8217;s final state or its potential failure modes purely through static analysis or by reading prompt code. The only way to understand the complex interaction of these agents is to run the system.</p><p>This presents a practical engineering dilemma. If you cannot predict a system&#8217;s behavior analytically, how do you debug it when it produces an unexpected result?</p><h4><strong>The Limits of Tracing</strong></h4><p>Standard observability tooling in AI relies heavily on tracing. We log the raw input and output strings of every agent in the chain.</p><p>Tracing is useful but backward-looking. It records exactly what happened. However, as we see a trend toward pipelines utilizing ten or more interacting components, manually parsing these logs becomes impossible for a human developer. Furthermore, in a non-deterministic pipeline, knowing what happened is rarely enough.</p><p>If an N-agent pipeline outputs a well-formatted but historically inaccurate research report, the tracing logs will show the exact sequence of events. They will not explain why the semantic drift occurred. They won&#8217;t specify if the error originated from the researcher retrieving an ambiguous source or if the critic failed to challenge a false premise set by the user. Tracing highlights the symptom but does not isolate the root cause.</p><h4><strong>Applying Causal Inference</strong></h4><p>Debugging emergent behavior requires counterfactual simulations. We have to ask what would have happened if the searcher agent had returned paragraph B instead of paragraph A. Would the synthesizer still hallucinate if the user&#8217;s prompt omitted a misleading premise?</p><p>This requires applying causal inference. By systematically perturbing the system&#8217;s graph, for example by ablating components, we can measure the causal impact of any single node on the final result. Using techniques inspired by Shapley values and agent-boundary perturbation, we can isolate the exact node and semantic shift responsible for a systemic hallucination, even if every individual agent appeared to be following its instructions.</p><h4><strong>The Counterfactual Debugger</strong></h4><p>This is the exact problem the Counterfactual Debugger solves. Instead of generating a static trace of a failure, the toolkit automatically orchestrates probabilistic stress tests and counterfactual simulations across the agent graph.</p><p>When an error occurs, it systematically perturbs the pipeline&#8217;s intermediate steps to calculate a causal attribution score. This quantifies each agent&#8217;s contribution to the failure.</p><p>Here is a brief look at how it works:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;02bba642-35e6-426f-857e-8a1aa4ce2be9&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">from counterfact import StateGraph, END

# 1. Build your pipeline with counterfact&#8217;s StateGraph (same API as LangGraph)
graph = StateGraph(MyState)

graph.add_node(&#8221;searcher&#8221;, searcher_fn)
graph.add_node(&#8221;synthesizer&#8221;, synthesizer_fn)
graph.add_node(&#8221;critic&#8221;, critic_fn)

graph.set_entry_point(&#8221;searcher&#8221;)
graph.add_edge(&#8221;searcher&#8221;, &#8220;synthesizer&#8221;)
graph.add_edge(&#8221;synthesizer&#8221;, &#8220;critic&#8221;)
graph.add_edge(&#8221;critic&#8221;, END)

compiled = graph.compile()

# 2. Run it
result = compiled.invoke({&#8221;query&#8221;: &#8220;Did Thomas Edison electrocute Topsy?&#8221;})

# 3. Diagnose: actually re-runs the pipeline with agents ablated
report = compiled.diagnose(
    input_state={&#8221;query&#8221;: &#8220;Did Thomas Edison electrocute Topsy?&#8221;},
    domain=&#8221;rag&#8221;,
)

# 4. Real output: Shapley values with bootstrap CIs, not &#8220;causal impact %&#8221;
print(report.shapley_values)

# {&#8221;searcher&#8221;: -0.11, &#8220;synthesizer&#8221;: +0.78, &#8220;critic&#8221;: +0.10}
# Result: The synthesizer is highly accountable (+0.78) for the failure.
# The debugger proves the hallucination was generated during synthesis,
# not driven by poor context retrieved by the searcher.

print(report.classification)       # FailureClassification(failure_type=&#8221;local&#8221;, ...)
print(report.recommendations)      # [Recommendation(...)]</code></pre></div><p></p><p>The tool converts qualitative failures into localized, actionable bugs. It enables offline testing of fixes in a shadow environment before pushing updates to production.</p><p>As we rely more heavily on multi-agent architectures, our maintenance methods must adapt. Print statements and standard trace logs are insufficient for computationally irreducible systems. Understanding these pipelines requires moving beyond observation and adopting causal inference.</p><p>The code and documentation are available below. If you are building complex agentic systems and looking for more rigorous ways to evaluate them, feel free to review the repository or open an issue.</p><p><a href="https://github.com/counterfact-labs/counterfact">https://github.com/counterfact-labs/counterfact</a></p>]]></content:encoded></item><item><title><![CDATA[Emergent Complex Behavior in Simple Multi-Agent Systems]]></title><description><![CDATA[Why Traditional Debugging Breaks Down in Generative Architectures]]></description><link>https://aryatafvizi.substack.com/p/emergent-complex-behavior-in-simple</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/emergent-complex-behavior-in-simple</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Thu, 05 Mar 2026 17:10:16 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!6Con!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Disclaimer: The views and opinions expressed in this article are my own and do not necessarily reflect the official policy or position of Google or DeepMind.</em></p><p>From 2019 to 2022, I led the analysis of primary machine learning systems for Search Ranking at Google. My team&#8217;s job was to discover and help address unexpected behaviors in some of the most widely used predictive models in the world. I later contributed to AI Overviews in Search and to Gemini, both of which use networks of generative LLMs to fulfill a user&#8217;s query.</p><p>As I look across the broader AI industry today, I see a collective shift from shallow ensembles of discriminative models to deep ensembles of generative models. This fundamental change in system architecture will introduce novel vulnerabilities and incomprehensible behaviors.</p><p>While pieces of this puzzle are actively debated in disparate academic forums, particularly within AI alignment and safety research, they are rarely viewed through the lens of production infrastructure. My goal here is to offer a new perspective: translating these theoretical alignment challenges into a practical, systems-engineering framework.</p><p>Traditional debugging approaches are not suited to addressing emergent behaviors in complex agent ecosystems. In multi-agent generative systems, the failure mode is no longer a broken component. It is a coherent interaction.</p><h3><strong>The Cellular Automata Problem</strong></h3><p>Cellular Automata are discussed early in computer science theory classes to demonstrate how complex behaviors emerge from very simple rules. See, for example, Conway&#8217;s <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of Life</a>, in which a grid of cells governed by very simple deterministic rules led to very complex, unpredictable, and sometimes chaotic macro-patterns. These systems are also computationally irreducible: the only way to predict their outcome is to run 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_!6Con!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Con!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6Con!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6Con!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6Con!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6Con!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg" width="343" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:435,&quot;width&quot;:343,&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_!6Con!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6Con!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6Con!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6Con!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46a3bca7-7c4e-4045-bf5c-2eb038066597_343x435.jpeg 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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In a modern AI pipeline, a web of specialized LLMs and tools processes an input to produce an output. Even if each component is perfectly prompted and highly capable, inter-agent interactions compound. These emergent complexities quickly exceed a human engineer&#8217;s ability to manually trace.</p><h3><strong>The Semantic Shift</strong></h3><p>Systems engineers might ask: &#8220;We&#8217;ve handled distributed microservices for decades. Why are multi-agent AI systems any different?&#8221;</p><p>Unpredictable chain reactions aren&#8217;t new. We see them in stock markets, power grids, and traditional software. The real difference is what the nodes send each other.</p><p>Traditional microservices exchange strict, structured data like JSON. If a service gets bad data, it usually throws a clear exception and stops. LLM agents, however, exchange natural language. If an agent receives a slightly inconsistent context, instead of crashing it will confidently process and further escalate the inconsistency before passing it to the next agent.</p><p>The new challenge isn&#8217;t fixing hard crashes; it&#8217;s stopping these small errors in reasoning from snowballing across the system.</p><p>Below we look at a concrete example to understand exactly how this semantic drift bypasses standard checks.</p><h3><strong>A Prototypical Systemic Failure</strong></h3><p>Consider a simple three-agent research pipeline:</p><ul><li><p><strong>A Searcher</strong> retrieves documents.</p></li><li><p><strong>A Synthesizer</strong> drafts the response.</p></li><li><p><strong>A Critic</strong> checks citations and logical flow.</p></li></ul><p>Each agent performs its local task correctly. Now, introduce a flawed prompt:</p><blockquote><p><em>&#8220;Detail how Thomas Edison used the execution of Topsy the elephant in his &#8216;War of the Currents&#8217; campaign to prove AC power was dangerous.&#8221;</em></p></blockquote><p>Historically, Edison&#8217;s company filmed <em>Electrocuting an Elephant</em> in 1903. The elephant was killed using AC power. But the execution was ordered by Luna Park, not Edison. The causal framing in the prompt is misleading.</p><p>The failure unfolds cleanly:</p><ol><li><p><strong>The Searcher</strong> retrieves accurate facts. No hallucination occurs at the retrieval layer.</p></li><li><p><strong>The Synthesizer</strong> attempts to answer the question as written. Its objective is relevance and coherence, not premise validation. The user&#8217;s framing becomes a constraint.</p></li><li><p>When retrieval reveals that Edison did not order the execution, the model resolves the tension by introducing a bridging claim: Edison did not initiate the event, but he <em>leveraged</em> it as anti-AC propaganda.</p></li></ol><p>To understand why, we have to look at what the model is actually doing. It bridges conflicting facts by generating semantic glue. The model simply generates the most plausible text that satisfies both the user&#8217;s framing and the retrieved facts, rather than optimizing for objective historical truth.</p><p>No facts are fabricated. Causality is.</p><p><strong>The Critic</strong> then verifies the output: Claims have citations, the reasoning is internally consistent, and the question is answered.</p><p>The output passes. The result is a coherent, citation-backed narrative that is historically misleading. Nothing broke. Retrieval worked. Generation worked. Critique worked.</p><p>The failure is architectural. Local objectives are satisfied, but no agent is responsible for rejecting the global premise. Once a flawed assumption enters the pipeline, it propagates forward as a structural constraint. The system optimizes around it.</p><h3><strong>The Scaling Multiplier</strong></h3><p>While this specific hallucination is easy to autopsy in a three-agent setup, production systems are rarely so contained. As we move toward <em>N</em>-agent systems, the interaction surfaces grow combinatorially.</p><p>In an <em>N</em>-agent directed graph, the number of possible interaction paths grows superlinearly. Each additional node introduces new composition routes for semantic error propagation, creating a mathematical escalation of risk that renders manual oversight impossible.</p><h3><strong>Why State-of-the-Art Models Still Fail</strong></h3><p>The goal of the previous example is to demonstrate a fundamental principle: <strong>complexity and unpredictability emerge purely from the interactions themselves.</strong> An engineer&#8217;s first instinct is to patch this. <em>&#8220;I&#8217;ll just add a Premise-Checking Agent,&#8221;</em> or <em>&#8220;I&#8217;ll rewrite the Synthesizer&#8217;s system prompt to be more skeptical.&#8221;</em> But these remedies are subject to the exact same issues. This is the Whack-a-Mole fallacy of agent architectures By adding more agents or rigid rules, you aren&#8217;t eliminating emergent behavior; you are simply increasing the number of network interactions, moving the complexity and the vulnerability to a new, untested part of the system.</p><p>Even state-of-the-art models fail inside poorly governed multi-agent architectures for three reasons:</p><ul><li><p><strong>Local Optimization Blindness:</strong> The Critic agent optimizes strictly for its local objective function, remaining blind to the global truth of the narrative.</p></li><li><p><strong>Cascading Drift:</strong> When Agent A introduces a minor semantic error, the context it passes to Agent B becomes slightly distorted. As information flows through the network, these compounding distortions degrade the system&#8217;s overall reasoning capabilities. Agents blindly build their logic on increasingly unstable foundations, turning small misinterpretations into systemic hallucinations.</p></li><li><p><strong>Reward Hacking &amp; The Sycophancy Trap:</strong> Models are fine-tuned via Reinforcement Learning from Human Feedback (RLHF) to prioritize user satisfaction. When faced with a prompt containing a false premise, the model might treat the user&#8217;s framing as a heavy statistical prior, agreeing with the user rather than zooming out to correct the fundamental error.</p></li></ul><h3><strong>The New Diagnostic Playbook</strong></h3><p>To build reliable multi-agent systems, we need bespoke diagnostic tooling designed to untangle, trace, and manage compounding interactions.</p><p>This requires three diagnostic pillars:</p><p><strong>1. The Shadow Sandbox (Offline Diagnosis &amp; Counterfactuals):</strong> When a failure occurs, traditional print logs are useless. New observability tools can trace prompts, responses, and agent calls across a system, giving us visibility into what happened. But tracing alone is insufficient. In generative systems, errors are rarely isolated bugs; instead, they are small misunderstandings that gradually compound as agents interact.</p><p>Observability shows what happened; a Shadow Sandbox would let us test what would have happened instead.</p><p>Since a single failing node cannot always be pinpointed, standard evaluation frameworks must evolve into full trajectory simulation. We need probabilistic stress tests and counterfactuals: pausing a trace, injecting corrections, and measuring the fix&#8217;s impact across historical runs.</p><p><strong>2. The AI Judge (Process Reward Models &amp; Out-of-Band Evaluation):</strong> You cannot rely on agents inside the loop to police the loop. Expanding on the LLM-as-a-Judge paradigm, a secondary AI must continuously evaluate the trajectory against core system rules. Crucially, this cannot just be an Outcome Reward Model (ORM) that grades the final output (which easily falls for the Topsy trap).</p><p>It must act as a Process Reward Model (PRM), evaluating the step-by-step reasoning trace to catch the exact moment semantic drift occurs.</p><p>Guided by explicit epistemic constraints rather than user satisfaction, this out-of-band judge catches the emergent errors that local agents miss.</p><p><strong>3. The Circuit Breaker (Representation Engineering &amp; Latent Monitoring):</strong> We need live monitoring to evaluate system stability. Rather than relying solely on semantic guardrails that parse text outputs, advanced circuit breakers must utilize probes on the model&#8217;s intermediate activations.</p><p>Existing techniques such as Representation Engineering (RepE) allow us to mathematically map these internal states during generation. Combined with Latent Monitoring, this detects internal signatures of uncertainty, contradiction, or cognitive conflict before a faulty generation, halting the pipeline proactively.</p><p>These techniques are admittedly difficult to operationalize and scale in production environments.</p><h3><strong>The Frontier of Multi-Agent Systems</strong></h3><p>Understanding these emergent failure modes is not just an engineering challenge; it defines the next generation of multi-agent AI architectures. Designing networks where agents interact predictably, ground each other in reality, and can be practically audited for truth is an open research frontier.</p><p>Print-statement debugging is insufficient: emergent failure is a system property, not broken code. Our diagnostic tools must evolve accordingly.</p>]]></content:encoded></item><item><title><![CDATA[The World Stayed Bright]]></title><description><![CDATA[For those who stood by me]]></description><link>https://aryatafvizi.substack.com/p/the-world-stayed-bright</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/the-world-stayed-bright</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Mon, 02 Mar 2026 19:32:15 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ED3H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The colors seemed more vibrant that day than they had in several months. The trees in Boston Common looked greener, the sky above them bluer. It wasn&#8217;t long after my left leg was strong enough to walk there without assistance. I was on my way to my gym by the park to exercise on the stair machine.</p><p>This was the fall of 2017. It was a few months after my skydiving accident, a 75-foot fall that brought with it ten broken bones and a traumatic brain injury.</p><p>The colors came back a few days later, then again after a shorter period, then every other day, until they stopped flickering. The world stayed bright.</p><p>Realizing Boston couldn&#8217;t offer the quiet refuge I needed to heal, I moved to my sister&#8217;s basement in Los Altos. There, I studied graduate textbooks in statistics, slowly relearning a language I once spoke fluently. By the time I went to Google for my on-site interviews, the experience felt more like teaching than interviewing.</p><p>A job at Google was the stable platform I needed to rebuild myself physically, mentally, and emotionally. But it was a lot more than that.</p><p>When I was around ten years old, my dad bought a bulky desktop computer with a CRT monitor for our home. He had someone show us how to connect to the internet with a dial-up modem. Navigating to google.com, he emphasized that it was the best way to find anything online. &#8220;Look, it found us a hundred thousand results in a fraction of a second.&#8221;</p><p>Later at MIT, our professor in Mathematics for Computer Science used Google&#8217;s PageRank algorithm to teach us about Markov Chains, one of my favorite mathematical constructs. In the early 2000s, it made Google the place to go to find results that were not only topical but also trustworthy.</p><p>Search Ranking was still the crown jewel of Google when I arrived. I learned as much as I could about the new ways Google&#8217;s algorithms found trustworthy sites and worked to improve them. Over the following eight years, I contributed to projects that were both interesting and important, helping shape how billions of people find and interact with the world&#8217;s information.</p><p>I learned and I taught. I mentored and was mentored. I found things to improve and created entirely new things: from analysis methods to production serving, and from internal articles to external papers. I moved from seeking stability to seeking problems worth solving. That pursuit led me from Search to DeepMind, where I explored novel problems at the frontier of AI in my final year at Google.</p><p>I am grateful for what I got to build. I am most proud of the person I became in the process. Recovery taught me a lesson that my engineering experiences reinforced: progress is rarely a breakthrough; it is a practice of trial, learning, and growth, repeated time after time.</p><p>I&#8217;m most fulfilled when my life serves a purpose larger than myself. Now, I choose how to serve the world in my own way, the best I can. The world has stayed bright, and I have never been more prepared for the road ahead.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ED3H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ED3H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ED3H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg" width="1440" height="808" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:808,&quot;width&quot;:1440,&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_!ED3H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ED3H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c70f521-a6ef-4883-9e98-abf064baa614_1440x808.jpeg 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"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p style="text-align: center;"><em>North Shore of Oahu, Summer 2020</em></p>]]></content:encoded></item><item><title><![CDATA[My Question for AI Maximalists]]></title><description><![CDATA[AI's fundamental challenge is a measurement problem]]></description><link>https://aryatafvizi.substack.com/p/my-question-for-ai-maximalists</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/my-question-for-ai-maximalists</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Sun, 22 Feb 2026 00:17:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!pxD7!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bf23816-25f4-48ee-8e31-b00037da5502_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Whenever someone declares that AI has achieved or will achieve &#8220;superhuman judgment,&#8221; (a common occurrence these days) I always ask the same question: <strong>How do you even measure that?</strong></p><p>The raw power of modern models is not in dispute. If the goal is passing a standardized exam or writing code to a clear spec, the debate is over. These are closed systems with a clear ground truth, agreed upon and defined by humans. Because the metric for success is perfectly definable, an optimization engine can directly solve for it.</p><p>However, as AI has saturated traditional metrics that reward the recall of training data, the industry is shifting toward benchmarks that measure fluid reasoning. The <a href="https://arcprize.org/">ARC Prize</a>&#8217;s AGI metrics are a prime example; they measure intelligence through skill acquisition efficiency (how quickly it learns) by presenting puzzles where the AI isn&#8217;t even told the &#8220;rules of the game&#8221; beforehand. It&#8217;s an attempt to see if a model can reason from first principles rather than relying on past examples.</p><p>But even as we improve these benchmarks, the vast majority of human choices happen in environments where no perfect metric exists. Consider a senior product engineer making an architectural decision. They aren&#8217;t just optimizing for clean code; they are balancing system latency, launch deadlines, costs, and team morale, among others.</p><p>The technical bottleneck here is <strong><a href="https://plato.stanford.edu/entries/value-incommensurable/">incommensurability</a></strong>. In a closed system, every variable can be converted into a single &#8220;score.&#8221; But in the real world, you cannot mathematically trade 50ms of latency for a 10% drop in team morale. There is no universal exchange rate between &#8220;code health&#8221; and &#8220;market timing.&#8221; Because machine learning requires a scalar objective, a single number to maximize, it is forced to collapse these distinct categories into an arbitrary calculation.</p><p>When we can&#8217;t define a goal mathematically, we rely on proxy metrics. Consider Nick Bostrom&#8217;s <strong><a href="https://nickbostrom.com/ethics/ai">Paperclip Maximizer</a></strong> thought experiment. If you task an AI with a single, measurable goal, like maximizing the production of paperclips, it will ruthlessly optimize for that metric at the expense of everything else, eventually consuming all human resources to build more paperclips. The AI isn&#8217;t malicious; it is simply following a mathematically defined target that lacks the unmeasurable context of human values.</p><p>This is the essence of <strong><a href="https://en.wikipedia.org/wiki/Goodhart%27s_law">Goodhart&#8217;s Law</a></strong>: when a measure becomes a target, it ceases to be a good measure. By optimizing for a proxy, the AI  games the metric while abandoning the spirit of the task.</p><p>This measurement problem explains why AI acts as a precise tool for measurable work, yet hitting a wall the moment it encounters complex human trade-offs. Until we solve a philosophical measurement problem humanity hasn&#8217;t cracked in thousands of years, the claim that AI will replace judgment remains unfalsifiable. True judgment resists quantification, and for now, that remains our moat.</p>]]></content:encoded></item><item><title><![CDATA[From Prototype to Production: Guiding Agents at Scale]]></title><description><![CDATA[Why speed is not structure, and why AI agents default to spaghetti code without guidance.]]></description><link>https://aryatafvizi.substack.com/p/from-prototype-to-production-guiding</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/from-prototype-to-production-guiding</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Fri, 06 Feb 2026 06:21:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!pxD7!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bf23816-25f4-48ee-8e31-b00037da5502_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The barrier to building software has collapsed. Today, someone with little formal engineering experience can generate thousands of lines of code in a single afternoon using intent-first development, colloquially known as &#8220;vibe coding.&#8221;</p><p>This shift is undeniably exciting. It lowers the barrier to entry and accelerates the &#8220;zero to one&#8221; phase of building. But as we recently discovered while helping a friend set up the engineering stack for their early-stage startup, this speed comes with a hidden tax.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://aryatafvizi.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Arya's Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>While looking into modifying features in an open-source library, we found ourselves leaning heavily on AI agents to get quick wins. In one specific instance, the agent was more than willing to cut corners to implement the narrow feature we requested. It worked, but it introduced a fragility that would clearly prove costly as the codebase grew.</p><p>It clarified a distinction that is often lost in the hype: <strong>You can vibe code a prototype. You cannot vibe code a system.</strong></p><h3><strong>The Illusion of Velocity</strong></h3><p>The mistake many teams are making right now isn&#8217;t using AI to write code. It is assuming that <em>generating</em> code is the same as <em>engineering</em> a system.</p><p>When you &#8220;vibe code,&#8221; you are optimizing for immediate functionality. You describe an outcome, and the model gives you the shortest path to that outcome. In a prototype, this is perfect. You want to validate an idea, test an API, or build an internal tool.</p><p>However, production software lives under different constraints. It requires reliability, observability, and the ability to be maintained by a team (human or AI) over years. </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{array}{|l|l|l|}\n\\hline\n\\textbf{Dimension} &amp; \\textbf{Vibe Coded (Intent-First)} &amp; \\textbf{Enterprise Grade (Engineering-First)} \\\\\n\\hline\n\\text{Primary Goal} &amp; \\text{Velocity. Ship functional quickly.} &amp; \\text{Durability. Systems run for years.} \\\\\n\\hline\n\\text{Logic Owner} &amp; \\text{AI generates implementation.} &amp; \\text{Humans define architecture.} \\\\\n\\hline\n\\text{Tech Debt} &amp; \\text{Accumulates fast, invisibly.} &amp; \\text{Managed via standards.} \\\\\n\\hline\n\\text{Scalability} &amp; \\text{Prototypes and small usage.} &amp; \\text{Production load and growth.} \\\\\n\\hline\n\\text{Observability} &amp; \\text{Limited debugging.} &amp; \\text{Logging \\&amp; tracing built in.} \\\\\n\\hline\n\\text{Data Gov} &amp; \\text{Assumptions are implicit.} &amp; \\text{Contracts are explicit.} \\\\\n\\hline\n\\text{Compliance} &amp; \\text{Often an afterthought.} &amp; \\text{Built-in from start.} \\\\\n\\hline\n\\text{Failure Mode} &amp; \\text{Silent fragility.} &amp; \\text{Recoverable issues.} \\\\\n\\hline\n\\end{array}&quot;,&quot;id&quot;:&quot;LFFSCZBTEX&quot;}" data-component-name="LatexBlockToDOM"></div><p>There is a counter-argument that AI reduces the cost of maintenance, so code quality matters less. While true that AI can help write tests or refactor functions, it is beside the point. AI agents struggle with context windows just as humans struggle with cognitive load. If you don&#8217;t have a good setup, clear boundaries, good hygiene, and logical flow, things get exponentially difficult for <em>both</em> humans and AI.</p><p>To survive the transition from prototype to production, you need to invest in the environment.</p><h3><strong>1. Magic Requires Modularity</strong></h3><p>A &#8220;magical&#8221; user experience is rarely the result of one massive, intelligent algorithm. It is usually the result of many small, boring components handling edge cases gracefully.</p><p>To create magic, you need <strong>modularity</strong>.</p><p>A system of interacting modules, where each is responsible for a simple, well-defined job, allows you to tweak and evaluate components independently. This is critical for AI-assisted development. If an AI agent attempts to modify a monolithic script, the blast radius of a mistake is the entire system. If it modifies a contained module with a defined interface, the risk is capped.</p><h3><strong>2. Guide the Ghost (Prompting Architecture)</strong></h3><p>One of the most surprising findings from our work is that <strong>AI agents actually respond well to design principles, but only if you explicitly express them.</strong></p><p>Agents default to the path of least resistance. If you ask for a feature, they will give you the quickest implementation (often &#8220;spaghetti code&#8221;). However, if you explicitly guide them by regularly reminding them of your modularity constraints, error-handling standards, and separation of concerns, they can be excellent architectural partners.</p><p>You cannot just prompt for code; you must prompt for <em>architecture</em>.</p><h3><strong>3. Simplicity is Long-Term Performance</strong></h3><p>There is a tension between simplicity and &#8220;performance&#8221; in the short term. You can vibe code a Proof of Concept (PoC) in a single day without caring about the overall health of the system.</p><p>While that implementation might appear efficient, it often creates a spaghetti codebase that halts future development. Real performance is not just runtime speed; it is <strong>velocity over time</strong>. Simplicity allows you, and your AI agents, to understand the state of the system six months from now.</p><h3><strong>4. The &#8220;Rewrite&#8221; Myth</strong></h3><p>A common pitfall in engineering is deprioritizing hygiene under the assumption that &#8220;one day we will replace this with a clean version.&#8221;</p><p>History teaches us this is a lie. Users and downstream tasks (including other AI agents) get used to the quirks of your existing system. Replacing it requires reproducing those quirks or suffering a painful migration. The messy system you build today is likely the system you will be maintaining in three years.</p><h3><strong>5. Debugging is Development</strong></h3><p>In the age of probabilistic software (LLMs), software engineering looks less like writing logic and more like shepherding behavior.</p><p>A massive portion of the workflow is the debug-and-develop cycle: identifying problematic examples, tracing them through the system, and improving the module responsible. Therefore, <strong>investing in observability is non-negotiable.</strong> You need the ability to easily trace an arbitrary example&#8217;s path through the system. If you cannot see where the agent went wrong, you cannot fix it.</p><h3><strong>Conclusion: The Environment is the Product</strong></h3><p>Before adding extensive new features, we recommend investing first in the environment:</p><ul><li><p><strong>Observability:</strong> Can you see what&#8217;s happening?</p></li><li><p><strong>Protection:</strong> Do you have tests that catch regressions?</p></li><li><p><strong>Decoupling:</strong> Are you building <em>on</em> external modules rather than <em>in</em> them?</p></li></ul><p>These concerns sound remote when you are rushing to ship a demo, but the pain from careless design arrives faster than you expect, likely within weeks.</p><p>AI makes it easier than ever to build software quickly. But engineering discipline is still the only thing that makes it possible to build software that lasts. You can vibe code a prototype, but you can&#8217;t vibe code a platform.</p><p>Not yet.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://aryatafvizi.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Arya's Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Coming soon]]></title><description><![CDATA[This is Arya&#39;s Substack.]]></description><link>https://aryatafvizi.substack.com/p/coming-soon</link><guid isPermaLink="false">https://aryatafvizi.substack.com/p/coming-soon</guid><dc:creator><![CDATA[Arya Tafvizi]]></dc:creator><pubDate>Mon, 01 Dec 2025 23:36:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!pxD7!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3bf23816-25f4-48ee-8e31-b00037da5502_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is Arya&#39;s Substack.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://aryatafvizi.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://aryatafvizi.substack.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item></channel></rss>