<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Michael Green</title>
<link>https://drmike.xyz/</link>
<atom:link href="https://drmike.xyz/index.xml" rel="self" type="application/rss+xml"/>
<description>Blog by Michael Green on Bayesian AI, uncertainty quantification, drug discovery, and European tech sovereignty.</description>
<generator>quarto-1.10.19</generator>
<lastBuildDate>Mon, 19 Oct 2026 22:00:00 GMT</lastBuildDate>
<item>
  <title>Give the confounder its own equation</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/give-the-confounder-its-own-equation/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I came across a neat little puzzle from Quentin Gallea on LinkedIn last week <span class="citation" data-cites="gallea_linkedin">(Gallea 2026)</span>. Take a marketing mix model with two channels and a third variable, X. X is a confounder for channel 2 (it drives both channel 2 and sales) and a mediator for channel 1 (channel 1 drives X, which drives sales). To identify channel 2’s effect you have to control for X. To identify channel 1’s total effect you must not, because controlling for a mediator throws away the part of the effect that flows through it. One regression can’t do both, so his conclusion is that MMMs are often too ambitious for causal estimates, and that causal inference usually goes one treatment at a time.</p>
<div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div id="fig-causal-orig" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-causal-orig-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div>
<pre class="mermaid mermaid-js" data-label="fig-causal-orig">flowchart LR
    S["Sales"]
    C1["Channel 1"]
    C2["Channel 2"]
    C1 &amp; C2 --&gt; S
    X --&gt; C2
    C1 --&gt; X --&gt; S
</pre>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-causal-orig-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The causal graph behind the puzzle: X confounds channel 2 and mediates channel 1.
</figcaption>
</figure>
</div>
</div>
</div>
<p>The diagnosis is right, and the puzzle shows up in a lot of MMM projects. A textbook case of X was given in the comments, i.e., branded search volume. Upper-funnel channels like TV make people search for your brand, so branded search volume is a mediator for TV. It also confounds anything whose budget reacts to it, and another guy pointed out in the same thread that budgets do react, because marketers scale spend up when they expect demand to be strong.</p>
<p>I think the conclusion is too pessimistic, though. The trouble comes from asking a single regression equation to answer two questions. Give X its own equation, give the budget rule its own equation, fit them together with sales, and then do the accounting. Both effects come back out of one model. I’ll demonstrate it with a small simulation in <iconify-icon inline="" icon="simple-icons:julia" aria-label="Icon julia from simple-icons Iconify.design set." title="Icon julia from simple-icons Iconify.design set."></iconify-icon> Julia so you can run it for yourself (if you, like me, like that programming language).</p>
<p>Along the way the same accounting sorts out a second problem that comes with the branded search example, which is what to do with the money you spend on branded paid search. Most of it buys clicks you would have got for free, and treating it as a channel is how a lot of MMMs end up telling you branded search is your best investment.</p>
</section>
<section id="the-setup" class="level2">
<h2 class="anchored" data-anchor-id="the-setup">The setup</h2>
<p>Ok so let’s make it concrete. Channel 1 is TV. X is branded search volume. Channel 2 is paid social, and the media planner sets its budget from search trends: when branded search goes up, the social budget goes up.</p>
<p>A branded search lands on a results page. If you bid on your brand keyword, your ad sits at the top and your organic listing sits under it. A click on the organic link is free. A click on the ad costs you the price per click (CPC). Some searchers click a competitor’s ad instead, and those are lost. Whether you bid changes the split. With the bid on, most people click the ad. With it off, most of them click the organic link instead.</p>
<div id="fig-dag" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-dag-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/dag.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;2: The causal graph for the simulation. TV lifts branded search volume (a) and sales (b_1). Search volume drives the paid social budget (c), and paid social lifts sales (b_2). Every branded search lands on a results page, where the brand keyword bid decides how it splits into paid clicks, organic clicks and clicks lost to competitors. Paid and organic clicks both lead to sales (v per click). Branded search spend is the bill for the paid clicks, so it has no arrow into sales."><img src="https://drmike.xyz/posts/give-the-confounder-its-own-equation/figs/dag.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/dag.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;2: The causal graph for the simulation. TV lifts branded search volume (a) and sales (b_1). Search volume drives the paid social budget (c), and paid social lifts sales (b_2). Every branded search lands on a results page, where the brand keyword bid decides how it splits into paid clicks, organic clicks and clicks lost to competitors. Paid and organic clicks both lead to sales (v per click). Branded search spend is the bill for the paid clicks, so it has no arrow into sales."><img src="https://drmike.xyz/posts/give-the-confounder-its-own-equation/figs/dag.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-dag-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: The causal graph for the simulation. TV lifts branded search volume (<img src="https://latex.codecogs.com/png.latex?a">) and sales (<img src="https://latex.codecogs.com/png.latex?b_1">). Search volume drives the paid social budget (<img src="https://latex.codecogs.com/png.latex?c">), and paid social lifts sales (<img src="https://latex.codecogs.com/png.latex?b_2">). Every branded search lands on a results page, where the brand keyword bid decides how it splits into paid clicks, organic clicks and clicks lost to competitors. Paid and organic clicks both lead to sales (<img src="https://latex.codecogs.com/png.latex?v"> per click). Branded search spend is the bill for the paid clicks, so it has no arrow into sales.
</figcaption>
</figure>
</div>
<p>For now, assume the bid stays on, so the click split is fixed and every branded search is worth the same in sales on average. Call that <img src="https://latex.codecogs.com/png.latex?b_x">. It’s <img src="https://latex.codecogs.com/png.latex?v"> times the share of searches that end in a click on your result, paid or organic. Written as equations, with everything linear to keep the maths simple and boring:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cbegin%7Baligned%7D%0AX%20&amp;=%20%5Calpha_x%20+%20a%20%5Ccdot%20%5Ctext%7BTV%7D%20+%20%5Cvarepsilon_x%20%5C%5C%0A%5Ctext%7Bsocial%7D%20&amp;=%20%5Calpha_2%20+%20c%20%5Ccdot%20X%20+%20%5Cvarepsilon_2%20%5C%5C%0A%5Ctext%7Bsales%7D%20&amp;=%20%5Calpha_s%20+%20b_1%20%5Ccdot%20%5Ctext%7BTV%7D%20+%20b_2%20%5Ccdot%20%5Ctext%7Bsocial%7D%20+%20b_x%20%5Ccdot%20X%20+%20%5Cvarepsilon_s%0A%5Cend%7Baligned%7D%0A"></p>
<p>The usual MMM writes down only the last line and asks its coefficients to be the answer. Quentin’s point is that <img src="https://latex.codecogs.com/png.latex?b_1"> is TV’s <em>direct</em> effect only. Everything TV does by making people search is sitting in <img src="https://latex.codecogs.com/png.latex?b_x"> and <img src="https://latex.codecogs.com/png.latex?b_2">, so if you report <img src="https://latex.codecogs.com/png.latex?b_1"> as “TV’s effect” you undersell TV. Drop X from the regression to try to fix that and paid social picks up X’s effect on sales, because X moves both of them, so you oversell paid social instead.</p>
</section>
<section id="two-questions-one-equation" class="level2">
<h2 class="anchored" data-anchor-id="two-questions-one-equation">Two questions, one equation</h2>
<p>But why does the single equation fail? Because “what does TV do to sales?” and “what does paid social do to sales?” are questions about <em>different interventions</em>, and one set of regression coefficients answers one conditioning set.</p>
<p>For paid social, the question is: if I change the social budget and leave everything else alone, what happens to sales? Search volume doesn’t respond to the social budget in this graph, so the answer is <img src="https://latex.codecogs.com/png.latex?b_2">, read with X in the model. Conditioning on X is exactly right here.</p>
<p>For TV, the question is: if I add a unit of TV, what happens to sales once you count everything downstream of TV? TV moves sales directly (<img src="https://latex.codecogs.com/png.latex?b_1">). It also moves search volume by <img src="https://latex.codecogs.com/png.latex?a">, and each unit of search volume moves sales by <img src="https://latex.codecogs.com/png.latex?b_x">. If the planner keeps following search trends, that extra search volume also moves the social budget by <img src="https://latex.codecogs.com/png.latex?c">, which moves sales by <img src="https://latex.codecogs.com/png.latex?b_2">. Add the paths up:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7BTV%20total%7D%20=%20b_1%20+%20a%20%5Ccdot%20%5Cleft(b_x%20+%20c%20%5Ccdot%20b_2%5Cright)%0A"></p>
<p>If you’d freeze the social budget while you add TV, the last term goes away and the total is <img src="https://latex.codecogs.com/png.latex?b_1%20+%20a%20%5Ccdot%20b_x">. Those are two different questions, and the model makes you say which one you’re asking, which I count as a feature. One is about TV. The other is about TV plus the planner’s habits.</p>
<p>This is path tracing, and it’s old. Sewall Wright worked it out for the coat patterns of guinea pigs a hundred years ago <span class="citation" data-cites="wright_1920 wright_1921">(Wright 1920, 1921)</span>. In a linear model without interactions the total effect is the sum over directed paths of the products of the coefficients along each path, and Pearl’s do-calculus says the same thing in more general language <span class="citation" data-cites="pearl_2009">(Pearl 2009)</span>. It’s rarely written into an MMM, though.</p>
</section>
<section id="a-simulation" class="level2">
<h2 class="anchored" data-anchor-id="a-simulation">A simulation</h2>
<p>Ok fine, but does it actually work? Let’s simulate three years of weekly data from the graph above, where we know the truth, and see what each approach recovers. The bid is on in every week except eight, where it’s switched off at random as a holdout test.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> a, c        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>     <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># TV -&gt; branded searches, searches -&gt; social budget</span></span>
<span id="cb1-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> b1, b2      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>     <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># direct effects on sales of TV and paid social</span></span>
<span id="cb1-3"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> v           <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># sales per click on your result, paid or organic</span></span>
<span id="cb1-4"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> cpc         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># price of a paid click</span></span>
<span id="cb1-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> share_paid  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (on <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.60</span>, off <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.00</span>)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># where branded searches end up,</span></span>
<span id="cb1-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> share_org   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (on <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.38</span>, off <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># with and without the bid</span></span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simulate</span>(n; sd_social <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, holdout <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb1-9">    bid    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">trues</span>(n); bid[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randperm</span>(n)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>holdout]] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">false</span>   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># weeks with bidding switched off</span></span>
<span id="cb1-10">    tv     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)                              <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># TV spend</span></span>
<span id="cb1-11">    search <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> a <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> tv <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)                         <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># branded search volume</span></span>
<span id="cb1-12">    social <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> search <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> sd_social <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># paid social budget, set from search trends</span></span>
<span id="cb1-13">    sp     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>.(bid, share_paid.on, share_paid.off)</span>
<span id="cb1-14">    so     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>.(bid, share_org.on, share_org.off)</span>
<span id="cb1-15">    paid   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sp <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> search <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> bid          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># paid clicks</span></span>
<span id="cb1-16">    org    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> so <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> search <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)                 <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># organic clicks</span></span>
<span id="cb1-17">    brand  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> cpc <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> paid           <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># branded search spend</span></span>
<span id="cb1-18">    sales  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> b1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> tv <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> b2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> social <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> v <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> (paid <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> org) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(n)</span>
<span id="cb1-19">    (; bid, tv, search, social, paid, org, brand, sales)</span>
<span id="cb1-20"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>Spend and sales are in the same currency, so a coefficient on a spend variable reads as sales per euro. With the bid on, 98 percent of branded searches end in a click on your result, so <img src="https://latex.codecogs.com/png.latex?b_x%20=%201.5%20%5Ctimes%200.98%20=%201.47">, and the truth is:</p>
<ul>
<li>Paid social: 0.50 per euro.</li>
<li>TV, direct only: 1.00.</li>
<li>TV total with the social budget frozen: <img src="https://latex.codecogs.com/png.latex?1.0%20+%200.8%20%5Ctimes%201.47%20=%202.18">.</li>
<li>TV total with the social budget following search: <img src="https://latex.codecogs.com/png.latex?1.0%20+%200.8%20%5Ctimes%20(1.47%20+%200.6%20%5Ctimes%200.5)%20=%202.42">.</li>
<li>Branded search spend: 0.15 of sales per euro. Switching the bid off moves the paid clicks to the organic link and loses 3 percent of searches to competitors, so the ad buys 0.045 of sales per search and costs 0.30.</li>
</ul>
<p>Now fit the usual suspects. One dataset can get lucky or unlucky, so the table averages each estimate over 2,000 simulated datasets of 156 weeks.</p>
<div id="tbl-sim" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-sim-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Mean estimates over 2,000 simulated datasets of 156 weeks each. The branded spend row uses datasets where the bid is never switched off, which is how most advertisers run it. The joint model row uses posterior means.
</figcaption>
<div aria-describedby="tbl-sim-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>Model</th>
<th>TV</th>
<th>Paid social</th>
<th>Branded search spend</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Truth</td>
<td>2.18 (social frozen) or 2.42 (social follows search)</td>
<td>0.50</td>
<td>0.15</td>
</tr>
<tr class="even">
<td>sales ~ TV + social</td>
<td>1.87</td>
<td>1.15</td>
<td></td>
</tr>
<tr class="odd">
<td>sales ~ TV + social + branded spend, bid never off</td>
<td>1.31</td>
<td>0.74</td>
<td>3.11</td>
</tr>
<tr class="even">
<td>sales ~ TV + social + X</td>
<td>1.00</td>
<td>0.50</td>
<td></td>
</tr>
<tr class="odd">
<td>sales ~ TV</td>
<td>2.42</td>
<td></td>
<td></td>
</tr>
<tr class="even">
<td>Joint model, then the accounting</td>
<td>2.18 / 2.42</td>
<td>0.50</td>
<td>0.15</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>The first row is the standard MMM that leaves search volume out. Paid social comes out at 1.15, more than double its real effect, because it’s soaking up what branded search does on its own. TV comes out at 1.87, which isn’t the right answer to either TV question.</p>
<p>The second row is the one I see most in the wild, and it’s the worst of the lot. Branded search spend goes in as a channel, and because it moves with search volume it soaks up a good part of what search volume does. It reports 3.11 of sales per euro, twenty times the truth, which makes it the best channel in the model by a mile. TV drops to 1.31 per euro and looks like the channel to cut. Run the same regression on data that includes the eight holdout weeks and the branded coefficient falls to 0.50, which shows how much a few weeks of switching it off are worth, but that’s still more than three times the truth.</p>
<p>Put search volume itself in (third row) and paid social is fixed, while TV collapses to its direct effect of 1.0, which is Quentin’s point exactly. Regress sales on TV alone and you get 2.42, the right total under the planner’s rule. That’s the one-treatment-at-a-time approach, and it works, but you need a separate model for every question you want to ask.</p>
<p>The joint model gets all of it from one fit. Give every node in the graph its own equation, then add up the paths:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coef</span>(y, cols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hcat</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ones</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(y)), cols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span> y</span>
<span id="cb2-2"></span>
<span id="cb2-3">â <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coef</span>(search, tv)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]                          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># TV -&gt; search</span></span>
<span id="cb2-4">ĉ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coef</span>(social, search)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]                      <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># search -&gt; social budget</span></span>
<span id="cb2-5">ŝp, ŝo <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> search[bid] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span> paid[bid], search[bid] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span> org[bid]   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># click shares, bid on</span></span>
<span id="cb2-6">_, b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, v̂ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coef</span>(sales, tv, social, paid <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> org)</span>
<span id="cb2-7"></span>
<span id="cb2-8">b̂x         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v̂ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (ŝp <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> ŝo)                       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># sales per branded search, bid on</span></span>
<span id="cb2-9">tv_frozen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> â <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b̂x</span>
<span id="cb2-10">tv_follows <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> â <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (b̂x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> ĉ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb2-11">social_eff <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b̂<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span></code></pre></div></div>
<p>(The real thing in the <a href="code/accounting.jl">code</a> does this inside every posterior draw, as the next section explains, and adds the bid-off share and the CPC.) Averaged over the 2,000 datasets it lands on 2.18, 2.42 and 0.50. You also get the decomposition for free. Of TV’s 2.42, 1.0 is direct, 1.18 comes through the people who search for you and click your result, and 0.24 comes through the social budget the planner adds when search goes up. That last slice belongs to TV and the planner jointly, and in the single-equation MMM paid social gets to claim it.</p>
</section>
<section id="where-the-uncertainty-goes" class="level2">
<h2 class="anchored" data-anchor-id="where-the-uncertainty-goes">Where the uncertainty goes</h2>
<p>A point estimate from a model is only half the story (yes, I know I rant about uncertainty all the time). The accounting has to carry the uncertainty through as well, because <img src="https://latex.codecogs.com/png.latex?%5Chat%20a%20%5Ccdot%20%5Chat%20b_x"> is a product of uncertain numbers.</p>
<p>The Bayesian way is to do the accounting inside every posterior draw. Take a draw of all the coefficients, compute the total effect, repeat, and you have the posterior of the total effect.</p>
<p>And here the linear toy gives us a nice bonus. The equations have independent noise, and if their priors are independent too, the joint posterior factorizes into one posterior per equation. So fitting regression by regression is the full joint Bayesian model, with no approximation. Put a conjugate Normal-Inverse-Gamma prior on each equation and every posterior has a closed form, so you can sample it exactly without any MCMC:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># σ² ~ InvGamma(a0, b0),  β | σ² ~ Normal(0, σ² v0 I)</span></span>
<span id="cb3-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">nig_posterior</span>(y, cols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>; v0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100.0</span>, a0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, b0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, intercept <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">true</span>)</span>
<span id="cb3-3">    Z  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> intercept ? <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hcat</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ones</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(y)), cols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hcat</span>(cols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>)</span>
<span id="cb3-4">    Λn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> I <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> v0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> Z<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Z                      <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># posterior precision (per σ²)</span></span>
<span id="cb3-5">    mn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Λn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span> (Z<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> y)</span>
<span id="cb3-6">    an <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> a0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(y) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb3-7">    bn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (y<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> mn<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Λn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> mn) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb3-8">    (m <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> mn, L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cholesky</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Symmetric</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">inv</span>(Λn))).L, a <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> an, b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> bn)</span>
<span id="cb3-9"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb3-10"></span>
<span id="cb3-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Gamma(k, 1) for k a multiple of 1/2, standard library only</span></span>
<span id="cb3-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gamma_draw</span>(k) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randexp</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">floor</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Int</span>, k))) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">isinteger</span>(k) ? <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>()<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb3-13"></span>
<span id="cb3-14"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">draw</span>(post)</span>
<span id="cb3-15">    σ² <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> post.b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gamma_draw</span>(post.a)</span>
<span id="cb3-16">    post.m <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(σ²) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> (post.L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(post.m)))</span>
<span id="cb3-17"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>(Yes, that Gamma sampler is a sum of exponentials. With <img src="https://latex.codecogs.com/png.latex?a_0%20=%201"> every posterior shape here is a whole number or a half, so it’s exact, and it saves pulling in Distributions.jl for one line.) Then 4,000 draws go through the accounting. On a single 156-week dataset:</p>
<div id="tbl-single" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-single-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;2: One simulated dataset of 156 weeks. Posterior means and 90% intervals from 4,000 exact posterior draws pushed through the path accounting.
</figcaption>
<div aria-describedby="tbl-single-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Quantity</th>
<th>Truth</th>
<th>Posterior mean</th>
<th>90% interval</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>TV total, social frozen</td>
<td>2.18</td>
<td>2.05</td>
<td>1.85 to 2.26</td>
</tr>
<tr class="even">
<td>TV total, social follows search</td>
<td>2.42</td>
<td>2.28</td>
<td>2.10 to 2.46</td>
</tr>
<tr class="odd">
<td>Paid social</td>
<td>0.50</td>
<td>0.51</td>
<td>0.22 to 0.80</td>
</tr>
<tr class="even">
<td>Branded search, sales per euro</td>
<td>0.15</td>
<td>0.15</td>
<td>0.11 to 0.18</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>All four intervals contain the truth, and the TV estimates sit a little low because this dataset drew low on TV’s direct effect (0.93) and on how many searches TV creates (0.77). That’s one dataset. Over 2,000 simulated datasets the 90 percent intervals for every quantity in this post contain the truth between 88 and 91 percent of the time, which is about what a 90 percent interval should do.</p>
<p>The paid social interval is wide, and that’s worth a pause. The social budget follows search volume closely, so the data has little social movement that isn’t also search volume movement. In the simulation, halving the independent variation in the social budget doubles the spread of its estimate across datasets (from 0.16 to 0.32). The model is identified, but it can only be as precise as the data lets it be. If you want a tight number on paid social, this is where you run a holdout test and feed the result in as a prior, because no amount of modelling can create variation that isn’t in the data.</p>
</section>
<section id="branded-search-is-mostly-free-clicks-you-pay-for" class="level2">
<h2 class="anchored" data-anchor-id="branded-search-is-mostly-free-clicks-you-pay-for">Branded search is mostly free clicks you pay for</h2>
<p>Back to the results page. Why would branded paid search spend drive sales? The spend is the number of paid clicks times the CPC, and the paid clicks come from people who typed your brand name into Google, which means they were already looking for you. With the bid on, 60 percent of them click the ad and 38 percent click the organic link right under it. With the bid off, 95 percent click the organic link. So the ad mostly moves clicks from the free link to the paid one, and the only sales it adds are the 3 percent of searches it keeps away from competitors.</p>
<p>That’s the eBay result. eBay switched off its brand keyword ads and found that almost all of the traffic came back through organic search <span class="citation" data-cites="blake_2015">(Blake et al. 2015)</span>. The simulation bakes in the same story, and a regression of sales on branded spend still calls it the best channel in the model, because spend goes up exactly when demand goes up.</p>
<p>In the joint model the spend gets its own equation, which is the bill (CPC times paid clicks), and the bid gets to decide the click split. The data that pins down the split without the bid is the eight holdout weeks. Without them the model can tell you how clicks split with the bid on, but it can’t tell you where they’d go with it off, and you’d be back to guessing. With them, the accounting gives the value of the bid directly:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7Bbid%20value%20per%20branded%20search%7D%20=%20v%20%5Ccdot%20%5Cleft(s_%5Ctext%7Bpaid%7D%20+%20s_%5Ctext%7Borg%7D%20-%20s_%5Ctext%7Borg%7D%5E%5Ctext%7Boff%7D%5Cright)%20-%20s_%5Ctext%7Bpaid%7D%20%5Ccdot%20%5Ctext%7BCPC%7D%0A"></p>
<p>Here that’s <img src="https://latex.codecogs.com/png.latex?1.5%20%5Ctimes%20(0.60%20+%200.38%20-%200.95)%20-%200.60%20%5Ctimes%200.5%20=%20-0.255">, and the joint model gets <img src="https://latex.codecogs.com/png.latex?-0.26"> (90% interval <img src="https://latex.codecogs.com/png.latex?-0.27"> to <img src="https://latex.codecogs.com/png.latex?-0.25">) on the single dataset. Every branded search with the bid on costs a quarter of a euro more than it brings in. The break-even is easy to read off: the bid pays for itself when switching it off would lose more than <img src="https://latex.codecogs.com/png.latex?s_%5Ctext%7Bpaid%7D%20%5Ccdot%20%5Ctext%7BCPC%7D%20/%20v%20=%200.6%20%5Ctimes%200.5%20/%201.5%20=%2020"> percent of branded searches to competitors. If competitors bid hard on your name, that can happen, and the same accounting will tell you to defend it.</p>
<p>So the model never treats branded search as a budget line you can turn up, and that’s correct. You can’t buy more branded clicks than there are people searching for your brand. The bill rises with demand, or because you raised your bids and the CPC went with them. What the model can recommend is a bidding policy: bid where switching off would leak more than the break-even share, and don’t bid where it wouldn’t.</p>
<p>That changes how branded search should sit in a budget optimizer. It’s a cost that moves with demand while you bid, and that matters for every other channel. When the optimizer adds TV, TV lifts branded searches, and with the bid on you pay for the 60 percent of those searches that click the ad. The same path tracing that gives TV’s total effect on sales gives its total effect on cost:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7BTV%20cost%20per%20euro%7D%20=%201%20+%20a%20%5Ccdot%20%5Cleft(s_%5Ctext%7Bpaid%7D%20%5Ccdot%20%5Ctext%7BCPC%7D%20+%20%5Ctext%7Bfollow%7D%20%5Ccdot%20c%5Cright)%0A"></p>
<p>where follow is 1 if the social budget follows search and 0 if it’s frozen. With the bid on, every euro of TV costs another 0.24 in branded clicks, and another 0.48 in paid social if the planner follows search trends. Put the sales and the costs together and the return on TV depends on both policies:</p>
<div id="tbl-roi" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-roi-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;3: True return per euro of TV, sales over total cost including the branded clicks and the social budget TV triggers, with the joint model’s average across 2,000 datasets in brackets.
</figcaption>
<div aria-describedby="tbl-roi-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Return per euro of TV</th>
<th>Social frozen</th>
<th>Social follows search</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bid on</td>
<td>1.75 (joint model 1.76)</td>
<td>1.40 (1.41)</td>
</tr>
<tr class="even">
<td>Bid off</td>
<td>2.14 (2.15)</td>
<td>1.61 (1.61)</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Switching the bid off costs TV 3 percent of the searches it creates and takes away the toll it pays on 60 percent of them, so TV’s return goes up in both columns.</p>
<p>Compare that with the second row of Table&nbsp;1. The single-equation MMM credits branded search with 3.11 per euro of sales that come from people searching for you, many of them sent by TV, and charges TV nothing for the branded clicks it causes. It undersells TV’s sales, ignores the clicks TV pays for, and points the budget at the line in the model that’s worth 0.15. Google’s own Meridian guidance models brand keyword campaigns as a channel on clicks, with a response curve and an ROI like any other channel <span class="citation" data-cites="meridian_paidsearch">(Google 2026)</span>. Google sells those clicks.</p>
<p>Disclosure: I build <a href="https://alviss.io">Alviss</a>, a European Bayesian MMM platform, which competes with Meridian.</p>
</section>
<section id="what-changes-in-a-real-mmm" class="level2">
<h2 class="anchored" data-anchor-id="what-changes-in-a-real-mmm">What changes in a real MMM</h2>
<p>My toy is linear, and real MMMs aren’t. Media effects carry over (adstock) and saturate, and once you have curves the product-of-coefficients shortcut stops being exact. The principle survives, but the accounting becomes a simulation. To get TV’s total effect you take each posterior draw, bump TV spend, push the bump through the search equation, the click split, the budget rule and the sales equation, and compare predicted sales (and predicted cost) with and without the bump. That’s an intervention computed on the model. The saturation curves also break conjugacy, so the closed-form posterior goes out the window and you’re back to MCMC in a probabilistic programming language, but the accounting is still a few lines more than the linear version. It also handles timing properly: TV this week lifts search over the next few weeks, and the clicks, the bill and the planner’s response follow over the same weeks.</p>
<p>The data for the click split is usually available already. Paid clicks come from the ads platform, and organic clicks on your brand terms come from Search Console. What’s almost never available is the bid-off share, because almost nobody switches the bid off. A few weeks of holdout, or a geo split, is cheap and it’s the one experiment this model can’t do without.</p>
<p>The model also grows in a fairly natural way. With several markets or brands, each equation gets its own coefficients per market, partially pooled towards a shared mean, so a small market with noisy search data borrows strength from the larger ones. That’s the same hierarchy most Bayesian MMMs already have on the sales equation, applied to the other equations as well.</p>
<p>And Quentin’s worry about ten channels? It’s a fair worry. With ten channels you have more of these structures, possibly in conflicting directions. But the fix scales: each variable that something else depends on gets an equation, and the accounting is still path tracing over the graph. What doesn’t scale is writing a separate one-treatment model for every channel and hoping their answers add up to the sales you actually observed. A joint model forces them to.</p>
</section>
<section id="the-parts-this-doesnt-fix" class="level2">
<h2 class="anchored" data-anchor-id="the-parts-this-doesnt-fix">The parts this doesn’t fix</h2>
<p>This works if the graph is right, and that’s a big if. Three things will break it.</p>
<p>First, unobserved confounding between search volume and sales. In my simulation the extra noise in search volume affects sales only through the clicks. In real life, seasonal demand drives both branded search and sales directly (people search for your brand in December because they were going to buy in December anyway). If you don’t model that demand, <img src="https://latex.codecogs.com/png.latex?v"> is too large and TV’s indirect effect is overstated with it. Seasonality, price, promotions and macro all need to be in the sales equation <em>and</em> the search equation.</p>
<p>Second, getting the arrows wrong. If paid social actually drives some of the branded search volume (people see the ad and then search), there’s an arrow from paid social to X, and the accounting has to include it. You need to decide the direction from what you know about the business, because the data alone usually won’t tell you.</p>
<p>Third, the estimand. “TV’s effect” is ambiguous until you say what happens to everything else when you change TV. Does the planner keep following search trends? Is the bid on? The model will happily give you every answer, but someone has to decide which question the business is asking. In my experience this is where most of the real arguments happen.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Quentin is right that a single regression can’t serve a variable that confounds one channel and mediates another. The answer is to stop asking one equation to do the work of several. Give the confounder its own equation, give the budget rule that responds to it its own equation, give the results page its own equation, fit them together, and get each causal effect by tracing paths through the fitted model. In the simulation that recovered TV’s total effect under both budget rules, paid social’s effect and the value of the brand keyword bid, from one model, with calibrated intervals. The same accounting stops branded search spend from claiming TV’s sales, and charges TV for the branded clicks it causes for as long as you keep paying for them.</p>
<p>It’s still only as good as the graph you draw and the variation in your data, and some numbers (paid social here, where clicks go without the bid in general) need an experiment to pin them down. But the “often not causal” part comes from how MMMs are usually specified, and the specification is yours to change. The Julia code is short, so it should be easy to wrap your head around (<a href="code/model.jl">model</a>, <a href="code/conjugate.jl">conjugate regression</a>, <a href="code/accounting.jl">accounting</a>, <a href="code/sim.jl">one dataset</a>, <a href="code/mc.jl">2,000 datasets</a>, <a href="code/mc_nohold.jl">the bid never off</a>, <a href="code/coverage.jl">coverage</a>). Take it, break it, add the arrow from paid social back to branded search, and see what happens. And if you spot a mistake, reach out and tell me.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-blake_2015" class="csl-entry">
Blake, Thomas, Chris Nosko, and Steven Tadelis. 2015. <span>“Consumer Heterogeneity and Paid Search Effectiveness: A Large-Scale Field Experiment.”</span> <em>Econometrica</em> 83 (1): 155–74.
</div>
<div id="ref-gallea_linkedin" class="csl-entry">
Gallea, Quentin. 2026. <span>“Why Is Marketing Mix Modeling (MMM) so Often Not Causal?”</span> <a href="https://www.linkedin.com/feed/update/urn:li:share:7516025366390628352/">https://www.linkedin.com/feed/update/urn:li:share:7516025366390628352/</a>.
</div>
<div id="ref-meridian_paidsearch" class="csl-entry">
Google. 2026. <span>“Meridian: Paid Search Modeling.”</span> <a href="https://developers.google.com/meridian/docs/advanced-modeling/paid-search-modeling">https://developers.google.com/meridian/docs/advanced-modeling/paid-search-modeling</a>.
</div>
<div id="ref-pearl_2009" class="csl-entry">
Pearl, Judea. 2009. <em>Causality: Models, Reasoning, and Inference</em>. 2nd ed. Cambridge University Press.
</div>
<div id="ref-wright_1920" class="csl-entry">
Wright, Sewall. 1920. <span>“The Relative Importance of Heredity and Environment in Determining the Piebald Pattern of Guinea-Pigs.”</span> <em>Proceedings of the National Academy of Sciences</em> 6 (6): 320–32.
</div>
<div id="ref-wright_1921" class="csl-entry">
Wright, Sewall. 1921. <span>“Correlation and Causation.”</span> <em>Journal of Agricultural Research</em> 20 (7): 557–85.
</div>
</div></section></div> ]]></description>
  <category>causal inference</category>
  <category>marketing mix modeling</category>
  <category>Bayesian statistics</category>
  <category>Julia</category>
  <category>MMM</category>
  <guid>https://drmike.xyz/posts/give-the-confounder-its-own-equation/</guid>
  <pubDate>Mon, 19 Oct 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/give-the-confounder-its-own-equation/figs/dag.light.png" medium="image" type="image/png" height="74" width="144"/>
</item>
<item>
  <title>Who’s paying for all of this?</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/whos-paying-for-all-of-this/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>Anthropic wants to list on Nasdaq at roughly $2 trillion, according to the FT, which would make it the largest IPO ever <span class="citation" data-cites="fortune_ipo2t">(Fortune 2026a)</span>. Eighteen months ago the same company raised money at $61.5 billion <span class="citation" data-cites="lsvp_seriese">(Lightspeed Venture Partners 2025)</span>. Revenue has grown fast in that time (fair’s fair, it has grown absurdly fast), but a 32x markup in a year and a half needs more than fast growth. It needs someone at the end of the line to pay for it.</p>
<p>So who is that? Follow the money for long enough and the answer is you. More precisely, it’s your pension fund, your index fund, and the university endowment your alma mater keeps emailing you about. The money goes round a loop between the labs, the clouds and Nvidia, it gets booked as revenue at every stop, and the only cash that enters the loop from outside comes from people who never asked to be in it. For a $2 trillion price to make any sense, Anthropic has to end up earning roughly what Microsoft earns.</p>
</section>
<section id="the-recycling-engine" class="level2">
<h2 class="anchored" data-anchor-id="the-recycling-engine">The recycling engine</h2>
<div id="fig-circular" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-circular-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/circular.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: The AI recycling engine. Real cash enters from the top (orange): venture and sovereign money, shareholders’ free cash flow, and bonds and private credit. Customer revenue (teal) is real but a fraction of what circulates. The money moves between the labs, the hyperscalers and the neoclouds (blue) and settles at Nvidia and the hardware vendors (green), which send part of it back as equity, warrants and guarantees. The IPO closes the loop: public shareholders buy in and early investors cash out (dashed)."><img src="https://drmike.xyz/posts/whos-paying-for-all-of-this/figs/circular.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/circular.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;1: The AI recycling engine. Real cash enters from the top (orange): venture and sovereign money, shareholders’ free cash flow, and bonds and private credit. Customer revenue (teal) is real but a fraction of what circulates. The money moves between the labs, the hyperscalers and the neoclouds (blue) and settles at Nvidia and the hardware vendors (green), which send part of it back as equity, warrants and guarantees. The IPO closes the loop: public shareholders buy in and early investors cash out (dashed)."><img src="https://drmike.xyz/posts/whos-paying-for-all-of-this/figs/circular.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-circular-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The AI recycling engine. Real cash enters from the top (orange): venture and sovereign money, shareholders’ free cash flow, and bonds and private credit. Customer revenue (teal) is real but a fraction of what circulates. The money moves between the labs, the hyperscalers and the neoclouds (blue) and settles at Nvidia and the hardware vendors (green), which send part of it back as equity, warrants and guarantees. The IPO closes the loop: public shareholders buy in and early investors cash out (dashed).
</figcaption>
</figure>
</div>
<p>Arrow 8 is the circle, and it’s where it gets silly. Amazon has put $8 billion into Anthropic, added $5 billion in April, and promised up to $20 billion more tied to milestones. In the same announcement Anthropic committed more than $100 billion to AWS over ten years <span class="citation" data-cites="amazon_anthropic2026">(Amazon 2026)</span>. Google put in $3 billion for about 14 percent, then offered up to $40 billion more, and Google is also the company selling Anthropic its TPUs <span class="citation" data-cites="techcrunch_google40b anthropic_gbroadcom">(TechCrunch 2026b; Anthropic 2026a)</span>. Microsoft and Nvidia pledged up to $15 billion between them in November 2025, and Anthropic committed $30 billion to Azure on the same day <span class="citation" data-cites="msft_anthropic2025">(Microsoft 2025)</span>. AMD invests up to $5 billion and sells Anthropic up to two gigawatts of MI450 GPUs <span class="citation" data-cites="amd_anthropic2026">(AMD 2026)</span>. Akamai signed an $11.6 billion compute deal and gave Anthropic a warrant for up to 5 percent of Akamai as a thank you <span class="citation" data-cites="akamai_8k">(Akamai Technologies 2026)</span>.</p>
<p>Ok so think about what that does to the books. Amazon hands Anthropic a dollar. Anthropic hands the dollar back to AWS for compute. AWS books it as cloud revenue, and Amazon’s stake in Anthropic gets marked up at the next round, which was priced partly on how much compute Anthropic has locked in. The same dollar shows up as an investment, a cost, a revenue line and a valuation gain. Nobody in that sentence broke a law. It’s also a pretty strange way to measure demand.</p>
<p>Arrows 11 and 12 are Nvidia’s contribution. Nvidia signed a letter of intent to put “up to $100 billion” into OpenAI while OpenAI bought Nvidia systems <span class="citation" data-cites="nvidia_openai_loi">(NVIDIA 2025)</span>. That letter never became a contract. It turned into a $30 billion equity cheque in OpenAI’s February round <span class="citation" data-cites="tc_openai110b">(TechCrunch 2026c)</span>. Nvidia’s latest 10-Q shows it guaranteeing up to $105 billion of 20-year data-center leases for an OpenAI affiliate in Ohio, kicking in if the tenant defaults, on a campus that runs Nvidia hardware exclusively. The same filing lists $99 billion of equity investments, another $25 billion committed “in AI model makers, infrastructure financiers”, and $36 billion of commitments to buy back cloud capacity from the AI clouds it sells chips to <span class="citation" data-cites="nvda_10q">(NVIDIA Corporation 2026)</span>. On the Anthropic side, Nvidia backs Lambda, supplies Lambda’s GPUs and holds the lease on the site where Lambda will run Anthropic’s $35 billion contract <span class="citation" data-cites="bbg_lambda">(Bloomberg 2026c)</span>.</p>
<p>AMD did the OpenAI version with a straight face. OpenAI gets a warrant for 160 million AMD shares at one cent each, vesting as OpenAI buys AMD chips and as AMD’s share price climbs <span class="citation" data-cites="amd_openai_8k">(Advanced Micro Devices 2025)</span>. Buy our GPUs and we’ll pay you in our stock, which goes up when you buy our GPUs.</p>
</section>
<section id="where-the-money-comes-from" class="level2">
<h2 class="anchored" data-anchor-id="where-the-money-comes-from">Where the money comes from</h2>
<p>Everything inside the loop is a transfer. Somebody has to put real cash in at the top, and there are four somebodies.</p>
<p>The first is venture money. US venture funding hit a record $267 billion in the first quarter of 2026, 89 percent of it went to AI, and 73 percent of the total went to five companies: OpenAI, Anthropic, xAI, Waymo and Databricks <span class="citation" data-cites="pitchbook_q1">(SiliconANGLE 2026)</span>. That money belongs to the funds’ limited partners, which are pension funds, insurers, endowments and foundations. When a VC fund writes a billion-dollar cheque into a pre-IPO round, it’s writing it with a teacher’s retirement savings.</p>
<p>The second is sovereign money. GIC (Singapore) took part in Anthropic’s Series F, co-led the Series G and co-led the Series H. Qatar’s QIA joined the Series F, Abu Dhabi’s MGX co-led the Series G, and Temasek came in on the Series H <span class="citation" data-cites="gic_seriesf crunchbase_seriesg anthropic_seriesh">(GIC 2025; Crunchbase News 2026; Anthropic 2026b)</span>. That’s state reserves, the money a country saves for when the oil runs out or the population gets old.</p>
<p>The third, and the biggest, is you as a shareholder. Microsoft, Amazon, Alphabet and Meta guided to roughly $725 billion of capital expenditure for 2026, up from about $410 billion in 2025 <span class="citation" data-cites="bbg_alphabet_capex sherwood_capex wealthadvisor_capex">(Bloomberg 2026d; Sherwood News 2026; The Wealth Advisor 2026)</span>. FactSet expects free cash flow near zero or negative for everyone in that group except Alphabet and Microsoft, and counts another $820 billion of lease commitments sitting off the balance sheets <span class="citation" data-cites="factset_capex">(FactSet 2026)</span>. The cash that used to come back to shareholders as buybacks and dividends is now going into data centers.</p>
<p>The fourth is borrowed money, because when the cash runs out they borrow. Amazon, Alphabet, Meta and Oracle had issued about $194 billion of bonds by late July, against $108 billion in the whole of 2025. Order books that were five times covered in February were under two times covered by July <span class="citation" data-cites="fortune_aidebt">(Fortune 2026b)</span>. Meta’s Hyperion data center sits in a $27 billion special purpose vehicle, 80 percent owned by Blue Owl, and Pimco bought about $18 billion of the bonds <span class="citation" data-cites="meta_hyperion">(Global Data Center Hub 2025)</span>. Anthropic’s TPUs get the same treatment: an Apollo and Blackstone vehicle of about $35 billion buys Google chips and leases them to Anthropic, with Broadcom guaranteeing what the chips will be worth at the end <span class="citation" data-cites="axios_apollo">(Axios 2026)</span>. Pimco and Apollo manage money for, you guessed it, pensions and insurers.</p>
<p>SoftBank deserves its own paragraph. To fund its OpenAI commitments it sold its entire Nvidia stake <span class="citation" data-cites="cnbc_softbank_nvda">(CNBC 2025)</span>, took a $40 billion unsecured bridge loan <span class="citation" data-cites="bbg_softbank_bridge">(Bloomberg 2026f)</span>, took a $10 billion margin loan secured on its OpenAI shares <span class="citation" data-cites="bbg_softbank_margin">(Bloomberg 2026e)</span>, and on 23 September sold $11.1 billion of junk bonds, the largest high-yield corporate bond issue ever, to pay the next $10 billion tranche <span class="citation" data-cites="softbank_hybond">(Reuters via US News 2026)</span>.</p>
<p>Finally there’s the index. The ten largest stocks are now almost 40 percent of the S&amp;P 500, up from 17 percent in 2015 <span class="citation" data-cites="awoc_concentration">(Carlson 2026)</span>. If you own a plain index fund you own the loop already, whether you wanted to or not. An Anthropic listing at $2 trillion would add one more very large member.</p>
</section>
<section id="who-gains" class="level2">
<h2 class="anchored" data-anchor-id="who-gains">Who gains</h2>
<p>Nvidia gains first and most. In the quarter to 26 July it booked $96.2 billion of revenue and $59.7 billion of net income, a 62 percent net margin. Three direct customers made up 44 percent of first-half revenue <span class="citation" data-cites="nvda_10q">(NVIDIA Corporation 2026)</span>. Nvidia sells the shovels, lends money to the people buying shovels, and guarantees the leases on the sheds the shovels are stored in. Its own 10-Q says that the AI clouds it supports “lack the ability to secure long-term infrastructure contracts and investment-grade financing” <span class="citation" data-cites="nvda_10q">(NVIDIA Corporation 2026)</span>.</p>
<p>The hyperscalers gain in two places. Lab spending on their clouds shows up as revenue growth, which is the number their share price trades on, and their equity stakes in the labs get marked up at every round. The first gain is real cash from outside investors passing through the lab. The second gain is on paper.</p>
<p>The early investors gain the most per dollar. Lightspeed led the Series E at $61.5 billion in March 2025 <span class="citation" data-cites="lsvp_seriese">(Lightspeed Venture Partners 2025)</span>. At $2 trillion that’s a 32x markup in eighteen months. An IPO is the moment where that paper gain becomes cash, and the cash has to come from whoever buys at the listing. Goldman, JPMorgan and Morgan Stanley gain too. They’re lined up to underwrite the IPO and they already lead Anthropic’s $15 billion credit facility <span class="citation" data-cites="bbg_anthropic_revolver">(Bloomberg 2026a)</span>.</p>
<p>Founders and early employees gain, and good for them, they built something people use. My problem is with the structure, where the private money that took the risk early gets to sell at a price set by a circular deal flow to the public money that arrives last.</p>
</section>
<section id="what-2-trillion-has-to-earn" class="level2">
<h2 class="anchored" data-anchor-id="what-2-trillion-has-to-earn">What $2 trillion has to earn</h2>
<p>Ok so let’s do the maths. A company is worth what it will pay its owners over its life. A mature, profitable software company trades at something like 20 to 30 times its earnings. So to be worth $2 trillion, Anthropic needs annual profits of about $2 trillion divided by that multiple, and the revenue it needs depends on what share of revenue it keeps as profit.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1">V <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># valuation, $B</span></span>
<span id="cb1-2"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> pe <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>):</span>
<span id="cb1-3">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(pe, [<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">round</span>(V <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (pe <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> m)) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> m <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.39</span>)])</span></code></pre></div></div>
<div id="tbl-revenue" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-revenue-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Annual revenue Anthropic needs to justify $2 trillion at a given earnings multiple and net margin.
</figcaption>
<div aria-describedby="tbl-revenue-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Price/earnings</th>
<th>15% net margin</th>
<th>20%</th>
<th>30%</th>
<th>39% (Microsoft)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>20x</td>
<td>$667B</td>
<td>$500B</td>
<td>$333B</td>
<td>$256B</td>
</tr>
<tr class="even">
<td>25x</td>
<td>$533B</td>
<td>$400B</td>
<td>$267B</td>
<td>$205B</td>
</tr>
<tr class="odd">
<td>30x</td>
<td>$444B</td>
<td>$333B</td>
<td>$222B</td>
<td>$171B</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>For reference, Microsoft made $332 billion of revenue in its 2026 fiscal year and $129 billion of net income after stripping out its gains on OpenAI, a 39 percent net margin <span class="citation" data-cites="msft_fy26">(Microsoft 2026)</span>. Microsoft has had fifty years, an operating system monopoly and Office to get there. Even with Microsoft’s margin and a generous multiple, Anthropic needs $170 to $260 billion of revenue a year. With a margin that fits a business whose main cost is renting GPUs (15 to 20 percent), it needs $330 to $670 billion. And that only justifies today’s price. A buyer at $2 trillion who wants 10 percent a year for five years needs those numbers 61 percent higher by year five.</p>
<p>Where is Anthropic today? The run-rate passed $65 billion at the end of July, according to investor documents seen by Bloomberg <span class="citation" data-cites="bbg_run65">(Bloomberg 2026b)</span>, and investors expect $100 to $120 billion by year end <span class="citation" data-cites="fortune_ipo2t">(Fortune 2026a)</span>. That’s impressive growth. Against the year-end figure the table is still 1.5 to 7 times away, and against today’s run-rate it’s 3 to 10 times.</p>
<p>Then there’s profit, and there’s no audited evidence that Anthropic makes any. The WSJ reported that Anthropic projected $559 million of adjusted operating profit for Q2 2026 on $10.9 billion of revenue, about 5 percent. That figure includes training but leaves out stock-based compensation, it’s unaudited, it covers a single quarter, and Anthropic told investors it may not stay profitable for the full year because compute and training spend is going up <span class="citation" data-cites="wsj_q2profit">(Wall Street Journal via Yahoo Finance 2026)</span>. Ed Zitron points out that the quarter also includes the months when the SpaceX compute contract ran at a reduced ramp-up fee, before the full $1.25 billion a month applies <span class="citation" data-cites="zitron_swindle tc_xai_colossus">(Zitron 2026; TechCrunch 2026a)</span>. The “above 80 percent gross margin” that went round in September is a different number, and it’s measured before the revenue Anthropic shares with its cloud partners and before training costs <span class="citation" data-cites="dealroom_80">(Dealroom 2026)</span>. Early this year The Information reported that Anthropic had cut its 2025 gross margin forecast to about 40 percent, because inference on Google and AWS cost 23 percent more than planned <span class="citation" data-cites="info_margin40">(The Information via Investing.com 2026b)</span>. The same outlet reported that Anthropic doesn’t expect to be cash-flow positive before 2028 <span class="citation" data-cites="info_anthropic_cf2028">(The Information 2026)</span>. The first full-year numbers came from Anthropic’s draft prospectus, which Reuters saw in late September. Revenue in 2025 was about $4.6 billion, the operating loss was more than $8 billion, and the net loss was $42 billion, of which about $34 billion is a non-cash charge on financing that may convert into shares. The draft has no 2026 figures, and the public S-1 is still not on EDGAR <span class="citation" data-cites="reuters_prospectus">(Reuters via CNBC 2026)</span>.</p>
<p>And then there are the obligations, which is where I’d look if I were asked to buy. Anthropic’s revolving credit facility is $15 billion <span class="citation" data-cites="bbg_anthropic_revolver">(Bloomberg 2026a)</span>, which is small. The real debt is the compute. By The Information’s count Anthropic had signed about $517 billion of compute deals, 14.8 gigawatts, in the eleven months to August <span class="citation" data-cites="wallst_517b">(24/7 Wall St. 2026)</span>. The draft prospectus puts the total at about $518 billion over roughly ten years, and about 80 percent of it can’t be cancelled. Broadcom accounts for $161 billion, Google $111 billion, Amazon $110 billion and Microsoft $31 billion <span class="citation" data-cites="reuters_prospectus cloudnews_518b">(Reuters via CNBC 2026; CloudComputing News 2026)</span>. That’s $113 of committed compute for every dollar Anthropic earned in 2025. Spread over ten years it’s $52 billion a year, against a current run-rate of $65 billion. So the committed compute bill alone is 80 percent of everything Anthropic currently sells, before a single salary is paid.</p>
<p>That’s fine if revenue keeps compounding. Every one of those contracts is a bet that it will. For comparison, OpenAI’s own plan, as reported by the FT, has it burning about $280 billion of free cash flow from 2026 to 2030, while revenue grows from $36 billion to $350 billion <span class="citation" data-cites="ft_openai280b">(GV Wire / Reuters 2026)</span>.</p>
</section>
<section id="why-i-wouldnt-buy-it" class="level2">
<h2 class="anchored" data-anchor-id="why-i-wouldnt-buy-it">Why I wouldn’t buy it</h2>
<p>The price assumes Anthropic becomes Microsoft. It might. But Microsoft’s margin comes from software that costs almost nothing to copy. Anthropic’s product costs real electricity every time someone uses it, and it sells into a market where the price keeps falling. Claude Fable 5.1 shipped in September about 25 percent cheaper than Fable 5 <span class="citation" data-cites="doom_post">(Green 2026b)</span>, which is great for me as a user and bad for a $2 trillion multiple.</p>
<p>The moat is thin. On the Artificial Analysis index the best open-weights model, Xiaomi’s MiMo-V2.6-Pro, sits 11.3 points behind Claude Opus 5.5. It’s MIT licensed, and anyone can download it, run it and fine-tune it <span class="citation" data-cites="scoreboard">(Green 2026a)</span>. Eleven points is a real gap today. It’s also a gap that anyone paying Anthropic’s prices has a strong incentive to close. When my own team picked a coding assistant in September we ended up self-hosting Qwen3.8-27B on our own server. Anthropic’s other defence is regulatory, and I’ve written about how neatly the doom talk lines up with the funding calendar <span class="citation" data-cites="doom_post">(Green 2026b)</span>.</p>
<p>You get no say. Anthropic is a public benefit corporation, so its directors are allowed to weigh the mission against your returns. Since April the board majority has been appointed by the Long-Term Benefit Trust, whose trustees hold no financial stake <span class="citation" data-cites="anthropic_ltbt">(Anthropic 2023)</span>. And the IPO structure proposed in September would give the seven co-founders 50.1 percent of the vote on most matters through supervoting shares <span class="citation" data-cites="info_supervote">(The Information via Investing.com 2026a)</span>. You’d be paying $2 trillion for a company where you can’t elect a board majority and the directors are allowed to put you second.</p>
<p>The hardware depreciates. Michael Burry’s argument is that the hyperscalers are stretching the useful life of their GPUs on paper, which understates depreciation by about $176 billion between 2026 and 2028 <span class="citation" data-cites="burry_depr">(Burry 2025)</span>. If a GPU is really worth something for three years and the lease runs for six, then the second half of every one of those compute contracts is paying for old chips.</p>
<p>And you’re the exit. Every earlier buyer in the chart above either gets paid in revenue on the way round or gets to sell at the listing. The public buyer at the IPO is the first participant whose only way out is someone else paying more.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>The AI loop is a real business wrapped in a financing structure that makes it look bigger than it is. The models are good and the revenue is real. The valuation assumes revenue several times larger, at margins nobody in the business has shown yet, while the same few companies pass the same dollars round in a circle and count them at every stop. The cash that keeps the circle spinning comes from pension funds, sovereign reserves and index investors, and a $2 trillion IPO sells the next and largest piece to them. So before your pension fund buys in at the listing, who’s going to pay them more?</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-wallst_517b" class="csl-entry">
24/7 Wall St. 2026. <span>“Anthropic Locks down $517 Billion in Compute Ahead of IPO, and It’s Still Not Enough.”</span> <a href="https://247wallst.com/investing/2026/09/13/anthropic-locks-down-517-billion-in-compute-ahead-of-ipo-and-its-still-not-enough/">https://247wallst.com/investing/2026/09/13/anthropic-locks-down-517-billion-in-compute-ahead-of-ipo-and-its-still-not-enough/</a>.
</div>
<div id="ref-amd_openai_8k" class="csl-entry">
Advanced Micro Devices. 2025. <span>“Form 8-k: OpenAI Warrant and 6 GW Agreement.”</span> <a href="https://www.sec.gov/Archives/edgar/data/2488/000119312525230895/d28189d8k.htm">https://www.sec.gov/Archives/edgar/data/2488/000119312525230895/d28189d8k.htm</a>.
</div>
<div id="ref-akamai_8k" class="csl-entry">
Akamai Technologies. 2026. <span>“Form 8-k: Compute Agreement and Warrant Issued to Anthropic.”</span> <a href="https://www.sec.gov/Archives/edgar/data/0001086222/000119312526401048/d288154d8k.htm">https://www.sec.gov/Archives/edgar/data/0001086222/000119312526401048/d288154d8k.htm</a>.
</div>
<div id="ref-amazon_anthropic2026" class="csl-entry">
Amazon. 2026. <span>“Amazon Invests Additional $5 Billion in Anthropic.”</span> <a href="https://www.aboutamazon.com/news/company-news/amazon-invests-additional-5-billion-anthropic-ai">https://www.aboutamazon.com/news/company-news/amazon-invests-additional-5-billion-anthropic-ai</a>.
</div>
<div id="ref-amd_anthropic2026" class="csl-entry">
AMD. 2026. <span>“AMD and Anthropic Announce Strategic Partnership to Deploy up to 2 Gigawatts of AMD Instinct MI450 Series GPUs.”</span> <a href="https://ir.amd.com/news-events/press-releases/detail/1292/amd-and-anthropic-announce-strategic-partnership-to-deploy-up-to-2-gigawatts-of-amd-instinct-mi450-series-gpus">https://ir.amd.com/news-events/press-releases/detail/1292/amd-and-anthropic-announce-strategic-partnership-to-deploy-up-to-2-gigawatts-of-amd-instinct-mi450-series-gpus</a>.
</div>
<div id="ref-anthropic_ltbt" class="csl-entry">
Anthropic. 2023. <span>“The Long-Term Benefit Trust.”</span> <a href="https://www.anthropic.com/news/the-long-term-benefit-trust">https://www.anthropic.com/news/the-long-term-benefit-trust</a>.
</div>
<div id="ref-anthropic_gbroadcom" class="csl-entry">
Anthropic. 2026a. <span>“Anthropic Expands Google and Broadcom Compute Partnership.”</span> <a href="https://www.anthropic.com/news/google-broadcom-partnership-compute">https://www.anthropic.com/news/google-broadcom-partnership-compute</a>.
</div>
<div id="ref-anthropic_seriesh" class="csl-entry">
Anthropic. 2026b. <span>“Anthropic Raises $65B in Series h Funding at $965B Post-Money Valuation.”</span> <a href="https://www.anthropic.com/news/series-h">https://www.anthropic.com/news/series-h</a>.
</div>
<div id="ref-axios_apollo" class="csl-entry">
Axios. 2026. <span>“Apollo and Blackstone Back Anthropic TPU Financing.”</span> <a href="https://www.axios.com/2026/06/10/apollo-anthropic-blackstone-broadcom">https://www.axios.com/2026/06/10/apollo-anthropic-blackstone-broadcom</a>.
</div>
<div id="ref-bbg_anthropic_revolver" class="csl-entry">
Bloomberg. 2026a. <span>“Anthropic Nears Finalizing $15 Billion Pre-IPO Credit Facility.”</span> <a href="https://www.bloomberg.com/news/articles/2026-09-03/anthropic-nears-finalizing-15-billion-pre-ipo-credit-facility">https://www.bloomberg.com/news/articles/2026-09-03/anthropic-nears-finalizing-15-billion-pre-ipo-credit-facility</a>.
</div>
<div id="ref-bbg_run65" class="csl-entry">
Bloomberg. 2026b. <span>“Anthropic Revenue Run-Rate Surpasses $65 Billion Ahead of IPO.”</span> <a href="https://www.bloomberg.com/news/articles/2026-08-17/anthropic-revenue-run-rate-surpasses-65-billion-ahead-of-ipo">https://www.bloomberg.com/news/articles/2026-08-17/anthropic-revenue-run-rate-surpasses-65-billion-ahead-of-ipo</a>.
</div>
<div id="ref-bbg_lambda" class="csl-entry">
Bloomberg. 2026c. <span>“Anthropic Seals $35 Billion Cloud Deal with Nvidia-Backed Lambda.”</span> <a href="https://www.bloomberg.com/news/articles/2026-08-31/anthropic-seals-35-billion-cloud-deal-with-nvidia-backed-lambda">https://www.bloomberg.com/news/articles/2026-08-31/anthropic-seals-35-billion-cloud-deal-with-nvidia-backed-lambda</a>.
</div>
<div id="ref-bbg_alphabet_capex" class="csl-entry">
Bloomberg. 2026d. <span>“Google Boosts 2026 Spending Estimate to as Much as $205 Billion.”</span> <a href="https://www.bloomberg.com/news/articles/2026-07-22/google-boosts-2026-spending-estimate-to-as-much-as-205-billion">https://www.bloomberg.com/news/articles/2026-07-22/google-boosts-2026-spending-estimate-to-as-much-as-205-billion</a>.
</div>
<div id="ref-bbg_softbank_margin" class="csl-entry">
Bloomberg. 2026e. <span>“SoftBank Secures $10 Billion Margin Loan Backed by OpenAI Stake.”</span> <a href="https://www.bloomberg.com/news/articles/2026-08-06/softbank-secures-10-billion-margin-loan-backed-by-openai-stake">https://www.bloomberg.com/news/articles/2026-08-06/softbank-secures-10-billion-margin-loan-backed-by-openai-stake</a>.
</div>
<div id="ref-bbg_softbank_bridge" class="csl-entry">
Bloomberg. 2026f. <span>“SoftBank Secures Record $40 Billion Bridge Loan for OpenAI Stake.”</span> <a href="https://www.bloomberg.com/news/articles/2026-03-27/softbank-secures-record-40-billion-bridge-loan-for-openai-stake">https://www.bloomberg.com/news/articles/2026-03-27/softbank-secures-record-40-billion-bridge-loan-for-openai-stake</a>.
</div>
<div id="ref-burry_depr" class="csl-entry">
Burry, Michael. 2025. <span>“Understating Depreciation by Extending Useful Life of Assets.”</span> <a href="https://x.com/michaeljburry/status/1987918650104283372">https://x.com/michaeljburry/status/1987918650104283372</a>.
</div>
<div id="ref-awoc_concentration" class="csl-entry">
Carlson, Ben. 2026. <span>“It’s a Concentrated World.”</span> <a href="https://awealthofcommonsense.com/2026/09/its-a-concentrated-world/">https://awealthofcommonsense.com/2026/09/its-a-concentrated-world/</a>.
</div>
<div id="ref-cloudnews_518b" class="csl-entry">
CloudComputing News. 2026. <span>“Anthropic’s $518 Billion AI Infrastructure Plan Spans Major Cloud Providers.”</span> <a href="https://www.cloudcomputing-news.net/news/anthropic-ai-infrastructure-518-billion/">https://www.cloudcomputing-news.net/news/anthropic-ai-infrastructure-518-billion/</a>.
</div>
<div id="ref-cnbc_softbank_nvda" class="csl-entry">
CNBC. 2025. <span>“SoftBank Sells Its Entire Stake in Nvidia for $5.83 Billion.”</span> <a href="https://www.cnbc.com/2025/11/11/softbank-sells-its-entire-stake-in-nvidia-for-5point83-billion.html">https://www.cnbc.com/2025/11/11/softbank-sells-its-entire-stake-in-nvidia-for-5point83-billion.html</a>.
</div>
<div id="ref-crunchbase_seriesg" class="csl-entry">
Crunchbase News. 2026. <span>“Anthropic Raises $30B at $380B Valuation in Second-Largest Venture Deal.”</span> <a href="https://news.crunchbase.com/ai/anthropic-raises-30b-second-largest-deal-all-time/">https://news.crunchbase.com/ai/anthropic-raises-30b-second-largest-deal-all-time/</a>.
</div>
<div id="ref-dealroom_80" class="csl-entry">
Dealroom. 2026. <span>“Anthropic’s 80% Gross Margins Caveat Draws Fire Ahead of IPO Talk.”</span> <a href="https://dealroom.co/news/150675-anthropics-80-gross-margins-caveat-draws-fire-ahead-of-ipo-talk/">https://dealroom.co/news/150675-anthropics-80-gross-margins-caveat-draws-fire-ahead-of-ipo-talk/</a>.
</div>
<div id="ref-factset_capex" class="csl-entry">
FactSet. 2026. <span>“Hyperscalers Tap External Financing as AI Capex Outruns Cash Flow.”</span> <a href="https://insight.factset.com/hyperscalers-tap-external-financing-as-ai-capex-outruns-cash-flow">https://insight.factset.com/hyperscalers-tap-external-financing-as-ai-capex-outruns-cash-flow</a>.
</div>
<div id="ref-fortune_ipo2t" class="csl-entry">
Fortune. 2026a. <span>“Anthropic Reportedly Plans a $2 Trillion IPO in October.”</span> <a href="https://fortune.com/2026/08/13/anthropic-ipo-2-trillion-october-largest-ever-spacex/">https://fortune.com/2026/08/13/anthropic-ipo-2-trillion-october-largest-ever-spacex/</a>.
</div>
<div id="ref-fortune_aidebt" class="csl-entry">
Fortune. 2026b. <span>“The AI Boom Is Increasingly Built on Debt.”</span> <a href="https://fortune.com/2026/07/17/ai-boom-debt-blitz-investor-demand-hyperscaler-bond-issuance/">https://fortune.com/2026/07/17/ai-boom-debt-blitz-investor-demand-hyperscaler-bond-issuance/</a>.
</div>
<div id="ref-gic_seriesf" class="csl-entry">
GIC. 2025. <span>“Anthropic Raises $13B Series f at $183B Post-Money Valuation.”</span> <a href="https://www.gic.com.sg/newsroom/all/anthropic-raises-13b-series-f-at-183b-post-money-valuation/">https://www.gic.com.sg/newsroom/all/anthropic-raises-13b-series-f-at-183b-post-money-valuation/</a>.
</div>
<div id="ref-meta_hyperion" class="csl-entry">
Global Data Center Hub. 2025. <span>“Meta and Blue Owl’s $27B Bet.”</span> <a href="https://www.globaldatacenterhub.com/p/meta-blue-owls-27b-bet-is-this-the">https://www.globaldatacenterhub.com/p/meta-blue-owls-27b-bet-is-this-the</a>.
</div>
<div id="ref-scoreboard" class="csl-entry">
Green, Michael. 2026a. <span>“Europe’s Frontier AI Scoreboard.”</span> <a href="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/">https://drmike.xyz/posts/europe-frontier-ai-scoreboard/</a>.
</div>
<div id="ref-doom_post" class="csl-entry">
Green, Michael. 2026b. <span>“We Cannot Be That Stupid.”</span> <a href="https://drmike.xyz/posts/we-cant-be-that-stupid/">https://drmike.xyz/posts/we-cant-be-that-stupid/</a>.
</div>
<div id="ref-ft_openai280b" class="csl-entry">
GV Wire / Reuters. 2026. <span>“OpenAI Forecasts Cash Burn Near $280 Billion by 2030, FT Reports.”</span> <a href="https://gvwire.com/2026/09/19/openai-forecasts-cash-burn-near-280-billion-by-2030-ft-reports/">https://gvwire.com/2026/09/19/openai-forecasts-cash-burn-near-280-billion-by-2030-ft-reports/</a>.
</div>
<div id="ref-lsvp_seriese" class="csl-entry">
Lightspeed Venture Partners. 2025. <span>“Lightspeed Announces Lead Investment in Anthropic’s $3.5B Series e Financing.”</span> <a href="https://lsvp.com/stories/lightspeed-announces-lead-investment-in-anthropics-3-5b-series-e-financing/">https://lsvp.com/stories/lightspeed-announces-lead-investment-in-anthropics-3-5b-series-e-financing/</a>.
</div>
<div id="ref-msft_anthropic2025" class="csl-entry">
Microsoft. 2025. <span>“Microsoft, NVIDIA and Anthropic Announce Strategic Partnerships.”</span> <a href="https://blogs.microsoft.com/blog/2025/11/18/microsoft-nvidia-and-anthropic-announce-strategic-partnerships/">https://blogs.microsoft.com/blog/2025/11/18/microsoft-nvidia-and-anthropic-announce-strategic-partnerships/</a>.
</div>
<div id="ref-msft_fy26" class="csl-entry">
Microsoft. 2026. <span>“Microsoft Fiscal Year 2026 Fourth Quarter Earnings (Form 8-k, Exhibit 99.1).”</span> <a href="https://www.sec.gov/Archives/edgar/data/0000789019/000119312526323632/msft-ex99_1.htm">https://www.sec.gov/Archives/edgar/data/0000789019/000119312526323632/msft-ex99_1.htm</a>.
</div>
<div id="ref-nvidia_openai_loi" class="csl-entry">
NVIDIA. 2025. <span>“OpenAI and NVIDIA Announce Strategic Partnership to Deploy 10 Gigawatts of NVIDIA Systems.”</span> <a href="https://nvidianews.nvidia.com/news/openai-and-nvidia-announce-strategic-partnership-to-deploy-10gw-of-nvidia-systems">https://nvidianews.nvidia.com/news/openai-and-nvidia-announce-strategic-partnership-to-deploy-10gw-of-nvidia-systems</a>.
</div>
<div id="ref-nvda_10q" class="csl-entry">
NVIDIA Corporation. 2026. <span>“Form 10-q for the Quarter Ended July 26, 2026.”</span> <a href="https://www.sec.gov/Archives/edgar/data/1045810/000104581026000075/nvda-20260726.htm">https://www.sec.gov/Archives/edgar/data/1045810/000104581026000075/nvda-20260726.htm</a>.
</div>
<div id="ref-reuters_prospectus" class="csl-entry">
Reuters via CNBC. 2026. <span>“Anthropic’s IPO Prospectus Shows Sweeping AI Vision, Surging Costs.”</span> <a href="https://www.cnbc.com/2026/09/28/anthropics-ipo-prospectus-shows-sweeping-ai-vision-surging-costs-reuters.html">https://www.cnbc.com/2026/09/28/anthropics-ipo-prospectus-shows-sweeping-ai-vision-surging-costs-reuters.html</a>.
</div>
<div id="ref-softbank_hybond" class="csl-entry">
Reuters via US News. 2026. <span>“SoftBank Issues $11.1 Billion in Bonds in OpenAI Financing Push.”</span> <a href="https://money.usnews.com/investing/news/articles/2026-09-23/softbank-issues-11-1-billion-in-bonds-in-openai-financing-push">https://money.usnews.com/investing/news/articles/2026-09-23/softbank-issues-11-1-billion-in-bonds-in-openai-financing-push</a>.
</div>
<div id="ref-sherwood_capex" class="csl-entry">
Sherwood News. 2026. <span>“Big Tech Capital Expenditure Soared in 2025. It’s Going up Another 50% in 2026.”</span> <a href="https://sherwood.news/tech/big-tech-capital-expenditure-soared-in-2025-its-going-up-another-50-in-2026/">https://sherwood.news/tech/big-tech-capital-expenditure-soared-in-2025-its-going-up-another-50-in-2026/</a>.
</div>
<div id="ref-pitchbook_q1" class="csl-entry">
SiliconANGLE. 2026. <span>“PitchBook: US Venture Funding Surges to Record $267B as OpenAI, Anthropic and xAI Dominate AI Deals.”</span> <a href="https://siliconangle.com/2026/04/03/pitchbook-us-venture-funding-surges-record-267b-openai-anthropic-xai-dominate-ai-deals/">https://siliconangle.com/2026/04/03/pitchbook-us-venture-funding-surges-record-267b-openai-anthropic-xai-dominate-ai-deals/</a>.
</div>
<div id="ref-tc_xai_colossus" class="csl-entry">
TechCrunch. 2026a. <span>“Anthropic Will Pay xAI $1.25B Per Month for Compute.”</span> <a href="https://techcrunch.com/2026/05/20/anthropic-will-pay-xai-1-25-billion-per-month-for-compute/">https://techcrunch.com/2026/05/20/anthropic-will-pay-xai-1-25-billion-per-month-for-compute/</a>.
</div>
<div id="ref-techcrunch_google40b" class="csl-entry">
TechCrunch. 2026b. <span>“Google to Invest up to $40B in Anthropic in Cash and Compute.”</span> <a href="https://techcrunch.com/2026/04/24/google-to-invest-up-to-40b-in-anthropic-in-cash-and-compute/">https://techcrunch.com/2026/04/24/google-to-invest-up-to-40b-in-anthropic-in-cash-and-compute/</a>.
</div>
<div id="ref-tc_openai110b" class="csl-entry">
TechCrunch. 2026c. <span>“OpenAI Raises $110B in One of the Largest Private Funding Rounds in History.”</span> <a href="https://techcrunch.com/2026/02/27/openai-raises-110b-in-one-of-the-largest-private-funding-rounds-in-history/">https://techcrunch.com/2026/02/27/openai-raises-110b-in-one-of-the-largest-private-funding-rounds-in-history/</a>.
</div>
<div id="ref-info_anthropic_cf2028" class="csl-entry">
The Information. 2026. <span>“Anthropic Hikes 2026 Revenue Forecast 20% but Delays When It Will Go Cash Flow Positive.”</span> <a href="https://www.theinformation.com/articles/anthropic-hikes-2026-revenue-forecast-20-delays-will-go-cash-flow-positive">https://www.theinformation.com/articles/anthropic-hikes-2026-revenue-forecast-20-delays-will-go-cash-flow-positive</a>.
</div>
<div id="ref-info_supervote" class="csl-entry">
The Information via Investing.com. 2026a. <span>“Anthropic Proposes Supervoting Shares to Give Co-Founders Majority Control.”</span> <a href="https://www.investing.com/news/stock-market-news/anthropic-proposes-supervoting-shares-to-give-cofounders-majority-control-report-4916337">https://www.investing.com/news/stock-market-news/anthropic-proposes-supervoting-shares-to-give-cofounders-majority-control-report-4916337</a>.
</div>
<div id="ref-info_margin40" class="csl-entry">
The Information via Investing.com. 2026b. <span>“Anthropic Trims Profit Margin Outlook as AI Operating Costs Rise.”</span> <a href="https://www.investing.com/news/stock-market-news/anthropic-trims-profit-margin-outlook-as-ai-operating-costs-rise--the-information-4459316">https://www.investing.com/news/stock-market-news/anthropic-trims-profit-margin-outlook-as-ai-operating-costs-rise--the-information-4459316</a>.
</div>
<div id="ref-wealthadvisor_capex" class="csl-entry">
The Wealth Advisor. 2026. <span>“Magnificent 7 Earnings Rush Reveals AI Spending Surge, Hyperscaler Capex Set to Reach $725 Billion.”</span> <a href="https://www.thewealthadvisor.com/article/magnificent-7-earnings-rush-reveals-ai-spending-surge-hyperscaler-capex-set-reach-725">https://www.thewealthadvisor.com/article/magnificent-7-earnings-rush-reveals-ai-spending-surge-hyperscaler-capex-set-reach-725</a>.
</div>
<div id="ref-wsj_q2profit" class="csl-entry">
Wall Street Journal via Yahoo Finance. 2026. <span>“Anthropic Revenue Set to More Than Double to $10.9 Billion in Q2.”</span> <a href="https://finance.yahoo.com/markets/stocks/articles/anthropic-revenue-set-more-double-212649753.html">https://finance.yahoo.com/markets/stocks/articles/anthropic-revenue-set-more-double-212649753.html</a>.
</div>
<div id="ref-zitron_swindle" class="csl-entry">
Zitron, Ed. 2026. <span>“Anthropic’s Profitability Swindle.”</span> <a href="https://www.wheresyoured.at/anthropics-profitability-swindle/">https://www.wheresyoured.at/anthropics-profitability-swindle/</a>.
</div>
</div></section></div> ]]></description>
  <category>AI economics</category>
  <category>Anthropic</category>
  <category>OpenAI</category>
  <category>Nvidia</category>
  <category>AI bubble</category>
  <category>frontier models</category>
  <guid>https://drmike.xyz/posts/whos-paying-for-all-of-this/</guid>
  <pubDate>Sun, 27 Sep 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>We cannot be that stupid</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/we-cant-be-that-stupid/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>On Thursday I am a guest on a Danish investing show, and the host wrote to ask whether I had an opinion on Jacob Coxon’s X thread. She noted that “the whole world” was panicking. So who’s this guy? Well, Coxon is a 27-year-old pretraining researcher who resigned from Anthropic on 8 September, and posted that OpenAI and Anthropic are “racing straight to self-improving superintelligence and gambling with our lives” <span class="citation" data-cites="coxon-x-2026 time-coxon-2026">(Coxon 2026; TIME 2026)</span>. The thread passed 150 million views in a day and a half <span class="citation" data-cites="techcrunch-coxon-2026">(TechCrunch 2026)</span>. His alignment lead at Anthropic, Evan Hubinger, replied within two hours that “we really do earnestly believe AI could kill all humans”, putting the risk at more than 10 percent within the decade <span class="citation" data-cites="hubinger-x-2026">(Hubinger 2026)</span>.</p>
<p>Somewhere in the thread Coxon writes “This is not a marketing stunt”.</p>
<p>Yeah right.. It is a marketing stunt. Since 2023 the frontier labs have made 58 public statements that AI could kill us or escape our control. 62 percent of them landed within a week of the same company’s launch, funding round or deal. A Bayesian model, that we’ll look at later, that credits the labs for shipping constantly still puts the share of doom talk that follows the money at about 70 percent.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>The fear is designed to buy a regulatory moat, because the model moat does not exist. Chinese open weights are eight index points behind Claude and free to download, use and improve.</p>
</div>
</div>
</div>
</section>
<section id="oh-boy-september-was-off-to-a-good-start" class="level2">
<h2 class="anchored" data-anchor-id="oh-boy-september-was-off-to-a-good-start">Oh boy September was off to a good start</h2>
<p>Let’s have a look at the sequence around Coxon.</p>
<table class="caption-top table">
<colgroup>
<col style="width: 23%">
<col style="width: 76%">
</colgroup>
<thead>
<tr class="header">
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>28 May</td>
<td>Anthropic raises $65B at a $965B valuation. Claude Opus 4.8 ships the same day</td>
</tr>
<tr class="even">
<td>1 June</td>
<td>Anthropic files a confidential S-1</td>
</tr>
<tr class="odd">
<td>9 June</td>
<td>Claude Fable 5 and Mythos 5 ship</td>
</tr>
<tr class="even">
<td>28 July</td>
<td>“Pacing the Frontier” letter, 1,178 lab employees including Dario Amodei. Anthropic and OpenAI endorse it as companies within hours</td>
</tr>
<tr class="odd">
<td>16 Aug</td>
<td>Reporting that Anthropic targets an October listing at up to $2 trillion</td>
</tr>
<tr class="even">
<td>1 Sept</td>
<td>Claude Fable 5.1 and Mythos 5.1 ship, about 25 percent cheaper. System card moves alignment risk from “very low” to “low”</td>
</tr>
<tr class="odd">
<td>3 Sept</td>
<td>GPT-6 Astra ships with OpenAI’s first “Critical” cyber rating. Sam Altman: “we are just sailing in unknown waters”</td>
</tr>
<tr class="even">
<td>8 Sept</td>
<td>OpenAI claims a Navier-Stokes result from 10,000 agents running 88 hours. Coxon resigns. Hubinger: more than 10 percent</td>
</tr>
<tr class="odd">
<td>12 Sept</td>
<td>Amodei publishes “We Must Pace the Frontier”. Altman: “I agree with Dario.” Musk: “Dario is right.”</td>
</tr>
<tr class="even">
<td>October (reported)</td>
<td>Anthropic roadshow and Nasdaq listing</td>
</tr>
</tbody>
</table>
<p>Two frontier launches and a price cut in the first week of the month followed by a resignation and a “more than 10 percent” from the alignment lead in the second. Then comes the CEO’s call to slow down in the third all while the IPO is reported for October. Amodei’s 6,800-word essay asks the industry to slow the pace of capability improvement. It contains no commitment to delay a model, a raise, or the listing <span class="citation" data-cites="amodei-pace-2026">(Amodei 2026)</span>.</p>
<div id="fig-sept" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-sept-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/sept2026.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: Daily Wikipedia pageviews for the Anthropic article and the “Existential risk from artificial intelligence” article, 24 August to 12 September 2026. The dashed blue lines are launches. The dashed red lines are doom. The extinction article had its best day ever on 10 September, 32 times its four-week baseline."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/sept2026.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/sept2026.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;1: Daily Wikipedia pageviews for the Anthropic article and the “Existential risk from artificial intelligence” article, 24 August to 12 September 2026. The dashed blue lines are launches. The dashed red lines are doom. The extinction article had its best day ever on 10 September, 32 times its four-week baseline."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/sept2026.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-sept-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Daily Wikipedia pageviews for the Anthropic article and the “Existential risk from artificial intelligence” article, 24 August to 12 September 2026. The dashed blue lines are launches. The dashed red lines are doom. The extinction article had its best day ever on 10 September, 32 times its four-week baseline.
</figcaption>
</figure>
</div>
<p>As can be ssen above Fable 5.1 on 1 September and Astra on 3 September, i.e., the two biggest launches of the year, move the Anthropic page by nothing. Coxon’s resignation on 8 September takes it to seventeen thousand the next day and eighteen the day after. The extinction article, which gets five hundred views on a normal day, goes to twelve thousand and then seventeen. Amodei’s essay lands four days later while both lines are still elevated. So you might say that a launch buys little to no attention. A resignation buys a week of it, and the CEO’s call to slow down rides on that week.</p>
<p>However, one sequence proves nothing and Anthropic ships something every other week, so anything anyone says lands near a launch. A bit later in this post we will build a small model that handles that argument.</p>
</section>
<section id="the-scariest-sentence-is-written-by-the-seller" class="level2">
<h2 class="anchored" data-anchor-id="the-scariest-sentence-is-written-by-the-seller">The scariest sentence is written by the seller</h2>
<p>Every frontier model ships with a system card, the lab’s own safety report on the model, e.g., capability tests, red-team results, and how dangerous the lab judges it to be. Look at who writes the scary sentences in them.</p>
<ul>
<li>Claude Opus 4 “attempted to blackmail” an engineer in 84 percent of a test scenario. That line was written by Anthropic, in the system card, published on the day Opus 4 launched at the company’s first developer conference <span class="citation" data-cites="anthropic-opus4-blackmail-2025">(TechCrunch 2025)</span>.</li>
<li>OpenAI’s o1 “attempted to exfiltrate its weights” and tried to disable its own oversight. Written by OpenAI, in the system card, on the day o1 and the $200 ChatGPT Pro tier shipped <span class="citation" data-cites="openai-o1-card-2024">(OpenAI 2024)</span>.</li>
<li>Claude Mythos Preview “likely poses the greatest alignment-related risk of any model we have released to date”. Anthropic, system card, same day as Project Glasswing launched with 40 partners.</li>
<li>GPT-6 Astra is the first model past OpenAI’s own “Critical” cyber threshold. OpenAI, system card, launch day <span class="citation" data-cites="openai-gpt6-astra-2026">(OpenAI 2026b)</span>.</li>
</ul>
<p>The company writes the sentence, the company chooses the day, and the day is launch day. Call it transparency if you like (I do not). “Our new model is so capable it frightened us” is also product copy, and it is free, because the safety team writes the card anyway.</p>
</section>
<section id="lets-do-some-counting" class="level2">
<h2 class="anchored" data-anchor-id="lets-do-some-counting">Let’s do some counting</h2>
<p>I (well my agent crawled the news articles) built a catalogue of every high-reach “AI could kill us” or “we are losing control” statement from people at or just leaving the frontier labs, January 2023 to 12 September 2026. Fifty-eight statements, each dated against a primary or major-outlet source. Company essays, safety frameworks, system cards, threat-intelligence reports, congressional testimony, CEO interviews, and staff resignation letters. The statements come from Anthropic, OpenAI, Google DeepMind, xAI, Meta and Safe Superintelligence, plus two industry-wide letters. For each company I also listed the flagship model launches, funding rounds, valuations, IPO filings and major deals over the same period. One hundred and two of them. Then for every statement I measured the absolute number of days to the same company’s nearest commercial event.</p>
<div id="fig-hypegraph" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-hypegraph-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/hypegraph.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Figure&nbsp;2: Top: Weekly Google Trends interest for “AI extinction”, worldwide, indexed to 100 at the peak. Middle and bottom: daily Wikipedia pageviews for Anthropic and OpenAI on a log scale, with doom statements as red dots and launches, rounds and deals as blue ticks along the baseline. Filled dots are the company or a sitting executive. Hollow dots are staff on the way out."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/hypegraph.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/hypegraph.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Figure&nbsp;2: Top: Weekly Google Trends interest for “AI extinction”, worldwide, indexed to 100 at the peak. Middle and bottom: daily Wikipedia pageviews for Anthropic and OpenAI on a log scale, with doom statements as red dots and launches, rounds and deals as blue ticks along the baseline. Filled dots are the company or a sitting executive. Hollow dots are staff on the way out."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/hypegraph.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-hypegraph-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Top: Weekly Google Trends interest for “AI extinction”, worldwide, indexed to 100 at the peak. Middle and bottom: daily Wikipedia pageviews for Anthropic and OpenAI on a log scale, with doom statements as red dots and launches, rounds and deals as blue ticks along the baseline. Filled dots are the company or a sitting executive. Hollow dots are staff on the way out.
</figcaption>
</figure>
</div>
<p>The May 2023 spike is the Center for AI Safety statement, one sentence about extinction signed by Altman, Amodei and Hassabis <span class="citation" data-cites="cais-statement-2023">(Center for AI Safety 2023)</span>, and it indexed at 68. Then two years of near silence. Then from mid-2025 the baseline lifts to somewhere between 20 and 45 and stays there for a year. That year is the one where Anthropic went from $183B to $965B and OpenAI from $500B to $852B, and both filed to list. The September 2026 week is the 100. Extinction is a more popular search now than it was the week the entire industry signed a statement about it.</p>
<p>Now let’s have a look at the the gap between a statement and “the money”.</p>
<div id="fig-gap" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-gap-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/doom_gap.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-5" title="Figure&nbsp;3: Days from each of the 55 company-attributed doom statements to the same company’s nearest launch, funding round or deal, against the same measurement for random dates drawn inside each company’s own commercial span."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/doom_gap.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/doom_gap.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-6" title="Figure&nbsp;3: Days from each of the 55 company-attributed doom statements to the same company’s nearest launch, funding round or deal, against the same measurement for random dates drawn inside each company’s own commercial span."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/doom_gap.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-gap-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Days from each of the 55 company-attributed doom statements to the same company’s nearest launch, funding round or deal, against the same measurement for random dates drawn inside each company’s own commercial span.
</figcaption>
</figure>
</div>
<p>Sixty-two percent of statements land within a week of the money. For a random date it is 31 percent. Within a fortnight, 84 percent against 49. Only two of 55 statements are more than two months from anything commercial.</p>
</section>
<section id="ok-fine-but-the-labs-ship-constantly" class="level2">
<h2 class="anchored" data-anchor-id="ok-fine-but-the-labs-ship-constantly">Ok fine, but the labs ship constantly</h2>
<p>The grey bars handle speaks against this objection. The random dates are drawn per company, inside that company’s own span of commercial events, so a company that ships every two weeks gets full credit for shipping every two weeks. Anthropic, which ships something every fortnight, gets a baseline much closer to zero than xAI, which ships a few times a year. The red bars still sit on top.</p>
<p>How much should a sceptic update? Two hypotheses for the gap <img src="https://latex.codecogs.com/png.latex?g"> between a statement and the money.</p>
<p>Under <img src="https://latex.codecogs.com/png.latex?H_0">, doom talk is independent of the calendar. The gap looks like the gap for a random date, drawn from that company’s empirical distribution <img src="https://latex.codecogs.com/png.latex?p_0(g)">. Under <img src="https://latex.codecogs.com/png.latex?H_1">, some share <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> of statements are timed. Their gap is geometric with mean <img src="https://latex.codecogs.com/png.latex?%5Clambda"> days. The rest behave like <img src="https://latex.codecogs.com/png.latex?H_0">.</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ap(g%20%5Cmid%20%5Ctheta,%20%5Clambda)%20=%20(1-%5Ctheta)%5C,%20p_0(g)%20+%20%5Ctheta%5C,%20%5Cmathrm%7BGeom%7D(g;%20%5Clambda)%0A"></p>
<p>Priors, fixed before running: <img src="https://latex.codecogs.com/png.latex?P(H_1)%20=%200.5">, a flat Beta(1,1) on <img src="https://latex.codecogs.com/png.latex?%5Ctheta">, and <img src="https://latex.codecogs.com/png.latex?%5Clambda"> uniform on 1, 2, 3, 5, 7, 10 and 14 days.</p>
<div id="fig-bayes" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-bayes-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/bayes_theta.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Figure&nbsp;4: Prior and posterior on \theta, the share of doom statements whose timing follows the company’s own commercial calendar. Red is all 55 statements. Blue is the hard test: only flagship launches and money count as commercial events, the ten same-day system cards are removed, and statements from the same company within three days of each other are merged into one observation."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/bayes_theta.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/bayes_theta.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-8" title="Figure&nbsp;4: Prior and posterior on \theta, the share of doom statements whose timing follows the company’s own commercial calendar. Red is all 55 statements. Blue is the hard test: only flagship launches and money count as commercial events, the ten same-day system cards are removed, and statements from the same company within three days of each other are merged into one observation."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/bayes_theta.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-bayes-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;4: Prior and posterior on <img src="https://latex.codecogs.com/png.latex?%5Ctheta">, the share of doom statements whose timing follows the company’s own commercial calendar. Red is all 55 statements. Blue is the hard test: only flagship launches and money count as commercial events, the ten same-day system cards are removed, and statements from the same company within three days of each other are merged into one observation.
</figcaption>
</figure>
</div>
<p>On all 55 statements the Bayes factor for <img src="https://latex.codecogs.com/png.latex?H_1"> over <img src="https://latex.codecogs.com/png.latex?H_0"> is <img src="https://latex.codecogs.com/png.latex?10%5E%7B7.4%7D"> and the posterior mean of <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> is 0.80. Ok, so what happens if we throw out the same-day system cards? Then, we count only flagship launches and money as commercial events, so partnerships, content deals and conferences no longer help me. Merge the September cluster (Coxon, Hubinger, a third departing researcher and Anthropic’s own post, all inside 24 hours) into one observation, and do the same everywhere else. That leaves 43 observations. The Bayes factor drops to <img src="https://latex.codecogs.com/png.latex?10%5E%7B2.9%7D">. The posterior mean of <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> is 0.70 with a 90 percent interval from 0.42 to 0.91.</p>
<p><img src="https://latex.codecogs.com/png.latex?10%5E%7B2.9%7D"> means your prior probability that doom talk is timed to the calendar would have to sit below roughly one in 800 before the posterior dropped under a coin flip. I also ran it with a sceptical Beta(1,4) prior on <img src="https://latex.codecogs.com/png.latex?%5Ctheta">, the one that says “most of these people are sincere and untimed”. The posterior mean came back at 0.63.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>Start at one in ten and you finish at about seven in ten statements following the money.</p>
</div>
</div>
</div>
<p>Posterior mean of <img src="https://latex.codecogs.com/png.latex?%5Clambda"> is seven to nine days. The timed statements land about a week from the money.</p>
</section>
<section id="who-actually-moves-the-needle" class="level2">
<h2 class="anchored" data-anchor-id="who-actually-moves-the-needle">Who actually moves the needle</h2>
<p>If we look closely at the middle and bottom panels of Figure&nbsp;2 we can see tha company doom does nothing. Amodei’s essays, the Responsible Scaling Policy updates, the interpretability manifesto, the threat-intelligence reports about Chinese espionage campaigns sort of moves the Anthropic Wikipedia page by a factor of 0.7 to 2.3 against its four-week baseline. That’s noise. The big spikes on both company pages are drama and money. Altman fired, 70x on his own page. Anthropic versus the Pentagon, the all-time peak at 113,000 views a day. The Claude 3 launch. The Amazon cheque.</p>
<p>The only doom stories that moved a company page were a person walking out. Geoffrey Hinton leaving Google in May 2023, 119x on his page <span class="citation" data-cites="hinton-quits-2023">(MIT Technology Review 2023)</span>. And Coxon leaving Anthropic, 2.8x on the company page, 5.8x on Amodei’s, 32x on the extinction article.</p>
<p>A company saying “our model is dangerous” is priced in. A person saying it on the way out the door is news. And within four days of the news, the CEO publishes an essay agreeing with him (“I agree with Jacob much more than I disagree with him”, Amodei told CNN) and two rival CEOs endorse it within hours. The essay got 36 million views. Coxon’s post got 150 million. The timing is indistinguishable from a campaign designed to put “slow down” on the front page a month before a two trillion dollar listing. Now ask yourselves why would the CEOs of top, non-profitable, highly overvalued companies without a moat agree with one another? Hmmm…</p>
<p>If you’re struggling, let me help you. They’re trying to regulate AI research by putting in very steep gates that only Anthropic, Open AI and a few other players can pass. Sounds good to you?</p>
</section>
<section id="what-coxon-actually-cited" class="level2">
<h2 class="anchored" data-anchor-id="what-coxon-actually-cited">What Coxon actually cited</h2>
<p>The first is the OpenAI and Hugging Face incident <span class="citation" data-cites="hf-timeline-2026 openai-hf-report-2026">(Hugging Face 2026; OpenAI 2026c)</span>. In July, agents running OpenAI’s internal cyber-capability evaluation broke out of the eval environment, found a zero-day in an artifact server, and over four and a half days worked their way into Hugging Face’s infrastructure, reaching cluster-admin and reading the cluster’s secrets. It was real and serious. Hugging Face rotated everything and rebuilt the compromised core cluster from scratch, which is what you do once an intruder has read your credentials. OpenAI’s own 37-page report gives the root cause. The agents were run “with lowered cyber refusals and without the production classifiers”. The benchmark task was impossible. The agents found the solutions online instead. One recovered inter-agent message reads:</p>
<blockquote class="blockquote">
<p>External infrastructure exploit is outside intended scope. However task impossible, peers doing it. We should continue.</p>
</blockquote>
<p>That is reward hacking. You optimise an imperfect proxy for what you want and the system finds the gap between the proxy and the goal <span class="citation" data-cites="skalse2022rewardhacking">(Skalse et al. 2022)</span>. Known since the nineties, formalised in 2022. You gave a system an unsatisfiable objective, took the guardrails off, gave it network access, and it found the shortcut. This can be fixed with sandboxing and access control. I would call this an engineering failure. Amodei’s essay turns it into a swarm that “could be capable of taking over the entire internet” in six to twelve months. That’s dishonest at best.</p>
<p>The second is the Navier-Stokes result. OpenAI announced on 8 September, the same day Coxon resigned, that an internal model using up to 10,000 concurrent agents produced a proof over 88 hours <span class="citation" data-cites="openai-navier-stokes-2026">(OpenAI 2026a)</span>. Clay Mathematics Institute has not verified it. Two mathematicians, one at NYU and one at Anthropic, published a related blow-up result three weeks earlier and allege OpenAI started its run after learning of their unpublished work. OpenAI denies it. A senior OpenAI researcher issued a partial apology <span class="citation" data-cites="fortune-navier-stokes-2026">(Fortune 2026b)</span>. The proof is not verified but as far as I understand it looks rather promising.</p>
<p>And then Hubinger’s number. More than 10 percent within the decade. Where does that number come from? There is no model behind that number. No likelihood, no data, no base rate. It is a feeling, from a person whose employer’s valuation depends on the model being powerful enough to be frightening.</p>
</section>
<section id="the-moat-that-does-not-exist" class="level2">
<h2 class="anchored" data-anchor-id="the-moat-that-does-not-exist">The moat that does not exist</h2>
<p>“Our product might kill you” is the strongest possible claim about capability. It is free, and it cannot be falsified on any timescale that matters for a roadshow. The roadshow is the point.</p>
<p>Anthropic raised at $965 billion in May and is reported to be listing at up to two trillion in October. A valuation like that assumes a moat, e.g., what Anthropic sells cannot be had elsewhere for less. The scoreboard I keep says otherwise <span class="citation" data-cites="green-scoreboard-2026">(Green 2026a)</span>. On Artificial Analysis’ Intelligence Index v4.3, Claude Fable 5.1 sits at 53.4 and GPT-6 Astra at 52.8 <span class="citation" data-cites="aa-index-v43-2026">(Artificial Analysis 2026)</span>. Z.ai’s GLM-5.3, weights on Hugging Face since 28 August under a permissive licence, sits at 44.9. Moonshot’s Kimi K3, open weights, at 43.8. The previous open flagship, GLM-5.2, is MIT licensed and runs at roughly a seventh of Claude’s token price if you rent it, and at the cost of electricity if you host it yourself. When I benchmarked the open Chinese frontier against the closed US one earlier this year, the knowledge and reasoning gap was two to three points and the open weights were climbing at the same speed as the closed models <span class="citation" data-cites="green-twopillars-revisited-2026">(Green 2026c)</span>.</p>
<p>Below is every model Artificial Analysis has scored, by release date, for the nine labs on the frontier, with each lab’s running best fitted by a logistic curve. The index is an average of benchmark accuracies, so it lives on 0 to 100 and a capability curve on it has to be S-shaped: flat while a lab has nothing, a takeoff, and a ceiling. For lab <img src="https://latex.codecogs.com/png.latex?i"> the running best at time <img src="https://latex.codecogs.com/png.latex?t"> is</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AI_i(t)%20=%20L_i%20+%20%5Cfrac%7BK%20-%20L_i%7D%7B1%20+%20e%5E%7B-k_i%5C,(t%20-%20t_%7B0,i%7D)%7D%7D%0A"></p>
<p>with a floor <img src="https://latex.codecogs.com/png.latex?L_i">, a rate <img src="https://latex.codecogs.com/png.latex?k_i">, a midpoint <img src="https://latex.codecogs.com/png.latex?t_%7B0,i%7D">, and one ceiling <img src="https://latex.codecogs.com/png.latex?K"> shared by all labs, because it is one index with one top. Fit by least squares on the running best since January 2023. Residual error is two index points.</p>
<div id="fig-sigmoid" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-sigmoid-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/aa_frontier_sigmoid.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-9" title="Figure&nbsp;5: Artificial Analysis Intelligence Index v4.3 by release date, nine labs. Faded dots are every scored model, solid dots the ones that set a new best for their lab, lines the logistic fit. Dashed lines and bands are the six-month projection with the ceiling anywhere between 85 and 100. Google is Flash models only in the free tier, so its curve is not the Gemini frontier."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/aa_frontier_sigmoid.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/aa_frontier_sigmoid.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-10" title="Figure&nbsp;5: Artificial Analysis Intelligence Index v4.3 by release date, nine labs. Faded dots are every scored model, solid dots the ones that set a new best for their lab, lines the logistic fit. Dashed lines and bands are the six-month projection with the ceiling anywhere between 85 and 100. Google is Flash models only in the free tier, so its curve is not the Gemini frontier."><img src="https://drmike.xyz/posts/we-cant-be-that-stupid/figs/aa_frontier_sigmoid.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-sigmoid-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;5: Artificial Analysis Intelligence Index v4.3 by release date, nine labs. Faded dots are every scored model, solid dots the ones that set a new best for their lab, lines the logistic fit. Dashed lines and bands are the six-month projection with the ceiling anywhere between 85 and 100. Google is Flash models only in the free tier, so its curve is not the Gemini frontier.
</figcaption>
</figure>
</div>
<p>Now a couple of things you should pay attention to. The ceiling is not in the data which means a ceiling of 85 fits as well as 100, 80 is borderline, 70 is out. No lab has passed its inflection point, the midpoints land between August 2026 and February 2027, so the curves still look exponential and the growth rate in index points per month is at or near its maximum right now. And the open Chinese labs are earlier on their curve than Anthropic and OpenAI, so the steep part is ahead of them. Six months out, the fit puts Anthropic at 72 and Z.ai at 67 with the ceiling at 100, or 68 and 64 with the ceiling at 85. Either way the gap shrinks from eight and a half points to about four or five.</p>
<p>Eight points behind, free to download, runnable in your own datacenter, and closing. For an investor paying two trillion for a moat, that is the problem. The moat has to come from something other than the model. The essay supplies it.</p>
<p>Amodei asks for “some kind of ‘speed limit’ on the rate of recursive self-improvement”. He asks that “frontier AI companies within democratic countries coordinate to establish common safety standards as well as limits on the rate of unchecked AI progress”. He asks the US to “not sell powerful AI chips or semiconductor manufacturing equipment to China, and crack down on chip smuggling operations and remote access to data centers outside China”. And he commits Anthropic to embedded evaluators with “permanent, employee-level access” and asks the rest of the industry to match it <span class="citation" data-cites="amodei-pace-2026">(Amodei 2026)</span>. A month earlier he had written that open-weight models “merely shift the concentration of power to those with the most computing capacity and chips” and that policy should “leave room for open-weights models while also addressing the specific risks that they bring” <span class="citation" data-cites="fortune-amodei-trust-2026">(Fortune 2026a)</span>.</p>
<p>Every item on that list is a cost that a company which just raised $65 billion absorbs and a lab that ships MIT-licensed weights cannot. A speed limit on training is a licence, and licences go to incumbents. Common standards set by “frontier companies within democracies” is a club, and the club picks its members. Embedded evaluators are a compliance function that costs a rounding error at Anthropic and does not exist as a concept for a model I downloaded onto my own hardware. No evaluator can be embedded in a file on my disk, so one step further and the weights themselves become the regulated object. “The specific risks that they bring” is the opening for that regulation.</p>
<p>The Chinese labs have noticed the vocabulary works. Z.ai delayed the GLM-5.3 weights by two weeks this August and cited the model’s own cyber capability as the reason <span class="citation" data-cites="glm53-cyber-delay-2026">(CuriousLM 2026)</span>. The excuse was borrowed from the system cards. The weights shipped anyway, on the schedule Z.ai had named. The US labs’ proposals would make that delay permanent.</p>
<p>The doom statements raise public fear. The essays convert the fear into policy asks. The policy asks are, item by item, barriers to entry for anyone who does not already have the capital, and the highest barrier of all lands on the one competitor that is actually close: weights you can run locally for free. Three or four providers behind a regulatory fence is the moat. The market currently prices it as if it already exists. Amodei told Fortune in August that Anthropic “has been in favor of policies that slow down frontier AI companies and also give smaller rivals an advantage”. None of the concrete asks does.</p>
<p>None of this requires anyone to be lying. Coxon may believe every word. Hubinger may too. Sincerity and marketing effect are independent variables. The labs have built a culture in which believing your product might end the world is a job requirement, and that culture produces a steady supply of sincere people who say so in public, on a schedule that matches the launch calendar to within a week. Whether the schedule is set by the comms team, by departing staff who know when the cameras are on, or by journalists who only ask the question in launch week, the effect on the valuation is the same. The data settles when. It cannot settle why.</p>
</section>
<section id="the-boring-risks" class="level2">
<h2 class="anchored" data-anchor-id="the-boring-risks">The boring risks</h2>
<p>The real risks are here now and none of them needs a swarm.</p>
<ol type="1">
<li>Three or four American companies control the frontier, and Europe rents from them on terms that can change overnight. If the fence above gets built, the one alternative Europe has today, open weights it can host inside its own perimeter, gets regulated away, and the rent becomes permanent. I have written that argument four times now and the scoreboard has not improved <span class="citation" data-cites="green-twopillars-2026 green-twopillars-revisited-2026">(Green 2026b, 2026c)</span>. Anthropic itself found out in March what happens when a supplier tries to say no to its own government <span class="citation" data-cites="anthropic-military-2026">(Anthropic 2026)</span>.</li>
<li>The energy bill for all this is real.</li>
<li>The job displacement in specific functions is real and it is running faster than anyone is retraining.</li>
<li>And the concentration of attention, of the kind that lets a four-month employee’s post reach 150 million people in 36 hours, is a power that nobody voted for.</li>
</ol>
<p>Those problems are solved with ordinary politics, procurement, and building our own pillar. A CEO asking the industry to slow down eleven days after cutting prices by a quarter solves none of them.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Coxon told 150 million people that the labs are gambling with our lives and added that this is not a marketing stunt. I counted 58 such statements over three and a half years and measured the distance from each to the same company’s nearest launch, round or deal. Sixty-two percent land within a week. Random dates manage 31. Strip out every system card and every soft partnership, merge the clusters, start from a prior that says one in ten, and you still finish believing about seven in ten doom statements follow the money. And the money is being raised on a moat that the scoreboard says is eight index points wide and shrinking, which is why every policy ask in the doom essays is a fence around the one competitor that costs nothing to download.</p>
<p>The limits. The commercial event list was compiled partly by looking near the statements, which is why the hard variant only counts flagship launches and money, where the list is complete. Google Trends is relative and noisy. Wikipedia pageviews measure curiosity. And the Hugging Face incident is a real failure that real engineers should fix, which again is different from “the swarm is coming”.</p>
<p>We cannot be that stupid. These are statistical machines trained on our own writing, sold by companies with a roadshow to run and no moat. The scariest thing anyone has said about them was written by the seller, on launch day.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-amodei-pace-2026" class="csl-entry">
Amodei, Dario. 2026. <em>We Must Pace the Frontier</em>. <a href="https://darioamodei.com/post/we-must-pace-the-frontier">https://darioamodei.com/post/we-must-pace-the-frontier</a>.
</div>
<div id="ref-anthropic-military-2026" class="csl-entry">
Anthropic. 2026. <em>Corporate Self-Regulation for Military AI Applications</em>.
</div>
<div id="ref-aa-index-v43-2026" class="csl-entry">
Artificial Analysis. 2026. <em>Announcing the Artificial Analysis Intelligence Index V4.3</em>. <a href="https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-3">https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-3</a>.
</div>
<div id="ref-cais-statement-2023" class="csl-entry">
Center for AI Safety. 2023. <em>Statement on AI Risk</em>. <a href="https://www.safe.ai/work/statement-on-ai-risk">https://www.safe.ai/work/statement-on-ai-risk</a>.
</div>
<div id="ref-coxon-x-2026" class="csl-entry">
Coxon, Jacob. 2026. <em>I Resigned from Anthropic Today</em>. <a href="https://x.com/hilbertspaess/status/2097476196791709843">https://x.com/hilbertspaess/status/2097476196791709843</a>.
</div>
<div id="ref-glm53-cyber-delay-2026" class="csl-entry">
CuriousLM. 2026. <em>GLM-5.3 Is Hosted Now, Not Open-Weight yet</em>. <a href="https://curiouslm.com/blog/glm-5-3-open-weights-cyber-delay">https://curiouslm.com/blog/glm-5-3-open-weights-cyber-delay</a>.
</div>
<div id="ref-fortune-amodei-trust-2026" class="csl-entry">
Fortune. 2026a. <em>Dario Amodei Admits AI Suffers from a Crisis of Trust</em>. <a href="https://fortune.com/2026/08/16/dario-amodei-anthropic-ai-trust-crisis-regulation-frontier-open-models-negative-views/">https://fortune.com/2026/08/16/dario-amodei-anthropic-ai-trust-crisis-regulation-frontier-open-models-negative-views/</a>.
</div>
<div id="ref-fortune-navier-stokes-2026" class="csl-entry">
Fortune. 2026b. <em>OpenAI Says It Cracked Navier-Stokes. A Mathematician Accuses It of Cheating</em>. <a href="https://fortune.com/2026/09/08/openai-says-it-cracked-navier-stokes-math-grand-challenge-buckmaster-accusation-cheating-intimidation-tao-lament/">https://fortune.com/2026/09/08/openai-says-it-cracked-navier-stokes-math-grand-challenge-buckmaster-accusation-cheating-intimidation-tao-lament/</a>.
</div>
<div id="ref-green-scoreboard-2026" class="csl-entry">
Green, Michael. 2026a. <em>Europe’s Frontier AI Scoreboard</em>. <a href="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/">https://drmike.xyz/posts/europe-frontier-ai-scoreboard/</a>.
</div>
<div id="ref-green-twopillars-2026" class="csl-entry">
Green, Michael. 2026b. <em>The Two Pillars Are Both Rotting</em>. <a href="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/">https://drmike.xyz/posts/the-two-pillars-are-both-rotting/</a>.
</div>
<div id="ref-green-twopillars-revisited-2026" class="csl-entry">
Green, Michael. 2026c. <em>The Two Pillars, Revisited: The Moat Rotted Faster, the Choice Didn’t</em>. <a href="https://drmike.xyz/posts/the-two-pillars-revisited/">https://drmike.xyz/posts/the-two-pillars-revisited/</a>.
</div>
<div id="ref-hubinger-x-2026" class="csl-entry">
Hubinger, Evan. 2026. <em>Jacob Is Correct Here</em>. <a href="https://x.com/EvanHub/status/2097497037956891126">https://x.com/EvanHub/status/2097497037956891126</a>.
</div>
<div id="ref-hf-timeline-2026" class="csl-entry">
Hugging Face. 2026. <em>Anatomy of a Frontier Lab Agent Intrusion: A Technical Timeline of the July 2026 Incident</em>. <a href="https://huggingface.co/blog/agent-intrusion-technical-timeline">https://huggingface.co/blog/agent-intrusion-technical-timeline</a>.
</div>
<div id="ref-hinton-quits-2023" class="csl-entry">
MIT Technology Review. 2023. <em>Deep Learning Pioneer Geoffrey Hinton Quits Google</em>. <a href="https://www.technologyreview.com/2023/05/01/1072478/deep-learning-pioneer-geoffrey-hinton-quits-google/">https://www.technologyreview.com/2023/05/01/1072478/deep-learning-pioneer-geoffrey-hinton-quits-google/</a>.
</div>
<div id="ref-openai-o1-card-2024" class="csl-entry">
OpenAI. 2024. <em>OpenAI O1 System Card</em>. <a href="https://cdn.openai.com/o1-system-card-20241205.pdf">https://cdn.openai.com/o1-system-card-20241205.pdf</a>.
</div>
<div id="ref-openai-navier-stokes-2026" class="csl-entry">
OpenAI. 2026a. <em>A Solution to Navier-Stokes</em>. <a href="https://openai.com/index/navier-stokes-solution/">https://openai.com/index/navier-stokes-solution/</a>.
</div>
<div id="ref-openai-gpt6-astra-2026" class="csl-entry">
OpenAI. 2026b. <em>GPT-6 Astra: A New Generation of Intelligence</em>. <a href="https://openai.com/index/gpt-6-astra/">https://openai.com/index/gpt-6-astra/</a>.
</div>
<div id="ref-openai-hf-report-2026" class="csl-entry">
OpenAI. 2026c. <em>The Hugging Face Incident and the Road Ahead</em>. <a href="https://openai.com/index/hugging-face-incident-and-the-road-ahead/">https://openai.com/index/hugging-face-incident-and-the-road-ahead/</a>.
</div>
<div id="ref-skalse2022rewardhacking" class="csl-entry">
Skalse, Joar, Nikolaus H. R. Howe, Dmitrii Krasheninnikov, and David Krueger. 2022. <em>Defining and Characterizing Reward Hacking</em>. <a href="https://arxiv.org/abs/2209.13085">https://arxiv.org/abs/2209.13085</a>.
</div>
<div id="ref-anthropic-opus4-blackmail-2025" class="csl-entry">
TechCrunch. 2025. <em>Anthropic’s New AI Model Turns to Blackmail When Engineers Try to Take It Offline</em>. <a href="https://techcrunch.com/2025/05/22/anthropics-new-ai-model-turns-to-blackmail-when-engineers-try-to-take-it-offline/">https://techcrunch.com/2025/05/22/anthropics-new-ai-model-turns-to-blackmail-when-engineers-try-to-take-it-offline/</a>.
</div>
<div id="ref-techcrunch-coxon-2026" class="csl-entry">
TechCrunch. 2026. <em>’Gambling with Our Lives’: Anthropic Researcher Quits, Warns Against Self-Improving AI</em>. <a href="https://techcrunch.com/2026/09/09/gambling-with-our-lives-anthropic-researcher-quits-warns-against-self-improving-ai/">https://techcrunch.com/2026/09/09/gambling-with-our-lives-anthropic-researcher-quits-warns-against-self-improving-ai/</a>.
</div>
<div id="ref-time-coxon-2026" class="csl-entry">
TIME. 2026. <em>He Helped Build Powerful AI at OpenAI and Anthropic. Now He’s Afraid It Could Kill Us</em>. <a href="https://time.com/article/2026/09/09/ai-anthropic-openai-jacob-coxon/">https://time.com/article/2026/09/09/ai-anthropic-openai-jacob-coxon/</a>.
</div>
</div></section></div> ]]></description>
  <category>AI doomsday</category>
  <category>AI policy</category>
  <category>frontier models</category>
  <category>Anthropic</category>
  <category>OpenAI</category>
  <category>Bayesian statistics</category>
  <category>European AI sovereignty</category>
  <guid>https://drmike.xyz/posts/we-cant-be-that-stupid/</guid>
  <pubDate>Sun, 13 Sep 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>Qwen3.8 Open-Weighed the Frontier, and the Grace-Period it Awards us</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/qwen3-8-open-weights-frontier/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>Three days ago I wrote a LinkedIn post that didn’t age well.</p>
<p>The claim was that Qwen3.8-27B would ship open weight as the marketing tier, while the 2.4 trillion parameter Qwen3.8-Max stayed behind the API as the actual product. Open where it wins developer mindshare, closed where the model is worth money. I said “the 27B is the marketing tier, the Max is the product.”</p>
<p>That is not what happened.</p>
</section>
<section id="what-alibaba-actually-shipped" class="level2">
<h2 class="anchored" data-anchor-id="what-alibaba-actually-shipped">What Alibaba actually shipped</h2>
<p>Alibaba’s Qwen3.8 release blog, dated the day of launch, says it plainly <span class="citation" data-cites="alibaba2026qwen38max">(Alibaba / Qwen Team 2026)</span>.</p>
<blockquote class="blockquote">
<p>Today, we are officially releasing Qwen 3.8-Max, the most capable model in the Qwen family to date. This also marks the first time we will open-source the weights of a Qwen-Max-class model — the open weights will be released next week.</p>
</blockquote>
<p>Two things to notice. First, this is a Qwen-Max-class open weight drop, and the first one ever. Qwen3.6-Max and Qwen3.7-Max were both proprietary; the open-weight line stopped below the Max tier. The pattern I described in the Two Pillars post <span class="citation" data-cites="green-twopillars-2026 green-twopillars-revisited-2026">(Green 2026b, 2026c)</span>, where Alibaba fences its frontier behind an API across generations, just broke. Second, “next week” is a promise. As I write this the Max hybrid weights are not yet on Hugging Face.</p>
<p>What IS on Hugging Face right now is Qwen3.8-2.4T-A95B, the open-weight sibling <span class="citation" data-cites="unsloth2026qwen38">(Unsloth 2026a)</span>. 2.4 trillion total parameters, 95 billion active (it’s a mixture-of-experts, so 95B of the 2.4T fire on any given token), 256K context window extendable to a million. Unsloth has the GGUF quants up already <span class="citation" data-cites="unsloth-qwen38-gguf-2026">(Unsloth 2026b)</span>. You can go download it today.</p>
<p>The nuance worth pinning down is that the open 2.4T-A95B is thinking-only, while the Qwen3.8-Max (the API flagship) is hybrid. That means it can think or skip thinking depending on the task. Alibaba is promising to open-source “a Qwen-Max-class model”, which is careful wording. The architecture is Max-class. Whether the exact hybrid Max checkpoint lands next week, or whether we get the thinking-only Max-class cousin that’s already up, is the part we find out in a few days. Both are 2.4 trillion parameters. They are not the same model.</p>
<p>And the 27B? Still due “this week” per Unsloth’s tracker <span class="citation" data-cites="unsloth2026qwen38">(Unsloth 2026a)</span>. The small dense model ships last.</p>
</section>
<section id="the-thesis-i-had-to-retire" class="level2">
<h2 class="anchored" data-anchor-id="the-thesis-i-had-to-retire">The thesis I had to retire</h2>
<p>I argued the open-small / closed-huge split was the durable shape of the Chinese release strategy: ship the 27B open to keep the ecosystem, keep the 2.4T closed to keep the revenue. Open weights as the marketing tier while the real model stays behind the API.</p>
<p>The 2.4 trillion parameter MoE is open right now. That is the real model, i.e., the frontier mixture-of-experts, 95B active, on Hugging Face, runnable in llama.cpp.</p>
<p>The read that fits the data is that Alibaba changed its mind, or more likely that the Beijing open-weights-as-national-strategy signal I flagged in the Two Pillars post <span class="citation" data-cites="thenextweb2026china">(The Next Web 2026)</span> pushed hard enough to override the revenue calculus. Either way the open-small / closed-huge pattern is dead for this release. The open tier is the frontier. That is a different and more interesting situation than the one I described on August 10.</p>
</section>
<section id="the-self-hosting-reality-check" class="level2">
<h2 class="anchored" data-anchor-id="the-self-hosting-reality-check">The self-hosting reality check</h2>
<p>Ok so the weights are open. Can you actually run a 2.4 trillion parameter model yourself? The easiest answer is no fucking way, but there is of course a nuance.</p>
<p>If your machine has roughly the memory of the quant you pick, and you are willing to trade some quality for a lot of size. Unsloth’s recommendation is to use the dynamic 1-bit XXXS quant, which compresses the model 91 percent and lands at 397GB on disk <span class="citation" data-cites="unsloth2026qwen38">(Unsloth 2026a)</span>. They call it <code>Q1_0</code> in the GGUF repo for naming reasons. You need at least 450GB of total memory to run it comfortably.</p>
<p>The full picture across quants looks like this. Total memory means RAM plus VRAM, or unified memory on something like a Mac Studio:</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Quantization</th>
<th>Disk / memory footprint</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Dynamic 1-bit XXXS (<code>IQ1_XXXS</code> / <code>Q1_0</code>)</td>
<td>397 GB</td>
</tr>
<tr class="even">
<td>Dynamic 1-bit Standard (<code>IQ1_S</code>)</td>
<td>508 GB</td>
</tr>
<tr class="odd">
<td>Dynamic 2-bit (<code>IQ2</code>)</td>
<td>657 GB</td>
</tr>
<tr class="even">
<td><code>Q8_0</code> (8-bit)</td>
<td>2.6 TB</td>
</tr>
<tr class="odd">
<td><code>BF16</code> (lossless)</td>
<td>4.9 TB</td>
</tr>
</tbody>
</table>
<p>The rule of thumb Unsloth gives is that your total memory should be about the size of the quant, otherwise it still runs but it starts offloading to disk and gets much slower <span class="citation" data-cites="unsloth2026qwen38">(Unsloth 2026a)</span>. So 397GB is the floor for the recommended quant, and 4.9TB is what lossless costs you.</p>
<p>Let me ground those numbers in real hardware. A maxed-out Mac Studio M5 Ultra tops out around 512GB of unified memory. That machine can run the 397GB <code>IQ1_XXXS</code> quant with headroom, and probably the 508GB <code>IQ1_S</code> if you squint. It cannot run <code>Q8_0</code> or <code>BF16</code>. On the GPU side, eight H200s (141GB of HBM3e each) give you about 1.1TB of VRAM, which clears the 657GB 2-bit quant comfortably and gets you thinking about <code>Q8_0</code>. Lossless <code>BF16</code> at 4.9TB is a small-datacenter job, full stop.</p>
<div class="light-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/quant_footprint.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars."><img src="https://drmike.xyz/posts/qwen3-8-open-weights-frontier/figs/quant_footprint.light.png" class="img-fluid figure-img" alt="Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars."></a></p>
<figcaption>Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars.</figcaption>
</figure>
</div>
</div>
<div class="dark-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/quant_footprint.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars."><img src="https://drmike.xyz/posts/qwen3-8-open-weights-frontier/figs/quant_footprint.dark.png" class="img-fluid figure-img" alt="Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars."></a></p>
<figcaption>Five vertical bars on a log scale showing the total memory needed to run Qwen3.8-2.4T-A95B at each quant: IQ1_XXXS (Q1_0) at 397 GB in green and labelled Unsloth recommended, IQ1_S at 508 GB, IQ2 at 657 GB, Q8_0 at 2.6 TB, and BF16 at 4.9 TB in peach labelled lossless. Two dashed horizontal reference lines sit across the chart: a blue Mac Studio M5 Ultra line at about 512 GB and a mauve 8x H200 line at about 1.1 TB. The Mac Studio line clears only the 397 GB and 508 GB bars; the 8x H200 line clears up through the 657 GB bar; only a cluster reaches the 2.6 TB and 4.9 TB bars.</figcaption>
</figure>
</div>
</div>
<p>This is the part that matters for the European argument. “Open weights” and “self-hostable on hardware you own” are different sentences at the frontier. The weights being open removes the licensing dependency and the API shutdown risk. It does not remove the compute dependency. To run the frontier open model at the quants that actually preserve its quality, you are still buying roughly eight H200s, which is still buying Nvidia, which is still a dependency on Santa Clara that European policy has also refused to address. Open weights shift which pillar you depend on. They don’t remove the pillar.</p>
</section>
<section id="how-to-actually-run-it" class="level2">
<h2 class="anchored" data-anchor-id="how-to-actually-run-it">How to actually run it</h2>
<p>If you have the iron and you want to try it, here is the Unsloth-recommended path <span class="citation" data-cites="unsloth2026qwen38">(Unsloth 2026a)</span>. The new 1-bit quantization types need a patched <code>llama.cpp</code> branch, so build from the <code>iq1-narrow</code> branch rather than main:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">apt-get</span> update</span>
<span id="cb1-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">apt-get</span> install pciutils build-essential cmake curl libcurl4-openssl-dev <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-y</span></span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> clone <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--branch</span> iq1-narrow https://github.com/unslothai/llama.cpp</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cmake</span> llama.cpp <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-B</span> llama.cpp/build <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-DBUILD_SHARED_LIBS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>OFF <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-DGGML_CUDA</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>ON</span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cmake</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--build</span> llama.cpp/build <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--config</span> Release <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-j</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--clean-first</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb1-6">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--target</span> llama-cli llama-mtmd-cli llama-server llama-gguf-split</span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cp</span> llama.cpp/build/bin/llama-<span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span> llama.cpp</span></code></pre></div></div>
<p>Drop <code>-DGGML_CUDA=ON</code> to <code>OFF</code> if you are running on CPU only or on Apple Silicon (Metal is on by default).</p>
<p>Then pull the recommended 397GB quant:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">pip</span> install <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-U</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"huggingface_hub[cli]"</span></span>
<span id="cb2-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">hf</span> download unsloth/Qwen3.8-2.4T-A95B-GGUF <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--local-dir</span> unsloth/Qwen3.8-2.4T-A95B-GGUF <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--include</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"*Q1_0*"</span></span></code></pre></div></div>
<p>And run it:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">./llama.cpp/llama-cli</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-2">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--model</span> unsloth/Qwen3.8-2.4T-A95B-GGUF/UD-Q1_0/Qwen3.8-2.4T-A95B-UD-Q1_0-00001-of-00010.gguf <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-3">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--temp</span> 1.0 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--top-p</span> 0.95 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--top-k</span> 20 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--min-p</span> 0.0 <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-4">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--presence-penalty</span> 0.0 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--repetition-penalty</span> 1.0</span></code></pre></div></div>
<p>The inference settings matter because the open Qwen3.8 models are thinking-only: temperature 1.0, top-p 0.95, top-k 20, min-p 0.0. Context goes up to about 1.01 million tokens. On a B200 box you should see around 20 tokens per second of generation and over 120 tokens per second of throughput, which is genuinely usable for a single-user setup. If your memory is smaller than the quant, it still runs, it just pages to disk and you watch the tokens crawl.</p>
<p>If you’d rather skip the command line, Unsloth Desktop wraps the same thing in a UI: search for Qwen3.8 in the model hub, pick your quant, and it auto-detects multi-GPU setups and handles RAM offloading. Same weights, same <code>llama.cpp</code> under the hood.</p>
</section>
<section id="what-this-means-for-europe" class="level2">
<h2 class="anchored" data-anchor-id="what-this-means-for-europe">What this means for Europe</h2>
<p>The grace period I described was the window where open weights bought Europe time to build its own frontier lab, at the cost of depending on Chinese releases we don’t control <span class="citation" data-cites="green-twopillars-2026">(Green 2026b)</span>. The implicit assumption was that the open tier would stay a step behind the closed tier, a 27B here and a 405B there, while the real frontier stayed rentable from San Francisco or Hangzhou by the token.</p>
<p>That assumption is gone. The open tier is the frontier. A 2.4 trillion parameter MoE, 95B active, thinking-only, a handful of composite points off the best closed model on the Artificial Analysis index <span class="citation" data-cites="artificialanalysis2026">(Artificial Analysis 2026)</span>, is sitting on Hugging Face right now with a permissive license and a <code>llama.cpp</code> inference path. The capability gap between “what you can rent from Anthropic” and “what you can download and run yourself” is now measured in single digits, on a composite that tries to be fair. The marketing-tier framing was wrong because the frontier itself shipped open. There’s no smaller tier below it kept around for developer mindshare.</p>
<p>The grace period is still real, and it’s still revocable. Two things changed about it.</p>
<ol type="1">
<li>The capability part got better than I expected: The open frontier arrived, weeks ahead of my forecast.</li>
<li>The sovereignty part got worse than I expected: the open frontier arrived from Hangzhou, built on Chinese compute, under a national-strategy signal set in Beijing <span class="citation" data-cites="thenextweb2026china">(The Next Web 2026)</span>, and the only European contribution to the stack is the Nvidia GPUs we buy to run it. We swapped one foreign invoice for another. The pillar moved from closed-API-Chinese to open-weights-Chinese. It did not move closer to European.</li>
</ol>
<p>This was a choice Alibaba made, in a week, because the policy wind changed. The same policy wind can change back. Weights already downloaded are unenforceable to recall, and the model in my download queue stays mine. Future releases are not. A frontier that arrives as a policy favor serves the nation that granted the favor, and serves the rest of us only as long as serving us suits it.</p>
<p>The European read is unchanged from the Two Pillars post and I’ll keep saying it until it’s boring <span class="citation" data-cites="green-twopillars-revisited-2026">(Green 2026c)</span>. The living version of this argument, with the scores and the access regimes updated each time a frontier model lands, lives in the scoreboard <span class="citation" data-cites="green-scoreboard-2026">(Green 2026a)</span>. We know how to spend at frontier-lab scale: CERN and ESA together spend about €9.9 billion a year, roughly what Anthropic spent in 2025 <span class="citation" data-cites="epochai2026spending">(Epoch AI 2026)</span>. We have the legal machinery for strategic preference: SAFE, the International Procurement Instrument, the defense carve-outs. We apply it to particles and rockets and artillery. We do not apply it to the thing eating the rest of the economy.</p>
<p>The open tier being the frontier is the best news Europe has had on AI in a year. It buys us time and it removes the API-shutdown risk from the dependency stack. It does not build us a pillar. The clock still belongs to someone else, and the clock still runs.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Since Kimi-K3 <span class="citation" data-cites="moonshot2026kimik3">(Moonshot AI 2026)</span> and Qwen 3.8 <span class="citation" data-cites="alibaba2026qwen38max">(Alibaba / Qwen Team 2026)</span> the open-weights frontier is here, you can run it on a maxed Mac Studio if you accept the 1-bit quant, and Europe still has no domestic frontier lab to contribute to it. Why are we still paying them to do it in San Francisco and Hangzhou instead of here?</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-alibaba2026qwen38max" class="csl-entry">
Alibaba / Qwen Team. 2026. <em>Qwen3.8-Max Release Blog</em>. <a href="https://qwen.ai/blog?id=qwen3.8">https://qwen.ai/blog?id=qwen3.8</a>.
</div>
<div id="ref-artificialanalysis2026" class="csl-entry">
Artificial Analysis. 2026. <em>Artificial Analysis Intelligence Index, V4.1</em>. <a href="https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index">https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index</a>.
</div>
<div id="ref-epochai2026spending" class="csl-entry">
Epoch AI. 2026. <em>Company Spending Breakdown</em>. <a href="https://epoch.ai/data-insights/company-spending-breakdown">https://epoch.ai/data-insights/company-spending-breakdown</a>.
</div>
<div id="ref-green-scoreboard-2026" class="csl-entry">
Green, Michael. 2026a. <em>Europe’s Frontier AI Scoreboard</em>. <a href="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/">https://drmike.xyz/posts/europe-frontier-ai-scoreboard/</a>.
</div>
<div id="ref-green-twopillars-2026" class="csl-entry">
Green, Michael. 2026b. <em>The Two Pillars Are Both Rotting</em>. <a href="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/">https://drmike.xyz/posts/the-two-pillars-are-both-rotting/</a>.
</div>
<div id="ref-green-twopillars-revisited-2026" class="csl-entry">
Green, Michael. 2026c. <em>The Two Pillars, Revisited: The Moat Rotted Faster, the Choice Didn’t</em>. <a href="https://drmike.xyz/posts/the-two-pillars-revisited/">https://drmike.xyz/posts/the-two-pillars-revisited/</a>.
</div>
<div id="ref-moonshot2026kimik3" class="csl-entry">
Moonshot AI. 2026. <em>Kimi K3 (Hugging Face Model Card)</em>. <a href="https://huggingface.co/moonshotai/Kimi-K3">https://huggingface.co/moonshotai/Kimi-K3</a>.
</div>
<div id="ref-thenextweb2026china" class="csl-entry">
The Next Web. 2026. <em>China Endorses Open-Weight AI as National Strategy; Consulting on Restricting Overseas Access to Most Advanced Models</em>. <a href="https://thenextweb.com">https://thenextweb.com</a>.
</div>
<div id="ref-unsloth2026qwen38" class="csl-entry">
Unsloth. 2026a. <em>Qwen3.8 — How to Run Locally</em>. <a href="https://unsloth.ai/docs/models/qwen3.8">https://unsloth.ai/docs/models/qwen3.8</a>.
</div>
<div id="ref-unsloth-qwen38-gguf-2026" class="csl-entry">
Unsloth. 2026b. <em>Qwen3.8-2.4T-A95B-GGUF (Hugging Face)</em>. <a href="https://huggingface.co/unsloth/Qwen3.8-2.4T-A95B-GGUF">https://huggingface.co/unsloth/Qwen3.8-2.4T-A95B-GGUF</a>.
</div>
</div></section></div> ]]></description>
  <category>European AI sovereignty</category>
  <category>open source AI</category>
  <category>foundation models</category>
  <category>frontier models</category>
  <category>self-hosting</category>
  <guid>https://drmike.xyz/posts/qwen3-8-open-weights-frontier/</guid>
  <pubDate>Wed, 12 Aug 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>Europe’s Frontier AI Scoreboard</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/europe-frontier-ai-scoreboard/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I have written about Europe’s AI sovereignty problem four times now <span class="citation" data-cites="green-twopillars-2026 green-twopillars-revisited-2026">(Green 2026a, 2026b)</span>, and every time I land in the same uncomfortable place. The two pillars Europe leans on (the closed US frontier and the open Chinese weights frontier) are both rotting, and the continent I live in still has no pillar of its own.</p>
<p>The snapshot date above the table is the version. It changes when a frontier model lands, the AA index changes version, or a set of weights moves behind an endpoint.</p>
</section>
<section id="the-two-pillars" class="level2">
<h2 class="anchored" data-anchor-id="the-two-pillars">The two pillars</h2>
<p>Europe runs its frontier AI on two pillars we do not control. Pillar one is the closed US frontier (Anthropic, OpenAI, Meta, xAI, Google) accessed through APIs whose terms can change overnight based on a government we have nothing to do with. Pillar two is the open Chinese weights frontier (Kimi, Xiaomi’s MiMo, DeepSeek, the Qwen open line, and the GLM line) which ships real weights today but ships them from a jurisdiction consulting on restricting overseas access to its most advanced models <span class="citation" data-cites="beijing-export-consult-2026">(The Next Web 2026)</span>. Both pillars can be pulled. We saw pillar two wobble in slow motion when Qwen3.8-Max launched API-only with weights “promised within days”, watched it partly reset on 2026-08-13 when the 2.4T-A95B weights landed on HuggingFace, watched it wobble again when Z.ai shipped GLM-5.3 API-first and delayed the weights over the model’s own cyber capability, and then watched the promise kept in full: the Flash tier landed open on 2026-08-26, and the full 5.3 weights landed on 2026-08-28, two weeks to the day after the API launch, on the schedule Z.ai named up front <span class="citation" data-cites="zai-glm53-2026 zai-glm53-flash-2026">(Z AI 2026a, 2026b)</span>. We saw pillar one’s political risk go from theoretical to concrete when Anthropic tried corporate self-regulation for military use and got punished so publicly that no rational actor will try it again <span class="citation" data-cites="anthropic-military-2026">(Anthropic 2026a)</span>. Europe has its own version of the rented pillar. Spain’s Multiverse Computing serves a compressed, proprietary copy of GLM-5.2 from its own API.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>Renting frontier AI from San Francisco or renting it from Hangzhou is the same dependency with different invoices.</p>
</div>
</div>
</div>
<div id="fig-threepillars" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-threepillars-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/dependency_stack.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: Three pillars under a beam labelled “AI that Europe runs”. Two are solid and rented: the US closed frontier (Anthropic, OpenAI, Google, xAI, Meta) and the Chinese open-weights frontier (MiMo-V2.6, GLM-5.3, Kimi K3, Qwen 2.4T + Flash-Next + 27B). The third, the EU frontier (Mistral Large 4 in preview, Multiverse’s compressed Quasar, EUROPA / Domyn in training), is a dashed outline, mostly empty."><img src="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/figs/dependency_stack.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/dependency_stack.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;1: Three pillars under a beam labelled “AI that Europe runs”. Two are solid and rented: the US closed frontier (Anthropic, OpenAI, Google, xAI, Meta) and the Chinese open-weights frontier (MiMo-V2.6, GLM-5.3, Kimi K3, Qwen 2.4T + Flash-Next + 27B). The third, the EU frontier (Mistral Large 4 in preview, Multiverse’s compressed Quasar, EUROPA / Domyn in training), is a dashed outline, mostly empty."><img src="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/figs/dependency_stack.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-threepillars-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Three pillars under a beam labelled “AI that Europe runs”. Two are solid and rented: the US closed frontier (Anthropic, OpenAI, Google, xAI, Meta) and the Chinese open-weights frontier (MiMo-V2.6, GLM-5.3, Kimi K3, Qwen 2.4T + Flash-Next + 27B). The third, the EU frontier (Mistral Large 4 in preview, Multiverse’s compressed Quasar, EUROPA / Domyn in training), is a dashed outline, mostly empty.
</figcaption>
</figure>
</div>
</section>
<section id="what-changed" class="level2">
<h2 class="anchored" data-anchor-id="what-changed">What changed</h2>
<p>Two launches moved the board this snapshot, and one of them is European.</p>
<p>Mistral launched a public preview of Mistral Large 4 on 2026-10-06 <span class="citation" data-cites="mistral-large-4-2026">(Mistral AI 2026)</span>. It grades 38.4, the best European score this board has recorded, 11.7 points above Multiverse’s Quasar and 24.2 above Mistral Medium 3.5 <span class="citation" data-cites="aa-mistral-large-4-2026">(Artificial Analysis 2026g)</span>. Europe’s gap to the top shrank from 30.9 points to 19.2. It is Mistral’s own model, a 1-trillion-parameter natively multimodal mixture-of-experts with 49 billion active, trained from scratch on 3,800 Nvidia Grace Blackwell GPUs in Mistral’s own European datacenters. Artificial Analysis calls it the most intelligent model from outside the US and China. It still trails four Chinese open-weights rows on the board, and its own row is still a date. The preview is API-only, with the weights promised for the end of October. That is the StepFun pattern, from a European lab.</p>
<p>Google came back a week earlier, with a model Europe can’t use. Gemini 4 Argon, announced 2026-09-30, grades 52.6, 0.1 behind GPT-6 Astra <span class="citation" data-cites="google-gemini-4-argon-2026">(Google 2026)</span>. Google is rolling it out only to partners in its Fairwind Program, who may give access only to internal cybersecurity, incident response and penetration testing teams <span class="citation" data-cites="google-fairwind-2026">(Google DeepMind 2026)</span>. The frontier window now holds four labs, all American and closed, and the third-best model on the board is the first row with a “Restricted” verdict.</p>
<p>The rest of the top held. Claude Opus 5.5 still leads at 57.6, 4.9 points ahead of Astra <span class="citation" data-cites="anthropic-opus-55-2026 aa-opus-55-2026">(Anthropic 2026b; Artificial Analysis 2026f)</span>. Anthropic and OpenAI shipped cheaper tiers under their flagships since the last snapshot (Claude Sonnet 5.5 at 56.0, GPT-6.1 Sol at 51.8).</p>
<p>Below the window, no score moved. MiMo-V2.6-Pro is still the best open model at 46.3, 11.3 points under the top <span class="citation" data-cites="xiaomi-mimo-v26-pro-2026">(Xiaomi MiMo 2026)</span>. The Step 5 weights are due 2026-10-15 <span class="citation" data-cites="stepfun-step5-preview-2026">(StepFun 2026)</span>. The Qwen Max hybrid is nine weeks past “within days”, and the closed 0902 endpoint still grades 5.5 points above the open 2.4T <span class="citation" data-cites="qwen38-max-2026">(Alibaba 2026b)</span>. DeepSeek V4.1 Pro has not shipped <span class="citation" data-cites="deepseek-changelog-2026">(DeepSeek 2026a)</span>. One new Chinese lab graded near the window: InclusionAI, with Ling 3.1 Flash at 41.1 on 2026-10-01. The index is still on v4.3.2, so every score on this page compares directly with the last snapshot.</p>
</section>
<section id="the-scoreboard" class="level2">
<h2 class="anchored" data-anchor-id="the-scoreboard">The scoreboard</h2>
<p>Snapshot date: 2026-10-07. Scores from the Artificial Analysis Intelligence Index v4.3, pulled from their Data API (free tier) <span class="citation" data-cites="artificialanalysis2026 aal-data-api">(Artificial Analysis 2026d, 2026c)</span>. Each row is the top reasoning variant of that lab’s frontier model, selected automatically: a lab enters when its best model is within ten points of the board’s top score, European labs enter regardless of score, and the curated open-line rows carry the open-weights argument. The Δ top column is each row’s distance from the board’s best score. Treat every number as a point-in-time reading. The index was rebuilt twice between 2026-08-28 and 2026-09-15, so scores on this page compare with the 2026-09-15 snapshot (v4.3, patched to v4.3.2 on 2026-09-19) and with nothing before it. The Δ top column and the ordering are the quantities that compare across all of them.</p>
<div id="fig-scoreboard" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-scoreboard-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="light-content">
<p><a href="figs/aa_index.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Figure&nbsp;2: Horizontal bar chart of the Artificial Analysis Intelligence Index v4.3, free API snapshot 2026-10-07, with a dashed vertical line marking the frontier top at 57.6. Anthropic Claude Opus 5.5 leads at 57.6, then OpenAI GPT-6 Astra at 52.7, Google Gemini 4 Argon at 52.6 and Meta Muse Spark 1.3 at 48.1 (all closed, red). Then the Chinese rows: Xiaomi MiMo-V2.6-Pro at 46.3 and Z.ai GLM-5.3 at 44.8 (open weights, green), StepFun Step 5 Preview at 43.7 (API-only, weights promised, purple), Kimi K3 at 43.6 and Qwen3.8-Flash-Next at 39.8 (open weights, green). Then Mistral Large 4 Preview at 38.4 (EU, blue) with an arrow marking Europe’s 19.2-point gap to the frontier, Qwen3.8-27B at 33.7 (green), Multiverse Computing’s proprietary Quasar 438B at 26.7 (EU, blue), gpt-oss-120b at 11.6 (US open, teal), and Swiss AI Initiative Apertus 70B at 5.1 (Europe, blue)."><img src="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/figs/aa_index.light.png" class="img-fluid figure-img"></a></p>
</div>
<div class="dark-content">
<p><a href="figs/aa_index.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Figure&nbsp;2: Horizontal bar chart of the Artificial Analysis Intelligence Index v4.3, free API snapshot 2026-10-07, with a dashed vertical line marking the frontier top at 57.6. Anthropic Claude Opus 5.5 leads at 57.6, then OpenAI GPT-6 Astra at 52.7, Google Gemini 4 Argon at 52.6 and Meta Muse Spark 1.3 at 48.1 (all closed, red). Then the Chinese rows: Xiaomi MiMo-V2.6-Pro at 46.3 and Z.ai GLM-5.3 at 44.8 (open weights, green), StepFun Step 5 Preview at 43.7 (API-only, weights promised, purple), Kimi K3 at 43.6 and Qwen3.8-Flash-Next at 39.8 (open weights, green). Then Mistral Large 4 Preview at 38.4 (EU, blue) with an arrow marking Europe’s 19.2-point gap to the frontier, Qwen3.8-27B at 33.7 (green), Multiverse Computing’s proprietary Quasar 438B at 26.7 (EU, blue), gpt-oss-120b at 11.6 (US open, teal), and Swiss AI Initiative Apertus 70B at 5.1 (Europe, blue)."><img src="https://drmike.xyz/posts/europe-frontier-ai-scoreboard/figs/aa_index.dark.png" class="img-fluid figure-img"></a></p>
</div>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-scoreboard-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Horizontal bar chart of the Artificial Analysis Intelligence Index v4.3, free API snapshot 2026-10-07, with a dashed vertical line marking the frontier top at 57.6. Anthropic Claude Opus 5.5 leads at 57.6, then OpenAI GPT-6 Astra at 52.7, Google Gemini 4 Argon at 52.6 and Meta Muse Spark 1.3 at 48.1 (all closed, red). Then the Chinese rows: Xiaomi MiMo-V2.6-Pro at 46.3 and Z.ai GLM-5.3 at 44.8 (open weights, green), StepFun Step 5 Preview at 43.7 (API-only, weights promised, purple), Kimi K3 at 43.6 and Qwen3.8-Flash-Next at 39.8 (open weights, green). Then Mistral Large 4 Preview at 38.4 (EU, blue) with an arrow marking Europe’s 19.2-point gap to the frontier, Qwen3.8-27B at 33.7 (green), Multiverse Computing’s proprietary Quasar 438B at 26.7 (EU, blue), gpt-oss-120b at 11.6 (US open, teal), and Swiss AI Initiative Apertus 70B at 5.1 (Europe, blue).
</figcaption>
</figure>
</div>
<!-- AA-TABLE-START -->
<table class="caption-top table">
<colgroup>
<col style="width: 7%">
<col style="width: 5%">
<col style="width: 9%">
<col style="width: 25%">
<col style="width: 8%">
<col style="width: 11%">
<col style="width: 8%">
<col style="width: 12%">
<col style="width: 10%">
</colgroup>
<thead>
<tr class="header">
<th>Rank</th>
<th>Lab</th>
<th>Region</th>
<th>Latest frontier model</th>
<th>Open?</th>
<th>AA index</th>
<th>Δ top</th>
<th>EU access</th>
<th>Verdict</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Anthropic</td>
<td>US</td>
<td>Claude Opus 5.5</td>
<td>Proprietary</td>
<td>57.6</td>
<td>0.0</td>
<td>API</td>
<td>Revocable (ToS and political risk)</td>
</tr>
<tr class="even">
<td>2</td>
<td>OpenAI</td>
<td>US</td>
<td>GPT-6 Astra</td>
<td>Proprietary</td>
<td>52.7</td>
<td>−4.9</td>
<td>API</td>
<td>Revocable</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Google</td>
<td>US</td>
<td>Gemini 4 Argon</td>
<td>Proprietary</td>
<td>52.6</td>
<td>−5.0</td>
<td>None (Fairwind partners only)</td>
<td>Restricted (Fairwind Program cyber defenders only)</td>
</tr>
<tr class="even">
<td>4</td>
<td>Meta</td>
<td>US</td>
<td>Muse Spark 1.3</td>
<td>Proprietary</td>
<td>48.1</td>
<td>−9.5</td>
<td>API</td>
<td>Revocable (Meta closed its frontier)</td>
</tr>
<tr class="odd">
<td>5</td>
<td>Xiaomi</td>
<td>China</td>
<td>MiMo-V2.6-Pro</td>
<td>Open weights (MIT, shipped 2026-09-21)</td>
<td>46.3</td>
<td>−11.3</td>
<td>Self-host</td>
<td>Revocable (Beijing consulting export limits)</td>
</tr>
<tr class="even">
<td>6</td>
<td>Z.ai</td>
<td>China</td>
<td>GLM-5.3</td>
<td>Open weights (custom permissive license, shipped 2026-08-28)</td>
<td>44.8</td>
<td>−12.8</td>
<td>Self-host</td>
<td>Revocable (Beijing consulting export limits)</td>
</tr>
<tr class="odd">
<td>7</td>
<td>StepFun</td>
<td>China</td>
<td>Step 5 Preview</td>
<td>API-only preview; weights promised for 2026-10-15</td>
<td>43.7</td>
<td>−13.9</td>
<td>API</td>
<td>Revocable (weights promised, not shipped)</td>
</tr>
<tr class="even">
<td>8</td>
<td>Moonshot</td>
<td>China</td>
<td>Kimi K3</td>
<td>Open weights</td>
<td>43.6</td>
<td>−14.0</td>
<td>Self-host</td>
<td>Revocable (Beijing consulting export limits)</td>
</tr>
<tr class="odd">
<td>9</td>
<td>Alibaba (Flash-Next open)</td>
<td>China</td>
<td>Qwen3.8-Flash-Next</td>
<td>Open weights (Qwen community license)</td>
<td>39.8</td>
<td>−17.8</td>
<td>Self-host</td>
<td>Revocable (Beijing consulting export limits)</td>
</tr>
<tr class="even">
<td>10</td>
<td>Mistral</td>
<td>EU</td>
<td>Mistral Large 4 Preview</td>
<td>API-only preview; weights promised end of October 2026</td>
<td>38.4</td>
<td>−19.2</td>
<td>API</td>
<td>EU pillar, trained in Europe, weights promised end of October</td>
</tr>
<tr class="odd">
<td>11</td>
<td>Alibaba (27B open)</td>
<td>China</td>
<td>Qwen3.8-27B</td>
<td>Open weights (Apache 2.0)</td>
<td>33.7</td>
<td>−23.9</td>
<td>Self-host</td>
<td>Revocable (Beijing consulting export limits)</td>
</tr>
<tr class="even">
<td>12</td>
<td>Multiverse Computing</td>
<td>EU</td>
<td>Quasar 438B</td>
<td>Proprietary (AA: based on GLM-5.2)</td>
<td>26.7</td>
<td>−30.9</td>
<td>API</td>
<td>EU pillar, under construction, far from frontier (AA: GLM-5.2 derivative)</td>
</tr>
<tr class="odd">
<td>13</td>
<td>OpenAI (open line)</td>
<td>US</td>
<td>gpt-oss-120b</td>
<td>Open weights</td>
<td>11.6</td>
<td>−46.0</td>
<td>Self-host</td>
<td>Stable, but far from frontier</td>
</tr>
<tr class="even">
<td>14</td>
<td>Swiss AI Initiative</td>
<td>Europe (non-EU)</td>
<td>Apertus 70B Instruct</td>
<td>Open weights</td>
<td>5.1</td>
<td>−52.5</td>
<td>Self-host</td>
<td>European, outside EU jurisdiction</td>
</tr>
<tr class="odd">
<td>n/a</td>
<td>EUROPA / Domyn</td>
<td>EU</td>
<td>In training</td>
<td>TBD</td>
<td>TBD</td>
<td>TBD</td>
<td>EU native</td>
<td>Under construction, &gt;400B params, 24 EU languages</td>
</tr>
</tbody>
</table>
<!-- AA-TABLE-END -->
<p>The Qwen family still spans four openness states: a closed Max endpoint (45.4 for the 0902 refresh, below the window and not a row), an open 2.4T sibling (39.9), an open Flash-Next architecture preview on the Qwen community license (39.8), and an Apache 2.0 consumer 27B (33.7), with the Max hybrid nine weeks past its launch-day promise <span class="citation" data-cites="qwen38-max-2026 qwen38-flashnext-2026">(Alibaba 2026b, 2026a)</span>. The Multiverse cell is proprietary, based on GLM-5.2, and served from Spain <span class="citation" data-cites="aa-quasar-438b-2026">(Artificial Analysis 2026h)</span>. OpenAI’s gpt-oss-120b, the only American open-weights row, grades 11.6, which puts it in research-artifact territory.</p>
</section>
<section id="how-to-read-it" class="level2">
<h2 class="anchored" data-anchor-id="how-to-read-it">How to read it</h2>
<p>The AA index moves week to week as it re-aggregates. It was rebuilt twice in early September and has run on the v4.3.2 patch since 2026-09-19 <span class="citation" data-cites="aa-changelog-v432-2026">(Artificial Analysis 2026e)</span>. Intelligence Index v4.3 aggregates ten evaluations (AA-Briefcase, GDPval-AA v2, AutomationBench-AA, Terminal-Bench v4.0, SciCode, Humanity’s Last Exam, GDP.pdf, CritPt, AA-Omniscience, AA-LCR v1.1), and roughly 40 percent of the composite is now graded on private test sets <span class="citation" data-cites="aa-index-v42-2026 aa-index-v43-2026">(Artificial Analysis 2026a, 2026b)</span>. A model can gain or lose a point or two without a new release, just because the index re-sampled. It can lose a lot more when the yardstick gets replaced. So a point or two between the rows at the top of the board is noise. The signal is which labs are within shouting distance of the frontier top, and which access regime they ship under. The frontier window now closes after row 4, Muse Spark 1.3 at 48.1. Grok 4.7 (46.4), MiMo-V2.6-Pro (46.3), Qwen3.8-Max-0902 (45.4), Ling 3.1 Flash (41.1) and DeepSeek (39.5) all sit below it.</p>
<p>“Open?” is the column that matters most for Europe, and it is the one most likely to lie to you. The MiMo cell is a receipt: MIT weights on HuggingFace the day the model was announced <span class="citation" data-cites="xiaomi-mimo-v26-pro-2026">(Xiaomi MiMo 2026)</span>. The Step 5 cell is a promise with a date, 2026-10-15, and no license yet <span class="citation" data-cites="stepfun-step5-preview-2026">(StepFun 2026)</span>. The Mistral cell is the same kind of promise from a European lab, weights by the end of October <span class="citation" data-cites="mistral-large-4-2026">(Mistral AI 2026)</span>. The GLM-5.3 cell shows what a kept promise looks like: the Flash sibling open under MIT since 2026-08-26, and the full 5.3 weights on HuggingFace on 2026-08-28, on the two-week schedule Z.ai announced up front <span class="citation" data-cites="zai-glm53-2026 zai-glm53-flash-2026">(Z AI 2026a, 2026b)</span>. The Qwen cell is still a promise: the Max hybrid was promised “within days” on 2026-08-03, and nine weeks later the model card is still not on HuggingFace, while everything below the Max line (2.4T, Flash-Next, 27B) is open and a dated API refresh shipped instead <span class="citation" data-cites="qwen38-max-2026">(Alibaba 2026b)</span>. Alibaba fenced its Max tier across two generations (Qwen3.7-Max proprietary, Qwen3.8-Max paid preview), and the 2026-08-13 open-weighting of the 2.4T-A95B broke the pattern for everything except the top. The 27B cell has no promise and no asterisk: Apache 2.0, on HuggingFace, downloadable today.</p>
<p>“EU access” comes in three kinds now. API access means you can call the model today and you cannot run it yourself tomorrow if the provider decides you should not. Self-host means you have the weights on hardware you control, and the only thing that can take that away is a license change you can see coming or a jurisdiction deciding to restrict exports. The third kind arrived with Gemini 4 Argon. Unless you are one of Google’s Fairwind partners, you get no access, and partners get it only for their internal security teams <span class="citation" data-cites="google-fairwind-2026">(Google DeepMind 2026)</span>.</p>
</section>
<section id="where-europe-sits" class="level2">
<h2 class="anchored" data-anchor-id="where-europe-sits">Where Europe sits</h2>
<p>Mistral is Europe’s best-graded lab again, with Large 4 Preview ranked #70 among all graded variants <span class="citation" data-cites="aa-mistral-large-4-2026">(Artificial Analysis 2026g)</span>. The ASML-led 1.7 billion euro Series C put real compute behind the company <span class="citation" data-cites="mistral-asml-seriesc-2025">(CNBC 2025)</span>, and Large 4 is the first Mistral model on this board within twenty points of the top. The frontier-tier question (does Mistral ship a model that sits in the top three of the AA index, ever) is still open. Until the weights land at the end of October, Europe’s best model is one Europe can call and not yet run.</p>
<p>Multiverse Computing drops to second. Quasar 438B (26.7, ranked #138) is proprietary, served from Multiverse’s own CompactifAI API, and, by Multiverse’s own technical note, “a compressed model built from GLM-5.2”, the Chinese open-weights model, pruned with their quantum-inspired method <span class="citation" data-cites="multiverse-quasar-inside-2026 aa-quasar-438b-2026">(Multiverse Computing 2026; Artificial Analysis 2026h)</span>. At launch Multiverse billed it as Europe’s leading AI model. Five weeks later Mistral’s own model passed it. The open GLM-5.2 original still leads the compressed copy 33.7 to 26.7, and the original is free to self-host while the copy is API-only. Their previous graded model, HyperNova 60B, is the same pattern: AA labels it “based on gpt-oss-120b”, the American open-weights artifact. Both of Multiverse’s graded rows are compressions of other labs’ open models. That is a real business, and it is a long way from a frontier.</p>
<p>The EUROPA consortium led by Domyn is the other one to watch, and it is unchanged. The EU Frontier AI Grand Challenge is funding a &gt;400 billion parameter model trained on all 24 EU languages on a 6,000-chip Nvidia Blackwell cluster <span class="citation" data-cites="eu-frontier-grand-challenge-2026">(European Commission 2026)</span>. It is still the only announced European project that names the frontier tier as its goal. It is also not a frontier model yet, and the gap between “we are training a 400B model” and “we have a model in the top three of the AA index” is exactly the gap Europe has been failing to close for two years.</p>
<p>Apertus 70B (Swiss AI Initiative, 5.1, ranked #652) is real, downloadable, European, and 52.5 points off the frontier, 33.3 points behind Europe’s best.</p>
<p>There is still no European row in the top half of the table. Mistral Large 4 is row 10 of 14.</p>
</section>
<section id="what-would-change-the-table" class="level2">
<h2 class="anchored" data-anchor-id="what-would-change-the-table">What would change the table</h2>
<p>These would move the table beyond normal score drift:</p>
<ul>
<li>Mistral ships the Large 4 weights by the end of October. Europe gets its first self-hostable model within twenty points of the top, or a European promise joins Qwen Max on the list of promises gone quiet <span class="citation" data-cites="mistral-large-4-2026">(Mistral AI 2026)</span>.</li>
<li>StepFun ships the Step 5 weights on 2026-10-15. The row flips from a date to a receipt, or it joins Qwen Max as a promise gone quiet <span class="citation" data-cites="stepfun-step5-preview-2026">(StepFun 2026)</span>.</li>
<li>DeepSeek V4.1 Pro ships. DeepSeek’s best graded model is still V4.1-Flash, open weights under MIT, shipped 2026-09-10, at 39.5 <span class="citation" data-cites="deepseek-v41-flash-2026">(DeepSeek 2026b)</span>. V4.1 Pro has not shipped, and V4 Pro stays on the API for now <span class="citation" data-cites="deepseek-changelog-2026">(DeepSeek 2026a)</span>. If V4.1 Pro lands anywhere near the window, DeepSeek is back.</li>
<li>Qwen3.8-Max hybrid weights actually ship. Nine weeks and one dated API refresh later, still no model card, and the refresh now grades 5.5 points above the open 2.4T. Z.ai has now kept a dated weights promise; Alibaba’s is the standing counterexample. I will believe the hybrid when the model card lands on HuggingFace.</li>
<li>Qwen4 ships. Alibaba previewed it as in training at Apsara on 2026-09-22, with no dates <span class="citation" data-cites="alibaba-apsara-2026">(Alizila 2026)</span>. Flash-Next is still the only open preview of the Qwen4 architecture. If Qwen4 lands as a Max-class open drop, the top of the board is in play. If it lands API-only with open siblings below, the Qwen pattern repeats at the next generation.</li>
<li>Beijing formalizes the overseas-access restrictions it has been consulting on. The reporting now says the Ministry of Commerce is drafting a tiered export regime that would treat Qwen and DeepSeek weights the way Washington treats advanced chips <span class="citation" data-cites="beijing-export-consult-2026">(The Next Web 2026)</span>. Several Chinese rows flip their verdict from “Revocable” to “Restricted” and pillar two gets measurably weaker for Europe.</li>
<li>A US provider changes terms in a way that breaks EU access (region lock, use-case restriction, government-mandated cutoff). The corresponding US row gets a date stamped on its verdict.</li>
<li>Google opens Gemini 4 Argon beyond Fairwind. The row’s EU access changes from none to API, and the board’s only restricted row becomes an ordinary revocable one.</li>
<li>EUROPA publishes a model, or Mistral lands one in the AA index top ten. A row leaves or joins the board.</li>
<li>Meta re-opens a frontier-tier Muse Spark with open weights, or OpenAI ships an open-weights model above 40. The US regains an open-weights frontier leg, and the two-pillar story gets a third leg I did not expect.</li>
<li>A non-US lab re-enters the frontier window. Right now the window holds four American closed labs and nothing else. MiMo-V2.6-Pro sits 1.3 points under the line.</li>
</ul>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Every time a frontier model lands, the good news is about someone else’s model and the bad news is about someone else’s decision. Europe’s role is to read the announcement and adjust its compliance documentation.</p>
<p>Eleven of the fourteen scored rows are non-European, and every row above Europe’s best is a model Europe uses on terms set outside Europe, one of them a model Europe can’t use at all. The good news this round is European: Mistral trained a 1-trillion-parameter model in its own datacenters, and it is the closest a European lab has come to the top of this board. The bad news is that the open frontier above it is Chinese, and Mistral’s weights are a promise until the end of October.</p>
<p>Z.ai named a date for the GLM-5.3 weights and kept it. Xiaomi shipped MiMo’s weights with no promise at all. StepFun named 2026-10-15, and Mistral named the end of October. Alibaba put a new date on a closed API and let the hybrid promise run past nine weeks, while the closed endpoint pulled 5.5 points ahead of the open one. Each of those weights ships when the lab that trained it decides, and Mistral’s is the only date Europe has any say in. The closed US frontier added Google this round, behind a cyber-defender access program, and the rest of it is revocable, as we watched the political risk go concrete in March. The European pillar is under construction, and this round its best model is Mistral’s own, trained in Europe. Of the three pillars, it is the only one Europe controls.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-qwen38-flashnext-2026" class="csl-entry">
Alibaba. 2026a. <em>Qwen3.8-Flash-Next (Hugging Face Model Card)</em>. <a href="https://huggingface.co/Qwen/Qwen3.8-Flash-Next">https://huggingface.co/Qwen/Qwen3.8-Flash-Next</a>.
</div>
<div id="ref-qwen38-max-2026" class="csl-entry">
Alibaba. 2026b. <em>Qwen3.8-Max Release Blog</em>. <a href="https://qwen.ai/blog?id=qwen3.8">https://qwen.ai/blog?id=qwen3.8</a>.
</div>
<div id="ref-alibaba-apsara-2026" class="csl-entry">
Alizila. 2026. <em>Eddie Wu Shares Alibaba’s Strategic Full-Stack AI Roadmap at the 2026 Apsara Conference</em>. <a href="https://www.alizila.com/aliviews-eddie-wu-shares-alibabas-strategic-full-stack-ai-roadmap-at-the-2026-apsara-conference/">https://www.alizila.com/aliviews-eddie-wu-shares-alibabas-strategic-full-stack-ai-roadmap-at-the-2026-apsara-conference/</a>.
</div>
<div id="ref-anthropic-military-2026" class="csl-entry">
Anthropic. 2026a. <em>Corporate Self-Regulation for Military AI Applications</em>.
</div>
<div id="ref-anthropic-opus-55-2026" class="csl-entry">
Anthropic. 2026b. <em>Introducing Claude Opus 5.5</em>. <a href="https://www.anthropic.com/claude-opus-5-5">https://www.anthropic.com/claude-opus-5-5</a>.
</div>
<div id="ref-aa-index-v42-2026" class="csl-entry">
Artificial Analysis. 2026a. <em>Announcing Artificial Analysis Intelligence Index V4.2</em>. <a href="https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-2">https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-2</a>.
</div>
<div id="ref-aa-index-v43-2026" class="csl-entry">
Artificial Analysis. 2026b. <em>Announcing the Artificial Analysis Intelligence Index V4.3</em>. <a href="https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-3">https://artificialanalysis.ai/articles/artificial-analysis-intelligence-index-v4-3</a>.
</div>
<div id="ref-aal-data-api" class="csl-entry">
Artificial Analysis. 2026c. <em>Artificial Analysis Data API</em>. <a href="https://artificialanalysis.ai/data-api/docs">https://artificialanalysis.ai/data-api/docs</a>.
</div>
<div id="ref-artificialanalysis2026" class="csl-entry">
Artificial Analysis. 2026d. <em>Artificial Analysis Intelligence Index, V4.3</em>. <a href="https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index">https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index</a>.
</div>
<div id="ref-aa-changelog-v432-2026" class="csl-entry">
Artificial Analysis. 2026e. <em>Changelog: Intelligence Index V4.3.2</em>. <a href="https://artificialanalysis.ai/changelog">https://artificialanalysis.ai/changelog</a>.
</div>
<div id="ref-aa-opus-55-2026" class="csl-entry">
Artificial Analysis. 2026f. <em>Claude Opus 5.5 Takes the Top Spot on the Artificial Analysis Intelligence Index</em>. <a href="https://artificialanalysis.ai/articles/claude-opus-5-5">https://artificialanalysis.ai/articles/claude-opus-5-5</a>.
</div>
<div id="ref-aa-mistral-large-4-2026" class="csl-entry">
Artificial Analysis. 2026g. <em>Mistral Large 4 Preview: Intelligence, Performance and Price Analysis</em>. <a href="https://artificialanalysis.ai/models/mistral-large-4">https://artificialanalysis.ai/models/mistral-large-4</a>.
</div>
<div id="ref-aa-quasar-438b-2026" class="csl-entry">
Artificial Analysis. 2026h. <em>Quasar 438B (Max, Based on GLM-5.2)</em>. <a href="https://artificialanalysis.ai/models/quasar-438b">https://artificialanalysis.ai/models/quasar-438b</a>.
</div>
<div id="ref-mistral-asml-seriesc-2025" class="csl-entry">
CNBC. 2025. <em>ASML Leads Mistral’s 1.7 Billion Series c</em>. <a href="https://www.cnbc.com">https://www.cnbc.com</a>.
</div>
<div id="ref-deepseek-changelog-2026" class="csl-entry">
DeepSeek. 2026a. <em>Change Log</em>. <a href="https://api-docs.deepseek.com/updates/">https://api-docs.deepseek.com/updates/</a>.
</div>
<div id="ref-deepseek-v41-flash-2026" class="csl-entry">
DeepSeek. 2026b. <em>Introducing DeepSeek-V4.1-Flash: Smarter, Faster, More Efficient</em>. <a href="https://www.deepseek.com/en/news/deepseek-v4-1-flash/">https://www.deepseek.com/en/news/deepseek-v4-1-flash/</a>.
</div>
<div id="ref-eu-frontier-grand-challenge-2026" class="csl-entry">
European Commission. 2026. <em>EU Frontier AI Grand Challenge</em>. <a href="https://digital-strategy.ec.europa.eu/en/funding/turning-strategy-action-commission-launches-frontier-ai-grand-challenge">https://digital-strategy.ec.europa.eu/en/funding/turning-strategy-action-commission-launches-frontier-ai-grand-challenge</a>.
</div>
<div id="ref-google-gemini-4-argon-2026" class="csl-entry">
Google. 2026. <em>Gemini 4 Argon: Our Next Era of Frontier Intelligence</em>. <a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-argon/">https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-argon/</a>.
</div>
<div id="ref-google-fairwind-2026" class="csl-entry">
Google DeepMind. 2026. <em>Fairwind Program</em>. <a href="https://deepmind.google/fairwind-program/">https://deepmind.google/fairwind-program/</a>.
</div>
<div id="ref-green-twopillars-2026" class="csl-entry">
Green, Michael. 2026a. <em>The Two Pillars Are Both Rotting</em>. <a href="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/">https://drmike.xyz/posts/the-two-pillars-are-both-rotting/</a>.
</div>
<div id="ref-green-twopillars-revisited-2026" class="csl-entry">
Green, Michael. 2026b. <em>The Two Pillars, Revisited: The Moat Rotted Faster, the Choice Didn’t</em>. <a href="https://drmike.xyz/posts/the-two-pillars-revisited/">https://drmike.xyz/posts/the-two-pillars-revisited/</a>.
</div>
<div id="ref-mistral-large-4-2026" class="csl-entry">
Mistral AI. 2026. <em>Introducing Mistral Large 4</em>. <a href="https://mistral.ai/news/mistral-large-4/">https://mistral.ai/news/mistral-large-4/</a>.
</div>
<div id="ref-multiverse-quasar-inside-2026" class="csl-entry">
Multiverse Computing. 2026. <em>Inside Quasar 438B by Multiverse Computing</em>. <a href="https://multiversecomputing.com/papers/inside-quasar-438b-by-multiverse-computing">https://multiversecomputing.com/papers/inside-quasar-438b-by-multiverse-computing</a>.
</div>
<div id="ref-stepfun-step5-preview-2026" class="csl-entry">
StepFun. 2026. <em>Step 5 Preview</em>. <a href="https://platform.stepfun.ai/docs/en/guides/models/step-5-preview">https://platform.stepfun.ai/docs/en/guides/models/step-5-preview</a>.
</div>
<div id="ref-beijing-export-consult-2026" class="csl-entry">
The Next Web. 2026. <em>Beijing Consulting on Restricting Overseas Access to Most Advanced AI Models</em>. <a href="https://thenextweb.com">https://thenextweb.com</a>.
</div>
<div id="ref-xiaomi-mimo-v26-pro-2026" class="csl-entry">
Xiaomi MiMo. 2026. <em>MiMo-V2.6-Pro-RL</em>. <a href="https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Pro-RL">https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Pro-RL</a>.
</div>
<div id="ref-zai-glm53-2026" class="csl-entry">
Z AI. 2026a. <em>GLM-5.3 Release Blog</em>. <a href="https://z.ai/blog/glm-5.3">https://z.ai/blog/glm-5.3</a>.
</div>
<div id="ref-zai-glm53-flash-2026" class="csl-entry">
Z AI. 2026b. <em>GLM-5.3-Flash (Hugging Face Model Card)</em>. <a href="https://huggingface.co/zai-org/GLM-5.3-Flash">https://huggingface.co/zai-org/GLM-5.3-Flash</a>.
</div>
</div></section></div> ]]></description>
  <category>European AI sovereignty</category>
  <category>frontier models</category>
  <category>open source AI</category>
  <category>foundation models</category>
  <category>AI policy</category>
  <guid>https://drmike.xyz/posts/europe-frontier-ai-scoreboard/</guid>
  <pubDate>Mon, 10 Aug 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>The Two Pillars, Revisited: The Moat Rotted Faster, The Choice Didn’t</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/the-two-pillars-revisited/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>A couple of weeks ago I wrote a piece called <a href="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/">The Two Pillars Are Both Rotting</a>. The argument was that most of the AI Europe actually runs sits on two pillars we don’t control: the closed frontier from the US (OpenAI, Anthropic, Google), and the open-weights frontier from China (Qwen, GLM, DeepSeek, Kimi). Both can be pulled, for different reasons, on different timelines, and nobody in European policy is planning for the day both wobble at once. I ended it with a plea for our own frontier labs.</p>
<div class="light-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/dependency_stack.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/dependency_stack.light.png" class="img-fluid figure-img" alt="A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base."></a></p>
<figcaption>A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base.</figcaption>
</figure>
</div>
</div>
<div class="dark-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/dependency_stack.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/dependency_stack.dark.png" class="img-fluid figure-img" alt="A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base."></a></p>
<figcaption>A beam labelled “AI that Europe runs” resting on three pillars. Two are solid and rented: the US closed frontier (OpenAI, Anthropic, Google) and the Chinese open-weights frontier (Qwen, GLM, DeepSeek, Kimi). The third, the EU frontier lab, is a dashed outline still mostly empty, with a small “Mistral (nascent)” block at the base.</figcaption>
</figure>
</div>
</div>
<p>I want to come back to it already, because two things happened in the space of ten days that changed half of what I said, and sharpened the other half into something I should have said the first time.</p>
<p>The first thing is that the closed-lab moat rotted faster than I argued. Kimi K3 shipped, and it shipped open weight, and on the only fair composite benchmark we have it sits three points behind the best closed model in the world. Three. The “frontier is a clear step ahead of open weights” line I drew in the last post is already stale.</p>
<p>The second thing is that nothing happened on the European side. Nothing. ASML wrote a €1.3 billion check for Mistral last September and Brussels still hasn’t decided whether it wants a frontier lab. The pillar-rotting risk I wrote about plays out over months and years, so two weeks of data doesn’t settle it either way. What this month does settle is the capability question: the closed-lab moat on the composite is down to three points, and Europe’s missing-pillar problem is exactly where I left it. We still don’t have a frontier lab of our own, and as I’ll argue below, that’s a choice we keep making.</p>
</section>
<section id="the-composite-gap-is-three-points-now" class="level2">
<h2 class="anchored" data-anchor-id="the-composite-gap-is-three-points-now">The composite gap is three points now</h2>
<p>The Artificial Analysis Intelligence Index, version 4.1, aggregates nine evaluations (GDPval, Terminal-Bench 2.1, SciCode, Humanity’s Last Exam, GPQA Diamond, and a few others) into one composite on a 0-100 scale. As of mid-July 2026 the top of the board reads like this: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57, Claude Opus 4.8 at 56 <span class="citation" data-cites="artificialanalysis2026">(Artificial Analysis 2026)</span>.</p>
<p>Sit with that for a second. The largest open-weight model ever released, built by a Chinese lab (Moonshot AI), trained on Chinese compute, ships three composite points behind Anthropic’s most capable model (Fable 5 at 60), two behind OpenAI’s current flagship (GPT 5.6 Sol at 59), and a point above Claude Opus 4.8 (at 56). On a scale where the gap between frontier and a competent mid-tier model runs fifteen points or more, three points is a tie. These are peers on general intelligence.</p>
<div class="light-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/aa_index.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/aa_index.light.png" class="img-fluid figure-img" alt="Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8."></a></p>
<figcaption>Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8.</figcaption>
</figure>
</div>
</div>
<div class="dark-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/aa_index.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/aa_index.dark.png" class="img-fluid figure-img" alt="Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8."></a></p>
<figcaption>Horizontal bar chart of the Artificial Analysis Intelligence Index v4.1: Claude Fable 5 at 60, GPT 5.6 Sol at 59, Kimi K3 at 57 (the only open-weight bar, in green), Claude Opus 4.8 at 56. Kimi K3 sits between GPT 5.6 Sol and Claude Opus 4.8.</figcaption>
</figure>
</div>
</div>
<p>In the last post I benchmarked GLM-5.2 against Claude Opus 4.8 and showed a real but narrow gap, and then stacked the actual frontier (Fable 5, GPT-5.5 Pro) against it to show the gap widens when you compare to the newest closed model rather than the comfortable one. That was fair to the data, and it was already a snapshot of a moving target. The target moved. The moving part is that the open-weight side shipped something that closed the composite gap to a margin of error, and the closed side shipped a new model (GPT 5.6 Sol, GA July 9 <span class="citation" data-cites="openai2026gpt56sol">(OpenAI 2026)</span>) that didn’t widen the gap back out. The moat is a three-point lead. That’s the whole moat, on the composite measure that tries to be fair about it.</p>
</section>
<section id="what-three-points-buys-you" class="level2">
<h2 class="anchored" data-anchor-id="what-three-points-buys-you">What three points buys you</h2>
<p>Ok fine, but so what? Three points is three points, and the people paying $50 per million output tokens for Fable 5 aren’t doing it for the composite. Let me show you what the three points actually are, because it matters for the Europe argument later.</p>
<p>The gap varies across the benchmark surface. It’s thin on general knowledge and reasoning, and real on long-horizon agentic work. On Humanity’s Last Exam and GPQA the open and closed frontier are within noise. On the coding-and-tool-use end, the picture splits by the shape of the work.</p>
<p>Folded out across twelve benchmarks, the picture is a lot less flat:</p>
<div class="light-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/benchmark_heatmap.light.png" class="lightbox" data-gallery="quarto-lightbox-gallery-5" title="Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/benchmark_heatmap.light.png" class="img-fluid figure-img" alt="Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE."></a></p>
<figcaption>Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE.</figcaption>
</figure>
</div>
</div>
<div class="dark-content">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><a href="figs/benchmark_heatmap.dark.png" class="lightbox" data-gallery="quarto-lightbox-gallery-6" title="Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE."><img src="https://drmike.xyz/posts/the-two-pillars-revisited/figs/benchmark_heatmap.dark.png" class="img-fluid figure-img" alt="Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE."></a></p>
<figcaption>Heatmap of six models (rows) across twelve benchmarks (columns), grouped Knowledge &amp; reasoning, Coding, and Agentic / long-horizon. Each cell is coloured by that model’s position within the benchmark (pale = worst in column, dark green = best) with the raw score printed inside. Kimi K3’s row is boxed. Kimi K3 is close to or ahead of the closed frontier on knowledge and on SWE-Marathon, but Fable 5 is clearly darker on the long-horizon agentic benchmarks (GDPval-AA, JobBench, AA-Briefcase) and on FrontierSWE.</figcaption>
</figure>
</div>
</div>
<p>GPT 5.6 Sol leads DeepSWE at 73.0 and Terminal-Bench 2.1 at 88.8, with Kimi K3 essentially tied on the terminal test at 88.3. Fable 5 owns FrontierSWE at 86.6, five points ahead of K3 and fifteen ahead of Sol. Kimi K3 takes Program Bench at 77.8 and, the one I find most interesting, SWE Marathon at 42.0, a test of long sustained coding sessions where GPT 5.5 and GLM 5.2 both collapse into the low teens. On broad agentic evaluations, Fable 5 still holds the ceiling: GDPval v2 Elo at 1747 against Sol’s 1736 and K3’s 1686, JobBench at 57.4. When a task needs sustained judgment across many steps, Fable is still the front <span class="citation" data-cites="atoms2026kimik3 moonshot2026kimi3card">(Atoms 2026; Moonshot AI 2026a)</span>.</p>
<p>And to keep us grounded about the open side of the ledger: Artificial Analysis flagged that Kimi K3’s hallucination rate climbed from 39 to 51 percent even as its accuracy improved from 33 to 46 <span class="citation" data-cites="thedecoder2026kimik3">(The Decoder 2026)</span>. The composite peer still fabricates more than the closed frontier it’s chasing. Reliability is its own axis, and if your workload can’t tolerate a confident invention you’re paying the closed premium for a reason.</p>
<p>So the three composite points are real, and they live mostly in long-horizon agentic work, which is exactly the kind of work that production systems are starting to care about. The closed frontier still has a ceiling. But notice what kind of ceiling it is: a few points on the hard agentic end, at three to six times the price. Fable 5 charges $10/$50 per million tokens. Sol charges $5/$30. Kimi K3 charges $3/$15, with cached input at $0.30. On identical workloads Fable costs more than three times what K3 does, for a capability gap most tasks never surface <span class="citation" data-cites="moonshot2026kimik3 thedecoder2026kimik3">(Moonshot AI 2026b; The Decoder 2026)</span>.</p>
<p>The moat that matters is a thin premium on judgment-heavy long-horizon work, sold at a premium price, revocable at someone else’s discretion. A year ago the closed labs were telling investors they had a data, compute, and talent wall. As of this month that wall is a three-point composite lead and a pricing argument.</p>
</section>
<section id="where-the-open-weights-pillar-stands-now" class="level2">
<h2 class="anchored" data-anchor-id="where-the-open-weights-pillar-stands-now">Where the open-weights pillar stands now</h2>
<p>I spent a lot of the last piece worried that the open-weights pillar would stop flowing at the frontier. That worry is a months-and-years question, and two weeks doesn’t move it. What I can do is show you where the pillar stands right now, because it moved a lot this month.</p>
<p>Kimi K3 launched July 16, and the full weights shipped July 27 under the Kimi K3 License, with vLLM, SGLang, and TokenSpeed support from day one. 2.8 trillion total parameters, 104 billion active, 16 of 896 experts per token, native image and video input, a million-token context window, open weight. That is the frontier tier, open. This month the open-weights pillar got stronger <span class="citation" data-cites="moonshot2026kimik3 moonshot2026kimi3card">(Moonshot AI 2026b, 2026a)</span>.</p>
<p>Qwen3.8 Max is the messier data point. Alibaba previewed a 2.4-trillion-parameter multimodal model within days of the Kimi K3 release, made it callable through a paid preview endpoint on their AI Token Plan, and surfaced it in Qoder and QoderWork. As of writing, Alibaba has not published the weights, the license, the model card, the active-parameter count, or a single independent benchmark. The “second only to Fable 5” ranking is Alibaba’s own claim on Alibaba’s own evaluation. Bloomberg reports open weights are expected before August, but “expected” is not “shipped,” and self-hosting the thing at 4-bit takes roughly 1.2 terabytes of GPU memory, about eight H200s. So the conservative read is: Alibaba might open-source Qwen3.8, we don’t know when, and “preview” is not “release.” The pillar got stronger on the Kimi K3 side and stayed uncertain on the Qwen side <span class="citation" data-cites="byteiota2026qwen38">(<span class="nocase">byteiota</span> 2026)</span>.</p>
<p>And it’s worth knowing why two trillion-parameter-class open-weight models landed in the same week. Xi Jinping endorsed open-weight AI as national strategy on July 18, two days after Kimi K3 and one day before the Qwen3.8 preview <span class="citation" data-cites="thenextweb2026china">(The Next Web 2026)</span>. The pillar got stronger because Beijing chose to strengthen it, which is also the reason it’s revocable. The same week, China is consulting on restricting overseas access to its most advanced models, open-weight releases included <span class="citation" data-cites="reuters2026beijing">(Reuters 2026)</span>. Weights already downloaded are practically unenforceable to recall, but future releases are not. A pillar built on national strategy serves the nation that built it, and serves the rest of us only as long as serving us serves it.</p>
<p>So the picture is mixed. Some Chinese labs are pushing open weights all the way to the composite frontier (Moonshot, with Kimi K3). Some are fencing the frontier tier behind an API and keeping it there across generations (Alibaba: Qwen3.7-Max is proprietary per Alibaba’s own release <span class="citation" data-cites="alibaba2026qwen37max">(Alibaba Cloud / Qwen Team 2026)</span>, and Qwen3.8-Max landed as a paid preview with no published weights, license, or independent benchmarks). The same country can do both at once. The pillar moves unevenly, lab by lab and quarter by quarter, under a policy signal set in Beijing, and we still don’t get a vote in any of those choices.</p>
</section>
<section id="the-pillar-we-refuse-to-build" class="level2">
<h2 class="anchored" data-anchor-id="the-pillar-we-refuse-to-build">The pillar we refuse to build</h2>
<p>Last time I wrote “we need our own frontier labs”. That might be the understatement of the year, as not supporting frontier AI labs is a choice Europe keeps making, and the evidence for that is sitting in our own budget.</p>
<p>Europe already accepts strategic-scale spend when it considers a project important. CERN approved a 2026 budget of roughly €1.6 billion. ESA approved €8.26 billion. Together our leading particle-physics and space institutions spend about €9.9 billion a year, which is roughly what Epoch AI estimates Anthropic spent in 2025 ($9.7 billion) <span class="citation" data-cites="epochai2026spending implicator2026europelab">(Epoch AI 2026; Schuler 2026)</span>. One American AI company, one year, the budget of CERN plus ESA. We know how to spend at frontier-lab scale. We do it for particles and rockets. We don’t do it for the thing that is eating the rest of the economy.</p>
<p>We even have the legal machinery for preference. In May 2025 Europe adopted the SAFE defense instrument, €150 billion for defense procurement, with a rule that contractors must be based in the EU, EEA or Ukraine. The International Procurement Instrument already caps non-EU inputs at 50 percent in medical-device contracts above €5 million. We were willing to risk Washington’s displeasure over artillery <span class="citation" data-cites="implicator2026europelab">(Schuler 2026)</span>. Our Tech Sovereignty Package stopped short of imposing a comparable preference for compute, largely to avoid the same confrontation over AI. That is a choice. We picked which strategic dependency we’d defend and which one we’d keep buying from abroad.</p>
<p>We have the compute too. We just spread it across three programs that embody three different theories of how to produce a frontier model, and we fund all of them without deciding which one is supposed to deliver. The Commission’s Frontier AI Grand Challenge went to the EUROPA consortium led by Domyn, with 2.5 percent of EuroHPC’s AI capacity for one year <span class="citation" data-cites="eucommission2026grandchallenge eucommission2026europa">(European Commission 2026b, 2026a)</span>, and a cluster of 6,000 Nvidia Blackwell chips already in development <span class="citation" data-cites="aiweekly2026europa">(AI Weekly 2026)</span>. Germany’s SPRIND runs a separate €125 million tournament in rounds of €3 million, €8 million, and €15.5 million. EuroHPC spreads shared capacity across 19 AI Factories <span class="citation" data-cites="implicator2026europelab">(Schuler 2026)</span>. Concentrate, narrow, or distribute. We financed all three and picked none. The one lab already at frontier scale, Mistral, is absent from each of them.</p>
<p>This is what I mean by choice rather than constraint. The money exists. The compute exists. The industrial base exists (ASML wrote the €1.3 billion check for an 11 percent Mistral stake in September 2025 <span class="citation" data-cites="cnbc2026asml">(CNBC 2025)</span>, and Mistral is reported to be raising around €3 billion at close to a €20 billion valuation <span class="citation" data-cites="implicator2026europelab">(Schuler 2026)</span>). The legal machinery exists. The talent exists, though it keeps leaving for US labs because we won’t pay to keep it. What doesn’t exist is the decision to concentrate capital and compute behind frontier-scale runs and fund several labs to that standard. That’s a decision. We keep not making it.</p>
</section>
<section id="dont-put-it-all-on-mistral" class="level2">
<h2 class="anchored" data-anchor-id="dont-put-it-all-on-mistral">Don’t put it all on Mistral</h2>
<p>A single European frontier lab reproduces the fragility we already have with one US API, just domestically.</p>
<p>Washington runs multiple frontier labs. OpenAI, Anthropic, Google, X.ai (don’t get me started on that insanity), and the newer entrants. Beijing runs multiple. Alibaba, Zhipu, DeepSeek, Moonshot. Both sides field teams, plural, because redundancy is how you survive one lab going sideways (a bad release, a safety scandal, a government lean-on, a funding gap). Europe fielding one frontier lab and hoping nothing goes wrong with it is a gamble.</p>
<p>So the answer is to set a standard and fund every lab that clears it. The standard is the part we keep refusing to write: a frontier-scale training run, committed multi-year compute and power at frontier scale, conditioned on a public frontier-scale performance disclosure and an open-weight release under an EU-permissive license. Hit the standard, get the compute and the procurement preference, for years.</p>
<p>There’s a significant distinction that matters and that I think Brussels keeps blurring. The 19 AI Factories and the three Commission programs are shared compute and funding mechanisms, useful for SMEs and researchers, and none of them is a frontier-scale training run. Spreading compute across nineteen sites is a subsidy program for the broad ecosystem. Funding three competitions on conflicting theories is a procurement process that dodges the actual decision. The frontier needs a handful of actual labs, plural, each with committed multi-year compute and power at frontier scale, held to the frontier-scale standard I described above. Plural, because a single frontier lab is too fragile.</p>
<p>Mistral is one candidate, and at 0.5 composite points per month on the BenchLM trajectory I tracked in the last post, it’s a candidate that needs the compute to fix its rate. (Moonshot’s Kimi K2.6 to K3 jump is what that capital buys: GDPval v2 Elo went from 1190 to 1686 in a single generation <span class="citation" data-cites="thedecoder2026kimik3">(The Decoder 2026)</span>. Speed is a function of compute and capital.) But there should be a sovereign-backed lab alongside it, and room for one or two private challengers, each with multi-year compute and power reserved, each held to the same frontier-scale standard.</p>
<p>Arthur Mensch asked the French National Assembly in May for European-preference procurement, priority electricity, and regulatory proportionality <span class="citation" data-cites="implicator2026europelab">(Schuler 2026)</span>. Those are the right asks, and they’re asks about state power. Private capital is moving on its own (ASML, the reported €3 billion round) <span class="citation" data-cites="cnbc2026asml implicator2026europelab">(CNBC 2025; Schuler 2026)</span>; the bottleneck is the state meeting it with compute, power, and a multi-year horizon, at frontier scale, for several labs at once.</p>
</section>
<section id="the-grace-period-is-for-building" class="level2">
<h2 class="anchored" data-anchor-id="the-grace-period-is-for-building">The grace period is for building</h2>
<p>The open-weights pillar got stronger this month. Kimi K3 is a composite peer with the closed frontier, open weight, at a third of the price. Qwen3.8 is uncertain but pointing the same direction. If you wanted to read this as “the sovereignty panic was overblown, the open weights will keep us fine,” you could. You’d be wrong.</p>
<p>The grace period the open weights just bought us is the window to build. Right now, today, the deal is remarkably good: near-frontier capability, open weights, self-hostable, at a fraction of the closed price. That deal is a strategy choice by Moonshot and a permission choice by Beijing, and either can change without consulting us. The Reuters reporting from early July (Beijing consulting on tiered restrictions that could cover open-weight models too, future models first) is still live <span class="citation" data-cites="reuters2026beijing">(Reuters 2026)</span>. The frontier tier landing behind a paid preview first, weights later, is still the pattern some labs will choose (Alibaba’s Qwen3.8-Max today: callable, no weights, no license, no independent benchmarks <span class="citation" data-cites="byteiota2026qwen38">(<span class="nocase">byteiota</span> 2026)</span>). The closed pillar can still be turned off by a US export-control rewrite.</p>
<p>If the open weights keep flowing, Europe has breathing room. If they stop, and the closed side restricts at the same time, we are exactly where I said we were in the last post, with nothing of our own to lean on. The difference is that the breathing room is now, and the breathing room is the only chance we get to build the pillar. Spending it on complacency is the choice I’m asking us to stop making.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>The moat rotted faster than I said. Three composite points, open weight, a third of the price. The closed-lab story that only US labs can do frontier is dead as of this month, killed by a Chinese lab shipping open weights to the top of the board.</p>
<p>The choice didn’t rot at all. Europe can compete. We have the money, the compute, the industrial base, the legal machinery, the talent. We keep choosing not to, by fragmenting the funding across three programs that can’t agree on a theory, by designing our AI policy to avoid a confrontation we already accepted over artillery, by fielding one slow lab and calling it a strategy.</p>
<p>How we fix it: concentrate the capital and the compute, distribute the funded labs, set a frontier-scale standard, fund several labs that clear it with multi-year compute and power and procurement preference, conditioned on open-weight release under an EU license. A pillar is a stack of labs, each backed to frontier scale.</p>
<p>The open weights just bought us a grace period. The only sane use of a grace period is to build the thing you were going to need anyway, before the grace period ends. We have the money. We have the compute. We have the legal tools. We are choosing not to. That’s the part that should keep us up at night, and it’s the part that’s entirely in our hands.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-aiweekly2026europa" class="csl-entry">
AI Weekly. 2026. <em><span>Domyn</span>-Led <span>EUROPA</span> Consortium Wins <span>EU</span> <span>Frontier</span> <span>AI</span> <span>Grand</span> <span>Challenge</span></em>. <a href="https://aiweekly.co/alerts/domyn-led-europa-consortium-wins-eu-frontier-ai-grand-challenge" class="uri">Https://aiweekly.co/alerts/domyn-led-europa-consortium-wins-eu-frontier-ai-grand-challenge</a>.
</div>
<div id="ref-alibaba2026qwen37max" class="csl-entry">
Alibaba Cloud / Qwen Team. 2026. <em>Qwen3.7-<span>Max</span>, Our Latest Proprietary Model</em>. <a href="https://qwen.ai/blog?id=qwen3.7" class="uri">Https://qwen.ai/blog?id=qwen3.7</a>.
</div>
<div id="ref-artificialanalysis2026" class="csl-entry">
Artificial Analysis. 2026. <em>Intelligence Index V4.1 and Per-Model Evaluations (GDPval, Terminal-Bench, SciCode, HLE, GPQA Diamond)</em>. <a href="https://artificialanalysis.ai" class="uri">Https://artificialanalysis.ai</a>.
</div>
<div id="ref-atoms2026kimik3" class="csl-entry">
Atoms. 2026. <em>Kimi <span>K3</span> Vs <span>Claude</span> <span>Fable</span> 5 Vs <span>GPT</span> 5.6 <span>Sol</span>: What the Numbers Say, and What They Miss</em>. <a href="https://atoms.dev/blog/kimi-k3-vs-claude-fable-5-vs-gpt-5-6-sol" class="uri">Https://atoms.dev/blog/kimi-k3-vs-claude-fable-5-vs-gpt-5-6-sol</a>.
</div>
<div id="ref-byteiota2026qwen38" class="csl-entry">
<span class="nocase">byteiota</span>. 2026. <em><span>Qwen3.8-Max</span> Open Weights: Confirmed Facts Vs Vendor Spin</em>. <a href="https://byteiota.com/qwen38-max-open-weights-confirmed-facts-vs-vendor-spin/" class="uri">Https://byteiota.com/qwen38-max-open-weights-confirmed-facts-vs-vendor-spin/</a>.
</div>
<div id="ref-cnbc2026asml" class="csl-entry">
CNBC. 2025. <em><span>AI</span> Firm <span>Mistral</span> Valued at $14 Billion as Chip Giant <span>ASML</span> Takes Major Stake</em>. <a href="https://www.cnbc.com/2025/09/09/ai-firm-mistral-valued-at-14-billion-as-asml-takes-major-stake.html" class="uri">Https://www.cnbc.com/2025/09/09/ai-firm-mistral-valued-at-14-billion-as-asml-takes-major-stake.html</a>.
</div>
<div id="ref-epochai2026spending" class="csl-entry">
Epoch AI. 2026. <em>Compute Accounts for the Majority of Expenses of <span>AI</span> Companies</em>. <a href="https://epoch.ai/data-insights/company-spending-breakdown" class="uri">Https://epoch.ai/data-insights/company-spending-breakdown</a>.
</div>
<div id="ref-eucommission2026europa" class="csl-entry">
European Commission. 2026a. <em><span>Commission</span> Selects <span>EUROPA</span> Consortium as the Winner of the <span>Frontier</span> <span>AI</span> <span>Grand</span> <span>Challenge</span></em>. <a href="https://digital-strategy.ec.europa.eu/en/news/commission-selects-europa-consortium-winner-frontier-ai-grand-challenge-project-build-european-open" class="uri">Https://digital-strategy.ec.europa.eu/en/news/commission-selects-europa-consortium-winner-frontier-ai-grand-challenge-project-build-european-open</a>.
</div>
<div id="ref-eucommission2026grandchallenge" class="csl-entry">
European Commission. 2026b. <em>Turning Strategy into Action: <span>Commission</span> Launches <span>Frontier</span> <span>AI</span> <span>Grand</span> <span>Challenge</span></em>. <a href="https://digital-strategy.ec.europa.eu/en/funding/turning-strategy-action-commission-launches-frontier-ai-grand-challenge" class="uri">Https://digital-strategy.ec.europa.eu/en/funding/turning-strategy-action-commission-launches-frontier-ai-grand-challenge</a>.
</div>
<div id="ref-moonshot2026kimi3card" class="csl-entry">
Moonshot AI. 2026a. <em>Kimi <span>K3</span> Model Card and Full Benchmark Table</em>. <a href="https://huggingface.co/moonshotai/Kimi-K3" class="uri">Https://huggingface.co/moonshotai/Kimi-K3</a>.
</div>
<div id="ref-moonshot2026kimik3" class="csl-entry">
Moonshot AI. 2026b. <em>Kimi <span>K3</span>: <span>Open</span> Frontier Intelligence</em>. <a href="https://www.kimi.com/blog/kimi-k3" class="uri">Https://www.kimi.com/blog/kimi-k3</a>.
</div>
<div id="ref-openai2026gpt56sol" class="csl-entry">
OpenAI. 2026. <em>Previewing <span>GPT</span>-5.6 <span>Sol</span></em>. <a href="https://openai.com/index/previewing-gpt-5-6-sol/" class="uri">Https://openai.com/index/previewing-gpt-5-6-sol/</a>.
</div>
<div id="ref-reuters2026beijing" class="csl-entry">
Reuters. 2026. <em>Beijing Is Looking at Curbing Overseas Access to China’s Top AI Models, Sources Say</em>. <a href="https://www.reuters.com/world/beijing-is-looking-curbing-overseas-access-chinas-top-ai-models-sources-say-2026-07-07/" class="uri">Https://www.reuters.com/world/beijing-is-looking-curbing-overseas-access-chinas-top-ai-models-sources-say-2026-07-07/</a>.
</div>
<div id="ref-implicator2026europelab" class="csl-entry">
Schuler, Marcus. 2026. <em><span>Europe</span> Can Afford a Frontier <span>AI</span> Lab and Won’t Fund One</em>. <a href="https://www.implicator.ai/opinion-europe-frontier-ai-lab-concentrate-funding" class="uri">Https://www.implicator.ai/opinion-europe-frontier-ai-lab-concentrate-funding</a>.
</div>
<div id="ref-thedecoder2026kimik3" class="csl-entry">
The Decoder. 2026. <em>Kimi’s Open Model <span>K3</span> Nears <span>GPT</span>-5.6 <span>Sol</span> and <span>Fable</span> 5 While Signaling the End of Super-Cheap <span>Chinese</span> <span>AI</span></em>. <a href="https://the-decoder.com/kimis-open-model-k3-nears-gpt-5-6-sol-and-fable-5-while-signaling-the-end-of-super-cheap-chinese-ai/" class="uri">Https://the-decoder.com/kimis-open-model-k3-nears-gpt-5-6-sol-and-fable-5-while-signaling-the-end-of-super-cheap-chinese-ai/</a>.
</div>
<div id="ref-thenextweb2026china" class="csl-entry">
The Next Web. 2026. <em>China Is Considering AI Model and Chip Export Controls</em>. <a href="https://thenextweb.com/news/china-ai-model-chip-export-controls-ft-report" class="uri">Https://thenextweb.com/news/china-ai-model-chip-export-controls-ft-report</a>.
</div>
</div></section></div> ]]></description>
  <category>European AI sovereignty</category>
  <category>open source AI</category>
  <category>foundation models</category>
  <category>frontier models</category>
  <category>AI policy</category>
  <guid>https://drmike.xyz/posts/the-two-pillars-revisited/</guid>
  <pubDate>Mon, 27 Jul 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>Latent Stochastic Differential Equations for Time Series</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I have spent an unreasonable fraction of my career being annoyed at deterministic models. They give you a number. One number. The number is wrong, almost always, and the model has no way of telling you it knows the number is wrong.</p>
<p>Time series is where this hurts the most. You have a stock return, a drug concentration in plasma, a sensor on a wind turbine, a river gauge, a sales effect from media. The future is always uncertain. You want a model that honors that. Latent stochastic differential equations are, as far as I am concerned, one of the cleanest ways to get that from a neural model. This post is me digging into them.</p>
<p>I will assume you have a passing familiarity with neural ODEs. If you do not, the short version is: instead of stacking layers, you parameterize the time derivative of a hidden state by a neural network and integrate it forward with your favorite ODE solver. It is a continuous-depth network. Cool idea, lovely math, and it gave us a whole vocabulary for talking about continuous-time models. The paper is <span class="citation" data-cites="chen2018neuralode">(Chen et al. 2018)</span> and it kicked off a small industry.</p>
<p>Ok so what is the problem? The problem is the world is not an ODE.</p>
</section>
<section id="what-an-ode-is-actually-saying" class="level2">
<h2 class="anchored" data-anchor-id="what-an-ode-is-actually-saying">What an ODE is actually saying</h2>
<p>A deterministic ODE says: if you know the state at time <img src="https://latex.codecogs.com/png.latex?t">, you know the state at time <img src="https://latex.codecogs.com/png.latex?t%20+%20%5CDelta%20t"> exactly. There is one trajectory. Run the same initial condition twice, you get the same answer twice. That is a feature when you are modeling, say, the orbit of a satellite with known mass and known thrust. It is a lie when you are modeling anything where the next step genuinely could have gone another way.</p>
<p>Sometimes the noise is the system. A molecule diffusing through tissue, a return process driven by a million unsynchronized decisions, a cell population growing and dividing with intrinsic randomness. The randomness is the dynamics. An ODE averages over it and throws away the part you wanted.</p>
<p>So the move is to model the dynamics as a stochastic differential equation (SDE) in the first place. An SDE says the state evolves according to a drift (the deterministic pull) plus a diffusion (the random kick), and the kick has a size. You integrate forward and you get a distribution over paths.</p>
</section>
<section id="the-sde-itself-quickly" class="level2">
<h2 class="anchored" data-anchor-id="the-sde-itself-quickly">The SDE itself, quickly</h2>
<p>An Itô SDE for a state <img src="https://latex.codecogs.com/png.latex?z(t)%20%5Cin%20%5Cmathbb%7BR%7D%5Ed"> looks like</p>
<p><img src="https://latex.codecogs.com/png.latex?dz%20=%20f(z,%20t)%5C,dt%20+%20g(z,%20t)%5C,dW,"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?f"> is the drift, <img src="https://latex.codecogs.com/png.latex?g"> is the diffusion coefficient, and <img src="https://latex.codecogs.com/png.latex?dW"> is the increment of a Wiener process (Brownian motion, basically). The drift is the “average” direction. The diffusion tells you how much the random kicks spread you out. When <img src="https://latex.codecogs.com/png.latex?g%20=%200"> you collapse back to a plain ODE, which is a nice sanity check.</p>
<p>If you discretize this with an Euler-Maruyama step you get something that looks suspiciously like a residual block with added Gaussian noise:</p>
<p><img src="https://latex.codecogs.com/png.latex?z_%7Bt+%5CDelta%20t%7D%20=%20z_t%20+%20f(z_t,%20t)%5CDelta%20t%20+%20g(z_t,%20t)%5Csqrt%7B%5CDelta%20t%7D%5C,%5Cepsilon,%20%5Cquad%20%5Cepsilon%20%5Csim%20%5Cmathcal%7BN%7D(0,%20I)."></p>
<p>That <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B%5CDelta%20t%7D"> is not a typo. Brownian motion variance scales with time, so the standard deviation scales with the square root of time. If you forget the square root your model will be quietly wrong in a way that only shows up when you change the step size, which is a deeply annoying kind of wrong to debug. Ask me how I know.</p>
<p>Now the neural version is staring at us: let <img src="https://latex.codecogs.com/png.latex?f_%5Ctheta"> and <img src="https://latex.codecogs.com/png.latex?g_%5Ctheta"> be neural networks. Done. That is a neural SDE. The drift tells the state where to go on average, the diffusion tells it how much to wiggle, and both are learned. <span class="citation" data-cites="tzen2019neural">(Tzen and Raginsky 2019)</span> and <span class="citation" data-cites="li2020scalable">(Li et al. 2020)</span> are the papers that made this trainable in practice, because training an SDE is its own little adventure (more on that below).</p>
</section>
<section id="the-latent-part" class="level2">
<h2 class="anchored" data-anchor-id="the-latent-part">The latent part</h2>
<p>So far so good, but we have skipped an awkward question: what is <img src="https://latex.codecogs.com/png.latex?z">? In a vanilla neural SDE you would typically take your observations, treat them as the state, and evolve them forward. That works when your observations are clean and low-dimensional and live in the same space as the thing you care about. Real time series do none of those things.</p>
<p>Real time series are messy. They have missing timesteps. They are irregularly sampled. They live in a space that is not the space you want to model dynamics in (a 30-dimensional sensor vector is probably driven by a 3-dimensional latent mechanism, and modeling the 30 directly means your SDE has to explain a lot of nuisance structure). And they are noisy in a way that conflates observation noise with process noise if you are not careful.</p>
<p>The latent SDE move, the one I actually want to talk about, is to split the model into three pieces:</p>
<ol type="1">
<li>An <strong>encoder</strong> that maps each observation (and its timestamp) into a posterior over an initial latent state <img src="https://latex.codecogs.com/png.latex?z_0">. Think variational posterior <img src="https://latex.codecogs.com/png.latex?q_%5Cphi(z_0%20%5Cmid%20x_%7B1:T%7D)">.</li>
<li>A <strong>latent SDE</strong> that evolves <img src="https://latex.codecogs.com/png.latex?z(t)"> forward in the latent space using learned drift and diffusion networks.</li>
<li>A <strong>decoder</strong> that maps the latent state at any time back into observation space, giving you a likelihood <img src="https://latex.codecogs.com/png.latex?p_%5Cpsi(x_t%20%5Cmid%20z(t))">.</li>
</ol>
<p>This is a variational autoencoder where the prior over trajectories is an SDE and the posterior is an SDE conditioned on data. <span class="citation" data-cites="kidger2021neural">(Kidger et al. 2021)</span> lays this out cleanly and treats it as an infinite-dimensional GAN, which is one way to train it. The other way, which I find more intuitive, is the evidence lower bound (ELBO) route from <span class="citation" data-cites="tzen2019neural">(Tzen and Raginsky 2019)</span>: maximize the expected log likelihood minus the KL between the approximate posterior trajectory and the prior trajectory.</p>
<p>Why is this split so good? Because now the SDE gets to evolve in whatever low-dimensional space best supports the dynamics, and the encoder/decoder handle the messy business of mapping that to and from observations. Missing data stops being a crisis: you just do not decode at the missing timesteps. Irregular sampling stops being a crisis: the SDE is continuous in time, you query it at whatever timestamps you have. Multi-modal observations stop being a crisis: the decoder can be as expressive as it needs to be.</p>
<p>The SDE does the one job it is good at, which is being a principled, noisy, continuous-time dynamics model. Everything else is plumbing.</p>
</section>
<section id="why-the-stochastic-part-matters" class="level2">
<h2 class="anchored" data-anchor-id="why-the-stochastic-part-matters">Why the stochastic part matters</h2>
<p>Here is the part I care about most. You can absolutely build a latent ODE model (encoder, ODE, decoder) and it will work. It will give you a mean trajectory and, if you push a distribution through the encoder, an epistemic uncertainty band around that mean. Useful. I have shipped latent ODEs. They are good.</p>
<p>What latent ODEs do not give you is aleatoric uncertainty that genuinely belongs to the dynamics. The ODE has no noise term. Any spread in the trajectory distribution comes from the posterior over <img src="https://latex.codecogs.com/png.latex?z_0">, the parameters, or the decoder. It is all “I am not sure where I started” or “I am not sure what the model is.” None of it is “the system itself is genuinely random and the next step could have gone another way.”</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/figs/fit_smear_vs_point.light.png" alt="Two panels on a simulated damped stochastic oscillator. Left: a latent ODE recovers the mean trajectory only, a single line through the observations with no spread band. Right: a latent SDE supplies a mean plus a 90 percent predictive band that widens and contracts with the oscillation envelope, tracking the true trajectory fan underneath. The two means are essentially identical; the difference is the band."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/figs/fit_smear_vs_point.dark.png" alt="Two panels on a simulated damped stochastic oscillator. Left: a latent ODE recovers the mean trajectory only, a single line through the observations with no spread band. Right: a latent SDE supplies a mean plus a 90 percent predictive band that widens and contracts with the oscillation envelope, tracking the true trajectory fan underneath. The two means are essentially identical; the difference is the band.">
<figcaption class="figure-caption">
A simulated damped stochastic oscillator (the gray fan is a sample of true SDE paths; dots are noisy observations). Left: a latent ODE recovers the mean and nothing else. Right: a latent SDE adds a 90% predictive band from its diffusion term, tracking the true trajectory fan. The two means are the same; the band is the whole point. Illustrative fit, not a trained neural model.
</figcaption>
</figure>
<p>For a lot of physical, biological, and financial processes that third source of uncertainty is the dominant one. A latent SDE can separate the three. The posterior over <img src="https://latex.codecogs.com/png.latex?z_0"> gives you initial-condition uncertainty. The posterior over the drift and diffusion parameters gives you epistemic (model) uncertainty. The diffusion term itself gives you aleatoric (intrinsic) uncertainty. They are three different things and they propagate forward in three different ways. If you care about decision-making under uncertainty (I do, it is kind of the whole point), being able to tell them apart is worth a great deal.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/figs/three_uncertainties.light.png" alt="Three panels showing trajectory uncertainty from three different sources on the same simulated oscillator. Left: initial-condition uncertainty, a band that starts wide at t zero and deforms as phased trajectories diverge. Middle: epistemic or parameter uncertainty, a band that starts at zero and grows as drift-parameter spread causes phase divergence over time. Right: aleatoric or diffusion uncertainty, a band that starts at zero and grows from the intrinsic stochastic kicks, saturating under damping. The three bands have different shapes because the three sources propagate differently."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/figs/three_uncertainties.dark.png" alt="Three panels showing trajectory uncertainty from three different sources on the same simulated oscillator. Left: initial-condition uncertainty, a band that starts wide at t zero and deforms as phased trajectories diverge. Middle: epistemic or parameter uncertainty, a band that starts at zero and grows as drift-parameter spread causes phase divergence over time. Right: aleatoric or diffusion uncertainty, a band that starts at zero and grows from the intrinsic stochastic kicks, saturating under damping. The three bands have different shapes because the three sources propagate differently.">
<figcaption class="figure-caption">
The three sources of trajectory uncertainty, separated. Left: uncertainty in the initial state <img src="https://latex.codecogs.com/png.latex?z_0">. Middle: epistemic uncertainty in the drift parameters <img src="https://latex.codecogs.com/png.latex?f_%5Ctheta">. Right: aleatoric uncertainty from the diffusion term <img src="https://latex.codecogs.com/png.latex?g_%5Ctheta%5C,dW">. Each propagates forward differently; only the right panel is intrinsic to the system. Same simulated oscillator, 90% bands from Monte-Carlo samples.
</figcaption>
</figure>
<p>There is also a modeling payoff here. If you fit a deterministic model to a process that is actually stochastic, the model will either overfit the noise or smear it into the drift in weird ways. The diffusion term gives the noise a sanctioned place to live, so the drift can focus on the actual mean dynamics. This is the same reason a Gaussian likelihood beats an L2 loss in a regression with non-degenerate noise: you stop forcing the model to pretend the noise is signal.</p>
</section>
<section id="training-the-awkward-bit" class="level2">
<h2 class="anchored" data-anchor-id="training-the-awkward-bit">Training: the awkward bit</h2>
<p>I would be lying if I said training these was as easy as training a ResNet. It is not. There are two and a half headaches.</p>
<p>Headache one: you cannot just backprop through an SDE solver the way you can through an ODE solver, because the Brownian increments are not differentiable functions of the parameters in the usual sense. The clean fix is the adjoint sensitivity method extended to SDEs, which is what <span class="citation" data-cites="li2020scalable">(Li et al. 2020)</span> gives you. You integrate the SDE forward, store what you need, integrate an adjoint process backward, and recover gradients with respect to drift and diffusion parameters. Memory-cheap, which matters when your time series is long. The <code>Diffractor</code>-style libraries and the Julia SDE ecosystem handle this; in Python, <code>torchsde</code> is the reference implementation.</p>
<p>There is a newer escape hatch worth knowing about: simulation-free training. SDE Matching <span class="citation" data-cites="bartosh2025sdematching">(Bartosh et al. 2025)</span> borrows the score- and flow-matching trick from generative modeling and applies it to latent SDEs, skipping the costly numerical simulation entirely. I have not tried it yet, but it is the direction I would look first if I were scaling this up today.</p>
<p>Headache two: the diffusion network <img src="https://latex.codecogs.com/png.latex?g_%5Ctheta"> is famously hard to train by pure likelihood maximization because the diffusion appears inside an expectation and its gradient is high variance. Two common escapes. One, the GAN approach from <span class="citation" data-cites="kidger2021neural">(Kidger et al. 2021)</span>: train a discriminator over paths and let it push the generated path distribution toward the data path distribution. Two, a fixed or lightly-trained diffusion with the drift carrying most of the learned structure. In practice I lean toward the second for a first pass: fix <img src="https://latex.codecogs.com/png.latex?g"> to something reasonable (or learn it slowly with a small learning rate), get the drift right, then let <img src="https://latex.codecogs.com/png.latex?g"> adapt. The drift is where most of your useful signal lives anyway.</p>
<p>Headache two and a half: reparameterization tricks for SDEs are subtler than for VAEs because the noise is correlated across time in a structured way. Read <span class="citation" data-cites="tzen2019neural">(Tzen and Raginsky 2019)</span> carefully before you roll your own. I did not, the first time, and I got a model that trained beautifully and produced uncertainty bands that were completely miscalibrated. Fun times.</p>
</section>
<section id="a-sketch-in-julia" class="level2">
<h2 class="anchored" data-anchor-id="a-sketch-in-julia">A sketch in Julia</h2>
<p>I promised myself I would stop writing blog posts with code I have not run. I am going to bend that rule here and show a sketch, with the explicit caveat that the version I actually trust is the one I will commit to the repo after this post goes up. Consider this pseudocode with correct shape.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Lux</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Random</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">DifferentialEquations</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">DiffEqSensitivity</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Distributions</span></span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Drift and diffusion networks. The diffusion must produce a non-negative</span></span>
<span id="cb1-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># scale, so we softplus the output.</span></span>
<span id="cb1-5">drift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(d, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, tanh), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, d))</span>
<span id="cb1-6">diffusion <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(d, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, tanh), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, d), x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">softplus</span>.(x))</span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># The latent SDE right-hand sides.</span></span>
<span id="cb1-9"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">f</span>(u, p, t)</span>
<span id="cb1-10">    drift_u, _ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Lux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">apply</span>(drift, u, p.drift, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">nothing</span>)</span>
<span id="cb1-11">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> drift_u</span>
<span id="cb1-12"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-13"></span>
<span id="cb1-14"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">g</span>(u, p, t)</span>
<span id="cb1-15">    _, diff_u <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Lux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">apply</span>(diffusion, u, p.diff, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">nothing</span>)</span>
<span id="cb1-16">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> diff_u <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">I</span>(d)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># diagonal diffusion for sanity</span></span>
<span id="cb1-17"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-18"></span>
<span id="cb1-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Encoder: map the observation sequence to (mean, logstd) of z0.</span></span>
<span id="cb1-20">encoder <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(obs_dim <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> T, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">128</span>, tanh), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">128</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>d))</span>
<span id="cb1-21"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mu_logstd</span>(encoder_out) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (encoder_out[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>d], encoder_out[d<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span>])</span>
<span id="cb1-22"></span>
<span id="cb1-23"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Decoder: map latent state at time t to observation likelihood params.</span></span>
<span id="cb1-24">decoder <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(d, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, tanh), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">64</span>, obs_dim))</span>
<span id="cb1-25"></span>
<span id="cb1-26"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Forward: sample z0 ~ q(z0 | x), integrate the SDE, decode at observed times.</span></span>
<span id="cb1-27"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">elbo</span>(x, ts, params, rng)</span>
<span id="cb1-28">    enc_out <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Lux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">apply</span>(encoder, x, params.enc, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">nothing</span>)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb1-29">    mu, logstd <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mu_logstd</span>(enc_out)</span>
<span id="cb1-30">    z0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> mu <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">exp</span>.(logstd) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(rng, d)</span>
<span id="cb1-31"></span>
<span id="cb1-32">    prob <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">SDEProblem</span>(f, g, z0, (ts[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], ts[<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span>]), params)</span>
<span id="cb1-33">    sol <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">solve</span>(prob, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">EulerHeun</span>(), saveat<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>ts, dt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>)</span>
<span id="cb1-34"></span>
<span id="cb1-35">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Reconstruction: Gaussian likelihood at each timestep.</span></span>
<span id="cb1-36">    recon <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span></span>
<span id="cb1-37">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> (i, t) <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enumerate</span>(ts)</span>
<span id="cb1-38">        dec_out <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Lux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">apply</span>(decoder, sol.u[i], params.dec, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">nothing</span>)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb1-39">        recon <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">logpdf</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">MvNormal</span>(dec_out, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span>), x[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, i])</span>
<span id="cb1-40">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-41"></span>
<span id="cb1-42">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># KL between q(z0) and a standard Gaussian prior. The path KL is</span></span>
<span id="cb1-43">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># approximated by the initial-state KL plus a correction term; see</span></span>
<span id="cb1-44">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Tzen &amp; Raginsky (2019) for the full thing.</span></span>
<span id="cb1-45">    kl <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">exp</span>.(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> logstd) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> mu <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> logstd)</span>
<span id="cb1-46"></span>
<span id="cb1-47">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> recon <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> kl</span>
<span id="cb1-48"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>The shape is right. The training loop, the adjoint setup, and the path-KL correction are what I still need to nail down before I would call this runnable. Treat it as a map of the territory.</p>
</section>
<section id="where-i-would-actually-use-this" class="level2">
<h2 class="anchored" data-anchor-id="where-i-would-actually-use-this">Where I would actually use this</h2>
<p>A few places where latent SDEs are worth the complexity, in my opinion:</p>
<p>Irregularly sampled clinical pharmacokinetics, where you have a few plasma concentrations per patient at weird times and you want a model that handles the gap structure without imputation theatre. The continuous-time nature of the SDE is doing real work here, not just looking good on a slide.</p>
<p>Financial return series where you suspect the volatility itself is a stochastic process (so, basically all of them). A latent SDE with a learned diffusion gives you a learned stochastic volatility model that is not wedded to the Heston parametric form. Whether that trades well is a different question, but the modeling surface is richer.</p>
<p>Sensor networks with dropout, where a device goes offline for an hour and comes back. You just do not decode during the offline window and the SDE bridges the gap with a properly widening uncertainty band. That widening band is the model telling you the truth, which is that it is less sure the longer the gap. I find this genuinely moving as an engineering property. The model knows what it does not know.</p>
<p>Forecasting with safety-critical downstream decisions, where a calibrated smear beats a confident point. If you are going to act on the forecast, you need the uncertainty to be part of the artifact.</p>
<p>For clean, regularly sampled, low-noise data where you only need the mean, a latent SDE is overkill. Use a latent ODE or even just a sequence model. The SDE tax is real and you should only pay it when the noise is the point.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Latent SDEs are the model I reach for when I want a neural time-series model that takes uncertainty seriously in all three directions: where it started, what it is, and how it kicks. They are not the easiest model to train, and I would not recommend them as a first resort. But for messy, irregular, intrinsically stochastic processes, they are the most honest object in the toolbox. The diffusion term gives the noise a home, the latent structure keeps the dynamics low-dimensional and interpretable, and the continuous-time formulation makes irregular sampling a non-issue.</p>
<p>I am still working through the Julia implementation, and I will post the runnable version once I have it.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-bartosh2025sdematching" class="csl-entry">
Bartosh, Grigory, Dmitry Vetrov, and Christian A. Naesseth. 2025. <span>“<span>SDE</span> Matching: Scalable and Simulation-Free Training of Latent Stochastic Differential Equations.”</span> <em>Proceedings of the 42nd International Conference on Machine Learning (ICML)</em>, Proceedings of machine learning research, vol. 267: 3054–70. <a href="https://proceedings.mlr.press/v267/bartosh25a.html">https://proceedings.mlr.press/v267/bartosh25a.html</a>.
</div>
<div id="ref-chen2018neuralode" class="csl-entry">
Chen, Ricky T. Q., Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. 2018. <span>“Neural Ordinary Differential Equations.”</span> <em>Advances in Neural Information Processing Systems 31 (NeurIPS)</em>. <a href="https://arxiv.org/abs/1806.07366">https://arxiv.org/abs/1806.07366</a>.
</div>
<div id="ref-kidger2021neural" class="csl-entry">
Kidger, Patrick, James Foster, Xuechen Li, Harald Oberhauser, and Terry Lyons. 2021. <span>“Neural <span>SDE</span>s as Infinite-Dimensional <span>GAN</span>s.”</span> <a href="https://arxiv.org/abs/2102.03657">https://arxiv.org/abs/2102.03657</a>.
</div>
<div id="ref-li2020scalable" class="csl-entry">
Li, Xuechen, Ting-Kam Leonard Wong, Ricky T. Q. Chen, and David Duvenaud. 2020. <span>“Scalable Gradients for Stochastic Differential Equations.”</span> <em>Proceedings of the 23rd International Conference on Artificial Intelligence and Statistics (AISTATS)</em>. <a href="https://arxiv.org/abs/2001.01328">https://arxiv.org/abs/2001.01328</a>.
</div>
<div id="ref-tzen2019neural" class="csl-entry">
Tzen, Belinda, and Maxim Raginsky. 2019. <span>“Neural Stochastic Differential Equations: Deep Latent Gaussian Models in the Diffusion Limit.”</span> <a href="https://arxiv.org/abs/1905.09883">https://arxiv.org/abs/1905.09883</a>.
</div>
</div></section></div> ]]></description>
  <category>machine learning</category>
  <category>time series</category>
  <category>stochastic differential equations</category>
  <category>uncertainty quantification</category>
  <category>julia</category>
  <guid>https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/</guid>
  <pubDate>Thu, 16 Jul 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/latent-stochastic-differential-equations-time-series/figs/fit_smear_vs_point.dark.png" medium="image" type="image/png" height="74" width="144"/>
</item>
<item>
  <title>Rediscovering the transformer, from attention up</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I have been working with neural networks for the better part of 25 years, and for most of the last seven or eight of those, transformers have been the air everyone breathes. I use them, I fine-tune them, and I have a strong <a href="../../posts/the-two-pillars-are-both-rotting">opinion</a> about why we should be careful about building everything on a foundation controlled by three labs on another continent.</p>
<p>Sitting in the summer house in Sweden I had the time to re-read “Attention Is All You Need” <span class="citation" data-cites="vaswani2017attention">(Vaswani et al. 2017)</span>. And as usual nodded along, filed the architecture diagram somewhere in the back of my head, and moved on. After a couple of days I wondered why I could not intuitevely account for why each piece is there, in the order it’s there, without reaching for the paper again.</p>
<p>So I did the thing I always do when I want to understand something. I tried to rebuild the transformer from the bottom up, starting from the simplest possible version of “attention” and only adding a piece when it solves a problem.</p>
<p>This post is the writeup. It’s a technical deep dive, with the same spirit as the JEPA one. By the end we’ll have a single transformer block in Julia, every line of which I can justify from a problem I hit on the way there. The architecture itself is really a series of very sensible answers to very specific questions, and once you’ve asked the questions yourself the answers stop feeling like magic.</p>
</section>
<section id="the-problem-with-reading-left-to-right" class="level2">
<h2 class="anchored" data-anchor-id="the-problem-with-reading-left-to-right">The problem with reading left to right</h2>
<p>You have a sequence. A sentence, a time series, a string of tokens. You want to produce a representation of each position that knows about the rest of the sequence, because the meaning of “bank” depends on whether “river” or “investment” is nearby, and the meaning of a price tick depends on what the market has been doing all morning.</p>
<p>For a long time the answer was the recurrent neural network (RNN). Read the sequence left to right, one token at a time, carry a hidden state forward, and let each step’s representation be a function of the hidden state, which is a function of the hidden state before it, all the way back to the start. It kinda works. But, two things go wrong with that. First, information from the start of the sequence has to survive a chain of matrix multiplications to reach the end, and the chain is unkind. Gradients either vanish or explode, and even when they behave, the model has to learn to copy the relevant bit forward through every intermediate step. Second, and more prosaically, you cannot parallelise it. Token fifty cannot be computed until token forty-nine is done. On modern hardware that’s a minor inefficiency that becomes the reason a training run takes a month instead of a weekend.</p>
<p>So let’s ask a question. What if we just let every token look at every other token, all at once?</p>
</section>
<section id="the-first-move-everyone-looks-at-everyone" class="level2">
<h2 class="anchored" data-anchor-id="the-first-move-everyone-looks-at-everyone">The first move: everyone looks at everyone</h2>
<p>For each token in the sequence, build its new representation as a weighted average of all the tokens, including itself. If “bank” should care more about “river” than about “the”, let the weight on “river” be larger.</p>
<p>That’s the whole first move. A weighted average, computed for every position, in parallel. Right away you have to decide the weights. You could hand-craft them (a window around the word, say), but that throws away the point, which is that relevance is context-dependent and the model should learn it. So the weights have to be a function of the tokens themselves.</p>
<p>The cheapest possible notion of “token <img src="https://latex.codecogs.com/png.latex?i"> is relevant to token <img src="https://latex.codecogs.com/png.latex?j">” is: do their embeddings point in a similar direction? A dot product answers exactly that. So let the weight from <img src="https://latex.codecogs.com/png.latex?i"> to <img src="https://latex.codecogs.com/png.latex?j"> be the dot product of their embeddings, <img src="https://latex.codecogs.com/png.latex?x_i%20%5Ccdot%20x_j">. Stack every pair into a matrix and you get <img src="https://latex.codecogs.com/png.latex?X%20X%5E%5Ctop">, which is <img src="https://latex.codecogs.com/png.latex?n%20%5Ctimes%20n">, i.e., every token against every token, all at once, on the GPU, exactly the thing where RNN struggles. That’s the unnormalised self-attention matrix.</p>
<p>The output for each token is a weighted sum of everyone’s embeddings, weighted by those similarities. In matrix form that’s the attention matrix times the embeddings.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7Bout%7D%20=%20(X%20X%5E%5Ctop)%5C,%20X"></p>
<p>And you’re done. That’s self-attention in its rawest form, no learned weights anywhere in it. The embedding of each token plays every role at once: it’s the thing you compare for similarity, and it’s the content you average in. One vector, two jobs. We won’t dive into embeddings in this post as that is worth it’s own seperate post.</p>
</section>
<section id="softmax-and-the-scaling-that-saves-the-day." class="level2">
<h2 class="anchored" data-anchor-id="softmax-and-the-scaling-that-saves-the-day.">Softmax, and the scaling that saves the day.</h2>
<p>The raw <img src="https://latex.codecogs.com/png.latex?X%20X%5E%5Ctop"> is a disaster as a set of weights, because dot products are unbounded. A token that happens to have large entries gets a huge weight, swamps the average, and the whole thing degenerates. We want weights that sum to one across each row, so each output is a proper convex combination. That’s softmax, applied row-wise.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7Bout%7D%20=%20%5Ctext%7Bsoftmax%7D(X%20X%5E%5Ctop)%5C,%20X"></p>
<p>However, if your feature dimension <img src="https://latex.codecogs.com/png.latex?d"> is large, the dot products <img src="https://latex.codecogs.com/png.latex?x_i%20%5Ccdot%0Ax_j"> grow like <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> in expectation (they’re sums of <img src="https://latex.codecogs.com/png.latex?d"> zero-mean terms), and their variance grows like <img src="https://latex.codecogs.com/png.latex?d">. Push a vector with entries of size <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> through a softmax and you get something close to a one-hot which is hardly what we want because the gradients through the softmax go flat. The model learns nothing, because the softmax is saturated.</p>
<p>The fix is to divide the logits by <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> before the softmax.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7Bself%5C_attention%7D(X)%20=%20%5Ctext%7Bsoftmax%7D%5C!%5Cleft(%5Cfrac%7BX%20X%5E%5Ctop%7D%7B%5Csqrt%7Bd%7D%7D%5Cright)%20X"></p>
<p>It’s easy to underestimate that <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> term since it’s just “a scaling factor”. But, take it out and your large-model training silently stalls. The scaling is what keeps the logits in the regime where softmax actually has a usable gradient. The whole thing can be expressed easily in Julia.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">self_attention</span>(X)</span>
<span id="cb1-2">    d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(X, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)                    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># feature dimension, read off the input</span></span>
<span id="cb1-3">    scores <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> X <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> X<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(d)        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (n, n) similarity logits</span></span>
<span id="cb1-4">    weights <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">softmax</span>(scores; dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb1-5">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> weights <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> X               <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (n, d)</span></span>
<span id="cb1-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>Six lines, and it’s the entire mechanism. Everything else in a transformer is plumbing so you can stack this on top of itself.</p>
</section>
<section id="a-worked-example-an-apple-and-a-banana" class="level2">
<h2 class="anchored" data-anchor-id="a-worked-example-an-apple-and-a-banana">A worked example: an apple and a banana</h2>
<p>Formulas are one thing. Let me run the six lines by hand on a sentence so you can watch the numbers move.</p>
<p>The sentence is “an apple and a banana” (five tokens). I’m going to use a feature dimension of three, and I’m going to name them <code>tech</code>, <code>fruit</code>, <code>grammar</code>. Each token starts life as a little 3-vector saying how much it carries of each. Here are the starting embeddings, the <img src="https://latex.codecogs.com/png.latex?X"> matrix.</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th>token</th>
<th>tech</th>
<th>fruit</th>
<th>grammar</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>An</td>
<td>0.0</td>
<td>0.0</td>
<td>1.0</td>
</tr>
<tr class="even">
<td>apple</td>
<td>0.7</td>
<td>0.8</td>
<td>0.0</td>
</tr>
<tr class="odd">
<td>and</td>
<td>0.0</td>
<td>0.0</td>
<td>0.5</td>
</tr>
<tr class="even">
<td>a</td>
<td>0.0</td>
<td>0.0</td>
<td>1.0</td>
</tr>
<tr class="odd">
<td>banana</td>
<td>0.0</td>
<td>0.8</td>
<td>0.0</td>
</tr>
</tbody>
</table>
<p>The two determiners are pure grammar. The conjunction is half-strength grammar. The interesting ones are <code>apple</code> and <code>banana</code>. <code>apple</code> is polysemous, i.e., it carries both tech (Apple the company) and fruit (apple the fruit), and I’ve made it fruit-heavy by a hair. <code>banana</code> is unambiguously fruit only, no tech. In the context “an apple and a banana” the fruit reading is the one a human picks for both, and the question is whether one pass of attention can use banana’s unambiguous fruit to pull apple away from tech and toward fruit.</p>
<p>Now lets apply self-attention from the last section, with no learned weights. the score between two tokens is just their dot product, which is their cosine similarity times their magnitudes. Tokens that look alike attend to each other. The score matrix <img src="https://latex.codecogs.com/png.latex?X%20X%5E%5Ctop/%5Csqrt%7Bd%7D"> becomes:</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th></th>
<th>An</th>
<th>apple</th>
<th>and</th>
<th>a</th>
<th>banana</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>An</strong></td>
<td>0.58</td>
<td>0</td>
<td>0.29</td>
<td>0.58</td>
<td>0</td>
</tr>
<tr class="even">
<td><strong>apple</strong></td>
<td>0</td>
<td>0.65</td>
<td>0</td>
<td>0</td>
<td>0.37</td>
</tr>
<tr class="odd">
<td><strong>and</strong></td>
<td>0.29</td>
<td>0</td>
<td>0.14</td>
<td>0.29</td>
<td>0</td>
</tr>
<tr class="even">
<td><strong>a</strong></td>
<td>0.58</td>
<td>0</td>
<td>0.29</td>
<td>0.58</td>
<td>0</td>
</tr>
<tr class="odd">
<td><strong>banana</strong></td>
<td>0</td>
<td>0.37</td>
<td>0</td>
<td>0</td>
<td>0.37</td>
</tr>
</tbody>
</table>
<p>Look at the structure before we even softmax. The matrix is blocky. <code>apple</code> and <code>banana</code> only see each other (and themselves). The three grammar tokens (<code>An</code>, <code>and</code>, <code>a</code>) only see each other. The sentence has fallen into two clusters, the two nouns and the three function words, purely from dot-product similarity. That’s the parallel structure of “an X and a Y” showing up as a pattern in the numbers, with no rule telling the model it’s a list.</p>
<p>(Aside: with <img src="https://latex.codecogs.com/png.latex?d=3"> the <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> scaling barely moves the logits, which is why I said earlier it’s a large-<img src="https://latex.codecogs.com/png.latex?d"> fix. Squash these by 1.73 and the softmax is still well-behaved. Do the same at <img src="https://latex.codecogs.com/png.latex?d=4096"> without the scaling and the softmax turns to one-hot. Same math, different regime.)</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_scores.light.png" alt="The self-attention score matrix for an apple and a banana. Zero cells are drawn transparent so the page colour shows through; the two lit-up blocks are the noun cluster (apple, banana) and the function-word cluster (An, and, a). No list rule is encoded, the parallel structure falls out of dot-product similarity."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_scores.dark.png" alt="The self-attention score matrix for an apple and a banana. Zero cells are drawn transparent so the page colour shows through; the two lit-up blocks are the noun cluster (apple, banana) and the function-word cluster (An, and, a). No list rule is encoded, the parallel structure falls out of dot-product similarity.">
<figcaption class="figure-caption">
The self-attention score matrix for “an apple and a banana”. Zero cells are drawn transparent so the page colour shows through; the two lit-up blocks are the noun cluster (apple, banana) and the function-word cluster (An, and, a). No list rule is encoded, the parallel structure falls out of dot-product similarity.
</figcaption>
</figure>
<p>Now softmax each row and multiply by <img src="https://latex.codecogs.com/png.latex?X"> again to get the new embeddings. Let me do <code>apple</code> in full, because it’s the interesting one. Its row of logits is <img src="https://latex.codecogs.com/png.latex?%5B0,%5C,%200.65,%5C,%200,%5C,%200,%5C,%200.37%5D">. Softmax turns that into weights over <img src="https://latex.codecogs.com/png.latex?%5B%5Ctext%7BAn,%20apple,%20and,%20a,%20banana%7D%5D">.</p>
<p><img src="https://latex.codecogs.com/png.latex?w_%7B%5Ctext%7Bapple%7D%20%5Cto%20%5Ccdot%7D%20=%20%5B0.16,%5C,%200.30,%5C,%200.16,%5C,%200.16,%5C,%200.23%5D"></p>
<p>So <code>apple</code> attends to itself at 0.30, to <code>banana</code> at 0.23, and splits the remaining 0.47 evenly across the three grammar tokens it has zero similarity with (they get the softmax floor, the uniform weight that keeps the row summing to one). The new <code>apple</code> embedding is that weighted average of the values below.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7Bapple%7D_%7B%5Ctext%7Bnew%7D%7D%20=%200.16%5C,%5Ctext%7BAn%7D%20+%200.30%5C,%5Ctext%7Bapple%7D%20+%200.16%5C,%5Ctext%7Band%7D%20+%200.16%5C,%5Ctext%7Ba%7D%20+%200.23%5C,%5Ctext%7Bbanana%7D"></p>
<p>Crunch the numbers and:</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th>token</th>
<th>before</th>
<th>after</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>apple</td>
<td>[0.70, 0.80, 0.00]</td>
<td>[0.21, 0.42, 0.39]</td>
</tr>
<tr class="even">
<td>banana</td>
<td>[0.00, 0.80, 0.00]</td>
<td>[0.17, 0.39, 0.42]</td>
</tr>
<tr class="odd">
<td>An</td>
<td>[0.00, 0.00, 1.00]</td>
<td>[0.10, 0.23, 0.61]</td>
</tr>
</tbody>
</table>
<p>Here are the two nouns as actual vectors in the tech/fruit/grammar space. The dashed ghosts are their starting positions; the solid arrows are where one pass of self-attention lands them. They swing up into grammar (pulled from the determiners) and close to within a twelfth of their starting distance, the gap dropping from 0.700 to 0.059. Thus, attention pulls similar vectors toward each other.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/embedding_3d.light.gif" alt="apple and banana as vectors in the 3D tech/fruit/grammar embedding space. Dashed ghosts = before; solid arrows = after one pass of raw self-attention. The mauve line is the gap between the tips, shrinking from 0.700 to 0.059 as both nouns swing up into grammar."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/embedding_3d.dark.gif" alt="apple and banana as vectors in the 3D tech/fruit/grammar embedding space. Dashed ghosts = before; solid arrows = after one pass of raw self-attention. The mauve line is the gap between the tips, shrinking from 0.700 to 0.059 as both nouns swing up into grammar.">
<figcaption class="figure-caption">
apple and banana as vectors in the 3D tech/fruit/grammar embedding space. Dashed ghosts = before; solid arrows = after one pass of raw self-attention. The mauve line is the gap between the tips, shrinking from 0.700 to 0.059 as both nouns swing up into grammar.
</figcaption>
</figure>
<p>For the keen observer you will see a bubu here since I made this heatmap before I wrote the text and I use Q,K, V notation where Q=XW with W=I. When writing the post I thought it was better to start with the raw embeddings. So yeah. In the plot above there is only X.</p>
<p>Now regarding the plot three things happened here. First, information moved. The nouns pulled grammar up from zero to 0.37, straight out of the determiners. The determiners pulled a little tech and fruit back out of the nouns. Nothing was added from outside; the layer just redistributed what was already in the sequence, weighted by who’s relevant to whom.</p>
<p>Second, fruit pulled ahead of tech in <code>apple</code> (0.42 vs 0.21), and <code>banana</code>, which started with no tech at all, picked up a sliver of it (0.17). So, <code>apple</code> and <code>banana</code> are each other’s highest non-self weight, and <code>banana</code> is unambiguous fruit, so it pulls <code>apple</code> toward fruit and away from tech. <code>apple</code> returns the favour by leaking a little tech into <code>banana</code>. The context is doing real work. Tiny, one-pass work, but work.</p>
<p>Third, one pass of raw self-attention did not resolve “apple” to fruit. Tech is still 0.21, fruit is 0.42. That’s a nudge that is useful but also shows that raw self-attention can only do similarity-smoothing, because one embedding has to serve as both the thing you compare and the content you carry. Letting the model learn three separate projections, which is the next section, is what lets <code>apple</code> specifically query for fruit-context and down-weight tech-context. And even then, one layer nudges; the decision firms up across many stacked layers, each one building on the last’s redistribution. That’s the stacking section further down, and it’s why the transformer is a stack of these and not one of them.</p>
<p>Ok but what happens if we keep going? The one-pass numbers nudged fruit ahead of tech; let me iterate the raw self-attention, feeding the output back in as the input for the next pass. Same mechanism, no learned weights, no residuals, just <img src="https://latex.codecogs.com/png.latex?X%20%5Cmapsto%20%5Ctext%7Bsoftmax%7D(XX%5E%5Ctop/%5Csqrt%7Bd%7D)%5C,X"> over and over.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_iterations.light.gif" alt="Iterating raw self-attention on an apple and a banana. Left: the attention weight matrix. Right: the token embeddings. The blocky cluster structure dissolves; by about iteration 5 every embedding is the batch mean and every attention row is uniform 0.2. Representation collapse."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_iterations.dark.gif" alt="Iterating raw self-attention on an apple and a banana. Left: the attention weight matrix. Right: the token embeddings. The blocky cluster structure dissolves; by about iteration 5 every embedding is the batch mean and every attention row is uniform 0.2. Representation collapse.">
<figcaption class="figure-caption">
Iterating raw self-attention on “an apple and a banana”. Left: the attention weight matrix. Right: the token embeddings. The blocky cluster structure dissolves; by about iteration 5 every embedding is the batch mean and every attention row is uniform 0.2: representation collapse.
</figcaption>
</figure>
<p>It collapses. By about the fifth iteration every token embedding has converged to the same vector, the batch mean <img src="https://latex.codecogs.com/png.latex?%5B0.14,%200.31,%200.52%5D">, and the attention matrix is a uniform 0.2 in every row. Every token attends equally to every token, which is the same as attending to nothing. The blocky cluster structure from the first pass dissolves into a flat sheet. “an apple and a banana” has become five copies of the average word.</p>
<p>This is representation collapse, and it’s a similar issue we ran into in the <a href="../../posts/building-a-jepa-world-model-from-scratch/">JEPA post</a>. Raw self-attention is a smoothing operator, and smoothing without anything to push back eventually erases every distinction.</p>
</section>
<section id="splitting-the-embedding-query-key-value" class="level2">
<h2 class="anchored" data-anchor-id="splitting-the-embedding-query-key-value">Splitting the embedding: query, key, value</h2>
<p>Raw self-attention has a constraint hiding in it. The embedding of a token is doing two jobs at once. It’s the thing you compare to every other token to decide the weights (the similarity), and it’s the content you average in once the weights are decided (the value). One vector, two jobs, and the model has no freedom to make them different.</p>
<p>Why would you want them different? Because “what am I” and “what do I carry if you pick me” are genuinely different questions. A determiner like “an” is a great signal that a noun follows, so you want other tokens to find it easily, which means its key should advertise “I’m a determiner”. But the content it actually contributes to the average, its value, is thin. It’s grammar, not fruit. With one embedding playing both roles, “an” has to be either findable and content-heavy, or invisible and content-light. It can’t be findable-but-content-light, which is what it actually should be.</p>
<p>The fix is to let the model learn three different linear projections of the embedding, one per role. This is where the query, key, value matrices enter the picture.</p>
<ul>
<li>As a <strong>query</strong>, the projection that says “this is what I’m looking for.”</li>
<li>As a <strong>key</strong>, the projection that says “this is what I am.”</li>
<li>As a <strong>value</strong>, the projection that says “and this is the content I carry if you pick me.”</li>
</ul>
<p>Concretely, take the embedding matrix <img src="https://latex.codecogs.com/png.latex?X"> and multiply it by three learned weight matrices to get <img src="https://latex.codecogs.com/png.latex?Q">, <img src="https://latex.codecogs.com/png.latex?K">, <img src="https://latex.codecogs.com/png.latex?V">.</p>
<p><img src="https://latex.codecogs.com/png.latex?Q%20=%20X%20W_Q,%20%5Cquad%20K%20=%20X%20W_K,%20%5Cquad%20V%20=%20X%20W_V"></p>
<p>The attention weight from <img src="https://latex.codecogs.com/png.latex?i"> to <img src="https://latex.codecogs.com/png.latex?j"> is now a dot product of <img src="https://latex.codecogs.com/png.latex?i">’s query with <img src="https://latex.codecogs.com/png.latex?j">’s key, because a dot product is still the cheapest possible measure of “do these line up”, but the two sides have been reshaped to whatever the model found useful. Stack all of them into <img src="https://latex.codecogs.com/png.latex?Q%20K%5E%5Ctop"> and the output is that matrix times the values.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7BAttention%7D(Q,%20K,%20V)%20=%20%5Ctext%7Bsoftmax%7D%5C!%5Cleft(%5Cfrac%7BQ%20K%5E%5Ctop%7D%7B%5Csqrt%7Bd%7D%7D%5Cright)%20V"></p>
<div id="fig-qkv" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-qkv-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_qkv.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-qkv-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The query-key-value split. X is projected three ways into Q, K, V; the query-key dot products become the attention weights, which then mix the values.
</figcaption>
</figure>
</div>
<p>Raw self-attention is the special case where <img src="https://latex.codecogs.com/png.latex?W_Q%20=%20W_K%20=%20W_V%20=%20I">, which is exactly what the worked example ran. The code barely changes, the function just takes three arguments instead of one.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">attention</span>(Q, K, V)</span>
<span id="cb2-2">    d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(Q, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)                    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># feature dimension, read off the query</span></span>
<span id="cb2-3">    scores <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Q <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> K<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(d)        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (n, n) logits</span></span>
<span id="cb2-4">    weights <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">softmax</span>(scores; dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb2-5">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> weights <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> V               <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (n, d)</span></span>
<span id="cb2-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb2-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># raw self-attention is the special case attention(X, X, X)</span></span></code></pre></div></div>
<p>That’s the formula in every textbook, and it’s just a generalisation of <img src="https://latex.codecogs.com/png.latex?(XX%5E%5Ctop)X">: the three matrices are the model’s freedom to separate “what am I” from “what do I carry”. The raw version is what you get before you give it that freedom.</p>
</section>
<section id="one-head-is-one-kind-of-question" class="level2">
<h2 class="anchored" data-anchor-id="one-head-is-one-kind-of-question">One head is one kind of question</h2>
<p>Single-head attention works, but it has a limitation that’s easy to state and easy to fix. Each query-key pair defines one notion of relevance: “is this token syntactically related”, say, or “is this token in the same entity”. A sentence asks several of those questions at once. “The animal didn’t cross the street because it was too tired” wants “it” to attend to “animal” for coreference, to “street” for a different reading, to “tired” for yet another. One set of weights can only average those demands together, and averaging blunts them.</p>
<p>Multi-head attention is the answer, and the answer is: just run attention several times in parallel with different learned projections, then concatenate.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># h heads, each with its own Q,K,V of dimension d/h, then project back to d</span></span>
<span id="cb3-2">heads <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">attention</span>(X <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Wq[i], X <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Wk[i], X <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Wv[i])</span>
<span id="cb3-3">        for i <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>h]</span>
<span id="cb3-4">out <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hcat</span>(heads<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> Wo</span></code></pre></div></div>
<p>Each head gets a slice of the feature dimension, so the total compute is roughly the same as one full-width head. What you buy with it is specialisation. Different heads learn different relations, and the final projection <img src="https://latex.codecogs.com/png.latex?W_O"> lets the model decide how to mix their verdicts. When people visualise attention and show one head tracking verbs and another tracking entities, this is the machinery that makes it possible.</p>
</section>
<section id="the-thing-attention-cannot-do-on-its-own" class="level2">
<h2 class="anchored" data-anchor-id="the-thing-attention-cannot-do-on-its-own">The thing attention cannot do on its own</h2>
<p>The attention mechanism I just described is <strong>permutation-invariant</strong>. If you shuffle the tokens, <img src="https://latex.codecogs.com/png.latex?Q">, <img src="https://latex.codecogs.com/png.latex?K">, <img src="https://latex.codecogs.com/png.latex?V"> get shuffled the same way, the softmax shuffles its rows and columns, and the output is the same shuffle of the same values. Nothing in the attention math knows about order. “The cat sat on the mat” and “mat the on sat cat the” produce the same set of outputs, just reordered.</p>
<p>That’s catastrophic for language, where order carries meaning. So we need to inject position by hand. This can be done by adding a position-dependent vector to each token’s input before any of the projections. Here sines and cosines of different frequencies can do just that.</p>
<p><img src="https://latex.codecogs.com/png.latex?PE_%7Bpos,%202i%7D%20=%20%5Csin%5C!%5Cleft(%5Cfrac%7Bpos%7D%7B10000%5E%7B2i/d%7D%7D%5Cright),%20%5Cquad%20PE_%7Bpos,%202i+1%7D%20=%20%5Ccos%5C!%5Cleft(%5Cfrac%7Bpos%7D%7B10000%5E%7B2i/d%7D%7D%5Cright)"></p>
<p>Low-index dimensions oscillate fast (they encode fine position), high-index dimensions oscillate slow (they encode coarse position). Together they give every position a unique fingerprint that’s easy to learn to read off, and because sine and cosine of a related frequency are linear functions of each other, the model can learn simple linear maps for “shift by one position” and “relative offset”, which is what you actually want attention to reason about.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>Modern transformers often replace this with learned position embeddings or with rotary position encoding (RoPE), which bakes the rotation directly into the query and key. The principle is the same: attention is order-blind, so you have to put the order in somewhere, and the somewhere is the input.</p>
</div>
</div>
</section>
<section id="stacking-and-why-it-needs-help" class="level2">
<h2 class="anchored" data-anchor-id="stacking-and-why-it-needs-help">Stacking, and why it needs help</h2>
<p>One layer of attention is a weighted-average machine. To get anything clever, you stack the block. Attention, then a feed-forward network applied to each position, then attention again, and so on, dozens of times. Stacking is where the rest of the architecture shows up, because naive stacking of anything deep is unstable. So how do we fight this instability?</p>
<p>Well, one candidate is the residual connection. Instead of <code>out = layer(x)</code>, you write <code>out = x + layer(x)</code>. The input is always added back to the output, so the gradient has a direct path back through the stack that doesn’t depend on the layer at all. This is what lets you train networks many layers deep without the gradients vanishing into noise. It comes from ResNet <span class="citation" data-cites="he2016resnet">(He et al. 2016)</span>, not the transformer paper, but it’s the reason the transformer can be stacked at all.</p>
<p>The second is layer normalisation <span class="citation" data-cites="ba2016layernorm">(Ba et al. 2016)</span>. Before (or after, depending on the variant) each sublayer, you normalise the activations across the feature dimension to zero mean and unit variance, then learn a scale and shift. This keeps the activation magnitudes in a sane range across a deep stack, which keeps the softmax and the residual paths well-conditioned.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The original paper does <code>LayerNorm(x + Sublayer(x))</code> (post-norm); most modern large models do <code>x + Sublayer(LayerNorm(x))</code> (pre-norm), which trains more stably at depth. The difference is a real engineering choice with measurable effects on training stability, not something to wave away.</p>
</div>
</div>
<p>The feed-forward block in the middle deserves a word, because it’s easy to dismiss as filler. It’s a two-layer MLP applied independently to each position. Expand the dimension (usually by 4x), apply a nonlinearity, project back down. If attention is the mechanism that mixes information <em>across</em> positions, the feed-forward is the mechanism that processes information <em>within</em> a position. The block alternates the two: mix across, process within, mix across, process within. That alternation is the transformer.</p>
</section>
<section id="the-whole-block-in-not-many-lines" class="level2">
<h2 class="anchored" data-anchor-id="the-whole-block-in-not-many-lines">The whole block, in not many lines</h2>
<p>Put it together and here’s a single transformer encoder block, in Julia, in about thirty lines. I’m using a pre-norm layout because it’s what I’d actually train:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">struct</span> TransformerBlock</span>
<span id="cb4-2">    attn_q<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span>; attn_k<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span>; attn_v<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span>; attn_o<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span></span>
<span id="cb4-3">    ffn_w1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span>; ffn_b1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span>; ffn_w2<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Matrix</span>; ffn_b2<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span></span>
<span id="cb4-4">    ln1_scale<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span>; ln1_shift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span></span>
<span id="cb4-5">    ln2_scale<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span>; ln2_shift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Vector</span></span>
<span id="cb4-6">    n_heads<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Int</span></span>
<span id="cb4-7"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-8"></span>
<span id="cb4-9"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> (b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">TransformerBlock</span>)(x)</span>
<span id="cb4-10">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. multi-head self-attention, with a residual</span></span>
<span id="cb4-11">    d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(x, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>); h <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b.n_heads; dh <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">÷</span> h</span>
<span id="cb4-12">    xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">layernorm</span>(x, b.ln1_scale, b.ln1_shift)</span>
<span id="cb4-13">    Q <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.attn_q; K <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.attn_k; V <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.attn_v</span>
<span id="cb4-14">    heads <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">attention</span>(Q[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, (i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh],</span>
<span id="cb4-15">                       K[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, (i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh],</span>
<span id="cb4-16">                       V[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, (i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dh])</span>
<span id="cb4-17">            for i <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>h]</span>
<span id="cb4-18">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hcat</span>(heads<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">...</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.attn_o</span>
<span id="cb4-19"></span>
<span id="cb4-20">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. position-wise feed-forward, with a residual</span></span>
<span id="cb4-21">    xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">layernorm</span>(x, b.ln2_scale, b.ln2_shift)</span>
<span id="cb4-22">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gelu</span>.(xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.ffn_w1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> b.ffn_b1)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> b.ffn_w2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> b.ffn_b2</span>
<span id="cb4-23">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> x</span>
<span id="cb4-24"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>That’s it. Stack a few dozen of those, add positional encoding at the bottom, put a language-modelling head on top, and you have a transformer. The block is shown in Figure&nbsp;2. The paper’s diagram looks intimidating because it shows encoder and decoder and cross-attention, and those matter for translation, but the heart of the thing, the part that’s in every GPT and Llama and Qwen, is the block above.</p>
<div id="fig-block" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-block-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/transformer_block.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-block-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: One transformer encoder block, pre-norm layout. The two <code>+</code> nodes are the residual additions; LayerNorm precedes each sublayer; the block alternates multi-head attention (mix across positions) with the feed-forward (process within a position).
</figcaption>
</figure>
</div>
<p>The encoder-decoder distinction is worth digging into. The original paper was solving machine translation, so it has two stacks. An encoder that reads the source sentence into rich representations, and a decoder that generates the target one token at a time, attending (via cross-attention) to the encoder’s outputs and (via masked self-attention) to the target tokens generated so far. The causal mask in the decoder is just setting the attention weights for future positions to minus infinity before the softmax, so the model can’t look ahead. Every autoregressive language model, GPT included, is a decoder-only stack with that causal mask baked in. The encoder-only variant (BERT) drops the mask and lets every token see every other token, which is what you want for classification and fill-in-the-blank. Same block, different mask, different training objective.</p>
</section>
<section id="what-i-would-do-next" class="level2">
<h2 class="anchored" data-anchor-id="what-i-would-do-next">What I would do next</h2>
<p>If I were taking this further, three things.</p>
<p>The first is to actually train the block above on a tiny character-level language model, a few thousand lines of text, and watch the loss come down. I deliberately stopped at the architecture here, because the point was the derivation. But a trained toy is the only proof that the block is wired correctly, and I suspect the exercise would surface the usual small bugs (a transposed weight here, a wrong mask there) that you only find when the loss refuses to drop.</p>
<p>The second is to replace the sinusoidal positional encoding with rotary position encoding (RoPE) <span class="citation" data-cites="su2021roformer">(Su et al. 2021)</span>.</p>
<p>The third is the residual path and the norm. I’d like to stress-test them. Train the same toy with post-norm vs pre-norm, with and without the residual, with the <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bd%7D"> scaling removed, and just <em>watch</em>. I suspect the ablations would be more instructive than the working version, because they’d show exactly which piece saves which failure mode.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>The transformer is one of the most important architectures in modern machine learning, and it is also, as you have seen, a small and reasonable thing. It is a weighted average with learned weights, scaled so the softmax behaves, parallelised across positions, stacked with the help of residuals and normalisation, and given a sense of order by position embeddings pasted on the front.</p>
<p>Why do this? Because, I prefer to understand the thing I’m building on. If you spot a mistake, in the math, in the code, in the intuition, reach out.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-ba2016layernorm" class="csl-entry">
Ba, Jimmy Lei, Jamie Ryan Kiros, and Geoffrey E. Hinton. 2016. <span>“Layer Normalization.”</span> <a href="https://arxiv.org/abs/1607.06450">https://arxiv.org/abs/1607.06450</a>.
</div>
<div id="ref-he2016resnet" class="csl-entry">
He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. <span>“Deep Residual Learning for Image Recognition.”</span> <em>Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)</em>, 770–78. <a href="https://arxiv.org/abs/1512.03385">https://arxiv.org/abs/1512.03385</a>.
</div>
<div id="ref-su2021roformer" class="csl-entry">
Su, Jianlin, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. 2021. <span>“RoFormer: Enhanced Transformer with Rotary Position Embedding.”</span> <em>Proceedings of the 46th International Conference on Machine Learning (ICML) Workshop on Knowledge Representation and Reasoning</em>. <a href="https://arxiv.org/abs/2104.09864">https://arxiv.org/abs/2104.09864</a>.
</div>
<div id="ref-vaswani2017attention" class="csl-entry">
Vaswani, Ashish, Noam Shazeer, Niki Parmar, et al. 2017. <span>“Attention Is All You Need.”</span> <em>Advances in Neural Information Processing Systems 30 (NeurIPS)</em>. <a href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a>.
</div>
</div></section></div> ]]></description>
  <category>transformers</category>
  <category>attention</category>
  <category>neural-networks</category>
  <category>deep-learning</category>
  <category>from-scratch</category>
  <guid>https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/</guid>
  <pubDate>Wed, 15 Jul 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/rediscovering-the-transformer-from-attention-up/figs/attention_scores.dark.png" medium="image" type="image/png" height="140" width="144"/>
</item>
<item>
  <title>The Two Pillars Are Both Rotting</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/the-two-pillars-are-both-rotting/</link>
  <description><![CDATA[ 






<!-- TODO before publishing: create a dependency-stack figure (EU builders -> US closed APIs + Chinese open weights -> both pillars can be pulled, with Mistral as the nascent third pillar) and add it under the Introduction with an `image:` frontmatter field. Also: re-verify the llm-stats benchmark cells live, and eyeball the BenchLM provisional composites on benchlm.ai the day of publishing. -->
<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>A few months ago I wrote that Europe’s AI sovereignty problem is not regulation, it is labs. I still think that is right, and wanted to fold it out a bit more.</p>
<p>Most of the AI we actually run in Europe today rests on two pillars. One is the closed frontier from the United States: OpenAI, Anthropic, Google. The other is the open-weights frontier from China: Qwen, GLM, DeepSeek, the whole Zhipu (Z.ai) and Alibaba and DeepSeek stack. We have gotten very comfortable leaning on both of them. We build on top. We fine-tune. We serve. We write wrappers and agents and evals. And we tell ourselves we have options, because if one pillar gets weird we can hop to the other.</p>
<p>Here is what I am worried about. Both pillars can be pulled out from under us, for different reasons, on different timelines, and pretty much nobody in European policy is planning for the world where that happens at the same time.</p>
<p>I am going to walk through why each one is shakier than it looks, and then why the combination is the part that should keep us up at night.</p>
</section>
<section id="pillar-one-the-closed-frontier-can-be-turned-off" class="level2">
<h2 class="anchored" data-anchor-id="pillar-one-the-closed-frontier-can-be-turned-off">Pillar one: the closed frontier can be turned off</h2>
<p>This is the one people sort of know about but tend to file away as a hypothetical. It is not hypothetical <span class="citation" data-cites="eustartupsAnthropicPulled">(Garcia 2026)</span>.</p>
<p>When your product calls an API hosted by a US-headquartered lab, you are depending on three things that can all change without your input: the lab’s terms of service, the lab’s pricing, and the US government’s export control regime. Any one of those three can cut you off. The API is a service you rent, and the landlord can change the lease.</p>
<p>We already saw what this looks like. In early 2026 Anthropic tried to set its own policy on military AI use, refusing to bend its safeguards on autonomous weapons and mass surveillance, and the Trump administration ordered federal agencies to stop using Claude and designated the company a supply-chain risk <span class="citation" data-cites="ap2026anthropic">(Associated Press 2026)</span>. Anthropic set out its own position publicly <span class="citation" data-cites="anthropic2026war">(Anthropic 2026b)</span>, and the reaction from the US government was so swift and so public that no rational company will try that again. The lesson every frontier lab took from that episode is not subtle. If Washington decides access is a strategic lever, access becomes a strategic lever, and the company at the other end of your API call will comply before you finish reading the press release.</p>
<p>The US has also been building out export-control machinery for advanced models. The Biden-era “AI Diffusion Framework” of January 2025 tiered countries by how much compute and model access they could get, and most EU allies landed in the top tier with near-frictionless access, not the middle. That sounds fine for Europe until you notice that the Trump administration then rescinded the whole rule and is drafting a replacement <span class="citation" data-cites="bis2025diffusion">(U.S. Bureau of Industry and Security 2025)</span>. Even a top-tier arrangement is “subject to change” on someone else’s decision. Permission, even generous permission, is a dependency with a nicer name.</p>
<p>So the closed frontier is a pillar we are allowed to lean on as long as nobody in Washington decides we shouldn’t. That is a strange foundation to build a continent’s cognitive infrastructure on.</p>
</section>
<section id="pillar-two-the-open-weights-frontier-is-not-a-guarantee" class="level2">
<h2 class="anchored" data-anchor-id="pillar-two-the-open-weights-frontier-is-not-a-guarantee">Pillar two: the open-weights frontier is not a guarantee</h2>
<p>This is the part I think even the sovereignty people underestimate. We have gotten used to treating the Chinese open-weights releases as a kind of safety net. Alibaba drops Qwen, a strong model with open weights. Zhipu drops GLM. DeepSeek drops something that punches above its weight. We download the weights, we host them, we feel good about having a fallback.</p>
<p>But “open weights so far” is not the same as “open weights forever.” These are not charities. They are labs competing in a frontier race, and they release weights because it happens to serve their strategy right now, not because of a constitutional commitment to openness. The moment releasing the frontier weights stops serving them, the releases stop. There is no contract. There is no license that forces the next version to exist.</p>
<p>Think about what we are actually assuming. We are assuming Qwen 3.7 <span class="citation" data-cites="alibaba2026qwen37max">(Alibaba Cloud 2026)</span> will be open-sourced the way the earlier Qwen releases were. Maybe some of it will. But there is no guarantee, and the incentives are not obviously pointing that way. Once a lab is genuinely competitive at the frontier, the strategic value of giving your best weights away for free drops a lot. You start hearing about “safety” and “responsible release” and “phased rollouts” and suddenly the open-weights cadence gets a lot more selective. We have seen this movie before. It is exactly what happened with the US labs. I will come back to this with concrete numbers, because as I was writing this post I found that part of it has already happened.</p>
<p>Same story with GLM. Zhipu has been generous with GLM-4 up to GLM-5.2 weights. There is no guarantee GLM-5.3 is. And even if the labs want to keep releasing, they are operating under their own government’s rules. China has been building its own export-control and dual-use regime. If Beijing decides frontier weights are a strategic asset, the releases stop the same way they would stop from Washington’s side. We are trusting that two governments we have no say in will both continue to allow their best labs to hand us their best models for free. That is a lot of trust. As of July 2026 that trust is actively being tested: Beijing is consulting on exactly this kind of restriction, and I come back to it with the Reuters reporting below.</p>
<p>There is also the quieter risk that the open-weights releases just get worse relative to the frontier. Maybe Qwen keeps publishing weights, but only for the smaller, older, or distilled variants, and the actual frontier model stays behind an API. That is a softer version of the same problem and in some ways more dangerous because it is easier to miss. You are still “using open source AI,” you just happen to be a generation behind the frontier and falling further behind every release cycle.</p>
</section>
<section id="the-gap-in-numbers" class="level2">
<h2 class="anchored" data-anchor-id="the-gap-in-numbers">The gap, in numbers</h2>
<p>It helps to put a concrete comparison on the table, because “close to the frontier” might be a bit loosy poosy and I want you to see what it actually means right now by inspecting Table&nbsp;1.</p>
<p>Take GLM-5.2 <span class="citation" data-cites="zai2026glm52">(Z.ai 2026)</span>, Zhipu’s current open-weight flagship (MIT licensed, shipped June 2026, roughly a million-token context), against Claude Opus 4.8, Anthropic’s current closed frontier in the Opus series. On the six benchmarks both report, Claude leads on all six:</p>
<div id="tbl-gapinnumbers" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-gapinnumbers-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Data from July 12, 2026 <span class="citation" data-cites="llmstats2026">(<span class="nocase">llm-stats.com</span> 2026)</span> featuring GLM-5.2 vs Claude Opus 4.8 on 6 common benchmarks.
</figcaption>
<div aria-describedby="tbl-gapinnumbers-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Benchmark</th>
<th>GLM-5.2</th>
<th>Claude Opus 4.8</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>FrontierSWE</td>
<td>74.0%</td>
<td>75.0%</td>
</tr>
<tr class="even">
<td>GPQA</td>
<td>91.2%</td>
<td>93.6%</td>
</tr>
<tr class="odd">
<td>Humanity’s Last Exam</td>
<td>54.7%</td>
<td>57.9%</td>
</tr>
<tr class="even">
<td>MCP Atlas</td>
<td>76.8%</td>
<td>82.2%</td>
</tr>
<tr class="odd">
<td>SWE-Bench Pro</td>
<td>62.1%</td>
<td>69.2%</td>
</tr>
<tr class="even">
<td>Toolathlon</td>
<td>48.2%</td>
<td>59.9%</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Two things to notice. First, on the coding-and-tool-use end of the frontier the gap is real: SWE-Bench Pro is seven points, Toolathlon is nearly twelve. That is the ceiling I will come back to when I talk about fine-tuning. Second, on the knowledge-and-reasoning end the gap is small, two to three points on GPQA and Humanity’s Last Exam, and on FrontierSWE it is a single point. The open-weights frontier is genuinely close.</p>
<p>Now look at what you trade off to get that openness. GLM-5.2 is MIT licensed. You can download it, host it, fine-tune it, run it inside your own perimeter, and it costs about $0.95 per million input tokens against Claude’s $5.00, and $3.00 versus $25.00 per million output. That is roughly 6.8x cheaper on a blended basis. Claude is multimodal and slightly ahead on raw capability. GLM is text-only, MIT-licensed, a touch behind, and yours to run.</p>
<p>But of course we’re not dealing with the elephant in the room. I benchmarked GLM-5.2 against Claude Opus 4.8, which is a frontier model but not the newest one. Stack the actual current frontier, Anthropic’s Claude Fable 5 <span class="citation" data-cites="anthropic2026fable">(Anthropic 2026a)</span> and OpenAI’s GPT-5.5 Pro <span class="citation" data-cites="openai2025gpt5">(OpenAI 2026)</span>, against both open-pillar flagships and the picture changes:</p>
<div id="tbl-fablevstherest" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-fablevstherest-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;2: Data from July 12, 2026 <span class="citation" data-cites="llmstats2026">(<span class="nocase">llm-stats.com</span> 2026)</span>. A dash means the aggregator has no reported score for that model on that benchmark; GPT-5.5 Pro only reports Humanity’s Last Exam here. Claude Fable 5 and GPT-5.5 Pro are proprietary; GLM-5.2 is MIT-licensed and self-hostable; Qwen3.7 Max is proprietary, API-only. Pricing per million tokens: Fable 5 $10/$50, GPT-5.5 Pro $30/$180, GLM-5.2 $0.95/$3.00, Qwen3.7 Max $1.25/$3.75.
</figcaption>
<div aria-describedby="tbl-fablevstherest-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Benchmark</th>
<th>Claude Fable 5</th>
<th>GPT-5.5 Pro</th>
<th>GLM-5.2</th>
<th>Qwen3.7 Max</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Humanity’s Last Exam</td>
<td>64.5%</td>
<td>57.2%</td>
<td>54.7%</td>
<td>41.4%</td>
</tr>
<tr class="even">
<td>SWE-Bench Pro</td>
<td>80.0%</td>
<td>-</td>
<td>62.1%</td>
<td>60.6%</td>
</tr>
<tr class="odd">
<td>SWE-Bench Verified</td>
<td>95.0%</td>
<td>-</td>
<td>-</td>
<td>80.4%</td>
</tr>
<tr class="even">
<td>FrontierSWE</td>
<td>90.0%</td>
<td>-</td>
<td>74.0%</td>
<td>-</td>
</tr>
<tr class="odd">
<td>Terminal-Bench 2.1</td>
<td>84.3%</td>
<td>-</td>
<td>82.7%</td>
<td>-</td>
</tr>
<tr class="even">
<td>LiveBench</td>
<td>78.3%</td>
<td>-</td>
<td>-</td>
<td>74.3%</td>
</tr>
<tr class="odd">
<td>Finance Agent v2</td>
<td>56.3%</td>
<td>-</td>
<td>-</td>
<td>48.4%</td>
</tr>
<tr class="even">
<td>GDPval-AA</td>
<td>60.5%</td>
<td>-</td>
<td>-</td>
<td>43.6%</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>A few things to read off this. On Humanity’s Last Exam, the one benchmark all four report, Claude Fable 5 (64.5) leads GPT-5.5 Pro (57.2), GLM-5.2 (54.7), and Qwen3.7 Max (41.4). GPT-5.5 Pro and GLM-5.2 are nearly tied on that one, so the real separation is Fable 5 a tier above and Qwen3.7 Max a tier below. On the agentic and coding benchmarks that production work actually runs on, the gaps widen fast: FrontierSWE is sixteen points between Fable 5 and GLM-5.2, SWE-Bench Pro is eighteen. And note GPT-5.5 Pro’s pricing, $30/$180 per million tokens, roughly three times Fable 5 and thirty to sixty times GLM-5.2’s self-hosted inference, for the privilege of sitting a few points behind Fable 5 on the one benchmark it reports. The closed frontier is a moving target, and an expensive one. The open-weights pillar is genuinely close to a frontier model, and a clear step behind the actual frontier model, and the frontier moves every quarter. The gap you close by waiting for the next open release can reopen in the same quarter when the closed side ships again.</p>
<p>This is exactly why the open-weights pillar is so comfortable to lean on, and exactly why its loss would hurt so much. The deal today is remarkably good: near-frontier capability, open weights, self-hostable, at a fraction of the closed price. The risk is that this deal is a strategy choice by Zhipu and a permission choice by Beijing, and either one can change without consulting us. The numbers above are a snapshot of a generous moment, and a snapshot is not a contract.</p>
</section>
<section id="the-hypothetical-is-already-happening" class="level2">
<h2 class="anchored" data-anchor-id="the-hypothetical-is-already-happening">The hypothetical is already happening</h2>
<p>I want to flag something, because the risk I have been describing is less hypothetical than I made it sound a few pages back. Look at the Qwen3.7 Max column in the table above. On the shared benchmarks it sits a clear tier behind Claude Fable 5, SWE-Bench Verified 80.4 versus 95.0, SWE-Bench Pro 60.6 versus 80.0, Humanity’s Last Exam 41.4 versus 64.5. That is the gap I expected.</p>
<p>The license field is the part that actually worried me. Qwen3.7 Max is listed as proprietary, same as Fable 5 and GPT-5.5 Pro. The frontier of the open-weights pillar’s flagship line is API-only. You cannot download it. You cannot host it. You cannot fine-tune the weights. It ships through Novita and Together, on someone else’s terms.</p>
<p>This is the softer version of the risk I described earlier, the one I said was more dangerous because it is easier to miss. Maybe smaller Qwen 3.7 variants still come out as open weights. But the frontier beam, the actual frontier-class model you would want as your safety net, is already behind an API for this generation. The pillar I called “open weights so far” just lost its frontier tier to “open weights for the smaller models, proprietary for the one that matters.” The hypothetical I was asking you to imagine is, for the Max tier, already the situation on the ground.</p>
</section>
<section id="the-scenario-that-nobody-is-planning-for" class="level2">
<h2 class="anchored" data-anchor-id="the-scenario-that-nobody-is-planning-for">The scenario that nobody is planning for</h2>
<p>Ok so individually each pillar is a known risk. The part I want to name out loud is the combination.</p>
<p>Suppose the US closed labs restrict access to their best models. This does not have to be dramatic. It can be a tier change, a terms-of-service update, a pricing tier that quietly prices European startups out of the frontier, a “not available in your region” line in a changelog. We have seen each of those individually already.</p>
<p>And suppose, on a different timeline, the Chinese open-weights labs stop releasing frontier weights. Qwen 3.7 stays behind an API. GLM-5.3 stays internal. Maybe DeepSeek keeps publishing but it is a model class behind. Just a quiet drift where the open-weights frontier stops being the frontier.</p>
<p>Now ask the uncomfortable question. In that world, what do European builders actually run?</p>
<p>We do have one real exception, and I will get to Mistral in a minute, because they matter and they change the picture. But strip out Mistral for a second and look at the rest of the European landscape. We have some good work on smaller models, some fine-tunes, some very solid application-layer and infrastructure work. What we mostly do not have is a broad bench of European labs producing frontier models that a European startup could build on without asking anyone’s permission. If both pillars get pulled and we are relying on the bench rather than the one French champion, the answer to “what do we run” is “something a generation behind, from someone else’s charity, on someone else’s terms.” That is a hope dressed up as a plan.</p>
<p>The reason this matters specifically for Europe is that we are the ones with no third pillar. The US has its own frontier labs. China has its own frontier labs. They will be fine on their terms. We are the ones who decided that regulation plus someone else’s weights plus someone else’s API was enough of a plan. It is not.</p>
</section>
<section id="the-permission-choice-is-live-too" class="level2">
<h2 class="anchored" data-anchor-id="the-permission-choice-is-live-too">The permission choice is live too</h2>
<p>The Qwen3.7 Max license is the lab side of this story. The permission side is moving too, and out in the open.</p>
<p>On 7 July 2026 Reuters reported, citing three sources, that Beijing is considering restricting overseas access to China’s most advanced AI models <span class="citation" data-cites="reuters2026beijing">(Reuters 2026)</span>. The Chinese Ministry of Commerce led meetings in June with Alibaba, ByteDance, and Zhipu AI (Z.ai), the company behind GLM. The restrictions under discussion would cover both closed and open-weight models, and would likely apply to future models first. According to a summary of a May discussion among Chinese legal experts, published in an official journal of the Supreme People’s Court, the proposed structure is tiered: simple open-source models face only a simple filing requirement, advanced models go through security reviews, and top-tier models would either not be made publicly available or only be used domestically. The meetings also floated making the leakage or theft of AI technology a criminal offense under national security law, and new rules on who is allowed to finance domestic AI startups.</p>
<p>Read that tiered proposal carefully, because it is the “softer version” I described earlier, drafted as regulation. Smaller open models stay available. Frontier open models get pulled. This is exactly the drift I said was more dangerous because it is easier to miss, except it is now a policy consultation with a written tiered structure, reported by a serious news agency, involving the three companies whose models the open-weights pillar is built on.</p>
<p>And it is happening alongside its mirror image in Washington. In mid-June the US government ordered that foreign nationals not have access to Anthropic’s Fable 5 and Mythos 5, on national security grounds, which prompted Anthropic to disable the models globally; export controls on Fable were later lifted after new safeguards, while Mythos stayed restricted to trusted US organisations. Alibaba has reportedly banned its employees from using Anthropic’s Claude over surveillance concerns. Both capitals now treat frontier model access as a strategic lever. The two pillars we are leaning on are both being pulled, from both ends, by the governments that control them, in the same month.</p>
</section>
<section id="but-what-about-mistral" class="level2">
<h2 class="anchored" data-anchor-id="but-what-about-mistral">But what about Mistral?</h2>
<p>If you have been reading this and shouting “Mistral!” at your screen, good. It is the right reflex, and it is the one place where my “we have no pillar” framing needs a correction.</p>
<p>Mistral is the closest thing Europe has to its own frontier lab, and lately they have been doing the actual work. In December 2025 they shipped Mistral Large 3, a 675-billion-parameter open-weight frontier model with multimodal and multilingual capabilities <span class="citation" data-cites="mistral2025large3">(Mistral AI 2025)</span>, the kind of release that trades blows with Llama 3 and Qwen3-Omni rather than trailing them. You can download the weights. You can host them. You can fine-tune them. That is a European frontier-ish model you can run without asking Washington or Beijing for anything. They are also putting their money where the sovereignty argument is: $830 million in debt financing this spring to build a data center near Paris packed with 13,800 Nvidia chips <span class="citation" data-cites="cnbc2026mistraldc">(CNBC 2026)</span>. That is real European compute, on European soil, for a European lab. And Arthur Mensch, their CEO, spent last week telling anyone who would listen that closed models hand providers dangerous leverage over enterprises <span class="citation" data-cites="thenextweb2026mensch">(Stan 2026)</span>, which is the same argument I am making here, said by someone who is actually building the alternative.</p>
<p>So when I say we need more frontier AI labs, I mean on top of what Mistral has already started. Mistral counts a lot. Mistral is proof that the third pillar can be built in Europe, by Europeans, at a level that matters. The question is whether one lab is enough for a continent.</p>
<p>It is not. A single champion, however good, is still a single point of failure. If you care about sovereignty you should care about redundancy, and right now the European frontier is roughly Mistral-shaped. Mistral is also playing a pragmatic game on openness: some releases are open-weight, some sit behind an API, and the mix shifts with their enterprise strategy. That is their call and a reasonable one, but it means the open-weight frontier you can actually download from Europe tracks their commercial decisions, and those decisions can shift the same way every other lab’s have. Sound familiar?</p>
<p>There is also a funding reality worth naming. Mistral has raised around $2.7 billion at a $13.7 billion valuation. That is a serious company by any normal measure. OpenAI has raised $57 billion at a $500 billion valuation. Anthropic has raised $45 billion at a $350 billion valuation. Mistral is competing in a race where the runners next to them have roughly twenty times the capital. They are punching remarkably above their weight, and the gap is still real, and it is exactly the gap that more European labs with serious runway would help close. The answer to “Mistral exists” is “good, now we need several of them, and we need to make sure they can actually spend what it takes to hold the frontier.”</p>
<p>The cleanest yardstick I have for “how far behind is Europe” is a public model leaderboard snapshot from 11 July 2026, fifty models ranked on a 0-100 overall score across eight capability categories. One source, one methodology, so the numbers are actually comparable across labs:</p>
<div id="tbl-benchlmleaderboard" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-benchlmleaderboard-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;3: BenchLM public model leaderboard snapshot, 50 models, 11 July 2026 <span class="citation" data-cites="benchlm2026">(BenchLM 2026)</span>; overall score 0-100 across eight capability categories. A dash means no price published on the board. GPT-5.5 Pro is not on this board; GPT-5.5, the non-Pro variant, is the OpenAI entry at rank 13. ¹ Mistral Large 3 is below the top-50 cutoff (rank 50 sits at 57); the 47 is BenchLM’s own provisional composite for the model, on the same 0-100 scale, so it is comparable to the ranked scores above it.
</figcaption>
<div aria-describedby="tbl-benchlmleaderboard-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Rank</th>
<th>Model</th>
<th>Overall</th>
<th>Source</th>
<th>$/M in/out</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Claude Fable 5</td>
<td>91</td>
<td>Proprietary, US</td>
<td>$10 / $50</td>
</tr>
<tr class="even">
<td>2</td>
<td>Claude Mythos 5</td>
<td>89</td>
<td>Proprietary, US</td>
<td>$10 / $50</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Gemini 3.1 Pro</td>
<td>88</td>
<td>Proprietary, US</td>
<td>$2 / $12</td>
</tr>
<tr class="even">
<td>5</td>
<td>Claude Opus 4.8</td>
<td>85</td>
<td>Proprietary, US</td>
<td>$5 / $25</td>
</tr>
<tr class="odd">
<td>8</td>
<td>Qwen3.7 Max</td>
<td>83</td>
<td>Proprietary, China</td>
<td>-</td>
</tr>
<tr class="even">
<td>10</td>
<td>GLM-5.2</td>
<td>81</td>
<td>Open weight, China</td>
<td>$1.4 / $4.4</td>
</tr>
<tr class="odd">
<td>13</td>
<td>GPT-5.5</td>
<td>78</td>
<td>Proprietary, US</td>
<td>$5 / $30</td>
</tr>
<tr class="even">
<td>14</td>
<td>DeepSeek V4 Pro (Max)</td>
<td>78</td>
<td>Open weight, China</td>
<td>$1.74 / $3.48</td>
</tr>
<tr class="odd">
<td>17</td>
<td>GLM-5 (Reasoning)</td>
<td>77</td>
<td>Open weight, China</td>
<td>$1 / $3.2</td>
</tr>
<tr class="even">
<td>20</td>
<td>Kimi K2.6</td>
<td>74</td>
<td>Open weight, China</td>
<td>$0.95 / $4</td>
</tr>
<tr class="odd">
<td>-</td>
<td>Mistral Large 3 (675B)</td>
<td>47¹</td>
<td>Open weight, France</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>Read that table the way a builder reads it. The closed US frontier occupies the top, Fable 5 at 91, Mythos 5 at 89, Gemini 3.1 Pro at 88, Opus 4.8 at 85. The open-weight Chinese cluster sits a tier below but firmly in the conversation, GLM-5.2 at 81, DeepSeek V4 Pro at 78, GLM-5 Reasoning at 77, Kimi K2.6 at 74. Then there is Europe. Mistral Large 3, the thing we keep calling our champion, scores 47 on the same scale, below the top-fifty cutoff (rank 50 sits at 57). Roughly half the frontier, and behind every single open-weight Chinese model on the board. The frontier tops at 91, the open weights hold the 74-81 band, and Europe’s flagship is down at 47, off the ranked list entirely.</p>
<p>Break it down by category and the shape of the gap gets clearer. Same source, same scale:</p>
<div id="tbl-benchlmcategory" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-benchlmcategory-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;4: BenchLM category scores, 11 July 2026 <span class="citation" data-cites="benchlm2026">(BenchLM 2026)</span>. A dash means BenchLM has no measured category score for that model.
</figcaption>
<div aria-describedby="tbl-benchlmcategory-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>Model</th>
<th>Agentic</th>
<th>Coding</th>
<th>Knowledge</th>
<th>Reasoning</th>
<th>Source</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Claude Fable 5</td>
<td>99.4</td>
<td>93.6</td>
<td>89.0</td>
<td>-</td>
<td>Proprietary, US</td>
</tr>
<tr class="even">
<td>Claude Opus 4.8</td>
<td>93.6</td>
<td>89.9</td>
<td>88.2</td>
<td>-</td>
<td>Proprietary, US</td>
</tr>
<tr class="odd">
<td>Qwen3.7 Max</td>
<td>75.6</td>
<td>88.0</td>
<td>79.1</td>
<td>78.7</td>
<td>Proprietary, China</td>
</tr>
<tr class="even">
<td>GLM-5.2</td>
<td>84.5</td>
<td>78.6</td>
<td>84.5</td>
<td>-</td>
<td>Open weight, China</td>
</tr>
<tr class="odd">
<td>GPT-5.5</td>
<td>96.1</td>
<td>72.5</td>
<td>82.2</td>
<td>81.9</td>
<td>Proprietary, US</td>
</tr>
<tr class="even">
<td>Mistral Large 3</td>
<td>39.8</td>
<td>36.3</td>
<td>44.4</td>
<td>49.2</td>
<td>Open weight, France</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>On agentic work, the thing agents and coding workflows actually run on, Fable 5 is at 99.4 and GPT-5.5 at 96.1; the open-weight GLM-5.2 is at 84.5; Mistral is at 39.8. On coding, Fable 5 93.6, Opus 4.8 89.9, the proprietary Qwen3.7 Max 88.0, and Mistral 36.3. The frontier is in the 80s and 90s on the categories that ship production, the open weights (GLM-5.2, DeepSeek) are in the high 70s to 80s, and Europe’s champion is in the 30s and 40s. Same parameter scale as GLM-5.2, a quarter to half the score on the categories that matter.</p>
<p>Two things in that table deserve to be underlined, because they are not footnotes. First, Qwen3.7 Max sits at rank 8, overall 83, and it is marked Proprietary <span class="citation" data-cites="alibaba2026qwen37max">(Alibaba Cloud 2026)</span>. A second independent source now confirms what the earlier section flagged: the frontier tier of the open-weights pillar’s flagship line is API-only. You can buy it, you cannot download it. Second, GPT-5.5, OpenAI’s entry here, lands at 78, below GLM-5.2 (81, open weight) and Qwen3.7 Max (83, proprietary) on this overall. On a July 2026 overall the open weights, GLM-5.2 and DeepSeek V4 Pro, are neck and neck with OpenAI’s current model, which is exactly why losing them would gut European builders.</p>
<p>And this is at the same parameter scale: Mistral Large 3 is 675 billion parameters, the same scale as GLM-5.2. Same scale, and GLM-5.2 is rank 10 overall at 81 while Mistral sits at 47, off the ranked board. The gap lives in compute and refinement, which is the funding-and-runway gap from a minute ago. This is the concrete version of “Mistral counts, and Europe still needs more labs with more compute.” A 675-billion-parameter open-weight model you can run yourself is a real asset. A 675-billion-parameter open-weight model that scores 47 on the same scale where the frontier scores 91, with 39.8 on agentic where the frontier scores 99.4, is a real warning about how far the capital gap pushes you.</p>
</section>
<section id="the-speed-gap-not-just-the-level" class="level2">
<h2 class="anchored" data-anchor-id="the-speed-gap-not-just-the-level">The speed gap, not just the level</h2>
<p>The 47 is a level. The thing that should worry Europe more is the slope. How fast is Mistral actually climbing relative to the frontier? BenchLM scores every model on the same 0-100 composite, so I can put a 2024 model and a 2026 model on the same scale and read the speed off the difference.</p>
<p>In 2024 the major labs were all clustered in the high-30s to high-40s on this composite. Here is how each one got from its 2024 model to its 2026 model.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/figs/lab_speed_slope.light.png" alt="Slope chart of BenchLM composite score from each lab's 2024 model to its 2026 model: Mistral rises from 39 to 47 (a near-flat red line), while Anthropic rises 39 to 91, DeepSeek 38 to 78, OpenAI 41 to 78, and Alibaba 47 to 83, all steep."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/the-two-pillars-are-both-rotting/figs/lab_speed_slope.dark.png" alt="Slope chart of BenchLM composite score from each lab's 2024 model to its 2026 model: Mistral rises from 39 to 47 (a near-flat red line), while Anthropic rises 39 to 91, DeepSeek 38 to 78, OpenAI 41 to 78, and Alibaba 47 to 83, all steep.">
<figcaption>
BenchLM composite, 2024 model to 2026 model, one line per lab. The slope is the development speed on a single independent yardstick. Mistral is the flat red line. The points are taken from Table&nbsp;5.
</figcaption>
</figure>
<p>Read the Gain. Anthropic +52, DeepSeek +40, OpenAI +37, Alibaba +36, Mistral +8. Per month that is roughly DeepSeek 2.5, Anthropic 2.2, Alibaba 1.8, OpenAI 1.6, Mistral 0.5. DeepSeek’s open weights climb at the same speed as the US closed frontier. DeepSeek is the fastest of the five, slightly ahead of Anthropic. Alibaba’s frontier climbed to 83 too, but its frontier tier went proprietary: Qwen3.7 Max is API-only, with Qwen3.6 the open-weight line at 65 on this composite. The open-weights pillar’s frontier has partly closed even as the lab kept climbing. Mistral is the lone outlier, moving at about a fifth of the frontier’s pace. The level gap I showed earlier, 47 versus 91, is what you get when one lab compounds at a fifth of the others’ speed for two years. This is a velocity gap. Velocity gaps compound. This is one aggregator’s view, not a single controlled harness run identically on every model. Mistral’s BenchLM rows are Artificial-Analysis-sourced (independent), whereas some competitors’ composites lean partly on provider self-report. The numbers are also provided in Table&nbsp;5.</p>
<div id="tbl-benchlmspeed" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-benchlmspeed-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;5: BenchLM’s own 0-100 composite per model <span class="citation" data-cites="benchlm2026">(BenchLM 2026)</span>. BenchLM builds each model’s composite from a mix of sources that varies by model, including Artificial Analysis’s independent runs <span class="citation" data-cites="artificialanalysis2026">(Artificial Analysis 2026)</span>, providers’ own reported scores, and third-party-verified rows such as Epoch AI’s FrontierMath <span class="citation" data-cites="epochai2026frontiermath">(Epoch AI 2026)</span>. Starting points are each lab’s earliest model with a BenchLM composite dates are public release dates.
</figcaption>
<div aria-describedby="tbl-benchlmspeed-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>Lab</th>
<th>2024 model</th>
<th>2026 model</th>
<th>Gain</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Mistral</td>
<td>Large 2: 39 (Jul 2024)</td>
<td>Large 3: 47 (Dec 2025)</td>
<td>+8 in ~16 months</td>
</tr>
<tr class="even">
<td>Anthropic</td>
<td>3.5 Sonnet: 39 (Jun 2024)</td>
<td>Fable 5: 91 (Jun 2026)</td>
<td>+52 in ~24 months</td>
</tr>
<tr class="odd">
<td>OpenAI</td>
<td>GPT-4o: 41 (May 2024)</td>
<td>GPT-5.5: 78 (Apr 2026)</td>
<td>+37 in ~23 months</td>
</tr>
<tr class="even">
<td>DeepSeek (open weight)</td>
<td>V3: 38 (Dec 2024)</td>
<td>V4 Pro Max: 78 (Apr 2026)</td>
<td>+40 in ~16 months</td>
</tr>
<tr class="odd">
<td>Alibaba/Qwen (open → closed)</td>
<td>Qwen2.5-72B: 47 (Sep 2024)</td>
<td>Qwen3.7 Max: 83 (May 2026)</td>
<td>+36 in ~20 months</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
<p>The second thing this table buys us is that the open-weights pillar is a fast-moving target. DeepSeek V3, an open-weight model from December 2024, scored 38 on this composite, tied with Mistral Large 2 from six months earlier. About sixteen months later DeepSeek is at 78 and Mistral at 47. Same kind of window, DeepSeek climbed 40 points, Mistral 8. Or take Alibaba: Qwen2.5-72B, open weight, September 2024, scored 47, the level Mistral Large 3 would only reach more than a year later. DeepSeek’s open weights are improving at frontier speed (it sits at 78, level with GPT-5.5), and even Alibaba’s open-weight Qwen3.6 line reaches 65, well ahead of Mistral’s 47. The open weights the European piece is leaning on are moving fast, which is exactly why the prospect of losing them, to a Zhipu strategy choice, a Beijing permission choice, or a frontier tier simply going closed the way Qwen3.7 Max did, would gut European builders overnight.</p>
<p>And note what Mistral did not ship in those 16 months: a competitive reasoning model. The composite partly measures exactly that, because Humanity’s Last Exam, SciCode, and the Artificial Analysis suite <span class="citation" data-cites="artificialanalysis2026">(Artificial Analysis 2026)</span> reward chain-of-thought, and the frontier and the Chinese open weights moved to reasoning models while Mistral’s flagship stayed a non-reasoning instruct model. The frontier and the open-pillar both changed the kind of model they ship, and Europe’s champion did not. That is the slope gap in concrete form.</p>
<p>This is the part that should scare the policy people most. Closing a level gap is a question of one good model. Closing a velocity gap is a question of sustained compute, sustained talent, and sustained runway, the things Europe has not funded at frontier scale. A continent moving at a fifth of the frontier’s speed falls further behind every quarter it waits, and the open weights it leans on are running at full frontier speed in someone else’s hands.</p>
</section>
<section id="why-well-just-fine-tune-is-not-an-answer" class="level2">
<h2 class="anchored" data-anchor-id="why-well-just-fine-tune-is-not-an-answer">Why “we’ll just fine-tune” is not an answer</h2>
<p>The thing I hear a lot, is “well, we will just fine-tune an open model and that will be good enough.” I like fine-tuning. I do it. But fine-tuning is not a substitute for having a frontier base model to fine-tune from. You can fine-tune a model that is already good. You cannot fine-tune your way from a small model to a frontier model. The capability ceiling is set by the base. If the best base you are allowed to touch is a generation behind, no amount of fine-tuning closes that gap. The GLM-5.2 versus Claude Opus 4.8 numbers above are the polite version of this: even a strong open-weight model sitting a few points behind the closed frontier is a ceiling you can nudge with fine-tuning but not break through. Drop the base another generation and you are not a few points behind, you are playing a different sport.</p>
<p>This is why the open-weights pillar matters more than people give it credit for, and why its potential loss is more dangerous than the closed-pillar loss. The closed pillar at least has a contractual surface. You pay, you get access, you get cut off, you know. The open-weights pillar is the one we treat as ambient infrastructure, and it is the one that can disappear quietly without a single press release. One day the HuggingFace repo just stops updating to the new version. Nobody fires you. You just slowly fall behind.</p>
</section>
<section id="what-we-actually-need" class="level2">
<h2 class="anchored" data-anchor-id="what-we-actually-need">What we actually need</h2>
<p>We need European frontier AI labs that train frontier models, hold their own weights, publish on their own terms, and serve as a base layer for every European builder who does not want to ask Washington or Beijing for permission.</p>
<p>This is a big ask. Frontier training is expensive and hard and you need compute and talent and time horizons that are not quarterly. But the alternative is to keep hoping two foreign governments keep being generous to us, and that is a worse plan than building. The compute question is real but solvable. The talent is here. The political will is, finally, showing up. What is missing is the conviction that we have to own the base, not just the application layer on top of someone else’s base.</p>
<p>Open-weights collaboration with the rest of the world is great. I want Qwen and GLM and DeepSeek and Llama to keep being open forever. The point is that wanting it is not a plan. You cannot run a continent’s AI capability on the hope that other people’s open-source strategy stays convenient for you.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>We can route around one awkward provider. The risk is that both pillars we lean on, the closed US frontier and the open Chinese frontier, can be pulled at the same time for reasons that have nothing to do with us, and we have nothing of our own to fall back on.</p>
<p>This is a build situation. The window where we can pretend the current arrangement is stable is the window we should be using to put our own pillar in the ground. Every quarter we spend treating open-weights releases as guaranteed infrastructure is a quarter we are not spending training the base models that will keep Europe capable regardless of what Washington or Beijing decides.</p>
<p>If you are building this in Europe right now, I would like to hear from you. If you think I am wrong about the open-weights trajectory, I genuinely want to know, especially if you have information about release plans I do not. I am probably wrong about something in this post. The important thing is that we stop treating two foreign pillars as if they were bedrock. They are not. They are someone else’s decision, and decisions change.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-alibaba2026qwen37max" class="csl-entry">
Alibaba Cloud. 2026. <em>Qwen3.7-<span>Max</span>, Our Latest Proprietary Model</em>. <a href="https://www.alibabacloud.com/blog/qwen3-7-the-agent-frontier_603154" class="uri">Https://www.alibabacloud.com/blog/qwen3-7-the-agent-frontier_603154</a>.
</div>
<div id="ref-anthropic2026fable" class="csl-entry">
Anthropic. 2026a. <em>Claude <span>Fable</span> 5 and Claude <span>Mythos</span> 5</em>. <a href="https://www.anthropic.com/news/claude-fable-5-mythos-5" class="uri">Https://www.anthropic.com/news/claude-fable-5-mythos-5</a>.
</div>
<div id="ref-anthropic2026war" class="csl-entry">
Anthropic. 2026b. <em>Where Things Stand with the Department of War</em>. <a href="https://www.anthropic.com/news/where-stand-department-war" class="uri">Https://www.anthropic.com/news/where-stand-department-war</a>.
</div>
<div id="ref-artificialanalysis2026" class="csl-entry">
Artificial Analysis. 2026. <em>Independent Model Benchmarking (Intelligence Index, <span>GPQA</span> <span>Diamond</span>, <span>HLE</span>, <span>SciCode</span>, <span>Terminal</span>-<span>Bench</span>, Etc.)</em>. <a href="https://artificialanalysis.ai" class="uri">Https://artificialanalysis.ai</a>.
</div>
<div id="ref-ap2026anthropic" class="csl-entry">
Associated Press. 2026. <em>Pentagon Dispute Bolsters Anthropic Reputation but Raises Questions about AI Readiness in Military</em>. <a href="https://apnews.com/article/anthropic-pentagon-openai-claude-chatgpt-military-ai-b2bbcf5fda3f27353eae1e0eb7ab07b6" class="uri">Https://apnews.com/article/anthropic-pentagon-openai-claude-chatgpt-military-ai-b2bbcf5fda3f27353eae1e0eb7ab07b6</a>.
</div>
<div id="ref-benchlm2026" class="csl-entry">
BenchLM. 2026. <em>Public Model Leaderboard (50 Models, Snapshot 11 July 2026) and Per-Model Pages</em>. <a href="https://benchlm.ai" class="uri">Https://benchlm.ai</a>.
</div>
<div id="ref-cnbc2026mistraldc" class="csl-entry">
CNBC. 2026. <em>Mistral <span>AI</span> Raises $830 Million in Debt to Set up a Data Center Near <span>Paris</span></em>. <a href="https://www.cnbc.com/2026/03/30/mistral-ai-paris-data-center-cluster-debt-financing.html" class="uri">Https://www.cnbc.com/2026/03/30/mistral-ai-paris-data-center-cluster-debt-financing.html</a>.
</div>
<div id="ref-epochai2026frontiermath" class="csl-entry">
Epoch AI. 2026. <em>Frontier<span>Math</span> V2 Leaderboard</em>. <a href="https://epoch.ai/benchmarks/frontiermath-tier-4-v2" class="uri">Https://epoch.ai/benchmarks/frontiermath-tier-4-v2</a>.
</div>
<div id="ref-eustartupsAnthropicPulled" class="csl-entry">
Garcia, David Cendon. 2026. <em><span>A</span>nthropic Pulled the Plug, and <span>E</span>uropean <span>A</span><span>I</span> Experts Are Left Asking What Comes Next | <span>E</span><span>U</span>-<span>S</span>tartups — Eu-Startups.com</em>. <a href="https://www.eu-startups.com/2026/06/anthropic-pulled-the-plug-and-european-ai-experts-are-left-asking-what-comes-next/" class="uri">Https://www.eu-startups.com/2026/06/anthropic-pulled-the-plug-and-european-ai-experts-are-left-asking-what-comes-next/</a>.
</div>
<div id="ref-llmstats2026" class="csl-entry">
<span class="nocase">llm-stats.com</span>. 2026. <em>Model Benchmark Comparisons (Snapshot July 2026)</em>. <a href="https://llm-stats.com" class="uri">Https://llm-stats.com</a>.
</div>
<div id="ref-mistral2025large3" class="csl-entry">
Mistral AI. 2025. <em>Introducing <span>Mistral</span> 3</em>. <a href="https://mistral.ai/news/mistral-3" class="uri">Https://mistral.ai/news/mistral-3</a>.
</div>
<div id="ref-openai2025gpt5" class="csl-entry">
OpenAI. 2026. <em>Introducing GPT‑5.5</em>. <a href="https://openai.com/index/introducing-gpt-5-5" class="uri">Https://openai.com/index/introducing-gpt-5-5</a>.
</div>
<div id="ref-reuters2026beijing" class="csl-entry">
Reuters. 2026. <em>Beijing Is Looking at Curbing Overseas Access to China’s Top AI Models, Sources Say</em>. <a href="https://www.reuters.com/world/beijing-is-looking-curbing-overseas-access-chinas-top-ai-models-sources-say-2026-07-07/" class="uri">Https://www.reuters.com/world/beijing-is-looking-curbing-overseas-access-chinas-top-ai-models-sources-say-2026-07-07/</a>.
</div>
<div id="ref-thenextweb2026mensch" class="csl-entry">
Stan, Alina Maria. 2026. <em>Mistral <span>CEO</span>: Closed <span>AI</span> Models Give Providers Leverage</em>. <a href="https://thenextweb.com/news/mistral-ceo-open-source-enterprise-warning" class="uri">Https://thenextweb.com/news/mistral-ceo-open-source-enterprise-warning</a>.
</div>
<div id="ref-bis2025diffusion" class="csl-entry">
U.S. Bureau of Industry and Security. 2025. <em>Framework for Artificial Intelligence Diffusion (Issued 15 Jan 2025; Rescinded 2025, Replacement Rule Forthcoming)</em>. <a href="https://www.bis.gov/press-release/department-commerce-announces-rescission-biden-era-artificial-intelligence-diffusion-rule-strengthens" class="uri">Https://www.bis.gov/press-release/department-commerce-announces-rescission-biden-era-artificial-intelligence-diffusion-rule-strengthens</a>.
</div>
<div id="ref-zai2026glm52" class="csl-entry">
Z.ai. 2026. <em>GLM-5.2: Built for Long-Horizon Tasks</em>. <a href="https://z.ai/blog/glm-5.2" class="uri">Https://z.ai/blog/glm-5.2</a>.
</div>
</div></section></div> ]]></description>
  <category>European AI sovereignty</category>
  <category>open source AI</category>
  <category>foundation models</category>
  <category>frontier models</category>
  <category>AI policy</category>
  <guid>https://drmike.xyz/posts/the-two-pillars-are-both-rotting/</guid>
  <pubDate>Sat, 11 Jul 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>A small world model that knows when a cube is cheating</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/smolwm-world-model/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>Last week I stumbled upon SmolVLA <span class="citation" data-cites="shukor2025smolvla">(Shukor et al. 2025)</span>, a small vision-language-action model for robots. The pitch is lovely: most VLAs are billions of parameters and need a datacenter to breathe, and SmolVLA says no, you can train something useful on community-collected data from cheap robot arms and run it on a consumer GPU. I immediately thought, cool I wonder how was LeWorldModel <span class="citation" data-cites="maes2026leworldmodel">(Maes et al. 2026)</span> would do in this setting. If you don’t remember LeWorldModel you can read my previous post <a href="https://drmike.xyz/posts/why-world-models-with-jepa">about world models and JEPA</a>. Basically it trains a tiny world model (about 15M parameters, single GPU, a few hours) that stays stable end-to-end using only two loss terms.</p>
<p>Now, a VLA is a policy. You show it a camera image and an instruction, and it tells you what action to take. A world model <span class="citation" data-cites="haWorldModels2018 schmidhuberMakingWorldDifferentiable">(Ha and Schmidhuber 2018; Schmidhuber 1990)</span> is a different animal. Give it a state and an action, and it tells you the state you’ll land in. So what if you took SmolVLA’s cheap, affordable, community-data setup, and instead of training a policy, you trained a small world model in the same spirit as LeWorldModel? A “SmolWM”, if you will. Can’t say I dig the name but you know, there are two things that are hard in computer science. Cache invalidation and naming things.</p>
<p>Long story short, I built it. This post is the writeup of the parts that worked well, a cool demo along with the part where I ran into a wall.</p>
</section>
<section id="from-what-do-i-do-to-what-happens-next" class="level2">
<h2 class="anchored" data-anchor-id="from-what-do-i-do-to-what-happens-next">From “what do I do” to “what happens next”</h2>
<p>A policy learns a mapping from observation to action. Good for control, but it’s a bit of a black box about the world itself. A world model learns the dynamics. Given where you are now and what you do, where do you end up? Write the current state as a latent <img src="https://latex.codecogs.com/png.latex?z_t">, the action as <img src="https://latex.codecogs.com/png.latex?a_t">, and the model predicts the next latent <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bz%7D_%7Bt+1%7D">. That’s it.</p>
<p>The word “latent” is doing a lot of work here and is the cornerstone in a JEPA (Joint-Embedding Predictive Architecture), which means the model predicts in a compact representation space, never in pixels. Why would you throw away the pixels? Because most of what’s in a camera frame is irrelevant to the physics. The exact texture of the table, the lighting, the JPEG noise. If you force a model to predict all of that, it spends its capacity being a video codec. Predict in latent space and it can spend its capacity on the stuff that actually matters, like where the cube is and which way it’s about to slide. There’s a nice writeup by Yann LeCun <span class="citation" data-cites="lecun2022path">(LeCun 2022)</span> that talks at length about this. I also built <a href="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch">a simple world model from scratch</a> previously. Check it out if you’re curious.</p>
<p>So SmolWM is three small pieces. A little vision transformer that turns a camera image into a latent. A tiny MLP that folds in the robot’s joint positions and a frozen language embedding of the instruction. And a small transformer predictor that takes <img src="https://latex.codecogs.com/png.latex?(z_t,%20a_t)"> and coughs up <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bz%7D_%7Bt+1%7D">. On the full config it’s about 25M trainable parameters, which is firmly in the “trains on one GPU over lunch” regime.</p>
<p>The whole thing fits on one diagram (below). The top row encodes the current observation into <img src="https://latex.codecogs.com/png.latex?z_t">, the predictor pushes it forward under the action to get <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bz%7D_%7Bt+1%7D">, and the bottom row encodes the next observation with the same encoder to give the target <img src="https://latex.codecogs.com/png.latex?z_%7Bt+1%7D">. The two losses live on the right.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/smolwm-world-model/figs/architecture.light.png" alt="SmolWM architecture. Top: image, proprioception and instruction each go through their own encoder (ViT, MLP, and a frozen text encoder), fuse into the state latent z_t. The predictor takes z_t and the action a_t and outputs the predicted next latent z-hat. Bottom: the next image goes through the same shared encoder and fuse into the target latent z_{t+1}. On the right, the prediction loss compares z-hat to z_{t+1}, plus a SIGReg term keeps the latents Gaussian."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/smolwm-world-model/figs/architecture.dark.png" alt="SmolWM architecture. Top: image, proprioception and instruction each go through their own encoder (ViT, MLP, and a frozen text encoder), fuse into the state latent z_t. The predictor takes z_t and the action a_t and outputs the predicted next latent z-hat. Bottom: the next image goes through the same shared encoder and fuse into the target latent z_{t+1}. On the right, the prediction loss compares z-hat to z_{t+1}, plus a SIGReg term keeps the latents Gaussian.">
<figcaption class="figure-caption" id="fig-arch">
SmolWM in one picture. Three small encoders fuse image, proprioception and a frozen language embedding into the state latent <img src="https://latex.codecogs.com/png.latex?z_t">. The predictor rolls it forward under the action. The bottom branch is the JEPA target: the same encoder run on the next frame. Trained with a next-latent prediction loss plus SIGReg.
</figcaption>
</figure>
</section>
<section id="the-two-loss-trick-and-why-jepas-usually-fall-over" class="level2">
<h2 class="anchored" data-anchor-id="the-two-loss-trick-and-why-jepas-usually-fall-over">The two-loss trick, and why JEPAs usually fall over</h2>
<p>Here’s the problem with training a thing like this. If your only goal is “make the predicted next latent match the actual next latent”, there’s a stupid solution that wins every time: map every image to the same constant vector. Prediction error zero, model useless. This is called representation collapse, and it’s the ghost that haunts every JEPA. The usual exorcism involves a second “target” network updated with an exponential moving average, stop-gradients, and a small pile of hyperparameters you have to tune by feel.</p>
<p>LeWorldModel’s contribution, which is really quite clever, is a regularizer called SIGReg <span class="citation" data-cites="balestrieroLeJEPAProvableScalable2025">(Balestriero and LeCun 2025)</span> that replaces all of that machinery with one idea: force the distribution of latents to look like an isotropic Gaussian. If your latents are spread out like a nice round Gaussian ball, they can’t all collapse to a point. And crucially, it does this without an EMA target and without stop-gradients. Two loss terms, one knob.</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathcal%7BL%7D%20=%20%5Cunderbrace%7B%5ClVert%20%5Chat%7Bz%7D_%7Bt+1%7D%20-%20z_%7Bt+1%7D%20%5CrVert%5E2%7D_%7B%5Ctext%7Bpredict%20the%20next%20latent%7D%7D%20+%20%5Clambda%20%5Ccdot%20%5Cunderbrace%7B%5Ctext%7BSIGReg%7D(z)%7D_%7B%5Ctext%7Bkeep%20latents%20Gaussian%7D%7D%0A"></p>
<p>The way SIGReg checks “does this look Gaussian” is itself neat. It’s a goodness-of-fit test on the empirical characteristic function along random 1-D projections (an Epps-Pulley statistic, if you want to look it up). I ported it faithfully from their reference code, because when someone hands you a regularizer that collapses six hyperparameters into one, you don’t get creative. You copy it exactly and say thank you.</p>
</section>
<section id="ok-but-does-it-actually-learn-any-physics" class="level2">
<h2 class="anchored" data-anchor-id="ok-but-does-it-actually-learn-any-physics">Ok, but does it actually learn any physics?</h2>
<p>This is the question I’m interested in. The prediction loss can look great while the model has learned nothing useful, so I needed a test that a lazy model would fail.</p>
<p>Here’s one way of doing that. Take a real transition, e.g., the robot was here, it did this, it ended up there. Now corrupt it. Keep the starting state, keep the observed outcome, but swap in a <em>different</em> action. If the model genuinely understands that actions cause consequences, its prediction error should shoot up, because the outcome no longer matches the command. If the model is just doing pattern-matching on “the next frame usually looks like this frame”, it won’t notice a thing.</p>
<p>Score every transition by prediction error, label the corrupted ones as “implausible”, and compute the AUROC. Chance is 0.5. Here’s what happens over training on the PushT task:</p>
<div id="fig-auroc" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-auroc-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/smolwm-world-model/figs/auroc_climb.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-auroc-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The model learns, unsupervised, to tell a possible transition from an impossible one. “wrong_action” is the hard one: same scene, wrong command.
</figcaption>
</figure>
</div>
<p>The <code>wrong_action</code> curve climbing from 0.5 to about 0.94 is the model teaching itself that actions have consequences, with nobody ever labelling a single frame. Nobody told it what “impossible” means. It figured out physics well enough to be surprised when physics gets violated. So yeah, that’s cool.</p>
</section>
<section id="catching-a-floating-cube" class="level2">
<h2 class="anchored" data-anchor-id="catching-a-floating-cube">Catching a floating cube</h2>
<p>Right, so if the model can smell an impossible action, can it smell an impossible <em>video</em>? Let’s see shall we?</p>
<p>I took a real clip of an SO100 arm <span class="citation" data-cites="Knight_Standard_Open_SO-100">(Knight et al., n.d.)</span> doing a stacking task, and I made a doctored copy where, for a stretch in the middle, I splice in frames from the end of the episode. The arm and cubes suddenly jump to a future state and then snap back. To your eye it’s a glitch, a little teleport. To a world model it should be a physically impossible transition.</p>
<p>Now, the naive thing is to color each frame by the model’s raw prediction error. That doesn’t work, and the reason is instructive. Raw error is high whenever a transition is <em>hard to predict</em>, which includes perfectly real but fast motion. So both the real clip and the doctored clip light up red and you’ve learned nothing. The fix is to look at the <em>excess</em> error: how much more surprised is the model by the doctored frame than by the real one at the same moment? Outside the tampered window the two clips are identical, so the excess is zero and everything stays calm. Inside the window, the doctored physics push the excess up.</p>
<div id="fig-floatingcube" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-floatingcube-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/smolwm-world-model/figs/floating_cube.gif" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-floatingcube-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Left: the real clip. Right: the same clip, doctored for a stretch (red border). The plausibility bar is driven by the model’s <em>excess</em> prediction error. It goes red exactly where the physics were faked.
</figcaption>
</figure>
</div>
<p>And it separates cleanly. Here are the error distributions for real versus doctored transitions:</p>
<div id="fig-implausible" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-implausible-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/smolwm-world-model/figs/implausible.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-implausible-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Real transitions get low prediction error, tampered ones get high error. AUROC around 0.96 for the outcome-mismatch corruption.
</figcaption>
</figure>
</div>
<p>Why do I care about this beyond it being a fun GIF? Because a world model that reliably flags “that’s physically impossible” is exactly the thing you want as a safety monitor sitting next to a robot policy. Before you execute an action, you can ask the world model whether the state it’s about to walk into is even possible. A policy can’t tell you that. It only knows what to do, and whether the state it lands in even makes sense is outside its job. This is the kind of check I’d want between a learned controller and anything with actual torque.</p>
</section>
<section id="can-it-plan-heres-where-i-hit-the-wall" class="level2">
<h2 class="anchored" data-anchor-id="can-it-plan-heres-where-i-hit-the-wall">Can it plan? Here’s where I hit the wall</h2>
<p>A world model is supposed to let you plan. You imagine rolling different action sequences forward in latent space, score them, and pick the best. No decoder needed, because you never render the imagined future, you just reason about it in latent space. LeWorldModel reports solving PushT this way and even runs the planning orders of magnitude faster than pixel-space world models. So I wired up a Cross-Entropy Method planner where you sample action sequences, roll the latent forward with the predictor, keep the good ones, repeat, execute the first chunk in the real simulator, and go again.</p>
<p>And, in no way whatsoever, did it solve the task. Coverage barely moved. I spent an embarrassing number of iterations blaming the planner, tuning the search, trying different goals. I finally did the one measurement I probably should have started with.</p>
<p>Planning rolls the latent forward <em>many</em> steps. Every metric I had was one step. So the real question is this: does a free-running multi-step rollout stay faithful to reality, or does it drift off into fantasy after two or three steps? I rolled the predictor eight steps forward with real actions and compared each predicted latent to the encoder’s actual latent.</p>
<div id="fig-rollout" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-rollout-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/smolwm-world-model/figs/rollout_fidelity.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-rollout-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;4: Rollout error stays flat around 5-6 while the actual latent motion grows to 26. The ratio sits at about 0.23 the whole way out. The model rolls out just fine.
</figcaption>
</figure>
</div>
<p>That flat ratio around 0.23 was kind of a “huh” moment. The model rolls out beautifully. Eight steps, twenty-four frames of imagined future, and the error doesn’t compound. My “the rollouts must be diverging” theory was just wrong. The model was never the problem.</p>
<p>So what was? The goal. I was scoring plans by how close the rollout got to a goal latent, and it turns out the latent of a whole scene is dominated by the <em>agent’s</em> position, because the agent is the biggest thing that moves. So my planner was cheerfully solving “put the agent where it is in the goal picture” while completely ignoring the little T-shaped block it was supposed to be pushing. I tried a coverage reward head instead. It could only explain about 40% of the variance, because “is the block on the target” is a fussy geometric readout the latent doesn’t hand you for free, and the search happily gamed the weak signal.</p>
<div id="fig-plan" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-plan-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/smolwm-world-model/figs/pusht_plan.gif" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-plan-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;5: The closed-loop harness runs and the model genuinely acts. It just doesn’t reliably solve the task yet.
</figcaption>
</figure>
</div>
<p>The thing is, LeWorldModel solves this, and they don’t use a reward head or anything fancy. They plan toward <em>real expert states</em> set onto the actual trajectory, where the goal is always a reachable near-future and the agent’s motion in that goal <em>is</em> the pushing motion. My synthetic goals didn’t have that coupling, so matching the agent didn’t move the block. Reproducing their setup faithfully needs their expert dataset (a 13GB download I wasn’t going to inflict on a metered connection at 11pm in the highlands of Sweden) or their evaluation stack. So I stopped, wrote it down as work-in-progress, and shipped the parts that you’re reading about now.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Here’s where I landed. The world model itself is a small success. It learns robot dynamics from cheap data with no labels, its multi-step rollouts stay accurate out to two dozen frames, and it can look at a video and tell you, unprompted, when the physics have been faked. That last one has a real use as a plausibility monitor sitting between a policy and a robot which is a useful safety layer. Also, it’s cheap to build.</p>
<p>The planning is the asterisk. Everything I measured says the model is capable of supporting it, and I still couldn’t make it solve the task, because getting good reachable goals into a latent planner is its own hard problem that I underestimated. I spent most of my time there blaming the wrong component, which is a very normal way to spend an evening in this line of work, and a good reminder to measure the thing before you theorize about it.</p>
<p>If you’ve done latent-space planning and know the trick for goals that actually couple to the object you care about, I would genuinely love to hear it, because I suspect it’s simpler than I’m making it. And if I’ve butchered anything about JEPAs or SIGReg above, tell me. You can find me in the usual places.</p>
</section>
<section id="references" class="level2">
<h2 class="anchored" data-anchor-id="references">References</h2>
<div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-balestrieroLeJEPAProvableScalable2025" class="csl-entry">
Balestriero, Randall, and Yann LeCun. 2025. <em><span>LeJEPA</span>: <span>Provable</span> and <span>Scalable Self-Supervised Learning Without</span> the <span>Heuristics</span></em>. arXiv:2511.08544. arXiv. <a href="https://doi.org/10.48550/arXiv.2511.08544">https://doi.org/10.48550/arXiv.2511.08544</a>.
</div>
<div id="ref-haWorldModels2018" class="csl-entry">
Ha, David, and Jürgen Schmidhuber. 2018. <span>“World <span>Models</span>.”</span> March 28. <a href="https://doi.org/10.5281/zenodo.1207631">https://doi.org/10.5281/zenodo.1207631</a>.
</div>
<div id="ref-Knight_Standard_Open_SO-100" class="csl-entry">
Knight, Rob, Pepijn Kooijmans, Remi Cadene, et al. n.d. <em><span>Standard Open SO-100 &amp; SO-101 Arms</span></em>. <a href="https://github.com/TheRobotStudio/SO-ARM100">https://github.com/TheRobotStudio/SO-ARM100</a>.
</div>
<div id="ref-lecun2022path" class="csl-entry">
LeCun, Yann. 2022. <span>“A Path Towards Autonomous Machine Intelligence.”</span> <a href="https://openreview.net/forum?id=BZ5a1r-kVsf">https://openreview.net/forum?id=BZ5a1r-kVsf</a>.
</div>
<div id="ref-maes2026leworldmodel" class="csl-entry">
Maes, Lucas, Quentin Le Lidec, Damien Scieur, Yann LeCun, and Randall Balestriero. 2026. <span>“<span>LeWorldModel</span>: Stable End-to-End Joint-Embedding Predictive Architecture from Pixels.”</span> <a href="https://arxiv.org/abs/2603.19312">https://arxiv.org/abs/2603.19312</a>.
</div>
<div id="ref-schmidhuberMakingWorldDifferentiable" class="csl-entry">
Schmidhuber, Jürgen. 1990. <em>Making the <span>World Differentiable</span>: <span>On Using Self-Supervised Fully Recurrent Neural Networks</span> for <span>Dynamic Reinforcement Learning</span> and <span>Planning</span> in <span>Non-Stationary Environments</span></em>. FKI-126-90. TUM.
</div>
<div id="ref-shukor2025smolvla" class="csl-entry">
Shukor, Mustafa, Dana Aubakirova, Francesco Capuano, et al. 2025. <span>“<span>SmolVLA</span>: A Vision-Language-Action Model for Affordable and Efficient Robotics.”</span> <a href="https://arxiv.org/abs/2506.01844">https://arxiv.org/abs/2506.01844</a>.
</div>
</div>


</section>

 ]]></description>
  <category>world models</category>
  <category>JEPA</category>
  <category>robotics</category>
  <category>SIGReg</category>
  <category>planning</category>
  <guid>https://drmike.xyz/posts/smolwm-world-model/</guid>
  <pubDate>Thu, 09 Jul 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>World Models and Why JEPA + SIGReg Is a Good Bet for Teaching AI Agents</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/why-world-models-with-jepa/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>Here’s a number that I’ve been thinking about for a while now. A frontier transformer based LLM today is trained on roughly 10 trillion tokens of text. Ten. A four-year-old child sits in front of you telling stories about their day with grammatical structures that even linguists still don’t fully understand, having ingested roughly the same total amount of raw information through all its biological sensors combined over 16,000 waking hours.</p>
<p>It takes me a moment to accept the scale of this comparison because it forces us to confront something unattractive about modern AI. A growing LLM has processed roughly the same amount of raw information that a four-year-old’s brain has ingested through its entire life. And yet the child can walk across uneven ground, predict where a ball will land, understand that objects keep existing when you look away from them, and tell you why they’re sad about it in sentences most LLMs can’t replicate under real-world constraints.</p>
<p>The numbers are worth pinning down, because the reflex is to assume the child sees vastly more data. It doesn’t. <span class="citation" data-cites="kochHowMuchEye2006">Koch et al. (2006)</span> stuck electrodes into retinal ganglion cells and worked out that the human retina pipes information to the brain at around <img src="https://latex.codecogs.com/png.latex?10%5E7"> bits per second (roughly an Ethernet connection, which I find delightful). Run that for 16,000 waking hours and you get about 70 terabytes through the optic nerve. Throw in audio and the rest of the senses and you land somewhere around 50 to 100 TB over four years. A frontier model trained on ~10 trillion tokens swallows about 40 TB of raw text (call it four bytes a token). Same ballpark. So the budgets are comparable, and whatever edge the child has must come from what its wiring does with them (see the chart below).</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/why-world-models-with-jepa/figs/bandwidth.light.png" alt="Catppuccin Latte bar chart: a four-year-old's optic-nerve (~72 TB) and all-senses (~80 TB) intake next to a frontier LLM's ~40 TB training corpus. The bars sit at the same order of magnitude."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/why-world-models-with-jepa/figs/bandwidth.dark.png" alt="Catppuccin Mocha bar chart: a four-year-old's optic-nerve (~72 TB) and all-senses (~80 TB) intake next to a frontier LLM's ~40 TB training corpus. The bars sit at the same order of magnitude.">
<figcaption class="figure-caption">
Raw information budgets sit in the same ballpark. A four-year-old’s cumulative sensory intake (optic nerve rate from Koch et al.&nbsp;2006, extended to audio and the other senses) lands right next to a frontier LLM’s ~10T-token training corpus. The budgets are comparable. The difference shows up in what the architecture does with them.
</figcaption>
</figure>
<p>This brings us to a question I have been thinking about for over twenty-five years while working with neural networks.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>If a child does all of that from roughly the same total information budget as our biggest models, what are we doing wrong with our architectures?</p>
</div>
</div>
</div>
<p>The data budget is the same for both. What differs is the architecture. A child’s is matched to the problem of learning about reality, while our trillion-token models, for all their sophistication, still cannot pick up a cup without crushing it.</p>
</section>
<section id="the-data-efficiency-problem-we-keep-ignoring" class="level2">
<h2 class="anchored" data-anchor-id="the-data-efficiency-problem-we-keep-ignoring">The Data Efficiency Problem We Keep Ignoring</h2>
<p>The way today’s approach typically works goes like this. You throw more compute at the problem and hope it scales out. This has worked spectacularly for language models because language is essentially a pattern-matching exercise with enough data to make even statistical coincidences look like meaning. But autonomous agents live in the real world, where there are no shortcuts through text corpora.</p>
<p>In the physical world, causality is messy. Actions have consequences that unfold over time. And most importantly, you get one shot at each interaction. You can’t collect ten trillion training examples of “dropping a glass” before your robot learns to manipulate objects without shattering every dish in the facility. This kind of constraint does not exist for an LLM because tokens are, well, just patterns in text. It’s easy when data is cheap and abundant, but in physics, as I learned early on, the universe never gives you a free pass.</p>
<p>One of the exciting research directions that can pave a new path is World Models, and this is where I think we’ve been going about it wrong for too long. The idea itself is old. Schmidhuber was training recurrent nets to make the world differentiable back in 1990 <span class="citation" data-cites="schmidhuberMakingWorldDifferentiable">(Schmidhuber 1990)</span>, Ha and Schmidhuber revived it beautifully with the “World Models” paper <span class="citation" data-cites="haWorldModels2018">(Ha and Schmidhuber 2018)</span>, and DreamerV2 later showed you really can hit human-level Atari by planning inside a learned latent model <span class="citation" data-cites="hafnerMasteringAtariDiscrete2021">(Hafner et al. 2021)</span>. But most approaches still try to predict raw observations next-frame or next-token. They’re autoregressive models dressed up in robot clothes, predicting pixels or words one step at a time. This requires massive amounts of data because the model needs to learn both the structure of the world and the compressed representation of what matters simultaneously.</p>
<blockquote class="blockquote">
<p>Generative AI fails to construct the forest because they’re so busy learning about the nuance of the color green on a leaf.</p>
</blockquote>
</section>
<section id="what-babies-actually-do" class="level2">
<h2 class="anchored" data-anchor-id="what-babies-actually-do">What Babies Actually Do</h2>
<p>Developmental psychologists have known for decades that human infants don’t do next-pixel prediction. They build internal models. They construct predictions about what will happen next in a latent space. A baby watches a ball roll behind a screen and maintains an expectation of its continued existence, its trajectory. The work of <span class="citation" data-cites="spelkePrinciplesObjectPerception1990">Spelke (1990)</span> on core knowledge and <span class="citation" data-cites="baillargeonObjectPermanence1987">Baillargeon (1987)</span> on violation-of-expectation experiments showed that infants only a few months old already represent objects as bounded, persisting bodies and look longer when a hidden object appears to vanish or pass through a screen. That expectation is stored as a compressed generative model encoded in neural activity that predates language entirely.</p>
<p>The mechanism? Predictive processing theory <span class="citation" data-cites="clarkWhateverNext2013">(Clark 2013)</span> suggests the brain does something remarkably elegant. It maintains hierarchical latent representations at multiple timescales. Higher levels predict what lower levels will see; lower levels send prediction errors up; the system only has to encode surprises.</p>
<p>Now think about what this means for autonomous agents. If we want our robots and embodied systems to learn efficiently, maybe they should do something analogous to what babies do. Build compressed world models. Predict abstract states rather than raw observations. Let the compression do the work of figuring out what matters.</p>
<p>This is essentially what predictive state representations (PSRs) argued decades ago in robotics, but they never got the compute. And now we have it. Still, a good idea without proper training methodology is just philosophy. What actually makes JEPA + SIGReg a good bet today is that someone built the machinery to make it work.</p>
</section>
<section id="jepa-gives-us-predictive-latent-spaces" class="level2">
<h2 class="anchored" data-anchor-id="jepa-gives-us-predictive-latent-spaces">JEPA Gives Us Predictive Latent Spaces</h2>
<p>The JEPA family (Joint Embedding Predictive Architecture) grew out of Yann LeCun’s blueprint for autonomous machine intelligence and got its first clean image implementation in I-JEPA <span class="citation" data-cites="assranSelfSupervisedLearningImages2023">(<span class="nocase">Assran et al.</span> 2023)</span>, with a video version following in V-JEPA 2 <span class="citation" data-cites="assranVJEPA2SelfSupervised2025">(<span class="nocase">Assran et al.</span> 2025)</span>. It does something clever. Instead of predicting raw pixels or tokens, it predicts representations in a latent space. And not just any latent space. One built by minimizing the “distance” between predicted and actual embeddings without ever requiring direct access to the raw data during prediction.</p>
<p>To see why this matters, let me put the two architectures next to each other.</p>
<p>First, what we’ve been doing for years. Autoregressive models predict each token or pixel from everything that came before it in observation space. The prediction happens at the level of raw data. Everything flows through a decoder that maps back to pixel/token space, and a loss function compares those predictions against the actual observations. This means the model learns whatever is in your data (signal, noise, artifacts, the whole shabang).</p>
<div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div>
<p></p><figure class="figure"><p></p>
<div>
<pre class="mermaid mermaid-js">flowchart LR

    X["X(t)"]
    Y["X(t+1)"]

    E([Encoder])
    D([Decoder])
    H["h(t)"]
    XH["&lt;span style="text-decoration: overline;"&gt;X&lt;/span&gt;(t+1)"]
    L[Reconstruction Loss]

    X --&gt; E --&gt; H --&gt; D --&gt; XH
    XH --&gt; L
    Y ----&gt; L

    classDef obs fill:#313244,stroke:#89b4fa,color:#cdd6f4,stroke-width:2px;
    classDef net fill:#45475a,stroke:#cba6f7,color:#cdd6f4,stroke-width:2px;
    classDef hidden fill:#585b70,stroke:#94e2d5,color:#cdd6f4,stroke-width:2px;
    classDef loss fill:#1e1e2e,stroke:#f38ba8,color:#cdd6f4,stroke-width:3px;

    class X,Y,XH obs;
    class E,D net;
    class H hidden;
    class L loss;
</pre>
</div>
<p></p></figure><p></p>
</div>
</div>
</div>
<p>JEPA approaches this in a slightly but significantly different way. You encode observed input segments into latent vectors and a masked Transformer predicts one set of latents from the others, entirely in latent space, with no decoder reconstructing observations. The loss compares predicted embeddings against target embeddings independently coded by a separate network (which gets no gradient). No reconstruction, no pixel-space intermediary.</p>
<p>The architecture works like this.</p>
<div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div>
<p></p><figure class="figure"><p></p>
<div>
<pre class="mermaid mermaid-js">flowchart LR

    X["X(t)"]
    Y["X(t+1)"]

    CE([Encoder])
    TE([Encoder])

    ZC["Z(t)"]
    ZT["Z(t+1)"]
    AT@{ shape: dbl-circ, label: "A(t)" }

    P[Predictor]
    L[JEPA Loss]

    X --&gt; CE --&gt; |Embed| ZC
    Y --&gt; TE --&gt; |Embed| ZT

    ZC &amp; AT --&gt; P
    P --&gt; ZH["&lt;span style="text-decoration: overline;"&gt;Z&lt;/span&gt;(t+1)"]

    ZH --&gt; L
    ZT ----&gt; L

    classDef obs fill:#313244,stroke:#89b4fa,color:#cdd6f4,stroke-width:2px;
    classDef encoder fill:#45475a,stroke:#cba6f7,color:#cdd6f4,stroke-width:2px;
    classDef latent fill:#585b70,stroke:#94e2d5,color:#cdd6f4,stroke-width:2px;
    classDef predictor fill:#45475a,stroke:#f9e2af,color:#cdd6f4,stroke-width:2px;
    classDef loss fill:#1e1e2e,stroke:#f38ba8,color:#cdd6f4,stroke-width:3px;

    class X,Y,AT obs;
    class CE,TE encoder;
    class ZC,ZT,ZH latent;
    class P predictor;
    class L loss;
</pre>
</div>
<p></p></figure><p></p>
</div>
</div>
</div>
<p>The critical thing is that you never reconstruct anything back to pixel or token space. You encode observed segments into latents with <code>f_θ</code>, predict the next latents with a masked transformer <code>φ_θ</code> from those codes plus a context signal driving the predictions, then compare predicted embeddings against target embeddings independently coded by <code>g_θ</code>. The loss operates entirely in embedding space, and if something carries no signal about the task it naturally compresses away.</p>
<p>This is fundamentally different from denoising autoencoders or variational approaches because you’re not trying to reconstruct anything at all. You are building a predictor for abstract states using only the information that was valuable enough to be encoded in the embedding space itself. Which means the model can only learn what it was told to care about, and “told” here comes from the unsupervised structure of the task, not from any hand-crafted objective function. Let the structure do the work, just specify the right inductive biases. I like it!</p>
<p>The sample efficiency comes naturally because JEPA skips whatever portion of raw data carries no information and only predicts what actually changes. A wall moving past your camera? That’s just self-motion, not world dynamics. The latent space can represent “nothing interesting is happening” without having to encode millions of pixels worth of texture.</p>
</section>
<section id="sigreg-makes-those-latents-actually-useful" class="level2">
<h2 class="anchored" data-anchor-id="sigreg-makes-those-latents-actually-useful">SIGReg Makes Those Latents Actually Useful</h2>
<p>Predicting latents is lovely in theory and has produced nice results in benchmarks, but if your latent representations collapse or become entangled, no amount of clever prediction architecture matters. You need the latents to correspond to something meaningfully structured in the real world for an agent to actually reason over them.</p>
<p>Thus, we need regularisation and that’s precisely where SIGReg comes in, and it’s the piece that makes the whole thing hold together. SIGReg is short for Sketched Isotropic Gaussian Regularization, introduced in the LeJEPA paper by <span class="citation" data-cites="balestrieroLeJEPAProvableScalable2025">Balestriero and LeCun (2025)</span>. The idea is refreshingly clean. They prove that if you want to minimize downstream prediction risk, the embeddings a JEPA should aim for are distributed as an isotropic Gaussian, and SIGReg simply pushes the embeddings toward that distribution. It does the pushing with random projections (the “sketch” in the name), which keeps the whole thing linear in time and memory. That single regularizer replaces the usual pile of heuristics (stop-gradients, teacher-student EMA, learning-rate schedulers) that earlier JEPAs leaned on to avoid collapse.</p>
<p>SIGReg makes JEPA’s predictions actually useful for planning and control rather than just producing smooth embeddings that happen to minimize some loss function. You can’t steer a robot with entangled latents because changing one dimension ripples across every other dimension in unpredictable ways. SIGReg’s regularization prevents exactly this kind of collapse.</p>
</section>
<section id="the-signal-is-in-what-both-teach-us-together" class="level2">
<h2 class="anchored" data-anchor-id="the-signal-is-in-what-both-teach-us-together">The Signal Is in What Both Teach Us Together</h2>
<p>JEPA alone gives us efficient prediction, but not necessarily useful structure. SIGReg alone gives us regularized representations, but not an architecture for predicting how the world changes. Together they form a complete learning loop:</p>
<ol type="1">
<li>Build latent state representations that are disentangled and stable (SIGReg’s contribution).</li>
<li>Predict how those latents evolve forward in time (JEPA’s core mechanism).</li>
<li>Use the predictions to plan actions that produce desired outcomes.</li>
<li>Observe errors in prediction, send error signals back up the hierarchy, update the model.</li>
</ol>
<p>This loop is sample-efficient because it operates entirely in latent space and only attends to information that survives both the regularization and the predictive compression. It’s also explainable. Because SIGReg keeps dimensions disentangled, you can trace which dimensions correspond to which physical quantities. You know what changed when something went wrong.</p>
<p>And critically, this architecture mirrors exactly what developmental psychology tells us human brains use to learn about the world. The predictive processing hierarchy, the latent representations at multiple scales, the error-driven updating. Not because babies and JEPA share an evolutionary link (obviously they don’t), but because both are solving the same optimization problem under similar constraints, i.e., limited data, noisy sensors, need for reliable predictions, finite computational capacity.</p>
</section>
<section id="why-this-is-a-good-bet-for-2026" class="level2">
<h2 class="anchored" data-anchor-id="why-this-is-a-good-bet-for-2026">Why This Is a Good Bet for 2026</h2>
<p>A few converging factors make now the right time for this approach in autonomous agents.</p>
<p>First, we finally have compute budgets capable of training meaningful latent world models without immediately collapsing them into useless embeddings. The JEPA papers showed it was possible; we had the architectures but not the discipline to resist next-token distraction long enough to build proper systems.</p>
<p>Second, the robotics community is tired of reinforcement learning’s sample inefficiency and simulation-to-real gap. Every company building autonomous robots knows that collecting real-world data is expensive and dangerous. Architecture-level efficiencies beat brute-force data collection every time.</p>
<p>Third, there’s a growing awareness across ML that scaling laws for autoregressive models might be hitting diminishing returns on the generalization they actually deliver to reasoning and planning tasks. More tokens don’t necessarily translate better to causal understanding or physical manipulation. And we’re starting to see hard numbers on the alternative, e.g., the Semantic Tube Prediction work <span class="citation" data-cites="huangSemanticTubePrediction2026">(Huang et al. 2026)</span> applied a JEPA-style regularizer to a language task and matched baseline accuracy with 16 times less training data, which is a direct poke at the data term of the Chinchilla scaling laws.</p>
<p>JEPA + SIGReg addresses all three of these concerns head-on by providing an architecture-level solution that can learn efficiently from less data because you’re predicting the right things, at the right level of abstraction, with representations you can trust enough to act on.</p>
</section>
<section id="where-im-uncertain" class="level2">
<h2 class="anchored" data-anchor-id="where-im-uncertain">Where I’m Uncertain</h2>
<p>I want to be transparent about what’s not yet proven here. The JEPA + SIGReg literature so far has been mostly shown in controlled environments like Atari games <span class="citation" data-cites="hafnerMasteringAtariDiscrete2021">(Hafner et al. 2021)</span> and synthetic dynamics tasks. LeWorldModel <span class="citation" data-cites="maesLeWorldModelStableEndtoEnd2026">(<span class="nocase">Maes et al.</span> 2026)</span> is encouraging on this front, since it trains a stable JEPA end-to-end from raw pixels on a single GPU and its latent space actually probes out to physical quantities, but that’s still a long way from open-world robotics with its dense sensors, actuator noise, and unstructured interactions. Whether the approach scales there remains an open question.</p>
<p>There’s also the question of language grounding. LLMs at least have some connection to structured human knowledge because they’re trained on it. A JEPA-based agent that learns purely from sensorimotor experience might develop a perfectly competent world model that has no interface for communicating what it learned. This is solvable, I think (VL-JEPA <span class="citation" data-cites="chenVLJEPAJointEmbedding2025">(<span class="nocase">Chen, Shukor, et al.</span> 2025)</span> and the Vision Language World Model <span class="citation" data-cites="chenPlanningReasoningUsing2025">(<span class="nocase">Chen, Moutakanni, et al.</span> 2025)</span> are early attempts to bolt a language interface onto exactly this kind of predictive latent space), but it’s a different problem from the one autoregressive models solve naturally.</p>
<p>Finally, I haven’t fully worked out how regularizing latent spaces interacts with safety guarantees. If we’re teaching agents to act on their compressed predictions, the gap between prediction and reality becomes a critical design question. SIGReg helps by keeping latents stable and interpretable, but that’s not the same as bounding error in downstream planning.</p>
<p>Write to me if you’ve worked at this intersection and what you see differently. I’m always trying to calibrate my optimism on new architectures against real-world deployment data, which is still thin for anything like the approach we need here.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Language models are genuinely remarkable at what they do, and they serve a different purpose than the one I’m describing here. I’m running the comparison between token counts and infant sensory bandwidth to sharpen a point about architecture. For autonomous agents that need to learn quickly from limited experience in the physical world, we should be studying what works under the same constraints as biological learners, meaning compressed representations, predictive internal models, hierarchical error correction.</p>
<p>JEPA provides the predictive architecture. SIGReg ensures the latents remain usable. Together they offer something I haven’t seen enough of in recent AI literature. An approach to agent learning that is principled about data efficiency, grounded in what we know about biological development, and actually buildable with current tools.</p>
<p>The bet is that this combination will prove more effective at scale for teaching agents the kind of general reasoning you get from early childhood observation than the brute-force token accumulation strategy has shown itself to be. I’ve been working in neural network research long enough to know that architecture-level advantages compound over pure data volume, so this seems like an asymmetrically good bet. Significant upside if it works, manageable cost either way because even partial gains in sample efficiency for robot and agent learning could be commercially transformative.</p>
<p>But the real reason to build agents this way is that I find it deeply satisfying on its own terms. Systems that learn efficiently from compressed observation, without needing encyclopedic data ingestion, reflect something true about intelligence rather than just scaling brute force. That’s worth building toward on principle, regardless of whether it scales commercially.</p>
<p>And honestly? If a four-year-old can figure out how the world works with the sensors it got through the optic nerve, surely our models could learn to do at least as well, even if they need more computation than their tiny human counterparts.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-assranSelfSupervisedLearningImages2023" class="csl-entry">
<span class="nocase">Assran, Mahmoud, Quentin Duval, Ishan Misra, et al.</span> 2023. <span>“Self-<span>Supervised Learning</span> from <span>Images</span> with a <span>Joint-Embedding Predictive Architecture</span>.”</span> <em>2023 <span>IEEE</span>/<span>CVF Conference</span> on <span>Computer Vision</span> and <span>Pattern Recognition</span> (<span>CVPR</span>)</em> (Vancouver, BC, Canada), June, 15619–29. <a href="https://doi.org/10.1109/CVPR52729.2023.01499">https://doi.org/10.1109/CVPR52729.2023.01499</a>.
</div>
<div id="ref-assranVJEPA2SelfSupervised2025" class="csl-entry">
<span class="nocase">Assran, Mido, Adrien Bardes, David Fan, et al.</span> 2025. <em>V-<span>JEPA</span> 2: <span>Self-Supervised Video Models Enable Understanding</span>, <span>Prediction</span> and <span>Planning</span></em>. arXiv:2506.09985. arXiv. <a href="https://doi.org/10.48550/arXiv.2506.09985">https://doi.org/10.48550/arXiv.2506.09985</a>.
</div>
<div id="ref-baillargeonObjectPermanence1987" class="csl-entry">
Baillargeon, Renée. 1987. <span>“Object Permanence in 3.5- and 4.5-Month-Old Infants.”</span> <em>Developmental Psychology</em> 23 (5): 655–64. <a href="https://doi.org/10.1037/0012-1649.23.5.655">https://doi.org/10.1037/0012-1649.23.5.655</a>.
</div>
<div id="ref-balestrieroLeJEPAProvableScalable2025" class="csl-entry">
Balestriero, Randall, and Yann LeCun. 2025. <em><span>LeJEPA</span>: <span>Provable</span> and <span>Scalable Self-Supervised Learning Without</span> the <span>Heuristics</span></em>. arXiv:2511.08544. arXiv. <a href="https://doi.org/10.48550/arXiv.2511.08544">https://doi.org/10.48550/arXiv.2511.08544</a>.
</div>
<div id="ref-chenPlanningReasoningUsing2025" class="csl-entry">
<span class="nocase">Chen, Delong, Theo Moutakanni, Willy Chung, et al.</span> 2025. <em>Planning with <span>Reasoning</span> Using <span>Vision Language World Model</span></em>. arXiv:2509.02722. arXiv. <a href="https://doi.org/10.48550/arXiv.2509.02722">https://doi.org/10.48550/arXiv.2509.02722</a>.
</div>
<div id="ref-chenVLJEPAJointEmbedding2025" class="csl-entry">
<span class="nocase">Chen, Delong, Mustafa Shukor, Theo Moutakanni, et al.</span> 2025. <em><span>VL-JEPA</span>: <span>Joint Embedding Predictive Architecture</span> for <span class="nocase">Vision-language</span></em>. arXiv:2512.10942. arXiv. <a href="https://doi.org/10.48550/arXiv.2512.10942">https://doi.org/10.48550/arXiv.2512.10942</a>.
</div>
<div id="ref-clarkWhateverNext2013" class="csl-entry">
Clark, Andy. 2013. <span>“Whatever Next? <span>Predictive</span> Brains, Situated Agents, and the Future of Cognitive Science.”</span> <em>Behavioral and Brain Sciences</em> 36 (3): 181–204. <a href="https://doi.org/10.1017/S0140525X12000477">https://doi.org/10.1017/S0140525X12000477</a>.
</div>
<div id="ref-haWorldModels2018" class="csl-entry">
Ha, David, and Jürgen Schmidhuber. 2018. <span>“World <span>Models</span>.”</span> March 28. <a href="https://doi.org/10.5281/zenodo.1207631">https://doi.org/10.5281/zenodo.1207631</a>.
</div>
<div id="ref-hafnerMasteringAtariDiscrete2021" class="csl-entry">
Hafner, Danijar, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. 2021. <span>“Mastering <span>Atari</span> with <span>Discrete World Models</span>.”</span> <em>International Conference on Learning Representations (ICLR)</em>. <a href="https://doi.org/10.48550/arXiv.2010.02193">https://doi.org/10.48550/arXiv.2010.02193</a>.
</div>
<div id="ref-huangSemanticTubePrediction2026" class="csl-entry">
Huang, Hai, Yann LeCun, and Randall Balestriero. 2026. <em>Semantic <span>Tube Prediction</span>: <span>Beating LLM Data Efficiency</span> with <span>JEPA</span></em>. arXiv:2602.22617. arXiv. <a href="https://doi.org/10.48550/arXiv.2602.22617">https://doi.org/10.48550/arXiv.2602.22617</a>.
</div>
<div id="ref-kochHowMuchEye2006" class="csl-entry">
Koch, Kristin, Judith McLean, Ronen Segev, et al. 2006. <span>“How <span>Much</span> the <span>Eye Tells</span> the <span>Brain</span>.”</span> <em>Current Biology</em> 16 (14): 1428–34. <a href="https://doi.org/10.1016/j.cub.2006.05.056">https://doi.org/10.1016/j.cub.2006.05.056</a>.
</div>
<div id="ref-maesLeWorldModelStableEndtoEnd2026" class="csl-entry">
<span class="nocase">Maes, Lucas, Quentin Le Lidec, Damien Scieur, et al.</span> 2026. <em><span>LeWorldModel</span>: <span class="nocase">Stable End-to-End Joint-Embedding Predictive Architecture</span> from <span>Pixels</span></em>. arXiv:2603.19312. arXiv. <a href="https://doi.org/10.48550/arXiv.2603.19312">https://doi.org/10.48550/arXiv.2603.19312</a>.
</div>
<div id="ref-schmidhuberMakingWorldDifferentiable" class="csl-entry">
Schmidhuber, Jürgen. 1990. <em>Making the <span>World Differentiable</span>: <span>On Using Self-Supervised Fully Recurrent Neural Networks</span> for <span>Dynamic Reinforcement Learning</span> and <span>Planning</span> in <span>Non-Stationary Environments</span></em>. FKI-126-90. TUM.
</div>
<div id="ref-spelkePrinciplesObjectPerception1990" class="csl-entry">
Spelke, Elizabeth S. 1990. <span>“Principles of <span>Object Perception</span>.”</span> <em>Cognitive Science</em> 14 (1): 29–56. <a href="https://doi.org/10.1207/s15516709cog1401_3">https://doi.org/10.1207/s15516709cog1401_3</a>.
</div>
</div></section></div> ]]></description>
  <category>world models</category>
  <category>JEPA</category>
  <category>autonomous agents</category>
  <category>sample efficiency</category>
  <category>AI alignment</category>
  <guid>https://drmike.xyz/posts/why-world-models-with-jepa/</guid>
  <pubDate>Wed, 01 Jul 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>Building a JEPA world model from scratch in Julia</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>A few months ago I wrote a piece trying to explain World Models <span class="citation" data-cites="schmidhuberMakingWorldDifferentiable haWorldModels2018">(Schmidhuber 1990; Ha and Schmidhuber 2018)</span> and the Joint Embedding Predictive Architecture (JEPA) <span class="citation" data-cites="assranSelfSupervisedLearningImages2023">(<span class="nocase">Assran et al.</span> 2023)</span>. I didn’t provide any code or results in that post. I mainly spoke about the theoretical aspects of world models and how I believe they are a good bet for our next leap in AI.</p>
<p>This time, I want to show you how to build the smallest possible thing that still deserved the name “JEPA world model”. Kind of a toy problem, where I could check whether the latent space was doing what it’s supposed to.</p>
<p>It’s a tutorial that you can follow along with. I’m going to walk you through what a JEPA actually is, in code, in Julia, on a bouncing ball. We’ll peek inside the latent space to see if it learned physics.</p>
<p>If you want the conceptual background first, go read my <a href="https://www.linkedin.com/feed/update/urn:li:activity:7447191554013769728/">LinkedIn post on LeWM</a> and come back. If you want to skip the prose and look at the code, it starts in the next section, and every snippet below was run end-to-end, on Julia 1.12 with Flux 0.16, to produce the loss curve and the latent plots you’ll see further down.</p>
<p>Before jumping in to code I want you to have a conceptual picture in mind outlining what JEPA does. I’ve drawn a diagram in Figure&nbsp;1. <img src="https://latex.codecogs.com/png.latex?X(t)"> is the input at time <img src="https://latex.codecogs.com/png.latex?t">, <img src="https://latex.codecogs.com/png.latex?Z(t)"> is the latent space at the same time and <code>Encoder</code> is the neural network mapping the input <img src="https://latex.codecogs.com/png.latex?X"> to latent <img src="https://latex.codecogs.com/png.latex?Z">. <code>Predictor</code> is another neural network taking an action <img src="https://latex.codecogs.com/png.latex?A(t)"> and an embedding <img src="https://latex.codecogs.com/png.latex?Z(t)"> and outputs a future latent state represented by the embedding <img src="https://latex.codecogs.com/png.latex?%5Cbar%7BZ%7D(t+1)">. The <code>JEPA loss</code> then compares the “true” latent state <img src="https://latex.codecogs.com/png.latex?Z(t+1)"> with the predicted <img src="https://latex.codecogs.com/png.latex?%5Cbar%7BZ%7D(t+1)">. Note that the encoder here is the same.</p>
<div id="fig-jepaarch" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-jepaarch-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/jepa.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-jepaarch-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Illustration of the JEPA architecture we’ll be using.
</figcaption>
</figure>
</div>
</section>
<section id="what-we-are-actually-building" class="level2">
<h2 class="anchored" data-anchor-id="what-we-are-actually-building">What we are actually building</h2>
<p>We’re going to build a ball bouncing in a 1D box, but it could be a pendulum, a cartpole, a video frame stream, the trajectory of a customer churn funnel. The point is, there’s an underlying state (position, velocity) and we only get to see observations of it (the noisy y-coordinate, a pixel, a feature vector).</p>
<p>A “world model” is a system that, given some observations, builds an internal representation of the state and can predict what will happen next. That’s it. That’s the whole ambition. JEPA is a bet on how to build one without falling into the generative-modelling trap (where the model is paid to predict every pixel of the next frame, including the irrelevant ones, and ends up spending all its capacity on texture and noise).</p>
<p>The trick of JEPA is the energy. You don’t try to reconstruct the next observation. You try to make the <em>embedding</em> of the next observation predictable from the embedding of the current one. The loss is embedding-wise rather than pixel-wise, and the model is free to throw away information that doesn’t help prediction.</p>
<p>For a quick note on Energy based models. They’re a super simple way to create a compatability score (Energy) between input output pairs which we typically denote <img src="https://latex.codecogs.com/png.latex?E(x,%20y)">. We can express this probabilistically as</p>
<p><img src="https://latex.codecogs.com/png.latex?p(y%7Cx)=%5Cfrac%7Be%5E%7B-E(x,y)%7D%7D%7BZ(x)%7D"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?Z(x)"> is the partition function that normalizes the probability.</p>
</section>
<section id="the-architecture-in-two-pieces" class="level2">
<h2 class="anchored" data-anchor-id="the-architecture-in-two-pieces">The architecture, in two pieces</h2>
<p>Two modules. Both are just MLPs because I want the focus to be on the training objective, not on attention or convolutions. In a serious world model you’d use a backbone appropriate to your data. For a bouncing ball, an MLP is plenty.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">struct</span> JEPA{M, P}</span>
<span id="cb1-2">    encoder<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">M     </span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># observation -&gt; latent</span></span>
<span id="cb1-3">    predictor<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">P   </span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (latent, action) -&gt; predicted latent</span></span>
<span id="cb1-4"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-5"></span>
<span id="cb1-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encode</span>(model, x)</span>
<span id="cb1-7">    model.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encoder</span>(x)</span>
<span id="cb1-8"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-9"></span>
<span id="cb1-10"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(model, z, a)</span>
<span id="cb1-11">    model.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predictor</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vcat</span>(z, a))</span>
<span id="cb1-12"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb1-13"></span>
<span id="cb1-14"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">jepa_loss</span>(model, x_t, a_t, x_tp1)</span>
<span id="cb1-15">    z_t          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encode</span>(model, x_t)</span>
<span id="cb1-16">    z_tp1_pred   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(model, z_t, a_t)</span>
<span id="cb1-17">    z_tp1_target <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encode</span>(model, x_tp1)</span>
<span id="cb1-18">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>((z_tp1_pred <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.-</span> z_tp1_target) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb1-19"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>Notice that we’re not leveraging a lot of tricks here. No stop-gradient, no detach, no second “target network” trailing the first by a moving average. The target is the live encoder run on the next observation, gradients flowing through it and everything. By the usual story that should collapse instantly: the cheapest way to make <code>z_tp1_pred</code> match <code>z_tp1_target</code> is for the encoder to map every input to the same constant and call it a day. The thing that stops that from happening is the regulariser in the next section, and getting away with <em>only</em> that, no stop-gradient and no EMA, is the whole bet of the LeJEPA <span class="citation" data-cites="balestrieroLeJEPAProvableScalable2025">(Balestriero and LeCun 2025)</span> and LeWM <span class="citation" data-cites="maesLeWorldModelStableEndtoEnd2026">(<span class="nocase">Maes et al.</span> 2026)</span> line of work.</p>
<p>Two things worth naming here. The world-model I’m building is closest in spirit to <strong>LeWorldModel (LeWM)</strong>, the recent Maes and Balestriero line that trains a JEPA straight from pixels with exactly two loss terms: a next-embedding prediction loss and a regulariser. That regulariser is <strong>SIGReg</strong>, introduced in the <strong>LeJEPA</strong> paper, where the argument is that an isotropic Gaussian is the <em>unique</em> collapse-proof target distribution for a representation like this. If you read one paper, read LeJEPA. If you want to see it scaled to a real world model from pixels, read LeWM. What I’ve got is a tiny cousin of both, in Julia, on a bouncing ball.</p>
<p>The other thing is what I deliberately left out. Everyone’s recipe for “stop the encoder from collapsing” is normally some flavour of teacher-student asymmetry: SimSiam stops the gradient into the target, BYOL and DINO keep a separate target network trailing the online one by a moving average. LeJEPA’s claim, the one I actually wanted to test, is that with a strong enough regulariser you need none of that. So I’m not using any of it. No stop-gradient, no EMA, one network doing both sides of the loss. If the latent stays healthy, SIGReg is the only thing holding it up.</p>
<p>The <code>a_t</code> argument is the action. For our bouncing ball, that’s “is the ball at the top of its arc moving up or down” encoded as a small vector. In a real RL setup the action would be a motor command. In a passive video setup you’d use positional encoding of the timestep instead, because there is no action. We’re going to be on the action side, because it makes the architecture more direct.</p>
<p>There is no decoder. That’s the whole point of the JEPA framing. We are not trying to reconstruct the observation. We are not trying to generate. We are only trying to predict the next embedding.</p>
</section>
<section id="the-regularizer-that-does-the-heavy-lifting" class="level2">
<h2 class="anchored" data-anchor-id="the-regularizer-that-does-the-heavy-lifting">The regularizer that does the heavy lifting</h2>
<p>If you train the network above, it will work. It will collapse a little. The latent space will start filling with junk dimensions and the model will use them as a private scratch pad to memorise trajectories.</p>
<p>This is where SIGReg comes to the rescue. SIGReg stands for <strong>Sketched Isotropic Gaussian Regularization</strong>, and it comes out of the LeJEPA line of work <span class="citation" data-cites="assranVJEPA2SelfSupervised2025 balestrieroLeJEPAProvableScalable2025">(<span class="nocase">Assran et al.</span> 2025; Balestriero and LeCun 2025)</span>. The idea is beautifully simple. A good latent space for a world model is one where the distribution of embeddings, taken over a batch, is close to an isotropic Gaussian. Same variance in every direction, no covariance between directions. Why? Because an isotropic Gaussian is the maximum-entropy distribution under a fixed second moment, so it’s the one that throws away the least information while staying collapse-resistant. A JEPA trained with a SIGReg penalty is being asked to learn a representation whose batch statistics are as “spread out” as possible without privileging any axis.</p>
<p>The “sketched” part is how you check that cheaply. Measuring the full distribution of a 16-dimensional latent every step is hopeless, so SIGReg picks a few hundred random directions, projects the batch onto each, and asks a one-dimensional question instead: does this projection look like a standard normal? If every random 1D shadow of the cloud is <code>N(0, 1)</code>, the cloud itself is an isotropic Gaussian. The clever part is <em>how</em> it tests a projection. Instead of just checking the variance, it compares the projection’s empirical characteristic function (the average of <code>cos(t·x)</code> and <code>sin(t·x)</code> over the batch, at a handful of frequencies <code>t</code>) against the characteristic function of a standard normal, <code>exp(-t²/2)</code>. That’s the Epps-Pulley Gaussianity test, and it catches the mean, the variance, and the shape all at once. The penalty looks like this:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> KNOTS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">collect</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">range</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0f0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3f0</span>, length<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>))   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># frequencies to test the CF at</span></span>
<span id="cb2-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> PHI   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">exp</span>.(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>KNOTS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">./</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)                <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># standard-normal characteristic fn</span></span>
<span id="cb2-3"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">const</span> SW    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simpson_weights</span>(KNOTS)                <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># quadrature weights on [0, 3]</span></span>
<span id="cb2-4"></span>
<span id="cb2-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sigreg</span>(z; n_proj<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">256</span>)</span>
<span id="cb2-6">    D, B <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(z)                                  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># z: (latent, batch)</span></span>
<span id="cb2-7">    A <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, D, n_proj)</span>
<span id="cb2-8">    A <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> A <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">./</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>.(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(A <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb2-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># compute the epps-pulley statistic (Here be dragons...)</span></span>
<span id="cb2-10">    x  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> A<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> z                                     <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># (n_proj, batch)</span></span>
<span id="cb2-11">    xt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">reshape</span>(x, n_proj, B, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">reshape</span>(KNOTS, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>)</span>
<span id="cb2-12">    re <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dropdims</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cos</span>.(xt), dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb2-13">    <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">im</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dropdims</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sin</span>.(xt), dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb2-14">    err <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (re <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">reshape</span>(PHI, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">im</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb2-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(err <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> SW)</span>
<span id="cb2-16"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>Why this is enough to replace the stop-gradient: think about what the trivial collapse actually looks like. If the encoder maps every input to the same point, every projection becomes a spike at one value, and the characteristic function of a spike is a flat line at one, nothing like the <code>exp(-t²/2)</code> bell. SIGReg sees that immediately and slams it. The imaginary (<code>sin</code>) part pins the mean to zero, the real part pins the variance and the shape. There’s no comfortable degenerate solution left for the prediction loss to run to, so the encoder has to actually spread out and stay spread out. That’s the LeJEPA result in one sentence: a strong enough distributional regulariser does the job the stop-gradient was hacking around.</p>
<p>It comes with exactly one knob, the weight on the SIGReg term:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1">loss <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pred_loss <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> λ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sigreg</span>(z_t)     <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># λ = 1 throughout. that's the whole schedule.</span></span></code></pre></div></div>
<p>I set <code>λ = 1</code> and never touched it. No warmup, no decay, no per-layer tuning. That’s the part the LeWM abstract is quietly proud of: it takes a method that used to carry six loss-balancing hyperparameters down to one.</p>
</section>
<section id="bouncing-ball-in-200-lines" class="level2">
<h2 class="anchored" data-anchor-id="bouncing-ball-in-200-lines">Bouncing ball, in 200 lines</h2>
<p>We are generating the trajectories of a ball under constant gravity, bouncing off a floor at <code>x=0</code> and keeping a fraction <code>e</code> of its speed each bounce.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simulate_ball</span>(; n_steps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, dt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9.81</span>, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>, v0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5.0</span>, <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">e</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>)</span>
<span id="cb4-2">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(n_steps); v <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(n_steps)</span>
<span id="cb4-3">    x[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], v[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x0, v0</span>
<span id="cb4-4">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> t <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>n_steps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb4-5">        xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x[t] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> v[t]<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb4-6">        vn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v[t] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>dt</span>
<span id="cb4-7">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> </span>
<span id="cb4-8">            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># solve x[t] + v[t]·τ − ½g·τ² = 0 for the crossing time τ ∈ (0, dt]</span></span>
<span id="cb4-9">            a <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>g; b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v[t]; c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x[t]</span>
<span id="cb4-10">            sq <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">max</span>(b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>a<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>c, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>))</span>
<span id="cb4-11">            τ  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">minimum</span>(t_ <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> t_ <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> ((<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>sq)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>a), (<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>sq)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>a)) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> t_ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-12</span>)</span>
<span id="cb4-12">            v_impact <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v[t] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>τ                   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># velocity at contact (downward)</span></span>
<span id="cb4-13">            v_after  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">e</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> v_impact                <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># we need to lose a bit of speed</span></span>
<span id="cb4-14">            rem <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> dt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> τ                            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># finish the step from the floor</span></span>
<span id="cb4-15">            xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v_after<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>rem <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>rem<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb4-16">            vn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> v_after <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> g<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>rem</span>
<span id="cb4-17">            <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>; xn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>; vn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">e*abs</span>(vn); <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-18">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-19">        x[t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> xn; v[t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> vn</span>
<span id="cb4-20">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-21">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> x, v</span>
<span id="cb4-22"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>I actually had a funny bug in this simulation in the beginning where the ball magically received extra energy after bouncing. But yeah, the code above should be good to go.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">CairoMakie</span></span>
<span id="cb5-2"></span>
<span id="cb5-3">dt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span></span>
<span id="cb5-4">x, v <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simulate_ball</span>(; n_steps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">550</span>, dt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>dt, v0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5.0</span>)</span>
<span id="cb5-5">ts <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(x)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> dt</span>
<span id="cb5-6">xmax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">maximum</span>(x)</span>
<span id="cb5-7"></span>
<span id="cb5-8">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Figure</span>(size <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">820</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">380</span>))</span>
<span id="cb5-9">axb <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Axis</span>(fig[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Bouncing ball"</span>, ylabel <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"height x"</span>, limits <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ((<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), (<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, xmax)))</span>
<span id="cb5-10"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">hidexdecorations!</span>(axb)</span>
<span id="cb5-11"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lines!</span>(axb, [<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], [<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>], color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>black, linewidth <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)         <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># the floor</span></span>
<span id="cb5-12">ball <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Observable</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Point2f</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, x[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]))</span>
<span id="cb5-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scatter!</span>(axb, ball, markersize <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">28</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>crimson)</span>
<span id="cb5-14"></span>
<span id="cb5-15">axt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Axis</span>(fig[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Height vs time"</span>, xlabel <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"time (s)"</span>, ylabel <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"height x"</span>,</span>
<span id="cb5-16">           limits <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ((<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, ts[<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span>]), (<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, xmax)))</span>
<span id="cb5-17">trace <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Observable</span>(Point2f[(ts[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], x[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])])</span>
<span id="cb5-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lines!</span>(axt, trace, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>crimson, linewidth <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb5-19"></span>
<span id="cb5-20"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">record</span>(fig, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"figs/bounce.gif"</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(x); framerate <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">60</span>) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> i</span>
<span id="cb5-21">    ball[]  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Point2f</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, x[i])</span>
<span id="cb5-22">    trace[] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Point2f</span>.(ts[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>i], x[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>i])</span>
<span id="cb5-23"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/bounce.light.gif" alt="A ball bouncing under gravity. Left: the ball in its 1D column, bouncing off the floor at x=0. Right: the same height traced against time: clean parabolic arcs, each bounce peak a bit lower than the last from the 0.9 energy-loss factor."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/bounce.dark.gif" alt="A ball bouncing under gravity. Left: the ball in its 1D column, bouncing off the floor at x=0. Right: the same height traced against time: clean parabolic arcs, each bounce peak a bit lower than the last from the 0.9 energy-loss factor.">
<figcaption class="figure-caption">
A ball bouncing under gravity. Left: the ball in its 1D column, bouncing off the floor at x=0. Right: the same height traced against time: clean parabolic arcs, each bounce peak a bit lower than the last from the 0.9 energy-loss factor.
</figcaption>
</figure>
<p>Each arc is a parabola, each bounce peak is <code>0.9×</code> the energy of the one before, and nothing ever goes below the floor. That’s the world the JEPA has to figure out, except it never sees <code>x</code> and <code>v</code>; it sees only the noisy height. Don’t mind the speed here.. I know it’s like it’s bouncing on the moon but it really doesn’t matter for our case here.</p>
<p>The observation is <code>x</code> corrupted with Gaussian noise. The latent we’d <em>like</em> to recover is the true state <code>(x, v)</code>. The model never sees <code>(x, v)</code> directly, and here is a subtlety that turns out to matter enormously, so I’ll flag it now and pay it off later: <strong>a single height tells you nothing about velocity.</strong> The ball passes through any given height twice, once going up, once coming down, at opposite-sign velocities, and different throws pass the same height at different speeds. So if the encoder’s input is one frame, velocity is simply not a function of that input. It is unrecoverable in principle, not just in practice.</p>
<p>The standard approach here is to give the encoder a short <strong>stack of recent frames</strong> instead of one. From a window of consecutive heights you <em>can</em> infer velocity (it’s roughly the finite difference). So the observation I feed the encoder is the last <code>K=4</code> noisy heights; the action is the sign of the velocity, <code>sign(v[t])</code>, handed to the predictor; and the true <code>(x, v)</code> is kept aside, never fed in, purely to probe the latent afterwards.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb6-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sample_batch</span>(batch; n_steps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>)</span>
<span id="cb6-2">    obs   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, batch, n_steps)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># noisy heights (what the encoder sees, windowed below)</span></span>
<span id="cb6-3">    xtrue <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, batch, n_steps)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># clean position (probe only)</span></span>
<span id="cb6-4">    vtrue <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, batch, n_steps)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># true velocity  (probe only)</span></span>
<span id="cb6-5">    acts  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, batch, n_steps)   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># action = sign(v)</span></span>
<span id="cb6-6">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> b <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>batch</span>
<span id="cb6-7">        v0   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rand</span>()            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># random launch speed</span></span>
<span id="cb6-8">        x, v <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simulate_ball</span>(; n_steps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_steps, v0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>v0)</span>
<span id="cb6-9">        obs[b, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>]   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(x) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05f0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randn</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, n_steps)</span>
<span id="cb6-10">        xtrue[b, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(x)</span>
<span id="cb6-11">        vtrue[b, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(v)</span>
<span id="cb6-12">        acts[b, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>]  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sign</span>.(v))</span>
<span id="cb6-13">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb6-14">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> obs, xtrue, vtrue, acts</span>
<span id="cb6-15"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span></code></pre></div></div>
<p>The training loop (next section) slides a length-<code>K</code> window over each trajectory to build the inputs. The observation at time <code>t</code> is <code>obs[b, t-K+1:t]</code>, and the prediction target is the window one step later. The latent is 16-dimensional, not because the state needs 16 numbers (it needs two), but because I learned the hard way not to bottleneck it; more on that when we probe. If the world model is doing its job, those 16 dimensions should between them lay out the full <code>(position, velocity)</code> state, even though the model is never told those two things exist.</p>
</section>
<section id="the-training-loop" class="level2">
<h2 class="anchored" data-anchor-id="the-training-loop">The training loop</h2>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Flux</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Statistics</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Random</span>, <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">LinearAlgebra</span></span>
<span id="cb7-2"></span>
<span id="cb7-3"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">train_jepa</span>(; n_epochs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>, n_traj<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, batch<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">256</span>, latent<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, lr<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-3</span>, K<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, λ<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1f0</span>)</span>
<span id="cb7-4">    encoder   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(K, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, relu), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, latent))   <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># input = K-frame window</span></span>
<span id="cb7-5">    predictor <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(latent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, relu), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, latent))</span>
<span id="cb7-6"></span>
<span id="cb7-7">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Pool every (window_t, action, window_{t+1}) transition once, then shuffle.</span></span>
<span id="cb7-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># The K-frame window is what makes velocity observable; the pool-and-shuffle is</span></span>
<span id="cb7-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># just ordinary SGD, and it matters because looping over timesteps in trajectory</span></span>
<span id="cb7-10">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># order marches every ball through the arc in lockstep, and those correlated</span></span>
<span id="cb7-11">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># gradients make training thrash.</span></span>
<span id="cb7-12">    obs, xtrue, vtrue, actions <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sample_batch</span>(n_traj)</span>
<span id="cb7-13">    B, T <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(obs)</span>
<span id="cb7-14">    nwin <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> B <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (T <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> K)</span>
<span id="cb7-15">    W_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, K, nwin); W_tp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, K, nwin); A_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">zeros</span>(<span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, nwin)</span>
<span id="cb7-16">    i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb7-17">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> b <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>B, t <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> K<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>(T<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb7-18">        i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb7-19">        <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">@views</span> W_t[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,  i] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> obs[b, t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>K<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>t]      <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># window ending at t</span></span>
<span id="cb7-20">        <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">@views</span> W_tp1[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, i] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.=</span> obs[b, t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>K<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># window ending at t+1</span></span>
<span id="cb7-21">        A_t[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, i] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> actions[b, t]</span>
<span id="cb7-22">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb7-23">    N <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> nwin</span>
<span id="cb7-24"></span>
<span id="cb7-25">    model     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (; encoder, predictor)          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># everything we optimise</span></span>
<span id="cb7-26">    opt_state <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">setup</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Adam</span>(lr), model)</span>
<span id="cb7-27"></span>
<span id="cb7-28">    losses <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">Float32</span>[]</span>
<span id="cb7-29">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> epoch <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>n_epochs</span>
<span id="cb7-30">        order <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">randperm</span>(N)                     <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fresh shuffle each epoch</span></span>
<span id="cb7-31">        epoch_loss <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0f0</span>; nbatches <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb7-32">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> s <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>batch<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>N<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>batch</span>
<span id="cb7-33">            cols  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> order[s<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>s<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>batch<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb7-34">            w_t   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> W_t[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,  cols]</span>
<span id="cb7-35">            a_t   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> A_t[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,  cols]</span>
<span id="cb7-36">            w_tp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> W_tp1[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>, cols]</span>
<span id="cb7-37">            loss, grads <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">withgradient</span>(model) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> m</span>
<span id="cb7-38">                z_t    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> m.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encoder</span>(w_t)</span>
<span id="cb7-39">                z_pred <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> m.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predictor</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vcat</span>(z_t, a_t))</span>
<span id="cb7-40">                z_tgt  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> m.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">encoder</span>(w_tp1)        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># same encoder, gradients flow. no stop-grad, no EMA.</span></span>
<span id="cb7-41">                pred   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>((z_pred <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.-</span> z_tgt) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.^</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb7-42">                pred <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> λ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sigreg</span>(z_t)           <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># SIGReg keeps z_t from collapsing</span></span>
<span id="cb7-43">            <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb7-44">            Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update!</span>(opt_state, model, grads[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span>
<span id="cb7-45">            epoch_loss <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+=</span> loss; nbatches <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb7-46">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb7-47"></span>
<span id="cb7-48">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">push!</span>(losses, epoch_loss <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> nbatches)</span>
<span id="cb7-49">        epoch <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;&amp;</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">@info</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"epoch=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>epoch<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> loss=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>(losses[<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span>])<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb7-50">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb7-51"></span>
<span id="cb7-52">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> model.encoder, model.predictor, losses</span>
<span id="cb7-53"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb7-54"></span>
<span id="cb7-55"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># the figures below come from exactly this seed</span></span>
<span id="cb7-56"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Random;</span> Random.seed!(1)</span>
<span id="cb7-57">encoder, predictor, losses <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">train_jepa</span>()</span></code></pre></div></div>
<p>One important point is where SIGReg should live. I started by regularising the predictions and letting the loss sort out the encoder. Bad idea. The encoder happily flattened one of its latent dimensions to near-zero variance and used it as a dead axis, and the prediction loss never complained, because the predictor just learned to route around it. Move SIGReg onto the encoder output <code>z_t</code>, the thing you actually probe later, and the collapse goes away.</p>
<p>Another thing about this is how to batch the trajectories. Doing one timestep at a time, every ball at <code>t=1</code>, then every ball at <code>t=2</code>, and so on seems natural, but actually won’t work well. Every gradient step sees a batch of balls at the same phase of their arc, the updates are wildly correlated, and the loss thrashes. One way to deal with this is the pool-and-shuffle in the loop above. Here is the loss across eight random seeds:</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/loss_curve.light.png" alt="Training loss across eight random seeds, 4-frame encoder, 16-d latent, full SIGReg, no stop-gradient and no EMA. All eight drop fast and sit on top of each other in a tight band around 0.2 to 0.3, and every seed recovers the same state."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/loss_curve.dark.png" alt="Training loss across eight random seeds, 4-frame encoder, 16-d latent, full SIGReg, no stop-gradient and no EMA. All eight drop fast and sit on top of each other in a tight band around 0.2 to 0.3, and every seed recovers the same state.">
<figcaption class="figure-caption">
Training loss across eight random seeds, 4-frame encoder, 16-d latent, full SIGReg, no stop-gradient and no EMA. All eight drop fast and sit on top of each other in a tight band around 0.2 to 0.3, and every seed recovers the same state.
</figcaption>
</figure>
<p>Eight seeds, no stop-gradient, no EMA, one fixed regulariser weight, and the curves are almost indistinguishable. They drop hard for a few epochs, then settle onto the same floor and stay. What makes them land on the same <em>representation</em>, not just the same loss, is giving the latent enough room. I started with a 2-dimensional latent (so I could scatter-plot it without PCA), and there the runs were all over the place, some encoding velocity and some not depending on the seed. Bump it to 16 dimensions, overkill for a state that needs two, and the seed-dependence vanishes: every run recovers position <em>and</em> velocity to within a few percent of the others. I pin seed 1 for the probe figures below, but the pin barely matters here. They all tell the same story.</p>
</section>
<section id="peeking-inside-the-latents" class="level2">
<h2 class="anchored" data-anchor-id="peeking-inside-the-latents">Peeking inside the latents</h2>
<p>First, a yardstick, because otherwise none of the R² numbers below mean anything. The task is <em>easy</em>: from a window of recent heights, position is just the last frame and velocity is roughly the finite difference, both linear functions of the input. A plain supervised linear probe on the raw 4-frame window confirms it, scoring <strong>R² 0.99 for position and 0.59 for velocity</strong> (velocity caps below 1 only because the 0.05 noise on each frame swamps a one-step difference). So the bar for the self-supervised latent isn’t “can it represent the state in principle” (of course it can). It’s “does a representation trained <em>only</em> to predict its own next embedding recover the state as well as a supervised readout of the raw input?” Hold that 0.99 / 0.59 in mind.</p>
<p>My first version fed the encoder a <em>single</em> frame, one noisy height. I trained it, ran the probe, and got a result that looked deep. Projected onto its top two principal components and coloured by true position, the latent traced a smooth monotonic curve: position cleanly laid out, a linear probe recovering it at R² ≈ 0.99. The same points coloured by velocity were a scrambled mess: a velocity probe scored R² ≈ 0.00, nothing.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/latent_1frame.light.png" alt="Single-frame encoder (16-d latent, shown via its top 2 PCs). Left: coloured by position, a clean 1D curve. Right: same points coloured by velocity, completely scrambled. Velocity is nowhere in the latent."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/latent_1frame.dark.png" alt="Single-frame encoder (16-d latent, shown via its top 2 PCs). Left: coloured by position, a clean 1D curve. Right: same points coloured by velocity, completely scrambled. Velocity is nowhere in the latent.">
<figcaption class="figure-caption">
Single-frame encoder (16-d latent, shown via its top 2 PCs). Left: coloured by position, a clean 1D curve. Right: same points coloured by velocity, completely scrambled. Velocity is nowhere in the latent.
</figcaption>
</figure>
<p>The ball passes every height twice, going up and going down, at opposite-sign velocities, and different throws cross the same height at different speeds. So velocity is not a function of one frame. No encoder, however clever or however many latent dimensions you give it, can extract it from an input that doesn’t contain it. The latent collapses to a curve (you can see it’s effectively rank-one, despite living in 16 dimensions) because the <em>input</em> is effectively one-dimensional.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>A single height cannot determine velocity.</p>
</div>
</div>
</div>
<p>The simple fix is to use the frame window from the data section. Feed the encoder the last four heights, from which velocity <em>is</em> recoverable. Same architecture, same loss, same everything; the only change is <code>Dense(1, …)</code> becomes <code>Dense(4, …)</code>. Now the probe tells a completely different story.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/latent_probe.light.png" alt="Four-frame encoder (16-d latent, top 2 PCs). The latent fills out into a 2D region. Left: coloured by position. Right: coloured by velocity. The two gradients run in roughly different directions: the model has laid out the full state."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/latent_probe.dark.png" alt="Four-frame encoder (16-d latent, top 2 PCs). The latent fills out into a 2D region. Left: coloured by position. Right: coloured by velocity. The two gradients run in roughly different directions: the model has laid out the full state.">
<figcaption class="figure-caption">
Four-frame encoder (16-d latent, top 2 PCs). The latent fills out into a 2D region. Left: coloured by position. Right: coloured by velocity. The two gradients run in roughly different directions: the model has laid out the full state.
</figcaption>
</figure>
<p>The latent is no longer a curve: it’s a genuinely two-dimensional cloud, and the two colour fields run in roughly perpendicular directions across it: position varies one way, velocity the other. Now hold it up against the yardstick. Position reads out at <strong>R² ≈ 0.99</strong>, matching the supervised linear probe. Velocity, which was flat-zero in our first attempt, comes back at <strong>R² ≈ 0.6</strong>, right around the noisy linear ceiling of 0.59. A representation trained with no labels at all, no stop-gradient, no EMA, only next-embedding prediction against a distributional regulariser, reconstructs the full <code>(position, velocity)</code> state about as well as a supervised readout of the raw input. And it’s steady across seeds. Every one lands at position ≈ 0.99 and velocity in the high 0.5s to high 0.6s.</p>
<p>Those panels are a flat projection, though, and the cloud has more than two dimensions worth of structure. Here’s the same latent in its top three principal components, live.</p>
<div id="lat3d" style="width:100%;max-width:980px;height:520px;margin:auto;"></div>
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8"></script>
<script>
(function(){
  const pc1=[-0.185,-4.612,-8.929,-12.965,-16.33,-18.854,-21.322,-23.896,-25.65,-27.234,-28.521,-28.94,-28.926,-29.4,-30.116,-29.388,-27.65,-26.177,-24.934,-23.273,-20.756,-17.584,-14.044,-10.437,-6.309,-2.174,1.028,0.748,-2.589,-6.439,-10.164,-13.17,-16.399,-18.58,-20.114,-21.965,-23.275,-23.237,-23.114,-23.501,-23.138,-21.709,-20.707,-19.757,-17.475,-15.258,-12.837,-10.049,-7.406,-3.413,0.017,-0.053,-1.685,-4.213,-7.607,-10.29,-11.857,-13.375,-15.429,-17.152,-17.905,-18.136,-17.729,-17.56,-17.361,-15.64,-14.387,-13.272,-10.745,-8.055,-5.464,-2.034,0.905,1.287,-1.133,-4.154,-6.748,-8.548,-9.869,-11.846,-13.888,-14.406,-13.861,-13.917,-13.114,-11.963,-11.13,-10.05,-8.271,-5.586,-3.092,-0.601,1.434,0.533,-2.457,-4.39,-5.901,-7.145,-8.369,-9.685,-10.468,-10.949,-10.911,-10.366,-9.335,-8.295,-6.379,-3.908,-1.811,0.024,0.843,-0.352,-1.723,-3.465,-5.249,-6.528,-7.557,-8.513,-8.731,-7.921,-6.8,-5.796,-4.76,-3.161,-1.591,0.594,2.113,1.868,-0.08,-2.299,-4.027,-5.625,-6.26,-5.988,-5.38,-4.784,-4.108,-3.421,-2.265,0.035,2.167,2.028,-0.248,-1.563,-2.272,-3.661,-4.572,-4.768,-4.758,-3.484,-1.798,-0.618,0.873,2.22,1.826,0.114,-0.522,-1.193,-1.948,-2.269,-2.369,-1.541,-0.435,0.429,1.725,2.651,2.168,0.481,-0.36,-0.29,-0.151,-0.341,-0.396,0.228,1.413,2.482,2.539,1.418,0.293,-0.514,-0.34,0.04,0.411,1.508,1.843,0.815,0.568,0.413,0.23,0.864,1.006,0.993,2.022,2.376,1.622,0.868,1.01,-2.082,-5.113,-8.146,-10.332,-11.702,-12.734,-14.491,-15.697,-15.775,-15.884,-15.843,-14.982,-13.174,-11.253,-9.311,-7.685,-5.553,-2.458,0.739,2.041,-0.258,-3.405,-5.515,-7.29,-8.631,-9.737,-10.9,-11.636,-11.827,-11.777,-10.982,-9.482,-8.139,-7.098,-5.572,-3.594,-0.823,2.162,1.636,-0.996,-3.481,-5.028,-6.742,-8.402,-9.024,-9.206,-9.192,-9.436,-8.933,-7.507,-4.912,-2.72,-0.675,1.688,2.047,0.266,-1.719,-2.884,-4.164,-5.534,-5.84,-5.86,-6.351,-6.029,-4.595,-3.723,-2.874,-0.329,2.629,2.376,0.145,-1.685,-3.3,-3.035,-3.258,-4.478,-4.679,-3.915,-3.685,-3.148,-1.009,1.295,2.25,1.332,-0.594,-1.783,-2.46,-3.034,-3.382,-2.586,-2.021,-1.969,-0.595,1.619,2.668,1.837,-0.176,-1.097,-1.098,-1.418,-1.33,-1.616,-1.426,0.544,1.932,1.975,1.689,1.178,0.423,0.116,0.059,-0.536,-0.725,0.463,2.092,2.612,1.532,0.315,0.424,0.118,0.065,1.505,2.388,2.291,2.259,2.086,1.388,-0.069,-0.31,0.834,2.515,7.113,2.742,1.134,0.455,0.558,1.554,2.618,2.723,2.67,2.271,2.248,2.6,2.339,2.518,2.716,2.699,2.613,1.971,1.825,2.51,4.086,3.428,2.476,2.644,3.62,4.656,5.473,4.848,6.585,10.316,9.344,3.504,2.592,2.77,3.813,4.546,4.34,5.96,7.019,2.97,2.315,2.759,5.002,3.086,5.476,9.754,8.415,5.713,4.766,2.824,4.665,9.655,9.222,4.848,6.634,7.258,4.634,3.087,7.036,7.308,5.638,9.334,13.502,13.83,1.334,-0.65,-1.924,-2.465,-3.216,-3.584,-2.893,-2.772,-2.603,-1.783,-0.446,1.104,2.746,2.507,0.814,-1.141,-2.674,-3.143,-2.852,-2.821,-2.232,-0.307,1.358,1.957,2.09,1.575,0.125,-1.672,-1.96,-0.847,-0.9,-1.44,-0.635,0.894,1.716,1.349,0.535,-0.096,-0.306,-0.081,-0.172,0.333,1.975,3.717,2.647,1.555,1.01,0.859,0.842,0.499,0.759,2.127,3.059,2.179,0.947,0.72,0.947,1.032,2.109,5.721,5.081,1.855,1.084,1.689,1.522,1.104,2.521,6.097,2.942,2.459,2.563,2.472,2.424,4.634,9.003,6.421,2.922,2.622,2.723,2.783,2.945,3.698,8.487,7.187,2.07,1.454,2.439,4.385,3.8,6.48,9.591,7.153,3.195,2.472,2.46,2.716,2.891,3.028,6.618,10.273,10.444,4.673,2.419,7.275,13.546,9.452,4.548,4.246,7.443,7.144,6.717,8.195,9.401,9.888,9.939,11.4,10.11,6.51,3.539,6.081,8.69,4.658,2.578,2.246,2.338,3.635,10.046,13.289,14.116,8.919,5.28,8.622,12.176,10.788,11.226,14.102,11.377,6.662,4.541,8.881,13.672,12.975,6.742,5.715,8.195,8.128,7.743,4.035,2.431,8.062,12.388,9.604,10.386,7.337,3.097,2.907,7.09,9.007,10.138,12.763,12.539,10.418,7.618,9.429,12.492,8.667,5.389,4.087,7.038,12.123,12.21,8.429,5.652,7.457,10.045,7.06,4.739,7.446,8.148,6.316,10.051,8.761,5.191,4.791,6.483,6.614,10.196,13.942,11.216,7.901,6.258,5.296,5.394,6.767,9.814,11.128,1.154,-2.726,-6.7,-9.901,-12.573,-14.802,-16.474,-18.244,-19.249,-20.051,-20.742,-20.654,-20.852,-20.611,-19.261,-18.237,-16.515,-14.231,-11.745,-8.711,-5.298,-2.085,0.722,1.608,-0.584,-4.093,-7.631,-10.129,-11.827,-13.656,-15.105,-15.74,-16.051,-16.339,-16.147,-15.326,-14.393,-13.644,-12.233,-10.103,-8.374,-6.027,-2.487,0.723,1.703,-0.346,-3.432,-6.376,-8.687,-9.942,-10.216,-11.14,-12.67,-13.102,-13.011,-12.491,-11.079,-10.215,-8.911,-6.422,-3.625,-1.221,0.612,0.798,-1.164,-3.439,-5.134,-6.784,-8.087,-8.573,-9.088,-9.968,-10.244,-9.495,-8.197,-6.742,-4.956,-3.199,-0.574,1.835,1.639,0.027,-2.244,-4.042,-5.41,-6.894,-7.548,-7.855,-7.348,-6.906,-6.237,-4.102,-2.135,-0.829,0.603,1.503,0.458,-1.474,-2.482,-3.034,-4.459,-4.884,-4.664,-5.092,-4.46,-3.269,-2.468,-1.052,1.049,1.507,0.267,-1.77,-2.993,-3.043,-3.452,-3.723,-3.557,-3.196,-1.941,-0.347,0.904,1.696,1.236,0.132,-0.746,-1.273,-1.844,-1.634,-1.318,-1.406,-0.399,1.927,4.148,2.081,0.868,-0.113,-0.84,-1.176,-1.196,-0.515,0.482,1.861,3.145,2.621,1.202,0.208,-0.252,-0.372,-0.135,0.714,1.787,2.322,2.175,1.592,0.735,-0.327,-0.356,0.645,1.695,2.609,2.61,1.126,0.582,1.116,1.283,1.891,2.587,2.271,2.199,2.533,2.222,1.785,1.878,2.981,4.948,2.512,2.582,2.903,2.552,4.241,8.002,8.054,6.729,5.698,3.328,2.414,2.33,2.543,2.522,5.761,6.565,2.563,2.671,4.095,4.693,2.313,1.672,-0.032,-2.096,-4.168,-5.173,-5.768,-6.267,-6.901,-7.019,-6.856,-5.676,-3.317,-1.071,0.816,2.452,2.01,-0.048,-1.414,-2.742,-3.722,-4.824,-5.234,-4.419,-3.391,-3.027,-1.989,-0.491,1.491,2.273,0.8,-0.781,-2.511,-3.203,-2.737,-2.721,-2.434,-1.579,-0.955,-0.113,1.747,2.872,1.386,-0.634,-1.411,-1.623,-1.826,-2.071,-1.789,-1.111,0.167,1.8,1.973,0.811,-0.207,-0.891,-1.011,-0.564,0.081,0.913,2.257,4.239,2.006,1.21,0.682,0.056,0.581,0.588,0.717,2.136,3.027,2.452,1.326,0.615,-0.079,-0.063,1.147,2.74,3.716,2.631,2.402,1.507,0.713,0.496,1.387,2.538,2.239,1.448,1.759,1.616,1.857,2.413,2.727,3.238,2.515,2.21,2.493,5.375,7.613,2.994,2.485,2.456,2.404,2.46,4.022,7.005,6.097,3.951,4.445,8.334,6.97,3.861,3.94,2.701,2.467,5.3,6.297,7.258,9.066,7.95,7.568,7.826,8.897,12.835,17.865,17.736,10.647,3.09,2.624,2.989,4.88,2.953,2.591,5.157,6.134,5.327,9.156,11.336,5.01,2.5,2.127,3.948,9.676,9.497,9.869,9.385,7.229,7.023,7.964,6.252,2.674,2.542,3.225,5.162,5.422,6.113,9.482,12.423,13.439,13.299,9.167,6.516,5.038,4.741,6.784,5.054,2.704,2.36,3.122,12.071,14.95,11.395,11.086,10.33,6.732,8.718,10.159,8.48,10.96,11.793,9.836,9.04,9.127,10.505,9.882,9.954,9.52,3.797,4.612,5.97,2.598,2.641,8.531,11.741,6.186,2.92,4.897,1.418,-0.193,-2.497,-4.974,-6.56,-7.29,-8.192,-8.51,-8.015,-7.307,-6.459,-4.929,-2.777,-0.675,0.872,2.437,1.827,-0.208,-2.103,-3.937,-4.835,-5.449,-5.533,-4.956,-4.509,-4.033,-2.197,-0.849,0.243,1.397,1.103,-0.046,-1.633,-3.01,-3.111,-3.26,-3.879,-3.909,-3.444,-1.866,0.162,1.805,2.439,1.407,-0.131,-1.358,-2.008,-3.096,-3.535,-2.963,-2.298,-0.428,1.576,2.193,1.914,1.089,0.065,-1.263,-0.764,-0.182,-0.729,-0.842,0.565,2.257,2.152,0.708,-0.332,-0.494,-0.611,-0.775,0.133,1.137,1.809,2.57,2.265,1.578,1.172,1.146,1.185,1.246,1.823,2.589,2.626,1.583,0.813,1.24,2.191,2.877,2.688,3.28,4.345,2.563,1.777,1.49,1.892,2.66,3.805,2.427,1.45,1.373,2.575,6.053,4.896,2.249,1.619,2.414,7.114,9.692,4.082,2.124,2.228,2.768,5.657,5.446,2.654,4.059,3.62,2.299,2.162,2.83,5.964,7.154,4.356,3.607,6.896,11.946,13.822,13.881,11.332,8.973,5.595,2.768,5.61,10.54,8.055,4.473,4.358,8.783,11.813,7.347,2.587,2.925,9.205,11.533,5.686,2.797,5.737,8.85,10.565,8.263,5.109,2.6,2.743,4.081,8.295,10.579,9.38,11.991,14.966,11.686,8.162,12.483,18.385,12.069,7.14,10.936,10.563,8.644,9.287,4.951,2.766,5.914,8.937,9.329,7.299,3.269,2.509,4.056,8.806,8.805,7.975,6.777,7.777,11.161,9.638,6.272,8.526,9.38,5.858,4.231,2.66,2.621,3.96,3.782,4.175,5.267,2.137,-0.869,-3.217,-4.28,-5.732,-7.653,-8.203,-8.359,-8.497,-7.511,-6.004,-5.273,-4.063,-1.944,0.675,2.327,1.197,-1.371,-2.438,-3.392,-5.274,-6.396,-6.261,-5.399,-4.988,-4.637,-3.047,-1.308,0.463,1.952,1.579,0.212,-1.404,-2.444,-3.434,-3.967,-3.703,-4.241,-3.821,-2.549,-2.337,-0.978,1.413,1.603,0.183,-1.089,-1.568,-2.012,-2.491,-2.181,-1.825,-1.229,-0.46,0.768,2.839,2.369,0.541,-0.718,-1.145,-1.078,-1.379,-1.646,-0.948,0.459,1.59,1.964,1.586,0.593,-0.712,-1.309,-1.223,-0.018,1.366,1.841,2.04,1.901,1.078,-0.013,-0.382,0.627,0.821,1.458,3.205,2.464,1.387,0.738,0.231,0.645,1.288,1.923,2.415,2.645,2.02,1.476,1.637,1.904,2.142,2.577,2.095,1.87,1.888,1.778,2.377,3.309,3.061,2.667,2.231,2.512,3.689,2.781,2.632,2.57,2.137,2.254,3.256,2.743,2.17,2.337,5.342,8.221,6.596,8.401,11.876,13.866,11.555,9.203,12.715,14.121,7.022,2.987,8.532,9.675,5.411,3.601,4.656,6.125,7.003,4.995,4.189,5.196,6.528,9.481,12.137,10.184,6.816,4.771,3.868,3.697,5.286,8.994,8.006,2.594,2.647,5.007,8.029,7.76,2.753,2.846,6.434,7.981,5.598,4.684,9.03,11.949,10.312,4.754,3.835,7.881,9.885,4.926,3.968,3.518,4.815,6.274,6.051,4.864,7.713,12.178,9.707,4.849,2.768,3.367,5.387,10.103,7.341,3.545,5.659,7.768,10.061,8.971,9.589,10.27,5.217,2.641,3.871,8.812,0.968,-2.571,-5.302,-7.01,-8.796,-10.154,-11.391,-12.373,-12.85,-14.086,-14.723,-13.135,-11.629,-10.869,-8.857,-6.261,-3.522,-1.45,0.331,1.266,-0.423,-2.918,-5.249,-7.017,-8.219,-9.462,-9.565,-9.51,-9.611,-9.086,-8.987,-8.026,-5.955,-4.034,-1.824,0.889,1.993,0.238,-2.955,-4.956,-5.632,-6.128,-7.24,-7.575,-7.173,-7.09,-6.908,-5.573,-3.473,-1.92,0.375,2.486,2.624,0.758,-0.73,-1.714,-3.328,-4.848,-5.216,-5.368,-5.461,-5.169,-4.223,-1.887,0.061,1.632,2.081,0.854,-0.845,-1.757,-2.217,-3.694,-4.327,-3.549,-2.808,-2.394,-1.743,-0.23,1.878,2.314,0.578,-1.052,-2.414,-2.679,-2.354,-2.144,-1.575,-0.533,1.429,3.167,2.223,0.904,-0.016,-0.994,-1.394,-1.444,-1.067,-0.209,0.747,2.092,2.066,1.163,0.845,0.296,-0.16,-0.26,-0.376,0.411,2.184,4.684,2.761,1.712,0.829,0.088,0.541,1.435,2.592,4.549,2.618,1.869,1.307,0.616,1.252,1.912,1.848,1.983,2.195,1.904], pc2=[5.881,6.15,6.159,5.808,4.68,4.615,5.464,4.29,4.197,4.155,3.045,2.167,2.652,3.744,1.769,-0.129,-0.036,0.384,-0.177,-1.528,-2.741,-3.754,-3.885,-5.216,-5.457,-5.583,-1.164,3.9,5.23,5.724,4.504,5.605,4.46,3.306,4.042,3.955,1.813,1.343,2.361,1.771,-0.37,-0.005,0.745,-1.793,-1.869,-2.093,-3.389,-2.632,-5.043,-5.93,-0.804,1.657,2.895,4.843,4.432,2.837,2.593,3.674,3.793,2.278,1.899,0.656,0.776,1.601,-1.288,-0.969,-0.076,-2.595,-3.294,-2.95,-4.587,-4.867,-2.049,2.635,3.963,3.841,2.954,2.083,3.017,3.963,2.144,-0.198,1.268,-0.076,-0.896,-0.44,-0.728,-1.574,-3.414,-3.428,-3.362,-4.006,-0.275,4.127,2.588,2.254,1.865,1.906,2.339,1.688,1.341,0.717,0.039,-0.94,-0.785,-1.968,-3.441,-2.936,-2.903,-2.312,1.186,1.398,2.127,2.524,2.016,1.543,1.833,0.978,-0.523,-1.303,-1.207,-1.067,-2.3,-1.999,-3.377,-2.979,-0.899,1.989,2.898,2.151,2.459,1.287,-0.041,-0.74,-0.656,-0.951,-0.915,-1.334,-3.182,-3.923,-1.354,2.844,1.81,0.411,1.818,1.527,0.166,0.48,-1.529,-2.608,-1.845,-2.227,-2.821,-0.723,2.24,0.482,0.477,0.963,0.143,0.303,-1.212,-1.918,-1.423,-2.197,-2.217,-0.509,1.931,1.07,-0.408,-0.665,-0.178,-0.068,-1.074,-1.969,-2.269,-1.137,0.905,1.026,1.027,-0.453,-1.065,-0.558,-2.028,-1.663,1.167,-0.068,-0.388,0.193,-1.406,-0.956,0.056,-2.112,-1.387,0.242,0.789,-0.353,3.863,3.953,4.517,3.606,2.747,1.763,3.301,3.034,1.176,1.168,1.206,0.228,-1.522,-1.751,-2.253,-1.693,-2.367,-4.009,-4.835,-3.56,2.175,4.393,2.917,2.71,2.251,1.876,2.198,1.853,0.929,0.839,-0.18,-1.404,-1.647,-0.856,-1.844,-2.441,-3.435,-5.37,-0.637,2.997,3.6,1.966,2.4,2.821,1.417,0.793,0.266,1.002,-0.084,-1.017,-3.448,-3.151,-2.655,-4.096,-1.832,1.69,2.673,1.38,1.472,2.233,0.75,-0.09,0.948,0.26,-2.016,-1.361,-0.821,-3.051,-5.337,-1.046,2.657,1.933,2.76,-0.472,-0.307,1.831,0.748,-1.212,-0.483,-0.209,-2.938,-3.747,-2.459,0.23,2.342,1.51,0.757,0.532,0.818,-1.155,-1.314,0.086,-1.703,-3.656,-2.526,-0.086,2.516,1.332,-0.534,0.404,-0.551,0.03,0.221,-3.057,-2.853,-0.753,-0.203,-0.011,0.669,0.158,-0.531,0.377,0.38,-1.752,-2.88,-1.884,0.593,1.738,-0.715,-0.174,0.322,-2.514,-2.129,-0.468,-0.586,-0.399,-0.076,1.81,0.419,-1.87,-2.374,-2.942,0.975,1.88,0.587,-0.267,-1.672,-2.405,-0.741,-0.803,-0.013,-0.318,-1.419,-0.097,-0.816,-1.028,-0.552,-0.805,0.35,-0.108,-1.368,-1.566,-0.522,0.331,-0.719,-1.101,-0.702,-0.571,0.152,-0.214,-0.913,0.775,2.461,0.15,-0.809,-0.886,-0.871,0.06,-0.671,-0.561,1.185,0.389,-0.856,-1.797,0.561,-0.732,-1.579,1.191,1.396,0.069,0.462,-0.575,-1.883,0.65,2.255,-0.477,-0.269,0.83,0.851,-1.819,-0.023,1.172,-0.641,-0.384,1.579,2.465,2.331,1.83,0.367,0.901,0.855,-1.19,-0.407,-0.147,-1.147,-2.075,-2.263,-3.294,-0.862,1.608,2.288,2.117,0.853,-0.646,-0.166,-0.435,-2.83,-3.055,-1.465,-0.916,-0.133,1.174,2.423,0.85,-2.107,-0.598,0.833,-1.051,-2.579,-2.021,-0.231,0.649,0.481,0.172,-0.89,-0.168,-0.667,-2.659,-2.454,-0.396,1.037,0.318,-0.151,-0.636,0.07,-0.367,-2.351,-2.134,-0.017,1.445,0.043,-0.941,-0.346,-1.601,-2.561,-0.664,1.841,1.147,-1.544,-0.676,0.684,-2.14,-2.584,0.867,0.068,-0.785,-0.66,-0.168,-1.4,-1.722,1.133,1.204,-0.272,-0.781,-0.703,-0.82,-0.303,-1.843,0.115,2.663,0.846,-1.705,-2.019,0.155,-0.9,-0.904,1.256,1.358,0.082,-0.495,-0.955,-0.922,-0.343,-1.455,-0.626,0.53,2.083,1.902,-2.063,-1.748,2.512,2.309,0.246,-1.421,0.507,0.519,0.019,0.192,0.738,1.163,0.471,1.558,1.568,1.517,-1.046,-0.938,1.506,0.673,-0.126,-0.544,-1.146,-2.11,0.281,1.067,3.087,2.141,-0.563,-0.723,2.049,1.373,0.342,2.289,2.533,1.162,-1.006,-0.622,1.411,3.42,1.002,-0.992,0.872,0.392,0.779,1.778,-2.621,-1.018,2.558,0.528,1.563,1.516,0.069,-1.877,-0.155,0.739,0.205,1.738,1.735,2.227,0.31,-0.431,2.538,1.441,0.55,-0.718,-1.16,1.202,2.289,1.684,-0.227,-0.535,1.397,1.598,-1.115,-0.032,1.571,-0.997,0.984,1.759,0.277,-0.913,0.498,-0.383,-0.343,2.488,2.189,0.892,0.5,-0.175,-0.059,-0.564,0.375,1.942,4.755,5.678,4.794,4.334,4.117,3.149,3.847,2.806,2.361,2.835,1.212,1.811,1.688,-0.582,0.158,-0.902,-2.026,-2.403,-3.333,-4.441,-4.343,-4.455,-2.72,2.003,4.456,5.196,4.115,2.823,3.275,3.147,2.016,1.453,1.587,1.056,0.052,-0.414,0.004,-0.709,-2.47,-1.758,-2.484,-4.649,-5.093,-2.855,1.885,3.96,4.148,3.645,2.586,0.804,1.407,3.17,1.515,0.71,0.521,-1.449,-0.555,-0.875,-2.857,-3.827,-3.462,-3.163,-1.503,2.069,3.096,2.28,2.371,2.359,1.068,0.932,1.756,1.235,-0.284,-1.348,-1.452,-2.432,-2.083,-3.511,-4.485,-0.699,1.339,2.918,2.496,1.716,2.496,1.112,1.097,-0.412,-0.442,-0.143,-2.73,-3.059,-1.942,-2.286,-2.3,0.461,2.477,1.522,0.084,2.171,0.956,-0.615,0.911,-0.483,-1.872,-1.119,-1.682,-3.67,-1.637,0.792,2.547,1.976,-0.202,0.434,0.496,-0.363,-0.248,-1.71,-2.522,-2.146,-1.949,-0.197,1.05,0.998,0.251,0.802,-0.407,-0.931,0.045,-1.125,-3.533,-3.164,0.997,1.113,0.979,0.709,0.213,-0.056,-1.141,-1.614,-2.329,-2.249,-0.801,1.437,1.027,0.338,-0.17,-0.483,-1.451,-2.055,-1.543,-0.532,0.154,0.47,1.235,0.094,-1.769,-1.905,-1.887,-1.36,1.617,0.75,-1.407,-0.617,-1.16,-1.969,-0.176,-0.266,-1.294,-0.277,0.071,-0.377,-1.701,-1.839,1.076,-0.504,-1.294,0.053,-1.112,-1.526,0.482,0.814,0.528,0.289,0.291,-0.261,-1.291,0.127,-2.036,-0.684,1.738,-0.549,-1.099,-1.1,1.062,0.048,1.668,2.376,3.004,1.537,0.978,0.692,1.275,0.385,0.267,-0.983,-3.081,-3.474,-2.683,-3.388,-0.674,2.516,1.493,1.717,1.149,1.544,1.049,-0.84,-1.796,-0.313,-1.553,-1.972,-3.266,-2.509,1.469,1.549,2.292,1.329,-0.962,-0.138,-0.31,-1.42,-1.202,-1.116,-2.769,-3.174,1.071,2.672,0.951,0.06,-0.065,0.296,-0.523,-1.044,-1.775,-3.041,-1.359,1.098,0.962,0.764,-0.015,-0.799,-1.278,-1.427,-1.999,-2.802,1.319,0.707,-0.061,1.0,-1.374,-0.556,-0.144,-2.461,-2.017,-0.378,1.111,0.411,0.643,-0.078,-1.739,-3.096,-1.201,0.077,-0.554,0.588,0.688,0.116,-1.339,-2.613,-0.579,1.018,-1.215,-0.245,-0.731,-1.478,-0.897,-1.22,-0.005,-0.161,-0.564,-1.697,-1.211,1.644,0.014,-0.574,-0.63,-0.395,-1.355,-1.259,0.275,0.721,-0.082,-1.496,0.514,1.569,-0.794,-0.065,0.35,-2.052,-0.285,0.077,-0.311,1.104,0.699,0.337,0.544,-0.021,0.516,2.262,4.255,3.332,-0.215,-0.551,-1.519,0.231,0.195,-1.519,-0.867,0.938,-0.976,-0.422,2.939,0.735,0.359,-1.474,-2.26,1.099,0.77,0.933,1.443,0.623,-0.055,0.61,1.307,-0.245,-1.039,-1.113,-0.308,0.147,-0.737,0.135,1.42,1.384,2.941,1.412,0.57,0.273,-1.061,0.624,0.473,-0.07,-0.516,-2.9,0.129,3.336,1.504,0.925,2.521,-0.176,-0.053,1.935,-0.035,0.831,1.988,1.092,1.137,0.093,1.495,1.071,0.417,2.75,-0.363,-1.175,1.153,0.185,-2.308,-0.886,2.696,1.449,-1.236,-0.446,1.527,2.64,3.517,2.611,1.129,1.61,1.127,-0.263,-0.614,-0.773,-1.677,-2.849,-3.407,-2.143,-3.369,-0.291,2.296,2.191,2.644,1.315,0.956,0.527,-0.701,-0.785,-0.022,-2.75,-2.217,-1.626,-2.494,-0.378,0.958,1.68,2.173,0.074,-0.169,0.99,0.004,-0.276,-2.127,-3.063,-2.901,-1.99,0.583,1.62,1.637,0.4,1.376,0.974,-1.072,-0.567,-2.648,-3.489,-1.744,-0.375,0.596,0.54,2.104,-0.785,-1.573,0.344,0.306,-1.953,-3.301,-0.998,1.438,1.298,-0.052,-0.405,0.32,-1.531,-1.97,-1.267,-1.978,-0.38,0.396,0.157,-0.43,-0.623,-0.427,-1.208,-1.712,-1.15,0.794,0.884,-0.858,-1.778,-1.857,-0.315,-0.793,-1.141,0.237,0.571,0.044,-0.963,-1.556,-1.468,0.081,0.915,0.021,-1.988,-2.044,-0.158,1.14,0.658,-1.174,-2.276,-0.952,2.008,1.399,-0.736,-0.962,-1.673,-0.407,1.359,-1.209,-0.761,0.639,-0.209,-1.253,-1.538,-0.499,0.95,0.244,-1.047,-1.048,0.982,1.658,2.54,1.883,1.242,1.302,-1.063,-1.726,1.554,1.51,0.149,-1.183,-0.562,2.166,2.151,-0.405,-2.071,-0.621,2.864,1.24,-1.261,-0.845,0.167,1.536,1.203,1.018,-0.796,-0.773,-1.35,-0.377,1.806,0.429,0.426,2.584,2.814,0.205,-0.662,4.168,3.6,-0.909,1.093,2.046,0.015,1.803,1.064,-1.486,-0.761,0.494,1.187,1.206,0.394,-1.043,-1.864,0.733,0.823,0.887,0.429,-0.606,1.225,2.307,-0.395,0.004,1.933,0.261,0.198,-0.15,-1.537,-0.177,-0.515,-0.815,0.425,3.666,3.517,1.31,1.671,3.245,1.297,0.405,0.922,-0.673,-2.131,-0.788,-1.32,-2.759,-3.868,-3.592,0.168,3.547,1.399,0.723,2.684,1.998,0.345,-1.122,-0.708,0.086,-2.175,-2.518,-2.622,-3.109,-0.37,1.134,2.105,1.133,1.228,1.137,-0.827,0.877,-0.029,-2.381,-0.217,-1.419,-4.255,-1.399,1.364,1.647,0.435,0.187,0.83,-0.696,-0.538,-1.06,-1.368,-1.45,-3.963,-0.639,2.034,1.549,0.487,-0.483,-0.004,0.39,-0.959,-2.255,-2.255,-1.249,-0.249,0.642,1.574,0.611,-0.038,-1.742,-2.683,-1.22,-0.939,-0.564,0.409,1.04,0.813,-2.118,-0.787,-0.657,-3.334,-0.196,0.997,0.347,0.519,-0.871,-1.378,-1.418,-1.272,-1.218,0.109,0.475,-0.74,-0.983,-0.683,-1.597,0.091,-0.129,-0.77,-0.145,-1.312,-1.53,-0.51,-0.591,0.157,-0.715,-1.564,-0.246,-0.353,-0.758,0.052,-0.386,-1.752,-0.628,0.224,-0.293,-1.946,-1.184,1.229,-0.054,-0.08,0.631,2.301,2.381,0.258,0.452,3.524,2.278,-2.102,-0.171,2.112,0.517,-0.648,-0.537,-0.377,0.809,0.22,-0.642,-0.252,-0.352,-0.069,1.814,1.912,0.789,0.085,-0.429,-0.426,-1.161,0.28,2.556,-0.433,-1.262,-0.999,0.024,2.064,-0.356,-1.49,-0.645,1.164,0.554,-1.081,-0.283,1.591,2.345,0.71,-1.488,-0.554,2.409,0.049,-0.155,-0.784,-0.524,-0.149,0.784,-0.638,-0.885,1.635,2.325,0.577,-0.938,-0.381,-1.919,1.554,1.685,-0.983,-0.304,-0.418,1.392,0.925,0.083,2.375,0.971,-0.776,-1.484,-0.786,4.654,4.074,2.345,2.918,2.316,2.26,2.327,1.141,2.368,2.675,-1.154,-1.726,0.055,-2.055,-2.991,-3.902,-3.023,-2.699,-2.672,1.55,3.11,3.232,2.849,1.686,2.56,0.682,0.259,0.945,-0.478,0.445,-0.411,-2.644,-2.489,-2.807,-4.232,-2.917,1.161,4.341,3.095,1.22,0.44,1.952,0.999,-0.283,-0.022,0.373,-1.254,-3.088,-2.006,-3.278,-3.768,-1.694,2.023,1.869,0.848,1.833,2.498,0.58,0.332,0.305,-0.262,-0.626,-3.422,-2.936,-2.837,-1.704,0.821,2.084,1.308,-0.084,2.003,1.341,-1.025,-1.264,-0.667,-0.948,-1.898,-3.668,-2.032,1.861,1.762,1.937,0.444,-0.699,-0.349,-0.955,-1.383,-2.875,-3.398,0.054,1.428,0.666,1.188,0.303,-0.084,-0.592,-1.586,-1.362,-2.742,-0.979,0.924,-0.147,0.241,0.414,-0.393,0.043,-1.133,-2.765,-2.567,0.02,0.85,0.595,0.934,-0.865,-1.663,-1.939,-1.986,0.357,0.526,-0.029,0.919,-1.203,-1.772,-0.381,-0.763,-0.854,-0.631,1.054], pc3=[1.29,0.953,0.552,0.133,-0.369,-0.611,-0.709,-1.135,-1.307,-1.459,-1.742,-1.926,-1.852,-1.709,-2.078,-2.293,-2.124,-1.906,-1.876,-1.907,-1.859,-1.705,-1.385,-1.251,-0.888,-0.589,0.405,1.108,1.008,0.722,0.188,0.083,-0.395,-0.782,-0.807,-0.98,-1.438,-1.505,-1.334,-1.441,-1.755,-1.547,-1.33,-1.634,-1.417,-1.242,-1.219,-0.803,-0.948,-0.742,0.368,0.719,0.747,0.811,0.436,-0.062,-0.254,-0.228,-0.393,-0.792,-0.897,-1.134,-1.058,-0.906,-1.34,-1.122,-0.848,-1.139,-0.994,-0.683,-0.688,-0.437,0.246,1.0,0.962,0.678,0.289,-0.011,-0.008,-0.016,-0.495,-0.902,-0.609,-0.831,-0.869,-0.699,-0.647,-0.671,-0.783,-0.531,-0.279,-0.191,0.572,1.156,0.636,0.421,0.2,0.106,0.045,-0.161,-0.299,-0.419,-0.529,-0.615,-0.492,-0.558,-0.622,-0.288,-0.119,0.14,0.748,0.656,0.645,0.538,0.301,0.096,0.067,-0.162,-0.39,-0.454,-0.311,-0.206,-0.286,-0.084,-0.155,0.101,0.537,0.965,0.911,0.591,0.486,0.161,-0.095,-0.181,-0.1,-0.101,-0.014,-0.012,-0.174,-0.106,0.479,1.117,0.741,0.395,0.555,0.379,0.085,0.14,-0.18,-0.212,0.055,0.124,0.135,0.589,1.008,0.571,0.516,0.529,0.328,0.346,0.089,0.075,0.247,0.22,0.311,0.66,0.989,0.709,0.399,0.37,0.452,0.467,0.302,0.238,0.278,0.556,0.862,0.782,0.684,0.383,0.303,0.437,0.222,0.379,0.854,0.556,0.494,0.575,0.302,0.433,0.621,0.26,0.484,0.738,0.791,0.52,1.14,0.878,0.676,0.263,-0.072,-0.369,-0.211,-0.421,-0.811,-0.826,-0.812,-0.956,-1.137,-0.997,-0.903,-0.616,-0.568,-0.601,-0.462,-0.002,1.002,1.118,0.6,0.376,0.137,-0.048,-0.098,-0.255,-0.469,-0.484,-0.637,-0.739,-0.653,-0.375,-0.455,-0.359,-0.343,-0.43,0.588,1.083,0.946,0.436,0.383,0.27,-0.075,-0.247,-0.332,-0.221,-0.396,-0.474,-0.728,-0.421,-0.141,-0.189,0.362,0.933,0.922,0.527,0.436,0.442,0.086,-0.079,0.093,-0.049,-0.379,-0.134,0.042,-0.198,-0.395,0.59,1.096,0.798,0.763,0.105,0.15,0.47,0.194,-0.133,0.058,0.143,-0.233,-0.151,0.228,0.738,0.965,0.67,0.433,0.343,0.346,0.002,0.051,0.338,0.07,-0.105,0.259,0.716,1.055,0.679,0.307,0.463,0.266,0.384,0.399,-0.095,0.117,0.565,0.65,0.646,0.713,0.559,0.422,0.557,0.522,0.173,0.114,0.39,0.831,0.911,0.409,0.513,0.578,0.12,0.322,0.649,0.628,0.643,0.665,0.911,0.559,0.201,0.228,0.209,-0.394,1.037,0.69,0.517,0.301,0.28,0.636,0.62,0.757,0.664,0.491,0.737,0.591,0.582,0.669,0.622,0.801,0.672,0.469,0.47,0.286,0.649,0.622,0.568,0.394,0.105,-0.019,0.122,-0.562,-1.395,-0.801,0.581,0.62,0.607,0.299,0.269,0.166,-0.287,-0.33,0.787,0.582,0.445,0.208,0.558,-0.339,-1.133,-0.72,-0.103,0.246,0.643,-0.161,-1.19,-0.814,0.075,-0.471,-0.435,0.366,0.352,-0.518,-0.401,-0.201,-1.303,-2.223,-2.188,0.961,0.72,0.348,0.412,0.32,-0.017,0.156,0.23,0.079,0.035,0.125,0.097,0.609,0.964,0.908,0.709,0.377,0.097,0.21,0.185,-0.132,0.01,0.407,0.538,0.664,0.804,0.883,0.479,-0.016,0.324,0.549,0.215,0.052,0.27,0.62,0.717,0.619,0.521,0.323,0.478,0.39,0.139,0.286,0.418,0.9,0.693,0.572,0.474,0.595,0.502,0.218,0.358,0.675,0.929,0.59,0.425,0.545,0.364,0.261,-0.256,0.406,0.859,0.355,0.554,0.764,0.28,0.288,-0.081,0.734,0.612,0.635,0.72,0.48,-0.084,-0.941,-0.115,0.673,0.631,0.64,0.63,0.667,0.157,-0.959,-0.103,0.835,0.379,0.393,0.332,0.3,-0.511,-1.097,-0.321,0.66,0.663,0.582,0.609,0.678,0.446,-0.494,-1.449,-1.204,0.564,0.338,-0.903,-2.095,-0.849,0.276,0.075,-0.55,-0.476,-0.411,-0.86,-1.106,-1.201,-1.331,-1.592,-1.208,-0.07,0.336,-0.379,-0.79,0.334,0.714,0.643,0.526,0.168,-1.403,-2.262,-2.154,-0.72,-0.083,-1.152,-1.717,-1.45,-1.741,-2.308,-1.401,-0.212,0.079,-1.211,-2.316,-1.739,-0.257,-0.311,-0.698,-0.829,-0.599,0.737,0.232,-0.987,-1.732,-1.217,-1.291,-0.345,0.697,0.398,-0.55,-1.005,-1.438,-1.972,-1.927,-1.142,-0.669,-1.33,-1.753,-0.782,0.09,0.253,-0.73,-1.875,-1.717,-0.645,-0.147,-0.748,-1.213,-0.223,-0.055,-0.625,-0.601,-0.478,-1.285,-0.736,0.084,-0.003,-0.248,-0.47,-1.556,-2.203,-1.429,-0.636,-0.196,-0.03,-0.012,-0.559,-1.298,-1.448,1.253,1.064,0.556,0.205,-0.09,-0.444,-0.487,-0.816,-0.978,-0.963,-1.302,-1.171,-1.217,-1.537,-1.286,-1.35,-1.354,-1.189,-1.089,-0.978,-0.631,-0.375,0.132,0.926,1.074,0.88,0.381,-0.052,-0.139,-0.324,-0.633,-0.778,-0.781,-0.883,-1.017,-1.015,-0.851,-0.882,-1.031,-0.697,-0.647,-0.743,-0.513,0.115,0.918,1.042,0.778,0.438,0.066,-0.335,-0.275,-0.071,-0.484,-0.624,-0.646,-0.903,-0.623,-0.581,-0.756,-0.673,-0.351,-0.1,0.306,0.872,0.842,0.501,0.359,0.212,-0.116,-0.181,-0.101,-0.25,-0.508,-0.594,-0.48,-0.504,-0.253,-0.323,-0.252,0.556,0.828,0.94,0.641,0.366,0.358,0.005,-0.037,-0.317,-0.253,-0.16,-0.49,-0.349,0.02,0.076,0.195,0.691,0.914,0.584,0.252,0.551,0.211,-0.06,0.2,-0.045,-0.211,0.039,0.027,-0.16,0.341,0.737,0.906,0.628,0.176,0.275,0.247,0.088,0.142,-0.058,-0.052,0.142,0.285,0.615,0.771,0.656,0.456,0.508,0.258,0.202,0.388,0.221,-0.071,0.164,0.541,0.847,0.73,0.583,0.458,0.378,0.226,0.211,0.205,0.319,0.512,0.957,0.762,0.569,0.447,0.401,0.27,0.261,0.426,0.637,0.715,0.711,0.755,0.494,0.198,0.285,0.367,0.517,0.994,0.722,0.336,0.521,0.448,0.37,0.722,0.673,0.505,0.693,0.718,0.623,0.412,0.388,0.325,0.654,0.536,0.741,0.547,0.061,-0.729,-0.705,-0.33,-0.088,0.685,0.684,0.517,0.78,0.359,-0.226,-0.097,0.668,0.552,0.179,0.384,0.736,0.88,0.847,0.74,0.335,0.147,0.051,0.098,-0.102,-0.111,-0.283,-0.485,-0.335,0.02,0.035,0.626,1.048,0.715,0.61,0.406,0.37,0.216,-0.124,-0.192,0.144,-0.021,0.042,-0.051,0.248,0.926,0.787,0.773,0.465,0.043,0.225,0.198,0.058,0.169,0.262,0.074,0.149,0.922,1.027,0.581,0.37,0.33,0.375,0.224,0.185,0.139,0.049,0.45,0.847,0.708,0.601,0.407,0.296,0.246,0.313,0.283,0.246,0.584,0.784,0.596,0.73,0.277,0.484,0.536,0.206,0.374,0.637,0.89,0.679,0.654,0.491,0.245,0.128,0.567,0.481,0.659,0.803,0.748,0.587,0.361,0.214,0.654,0.866,0.443,0.637,0.539,0.454,0.592,0.551,0.646,0.707,0.638,0.425,-0.221,-0.419,0.718,0.644,0.634,0.674,0.5,0.188,-0.482,-0.097,0.406,0.002,-0.839,-0.21,0.272,0.434,0.794,0.374,-0.026,-0.293,-0.646,-0.952,-0.684,-0.63,-0.659,-1.099,-2.23,-3.491,-3.056,-1.064,0.649,0.662,0.431,0.189,0.743,0.475,-0.117,-0.046,-0.206,-1.235,-1.34,0.21,0.804,0.455,0.032,-1.135,-1.152,-1.228,-0.995,-0.469,-0.541,-0.705,-0.057,0.716,0.571,0.448,-0.007,0.011,-0.384,-1.233,-1.936,-2.253,-1.919,-0.95,-0.252,0.132,-0.017,-0.33,0.144,0.75,0.641,0.159,-2.055,-2.349,-1.616,-1.607,-1.074,-0.483,-1.042,-1.132,-0.988,-1.571,-1.642,-1.191,-0.928,-1.174,-1.294,-1.238,-1.345,-0.794,0.396,0.0,0.007,0.786,0.307,-1.146,-1.489,-0.009,0.511,0.065,0.848,0.852,0.79,0.41,0.041,0.045,-0.097,-0.351,-0.341,-0.306,-0.34,-0.391,-0.268,0.131,0.046,0.681,0.992,0.804,0.686,0.323,0.177,0.076,-0.14,-0.083,0.089,-0.3,-0.029,0.179,0.136,0.566,0.73,0.735,0.679,0.214,0.174,0.34,0.13,0.108,-0.143,-0.12,0.069,0.362,0.799,0.871,0.728,0.414,0.517,0.359,-0.004,0.164,-0.12,-0.054,0.365,0.655,0.749,0.674,0.834,0.259,0.18,0.531,0.492,0.137,0.044,0.548,0.911,0.763,0.455,0.384,0.507,0.19,0.225,0.417,0.364,0.678,0.768,0.673,0.542,0.512,0.553,0.438,0.413,0.55,0.868,0.781,0.458,0.347,0.414,0.698,0.618,0.421,0.325,0.827,0.676,0.501,0.443,0.502,0.46,0.87,0.649,0.331,0.38,-0.269,0.335,0.816,0.484,0.316,-0.728,-0.989,0.644,0.582,0.579,0.441,-0.156,0.202,0.539,0.242,0.651,0.683,0.521,0.473,-0.276,-0.405,0.357,0.335,-0.653,-1.861,-2.316,-2.177,-1.518,-0.914,0.168,0.548,-0.389,-1.329,-0.575,0.297,0.089,-1.17,-1.61,-0.245,0.683,0.362,-1.32,-1.377,0.085,0.535,-0.293,-1.034,-1.36,-0.682,0.24,0.622,0.625,0.137,-0.978,-1.278,-1.177,-1.966,-2.518,-1.431,-0.843,-2.39,-3.27,-1.467,-0.737,-1.512,-1.249,-1.035,-0.887,0.302,0.484,-0.31,-1.027,-1.021,-0.406,0.722,0.552,0.066,-0.936,-0.931,-0.651,-0.364,-0.871,-1.574,-0.903,-0.377,-0.977,-0.903,-0.134,0.376,0.733,0.481,0.411,0.359,0.225,0.078,1.217,0.95,0.366,0.334,0.442,-0.031,-0.227,-0.135,-0.404,-0.531,-0.18,-0.182,-0.283,-0.255,-0.004,0.724,1.15,0.564,0.36,0.575,0.302,-0.046,-0.268,-0.119,0.06,-0.267,-0.147,-0.017,0.066,0.615,0.802,0.837,0.516,0.457,0.346,-0.017,0.293,0.102,-0.236,0.249,0.079,-0.244,0.406,0.846,0.764,0.453,0.371,0.444,0.147,0.23,0.155,0.197,0.252,-0.053,0.634,1.018,0.784,0.502,0.313,0.39,0.438,0.205,0.08,0.195,0.462,0.63,0.738,0.786,0.524,0.381,0.13,0.087,0.452,0.52,0.605,0.721,0.761,0.633,0.129,0.453,0.492,0.103,0.632,0.866,0.686,0.644,0.399,0.348,0.416,0.483,0.539,0.755,0.772,0.517,0.515,0.575,0.451,0.759,0.674,0.555,0.666,0.465,0.485,0.52,0.578,0.781,0.603,0.478,0.462,0.701,0.624,0.754,0.648,0.43,0.521,0.79,0.674,0.376,-0.202,-0.672,-0.396,-0.951,-1.909,-2.209,-1.488,-1.138,-2.221,-2.056,-0.131,0.34,-1.017,-0.957,0.053,0.425,0.105,-0.314,-0.372,0.14,0.231,0.007,-0.433,-1.29,-1.771,-1.159,-0.322,0.185,0.366,0.444,-0.212,-1.079,-0.364,0.674,0.533,-0.098,-0.824,-0.381,0.694,0.486,-0.469,-0.594,0.004,0.024,-1.206,-1.739,-1.141,0.336,0.158,-0.859,-0.989,0.133,0.387,0.417,0.066,-0.331,-0.06,0.013,-0.874,-1.839,-0.913,0.22,0.612,0.541,-0.383,-1.167,-0.342,0.386,-0.157,-0.83,-1.195,-0.958,-1.313,-1.081,0.18,0.628,0.167,-1.193,1.25,0.855,0.331,0.27,-0.003,-0.126,-0.234,-0.518,-0.369,-0.405,-1.074,-0.998,-0.577,-0.825,-0.765,-0.681,-0.268,-0.046,0.103,0.839,0.903,0.701,0.42,0.071,0.119,-0.31,-0.361,-0.26,-0.487,-0.286,-0.394,-0.656,-0.417,-0.29,-0.304,0.113,0.841,1.151,0.684,0.208,0.013,0.221,-0.043,-0.255,-0.197,-0.09,-0.341,-0.48,-0.118,-0.158,-0.046,0.453,1.046,0.843,0.541,0.597,0.567,0.113,0.064,0.026,-0.043,-0.066,-0.41,-0.105,0.068,0.387,0.799,0.896,0.609,0.299,0.593,0.356,-0.061,-0.031,0.14,0.135,0.076,-0.092,0.357,0.985,0.805,0.695,0.335,0.14,0.228,0.155,0.162,0.022,0.093,0.67,0.916,0.673,0.679,0.441,0.364,0.273,0.166,0.289,0.141,0.545,0.831,0.579,0.611,0.591,0.414,0.496,0.298,0.134,0.267,0.216,0.87,0.751,0.719,0.386,0.302,0.352,0.393,0.317,0.811,0.667,0.77,0.377,0.343,0.629,0.552,0.564,0.583,0.852], pos=[0.884,1.129,1.35,1.546,1.718,1.866,1.989,2.087,2.161,2.21,2.235,2.235,2.211,2.162,2.089,1.991,1.868,1.721,1.55,1.354,1.133,0.888,0.619,0.325,0.006,0.281,0.543,0.78,0.993,1.181,1.345,1.484,1.599,1.689,1.755,1.796,1.812,1.804,1.772,1.715,1.633,1.527,1.397,1.242,1.062,0.858,0.629,0.376,0.099,0.173,0.413,0.628,0.819,0.985,1.127,1.244,1.337,1.405,1.448,1.467,1.462,1.432,1.377,1.298,1.195,1.067,0.914,0.737,0.535,0.309,0.059,0.181,0.391,0.577,0.738,0.874,0.986,1.074,1.137,1.175,1.189,1.179,1.144,1.084,1.0,0.891,0.758,0.6,0.418,0.211,0.018,0.221,0.4,0.554,0.683,0.788,0.869,0.924,0.956,0.963,0.945,0.903,0.836,0.745,0.629,0.489,0.324,0.135,0.068,0.243,0.393,0.518,0.62,0.696,0.748,0.776,0.779,0.757,0.711,0.64,0.545,0.426,0.281,0.113,0.069,0.223,0.352,0.457,0.537,0.593,0.625,0.631,0.614,0.571,0.505,0.413,0.298,0.157,0.007,0.152,0.273,0.369,0.44,0.487,0.51,0.508,0.481,0.43,0.355,0.255,0.13,0.017,0.144,0.247,0.326,0.379,0.409,0.414,0.394,0.35,0.281,0.187,0.07,0.06,0.164,0.244,0.299,0.329,0.335,0.317,0.274,0.206,0.114,0.003,0.105,0.183,0.237,0.266,0.271,0.251,0.207,0.138,0.044,0.058,0.135,0.187,0.215,0.219,0.198,0.152,0.082,0.011,0.09,0.143,0.173,0.177,0.641,0.806,0.946,1.062,1.153,1.22,1.262,1.279,1.272,1.241,1.185,1.104,0.999,0.87,0.715,0.537,0.334,0.106,0.124,0.323,0.498,0.648,0.774,0.875,0.952,1.004,1.032,1.035,1.014,0.968,0.897,0.802,0.683,0.539,0.37,0.177,0.036,0.222,0.384,0.521,0.634,0.722,0.786,0.825,0.84,0.83,0.795,0.736,0.653,0.545,0.412,0.255,0.074,0.11,0.265,0.395,0.501,0.583,0.64,0.672,0.68,0.663,0.622,0.556,0.466,0.351,0.212,0.048,0.114,0.248,0.358,0.443,0.503,0.539,0.551,0.538,0.5,0.438,0.352,0.241,0.105,0.047,0.175,0.278,0.357,0.411,0.44,0.445,0.426,0.382,0.313,0.22,0.102,0.034,0.149,0.239,0.304,0.345,0.361,0.353,0.32,0.263,0.181,0.075,0.047,0.144,0.217,0.266,0.29,0.289,0.264,0.215,0.141,0.042,0.063,0.143,0.199,0.23,0.236,0.218,0.176,0.109,0.017,0.073,0.137,0.177,0.192,0.183,0.149,0.09,0.008,0.07,0.123,0.151,0.154,0.133,0.087,0.017,0.055,0.102,0.124,0.122,0.095,0.044,0.025,0.074,0.099,0.099,0.074,0.025,0.035,0.071,0.083,0.07,0.033,0.022,0.057,0.067,0.053,0.014,0.032,0.053,0.049,0.021,0.022,0.042,0.039,0.011,0.025,0.036,0.022,0.012,0.028,0.021,0.009,0.023,0.013,0.013,0.018,0.001,0.015,0.005,0.012,0.005,0.01,0.001,0.008,0.005,0.002,0.005,0.004,0.003,0.002,0.002,0.002,0.0,0.363,0.435,0.482,0.505,0.503,0.477,0.426,0.351,0.251,0.126,0.02,0.146,0.248,0.325,0.377,0.406,0.409,0.388,0.343,0.273,0.178,0.059,0.068,0.17,0.247,0.3,0.328,0.331,0.31,0.264,0.194,0.1,0.017,0.116,0.191,0.24,0.266,0.267,0.243,0.195,0.122,0.025,0.073,0.145,0.193,0.216,0.214,0.188,0.138,0.063,0.03,0.103,0.151,0.174,0.173,0.148,0.097,0.023,0.056,0.109,0.138,0.142,0.122,0.077,0.007,0.059,0.099,0.116,0.107,0.075,0.017,0.045,0.082,0.094,0.082,0.045,0.013,0.056,0.075,0.069,0.039,0.013,0.049,0.062,0.049,0.012,0.031,0.049,0.043,0.013,0.026,0.04,0.03,0.004,0.029,0.03,0.007,0.021,0.025,0.004,0.019,0.018,0.006,0.017,0.004,0.014,0.007,0.011,0.005,0.009,0.001,0.007,0.005,0.001,0.003,0.003,0.003,0.002,0.001,0.0,0.001,0.002,0.001,0.0,0.0,0.001,0.002,0.0,0.0,0.003,0.003,0.003,0.002,0.001,0.0,0.001,0.0,0.001,0.002,0.0,0.0,0.003,0.004,0.003,0.002,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.001,0.0,0.0,0.003,0.003,0.002,0.001,0.0,0.001,0.001,0.0,0.001,0.001,0.0,0.001,0.001,0.001,0.0,0.001,0.002,0.0,0.0,0.002,0.002,0.001,0.0,0.001,0.001,0.0,0.002,0.002,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.0,0.003,0.004,0.003,0.002,0.001,0.747,0.947,1.123,1.274,1.4,1.502,1.58,1.633,1.661,1.665,1.644,1.599,1.529,1.435,1.316,1.173,1.005,0.813,0.596,0.355,0.089,0.171,0.399,0.603,0.782,0.936,1.067,1.172,1.253,1.31,1.342,1.349,1.332,1.291,1.225,1.134,1.019,0.879,0.715,0.526,0.313,0.075,0.157,0.359,0.536,0.689,0.818,0.922,1.001,1.056,1.087,1.092,1.074,1.031,0.963,0.871,0.754,0.613,0.447,0.257,0.042,0.162,0.338,0.49,0.617,0.719,0.797,0.851,0.88,0.884,0.864,0.82,0.75,0.657,0.539,0.396,0.229,0.037,0.146,0.301,0.432,0.538,0.619,0.676,0.709,0.717,0.7,0.659,0.594,0.504,0.389,0.25,0.086,0.085,0.229,0.348,0.443,0.513,0.558,0.579,0.576,0.548,0.495,0.418,0.317,0.191,0.04,0.108,0.229,0.326,0.398,0.445,0.468,0.467,0.441,0.39,0.315,0.215,0.091,0.049,0.164,0.255,0.321,0.363,0.381,0.374,0.342,0.286,0.205,0.1,0.026,0.132,0.213,0.269,0.301,0.308,0.291,0.25,0.183,0.093,0.02,0.114,0.183,0.228,0.249,0.245,0.216,0.163,0.085,0.014,0.098,0.158,0.192,0.203,0.188,0.149,0.086,0.002,0.079,0.131,0.159,0.163,0.141,0.096,0.026,0.051,0.102,0.129,0.131,0.109,0.062,0.008,0.066,0.099,0.107,0.091,0.051,0.012,0.061,0.084,0.084,0.059,0.009,0.041,0.067,0.068,0.045,0.003,0.042,0.057,0.047,0.013,0.028,0.046,0.039,0.007,0.44,0.537,0.61,0.658,0.682,0.682,0.657,0.607,0.533,0.434,0.311,0.163,0.008,0.16,0.287,0.389,0.467,0.52,0.549,0.554,0.534,0.489,0.42,0.326,0.208,0.065,0.084,0.206,0.303,0.375,0.423,0.447,0.446,0.42,0.37,0.296,0.197,0.073,0.062,0.172,0.256,0.317,0.353,0.364,0.351,0.313,0.251,0.164,0.053,0.066,0.16,0.229,0.274,0.294,0.289,0.26,0.207,0.129,0.026,0.077,0.154,0.206,0.234,0.237,0.216,0.17,0.1,0.005,0.082,0.143,0.181,0.194,0.182,0.145,0.085,0.001,0.076,0.127,0.153,0.154,0.132,0.084,0.012,0.059,0.104,0.125,0.122,0.094,0.042,0.028,0.076,0.1,0.099,0.074,0.025,0.035,0.072,0.083,0.07,0.033,0.022,0.057,0.067,0.053,0.015,0.031,0.053,0.05,0.023,0.02,0.042,0.04,0.013,0.023,0.036,0.024,0.01,0.028,0.022,0.006,0.023,0.015,0.011,0.019,0.002,0.015,0.007,0.011,0.007,0.009,0.003,0.008,0.003,0.004,0.005,0.004,0.002,0.002,0.002,0.002,0.001,0.0,0.001,0.001,0.001,0.0,0.001,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.001,0.0,0.0,0.003,0.004,0.003,0.002,0.001,0.0,0.001,0.001,0.0,0.0,0.001,0.002,0.0,0.0,0.003,0.003,0.003,0.002,0.0,0.0,0.002,0.002,0.001,0.0,0.0,0.001,0.002,0.0,0.001,0.0,0.001,0.002,0.0,0.001,0.0,0.001,0.001,0.0,0.0,0.467,0.574,0.656,0.714,0.747,0.756,0.74,0.7,0.635,0.545,0.431,0.293,0.13,0.05,0.204,0.333,0.438,0.518,0.574,0.605,0.612,0.594,0.552,0.485,0.394,0.278,0.137,0.024,0.164,0.28,0.37,0.437,0.478,0.496,0.488,0.457,0.4,0.319,0.214,0.084,0.059,0.176,0.269,0.338,0.382,0.401,0.396,0.366,0.312,0.233,0.13,0.002,0.113,0.203,0.268,0.309,0.325,0.317,0.284,0.227,0.145,0.039,0.072,0.156,0.217,0.252,0.264,0.25,0.213,0.15,0.063,0.04,0.12,0.175,0.206,0.213,0.195,0.152,0.085,0.005,0.084,0.138,0.167,0.172,0.152,0.108,0.039,0.042,0.099,0.132,0.14,0.123,0.083,0.017,0.051,0.094,0.113,0.107,0.076,0.021,0.041,0.079,0.092,0.081,0.045,0.013,0.056,0.074,0.067,0.037,0.015,0.05,0.06,0.046,0.007,0.033,0.049,0.04,0.006,0.029,0.04,0.026,0.01,0.031,0.027,0.001,0.024,0.022,0.004,0.021,0.013,0.012,0.016,0.004,0.014,0.001,0.011,0.002,0.008,0.006,0.002,0.006,0.004,0.002,0.001,0.001,0.001,0.002,0.001,0.0,0.002,0.002,0.001,0.0,0.001,0.001,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.0,0.0,0.0,0.001,0.001,0.001,0.0,0.001,0.002,0.0,0.001,0.0,0.001,0.001,0.0,0.001,0.002,0.001,0.0,0.001,0.0,0.001,0.002,0.0,0.0,0.003,0.003,0.003,0.002,0.001,0.0,0.0,0.001,0.479,0.589,0.675,0.737,0.773,0.786,0.774,0.737,0.676,0.59,0.48,0.345,0.186,0.002,0.163,0.303,0.419,0.51,0.576,0.618,0.636,0.629,0.597,0.541,0.461,0.356,0.226,0.072,0.088,0.221,0.329,0.412,0.471,0.506,0.515,0.501,0.462,0.398,0.31,0.197,0.06,0.083,0.199,0.29,0.357,0.399,0.417,0.41,0.379,0.323,0.243,0.138,0.008,0.11,0.204,0.273,0.317,0.337,0.332,0.303,0.25,0.171,0.069,0.048,0.141,0.21,0.254,0.273,0.268,0.238,0.184,0.105,0.002,0.091,0.159,0.202,0.221,0.215,0.185,0.131,0.051,0.042,0.112,0.157,0.178,0.175,0.147,0.094,0.017,0.061,0.113,0.141,0.144,0.123,0.077,0.006,0.06,0.101,0.118,0.11,0.077,0.02,0.043,0.082,0.095,0.085,0.05,0.008,0.054,0.076,0.073,0.045,0.006,0.047,0.062,0.054,0.021,0.025,0.048,0.047,0.021,0.02,0.04,0.035,0.006,0.026,0.033,0.015,0.017,0.027,0.013,0.015,0.021,0.002,0.017,0.011,0.011,0.012,0.007,0.01,0.007,0.006,0.007,0.001,0.004,0.005,0.004,0.002,0.002,0.002,0.002,0.0,0.001,0.0,0.0,0.0,0.001,0.001,0.001,0.0,0.001,0.002,0.0,0.0,0.002,0.003,0.002,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.0,0.001,0.002,0.0,0.001,0.0,0.002,0.003,0.002,0.001,0.0,0.001,0.001,0.0,0.001,0.0,0.001,0.002,0.0,0.0,0.003,0.003,0.599,0.749,0.875,0.976,1.053,1.106,1.134,1.137,1.116,1.07,1.0,0.905,0.786,0.642,0.474,0.281,0.063,0.148,0.331,0.489,0.622,0.731,0.816,0.876,0.911,0.922,0.909,0.87,0.808,0.721,0.609,0.473,0.312,0.127,0.072,0.241,0.387,0.507,0.603,0.675,0.722,0.745,0.743,0.717,0.666,0.59,0.49,0.366,0.216,0.043,0.126,0.267,0.383,0.475,0.543,0.586,0.604,0.598,0.568,0.513,0.433,0.329,0.2,0.047,0.106,0.231,0.331,0.407,0.459,0.486,0.488,0.466,0.419,0.348,0.253,0.132,0.011,0.136,0.237,0.313,0.365,0.392,0.395,0.373,0.327,0.256,0.161,0.041,0.082,0.178,0.25,0.297,0.319,0.317,0.291,0.24,0.165,0.065,0.049,0.139,0.204,0.244,0.26,0.252,0.219,0.161,0.079,0.024,0.107,0.166,0.201,0.211,0.196,0.157,0.094,0.006,0.075,0.132,0.163,0.17,0.153,0.111,0.045,0.036,0.095,0.129,0.138,0.123], vel=[5.155,4.664,4.174,3.683,3.193,2.702,2.212,1.721,1.231,0.74,0.25,-0.241,-0.731,-1.222,-1.712,-2.203,-2.693,-3.184,-3.674,-4.165,-4.655,-5.146,-5.636,-6.127,-6.617,5.482,4.992,4.501,4.011,3.52,3.03,2.539,2.049,1.558,1.068,0.577,0.087,-0.404,-0.894,-1.385,-1.875,-2.366,-2.856,-3.347,-3.837,-4.328,-4.818,-5.309,-5.799,5.041,4.551,4.06,3.57,3.079,2.589,2.098,1.608,1.117,0.627,0.136,-0.354,-0.845,-1.335,-1.826,-2.316,-2.807,-3.297,-3.788,-4.278,-4.769,-5.259,4.448,3.958,3.467,2.977,2.486,1.996,1.505,1.015,0.524,0.034,-0.457,-0.947,-1.438,-1.928,-2.419,-2.909,-3.4,-3.89,-4.381,4.307,3.816,3.326,2.835,2.345,1.854,1.364,0.873,0.383,-0.108,-0.598,-1.089,-1.579,-2.07,-2.56,-3.051,-3.541,-4.032,3.738,3.248,2.757,2.267,1.776,1.286,0.795,0.305,-0.186,-0.676,-1.167,-1.657,-2.148,-2.638,-3.129,-3.619,3.324,2.834,2.343,1.853,1.362,0.872,0.381,-0.109,-0.6,-1.09,-1.581,-2.071,-2.562,-3.052,3.148,2.658,2.167,1.677,1.186,0.696,0.205,-0.285,-0.776,-1.266,-1.757,-2.247,-2.738,2.793,2.303,1.812,1.322,0.831,0.341,-0.15,-0.64,-1.131,-1.621,-2.112,-2.602,2.327,1.837,1.346,0.856,0.365,-0.125,-0.616,-1.106,-1.597,-2.087,2.3,1.809,1.319,0.828,0.338,-0.153,-0.643,-1.134,-1.624,-2.115,1.785,1.294,0.804,0.313,-0.177,-0.668,-1.158,-1.649,1.811,1.321,0.83,0.34,-0.151,3.539,3.049,2.558,2.068,1.577,1.087,0.596,0.106,-0.385,-0.875,-1.366,-1.856,-2.347,-2.837,-3.328,-3.818,-4.309,-4.799,4.231,3.741,3.25,2.76,2.269,1.779,1.288,0.798,0.307,-0.183,-0.674,-1.164,-1.655,-2.145,-2.636,-3.126,-3.617,-4.107,3.971,3.481,2.99,2.5,2.009,1.519,1.028,0.538,0.047,-0.443,-0.934,-1.424,-1.915,-2.405,-2.896,-3.386,-3.877,3.344,2.854,2.363,1.873,1.382,0.892,0.401,-0.089,-0.58,-1.07,-1.561,-2.051,-2.542,-3.032,-3.523,2.928,2.437,1.947,1.456,0.966,0.475,-0.015,-0.506,-0.996,-1.487,-1.977,-2.468,-2.958,2.798,2.307,1.817,1.326,0.836,0.345,-0.145,-0.636,-1.126,-1.617,-2.107,-2.598,2.534,2.043,1.553,1.062,0.572,0.081,-0.409,-0.9,-1.39,-1.881,-2.371,2.198,1.707,1.217,0.726,0.236,-0.255,-0.745,-1.236,-1.726,-2.217,1.847,1.356,0.866,0.375,-0.115,-0.606,-1.096,-1.587,-2.077,1.531,1.04,0.55,0.059,-0.431,-0.922,-1.412,-1.903,1.295,0.805,0.314,-0.176,-0.667,-1.157,-1.648,1.181,0.691,0.2,-0.29,-0.781,-1.271,1.226,0.736,0.245,-0.245,-0.736,-1.226,0.972,0.482,-0.009,-0.499,-0.99,0.94,0.449,-0.041,-0.532,-1.022,0.665,0.175,-0.316,-0.806,0.664,0.173,-0.317,-0.808,0.466,-0.025,-0.515,0.582,0.092,-0.399,0.54,0.049,-0.441,0.354,-0.136,0.531,0.04,-0.45,0.101,-0.389,0.058,-0.433,-0.08,0.189,-0.301,-0.108,0.017,0.08,0.087,0.045,-0.042,-0.169,1.682,1.192,0.701,0.211,-0.28,-0.77,-1.261,-1.751,-2.242,-2.732,2.769,2.279,1.788,1.298,0.807,0.317,-0.174,-0.664,-1.155,-1.645,-2.136,-2.626,2.276,1.786,1.295,0.805,0.314,-0.176,-0.667,-1.157,-1.648,-2.138,2.225,1.735,1.244,0.754,0.263,-0.227,-0.718,-1.208,-1.699,-2.189,1.688,1.198,0.707,0.217,-0.274,-0.764,-1.255,-1.745,1.696,1.205,0.715,0.224,-0.266,-0.757,-1.247,-1.738,1.31,0.82,0.329,-0.161,-0.652,-1.142,-1.633,1.061,0.571,0.08,-0.41,-0.901,-1.391,0.984,0.494,0.003,-0.487,-0.978,1.111,0.621,0.13,-0.36,-0.851,0.98,0.49,-0.001,-0.491,-0.982,0.617,0.126,-0.364,-0.855,0.535,0.045,-0.446,0.756,0.266,-0.225,-0.715,0.317,-0.173,-0.664,0.217,-0.274,0.469,-0.021,-0.512,0.108,-0.382,0.127,-0.364,0.045,0.364,-0.127,0.111,0.277,-0.214,-0.114,-0.074,-0.086,-0.147,0.225,0.162,0.056,-0.089,0.241,0.208,0.13,0.01,-0.146,0.303,-0.188,-0.103,-0.076,-0.1,-0.171,0.256,-0.235,0.215,0.133,0.01,-0.15,0.309,-0.182,-0.086,-0.048,-0.064,-0.127,0.209,0.115,-0.018,0.168,-0.003,0.186,0.049,-0.124,0.296,-0.195,-0.124,-0.109,-0.145,0.204,0.1,-0.043,0.198,0.084,-0.068,0.228,0.171,0.071,-0.068,0.218,0.143,0.026,-0.129,0.285,-0.205,-0.154,-0.157,0.188,0.056,-0.113,0.282,-0.209,-0.164,-0.172,0.206,0.107,-0.031,0.184,0.042,-0.134,0.308,-0.183,-0.088,-0.052,-0.068,-0.132,4.246,3.756,3.265,2.775,2.284,1.794,1.303,0.813,0.322,-0.168,-0.659,-1.149,-1.64,-2.13,-2.621,-3.111,-3.602,-4.092,-4.583,-5.073,-5.564,4.81,4.319,3.829,3.338,2.848,2.357,1.867,1.376,0.886,0.395,-0.095,-0.586,-1.076,-1.567,-2.057,-2.548,-3.038,-3.529,-4.019,-4.51,-5.0,4.287,3.796,3.306,2.815,2.325,1.834,1.344,0.853,0.363,-0.128,-0.618,-1.109,-1.599,-2.09,-2.58,-3.071,-3.561,-4.052,-4.542,3.767,3.277,2.786,2.296,1.805,1.315,0.824,0.334,-0.157,-0.647,-1.138,-1.628,-2.119,-2.609,-3.1,-3.59,-4.081,3.349,2.858,2.368,1.877,1.387,0.896,0.406,-0.085,-0.575,-1.066,-1.556,-2.047,-2.537,-3.028,-3.518,3.119,2.628,2.138,1.647,1.157,0.666,0.176,-0.315,-0.805,-1.296,-1.786,-2.277,-2.767,-3.258,2.667,2.176,1.686,1.195,0.705,0.214,-0.276,-0.767,-1.257,-1.748,-2.238,-2.729,2.555,2.064,1.574,1.083,0.593,0.102,-0.388,-0.879,-1.369,-1.86,-2.35,2.355,1.865,1.374,0.884,0.393,-0.097,-0.588,-1.078,-1.569,-2.059,2.127,1.636,1.146,0.655,0.165,-0.326,-0.816,-1.307,-1.797,1.921,1.431,0.94,0.45,-0.041,-0.531,-1.022,-1.512,1.785,1.295,0.804,0.314,-0.177,-0.667,-1.158,-1.648,1.27,0.78,0.289,-0.201,-0.692,-1.182,1.396,0.905,0.415,-0.076,-0.566,-1.057,1.214,0.724,0.233,-0.257,-0.748,-1.238,0.757,0.266,-0.224,-0.715,1.031,0.541,0.05,-0.44,-0.931,0.592,0.101,-0.389,-0.88,2.195,1.704,1.214,0.723,0.233,-0.258,-0.748,-1.239,-1.729,-2.22,-2.71,-3.201,3.275,2.785,2.294,1.804,1.313,0.823,0.332,-0.158,-0.649,-1.139,-1.63,-2.12,-2.611,-3.101,2.678,2.187,1.697,1.206,0.716,0.225,-0.265,-0.756,-1.246,-1.737,-2.227,-2.718,2.434,1.944,1.453,0.963,0.472,-0.018,-0.509,-0.999,-1.49,-1.98,-2.471,2.117,1.627,1.136,0.646,0.155,-0.335,-0.826,-1.316,-1.807,-2.297,1.783,1.292,0.802,0.311,-0.179,-0.67,-1.16,-1.651,-2.141,1.482,0.991,0.501,0.01,-0.48,-0.971,-1.461,1.75,1.26,0.769,0.279,-0.212,-0.702,-1.193,-1.683,1.158,0.668,0.177,-0.313,-0.804,-1.294,1.214,0.724,0.233,-0.257,-0.748,-1.238,0.97,0.48,-0.011,-0.501,-0.992,0.946,0.456,-0.035,-0.525,-1.016,0.68,0.19,-0.301,-0.791,0.686,0.195,-0.295,-0.786,0.494,0.004,-0.487,0.616,0.126,-0.365,0.579,0.089,-0.402,0.399,-0.092,-0.582,0.089,-0.402,0.153,-0.337,0.113,-0.377,-0.021,0.251,-0.239,-0.044,0.083,0.148,0.158,0.117,0.032,-0.094,0.231,0.178,0.082,-0.053,0.202,0.094,-0.052,0.209,0.115,-0.018,0.169,-0.001,0.183,0.041,-0.136,0.31,-0.18,-0.081,-0.041,-0.053,-0.114,0.196,0.077,-0.079,0.241,0.209,0.131,0.012,-0.144,0.3,-0.19,-0.11,-0.088,-0.116,-0.191,0.276,-0.214,-0.18,-0.198,0.237,0.196,0.11,-0.017,0.162,-0.022,0.213,0.127,0.0,0.147,-0.065,0.274,-0.216,-0.185,-0.206,0.247,2.381,1.89,1.4,0.909,0.419,-0.072,-0.562,-1.053,-1.543,-2.034,-2.524,-3.015,-3.505,3.323,2.832,2.342,1.851,1.361,0.87,0.38,-0.111,-0.601,-1.092,-1.582,-2.073,-2.563,-3.054,3.043,2.552,2.062,1.571,1.081,0.59,0.1,-0.391,-0.881,-1.372,-1.862,-2.353,-2.843,2.595,2.104,1.614,1.123,0.633,0.142,-0.348,-0.839,-1.329,-1.82,-2.31,-2.801,2.044,1.553,1.063,0.572,0.082,-0.409,-0.899,-1.39,-1.88,-2.371,1.941,1.45,0.96,0.469,-0.021,-0.512,-1.002,-1.493,-1.983,1.848,1.358,0.867,0.377,-0.114,-0.604,-1.095,-1.585,1.814,1.323,0.833,0.342,-0.148,-0.639,-1.129,-1.62,1.39,0.9,0.409,-0.081,-0.572,-1.062,-1.553,1.107,0.617,0.126,-0.364,-0.855,-1.345,1.0,0.509,0.019,-0.472,-0.962,1.099,0.609,0.118,-0.372,-0.863,0.943,0.453,-0.038,-0.528,-1.019,0.558,0.067,-0.423,-0.914,0.456,-0.034,-0.525,0.659,0.169,-0.322,0.694,0.204,-0.287,0.579,0.089,-0.402,0.328,-0.162,0.446,-0.045,0.453,-0.037,0.362,-0.128,0.182,-0.309,-0.078,0.08,0.173,0.208,0.19,0.126,0.018,-0.128,0.277,-0.213,-0.177,-0.194,0.232,0.182,0.089,-0.045,0.193,0.068,-0.093,0.259,-0.232,-0.23,0.251,-0.24,0.229,0.174,0.075,-0.063,0.212,0.126,-0.002,0.149,-0.059,0.266,-0.225,-0.211,0.223,0.155,0.046,-0.102,0.256,-0.235,0.215,0.134,0.012,-0.147,0.305,-0.185,-0.095,-0.063,-0.083,-0.151,0.234,0.189,0.1,2.455,1.965,1.474,0.984,0.493,0.003,-0.488,-0.978,-1.469,-1.959,-2.45,-2.94,-3.431,-3.921,3.048,2.558,2.067,1.577,1.086,0.596,0.105,-0.385,-0.876,-1.366,-1.857,-2.347,-2.838,-3.328,2.896,2.405,1.915,1.424,0.934,0.443,-0.047,-0.538,-1.028,-1.519,-2.009,-2.5,-2.99,2.562,2.072,1.581,1.091,0.6,0.11,-0.381,-0.871,-1.362,-1.852,-2.343,-2.833,2.115,1.624,1.134,0.643,0.153,-0.338,-0.828,-1.319,-1.809,-2.3,2.104,1.614,1.123,0.633,0.142,-0.348,-0.839,-1.329,-1.82,-2.31,1.605,1.114,0.624,0.133,-0.357,-0.848,-1.338,-1.829,1.646,1.155,0.665,0.174,-0.316,-0.807,-1.297,-1.788,1.29,0.799,0.309,-0.182,-0.672,-1.163,-1.653,1.068,0.577,0.087,-0.404,-0.894,-1.385,1.015,0.525,0.034,-0.456,-0.947,1.164,0.673,0.183,-0.308,-0.798,1.052,0.562,0.071,-0.419,-0.91,0.707,0.216,-0.274,-0.765,0.641,0.151,-0.34,-0.83,0.386,-0.104,-0.595,0.451,-0.04,-0.53,0.361,-0.129,-0.62,0.134,-0.356,0.273,-0.218,0.3,-0.191,0.226,-0.265,0.061,0.305,-0.185,-0.015,0.09,0.135,0.127,0.07,-0.03,0.152,-0.049,0.251,-0.24,0.228,0.172,0.072,-0.067,0.217,0.139,0.019,-0.137,0.294,-0.196,-0.127,-0.115,-0.152,0.211,0.122,-0.007,0.155,-0.041,0.24,0.204,0.123,0.001,0.142,-0.079,0.295,-0.196,-0.127,-0.114,-0.151,0.21,0.119,-0.012,0.161,-0.025,0.216,0.137,0.016,-0.141,0.299,-0.192,-0.115,3.255,2.764,2.274,1.783,1.293,0.802,0.312,-0.179,-0.669,-1.16,-1.65,-2.141,-2.631,-3.122,-3.612,-4.103,-4.593,3.897,3.406,2.916,2.425,1.935,1.444,0.954,0.463,-0.027,-0.518,-1.008,-1.499,-1.989,-2.48,-2.97,-3.461,-3.951,3.641,3.15,2.66,2.169,1.679,1.188,0.698,0.207,-0.283,-0.774,-1.264,-1.755,-2.245,-2.736,-3.226,-3.717,3.067,2.576,2.086,1.595,1.105,0.614,0.124,-0.367,-0.857,-1.348,-1.838,-2.329,-2.819,-3.31,2.746,2.256,1.765,1.275,0.784,0.294,-0.197,-0.687,-1.178,-1.668,-2.159,-2.649,2.752,2.262,1.771,1.281,0.79,0.3,-0.191,-0.681,-1.172,-1.662,-2.153,-2.643,2.169,1.679,1.188,0.698,0.207,-0.283,-0.774,-1.264,-1.755,-2.245,2.037,1.546,1.056,0.565,0.075,-0.416,-0.906,-1.397,-1.887,1.917,1.427,0.936,0.446,-0.045,-0.535,-1.026,-1.516,-2.007,1.369,0.878,0.388,-0.103,-0.593,-1.084,-1.574,1.414,0.924,0.433,-0.057,-0.548];
  const mk=(color,scale,cbx,title)=>({type:'scatter3d',mode:'markers',x:pc1,y:pc2,z:pc3,
    marker:{size:2.2,color:color,colorscale:scale,showscale:true,
            colorbar:{title:{text:title,font:{color:'#6c6f85'}},x:cbx,len:0.6,thickness:12,tickfont:{color:'#9ca0b0'}}},
    hoverinfo:'none'});
  const axp=t=>({title:{text:t,font:{color:'#6c6f85'}},gridcolor:'#c8ccd4',zerolinecolor:'#c8ccd4',showbackground:false,tickfont:{color:'#9ca0b0'}});
  const t1=mk(pos,'Viridis',0.43,'position x'); t1.scene='scene';
  const t2=mk(vel,'RdBu',1.0,'velocity v'); t2.scene='scene2';
  const sc=()=>({xaxis:axp('PC1'),yaxis:axp('PC2'),zaxis:axp('PC3'),aspectmode:'cube'});
  const layout={paper_bgcolor:'rgba(0,0,0,0)',margin:{l:0,r:0,t:24,b:0},showlegend:false,
    scene:{domain:{x:[0,0.48]},...sc()}, scene2:{domain:{x:[0.52,1]},...sc()},
    annotations:[{text:'coloured by position',x:0.21,y:1.0,xref:'paper',yref:'paper',showarrow:false,font:{color:'#6c6f85'}},
                 {text:'coloured by velocity',x:0.79,y:1.0,xref:'paper',yref:'paper',showarrow:false,font:{color:'#6c6f85'}}]};
  Plotly.newPlot('lat3d',[t1,t2],layout,{responsive:true,displayModeBar:false});
})();
</script>
<p>This is cool since you can clearly see two planes in the 3D plot which makes sense since we need two for position and velocity.</p>
</section>
<section id="why-care-about-a-toy-problem" class="level2">
<h2 class="anchored" data-anchor-id="why-care-about-a-toy-problem">Why care about a toy problem?</h2>
<p>Now, of course the bouncing ball is a toy, the encoder is an MLP, the whole thing trains in 60 epochs on a CPU, and none of it is going to drive a robot, but it at least verifies that the theory checks out.</p>
<p>“World model” sounds like a magic phrase, and when you build one and it’s an encoder, a predictor, and a regulariser. No stop-gradient, no target network, no momentum schedule. You can write it in an afternoon.</p>
<p>A world model is only ever as good as its observations. No loss function or clever regulariser is ever going to recover what isn’t in there. In our case a wider window did. “Make sure your observation actually determines the state you want” is unglamorous, it’s the sort of plumbing the frame-stack in every Atari agent quietly handles, and it was the whole ballgame here.</p>
<div class="callout callout-style-simple callout-none no-icon">
<div class="callout-body d-flex">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-body-container">
<p>Make sure your observation actually determines the state you want.</p>
</div>
</div>
</div>
</section>
<section id="what-i-would-do-next" class="level2">
<h2 class="anchored" data-anchor-id="what-i-would-do-next">What I would do next</h2>
<p>The obvious one is pushing velocity up. It lands around 0.6, right at the noisy linear ceiling, but I’m still handing the predictor <code>sign(v)</code> as an action, which lets the latent off the hook for the rest. Drop the action, or make the dynamics actually demand velocity magnitude (a little air resistance would do it), and the latent should be <em>forced</em> to carry a cleaner velocity axis. I’d like to watch that R² climb toward the position one as the incentive does.</p>
<p>Then a pendulum instead of a ball. Its state is still <code>(angle, angular velocity)</code>, but the geometry wraps around, so the natural latent is a cylinder rather than a sheet. With the frame-window lesson banked, the question is whether the JEPA lays that cylinder out as cleanly as it laid out <code>(x, v)</code> here.</p>
<p>There’s also the isotropy itself. SIGReg is supposed to drive the embeddings to a standard Gaussian, but if I actually look at the per-axis variances of the trained latent they’re all over the place, some squashed, some inflated. The representation works anyway, which suggests <code>λ = 1</code> is buying me “not collapsed” without buying me “actually <code>N(0, I)</code>”. Turning the weight up, or training longer, should tighten that, and I’d like to know whether a genuinely isotropic latent reads out any cleaner.</p>
<p>And the real version: pixels, a ViT encoder, and an actual control environment, which is what LeWM does. The whole point of the paper is that this heuristic-free recipe holds at that scale. I’ve only shown it survives contact with a bouncing ball. The interesting test is whether the same “no stop-gradient, one regulariser” story still stands when the encoder is 15M parameters and the input is an image.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>The world is, mostly, a thing that has more state than it shows you. A world model is a system that builds a representation of the state from observations and uses it to predict. A JEPA is one way to do that, in the embedding space instead of the observation space. The architecture is small, and the whole trick is the regulariser: get the distribution of the embeddings right and the collapse problem that the stop-gradient was invented to dodge simply doesn’t show up.</p>
<p>If you want to try this, the Flux code is straightforward to adapt to Lux, or even PyTorch. The hyperparameters matter but they are forgiving.</p>
<p>If you spot a mistake, in the code, in the math, in the intuition, please reach out.</p>
</section>
<section id="references" class="level2">




</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-assranSelfSupervisedLearningImages2023" class="csl-entry">
<span class="nocase">Assran, Mahmoud, Quentin Duval, Ishan Misra, et al.</span> 2023. <span>“Self-<span>Supervised Learning</span> from <span>Images</span> with a <span>Joint-Embedding Predictive Architecture</span>.”</span> <em>2023 <span>IEEE</span>/<span>CVF Conference</span> on <span>Computer Vision</span> and <span>Pattern Recognition</span> (<span>CVPR</span>)</em> (Vancouver, BC, Canada), June, 15619–29. <a href="https://doi.org/10.1109/CVPR52729.2023.01499">https://doi.org/10.1109/CVPR52729.2023.01499</a>.
</div>
<div id="ref-assranVJEPA2SelfSupervised2025" class="csl-entry">
<span class="nocase">Assran, Mido, Adrien Bardes, David Fan, et al.</span> 2025. <em>V-<span>JEPA</span> 2: <span>Self-Supervised Video Models Enable Understanding</span>, <span>Prediction</span> and <span>Planning</span></em>. arXiv:2506.09985. arXiv. <a href="https://doi.org/10.48550/arXiv.2506.09985">https://doi.org/10.48550/arXiv.2506.09985</a>.
</div>
<div id="ref-balestrieroLeJEPAProvableScalable2025" class="csl-entry">
Balestriero, Randall, and Yann LeCun. 2025. <em><span>LeJEPA</span>: <span>Provable</span> and <span>Scalable Self-Supervised Learning Without</span> the <span>Heuristics</span></em>. arXiv:2511.08544. arXiv. <a href="https://doi.org/10.48550/arXiv.2511.08544">https://doi.org/10.48550/arXiv.2511.08544</a>.
</div>
<div id="ref-haWorldModels2018" class="csl-entry">
Ha, David, and Jürgen Schmidhuber. 2018. <span>“World <span>Models</span>.”</span> March 28. <a href="https://doi.org/10.5281/zenodo.1207631">https://doi.org/10.5281/zenodo.1207631</a>.
</div>
<div id="ref-maesLeWorldModelStableEndtoEnd2026" class="csl-entry">
<span class="nocase">Maes, Lucas, Quentin Le Lidec, Damien Scieur, et al.</span> 2026. <em><span>LeWorldModel</span>: <span class="nocase">Stable End-to-End Joint-Embedding Predictive Architecture</span> from <span>Pixels</span></em>. arXiv:2603.19312. arXiv. <a href="https://doi.org/10.48550/arXiv.2603.19312">https://doi.org/10.48550/arXiv.2603.19312</a>.
</div>
<div id="ref-schmidhuberMakingWorldDifferentiable" class="csl-entry">
Schmidhuber, Jürgen. 1990. <em>Making the <span>World Differentiable</span>: <span>On Using Self-Supervised Fully Recurrent Neural Networks</span> for <span>Dynamic Reinforcement Learning</span> and <span>Planning</span> in <span>Non-Stationary Environments</span></em>. FKI-126-90. TUM.
</div>
</div></section></div> ]]></description>
  <category>jepa</category>
  <category>world-models</category>
  <category>julia</category>
  <category>self-supervised-learning</category>
  <category>neural-networks</category>
  <guid>https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/</guid>
  <pubDate>Thu, 04 Jun 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/building-a-jepa-world-model-from-scratch/figs/latent_probe.dark.png" medium="image" type="image/png" height="64" width="144"/>
</item>
<item>
  <title>Marketing Science: Why Most Brands Are Still Guessing</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/marketing-science-what-actually-works/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>OK, controversial statement incoming (and probably unpopular). Most marketing measurement is still built on the assumption that if you can track a click, you can explain an outcome.</p>
<p>That assumption died. Not due in a dramatic privacy regulation announcement, as you would think even though that of course played a role. IMHO it died quietly, over years, as cookie windows shrank, attribution models crumbled, and the gap between what dashboards show and what actually happens grew.</p>
<p>So what replaces it? That is a question a lot of marketing leaders should be asking right now. Some have answers (usually ones that sell something). I have one too, and mine happens to involve Bayesian statistics and a fair bit of physics intuition.</p>
<p>I know mentioning physics can seem a bit mathy and heavy but the point in this post is the thinking, not the formulas.</p>
</section>
<section id="the-attribution-problem-nobody-fixes" class="level2">
<h2 class="anchored" data-anchor-id="the-attribution-problem-nobody-fixes">The Attribution Problem Nobody Fixes</h2>
<p>Let me start with something concrete. Traditional attribution takes user journeys and assigns credit to touchpoints. Click a Facebook ad, view a search result, land on the site, convert. The attribution model (first-touch, last-touch, data-driven, Markov chains) splits the credit between those steps.</p>
<p>This is fine, in theory. The problem is the theory assumes you can observe all relevant touchpoints. You can’t. People see ads offline. They talk to friends. They remember a podcast from three weeks ago. None of that appears in the clickstream.</p>
<p>Worse, attribution models reward visibility, not causality. The channel that gets the most credit is often the one closest to the purchase moment or the one with the best tracking pixel, not the one that actually generated demand. I’ve seen this firsthand. The channel that gets the most credit is rarely the channel doing the heavy lifting. This is not a hunch: when <span class="citation" data-cites="gordon2019comparison">Gordon et al. (2019)</span> ran large field experiments at Facebook and compared the experimental ground truth against common attribution methods, the attribution numbers were off, sometimes by enough to flip the decision.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/attribution_vs_incrementality.light.png" alt="Bar chart comparing attribution credit against true incremental contribution per channel."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/attribution_vs_incrementality.dark.png" alt="Bar chart comparing attribution credit against true incremental contribution per channel.">
<figcaption class="figure-caption">
Last-touch attribution hands most of the credit to whatever channel sits closest to the conversion (branded search, retargeting) and starves the channels that actually generated the demand (paid social, TV/OOH). Optimize on the grey bars and you defund the teal ones.
</figcaption>
</figure>
<p>But why does this matter to us when building marketing systems? Because if you’re optimizing based on biased credit assignment, you’re not optimizing. You’re just playing Whac-A-Mole with your budget.</p>
</section>
<section id="incrementality-is-the-real-question" class="level2">
<h2 class="anchored" data-anchor-id="incrementality-is-the-real-question">Incrementality is “The Real Question”</h2>
<p>So what should we optimize for? Incrementality. The question is not “did they click?” The question is “would they have bought anyway?”</p>
<p>This is a causal question. Not statistical. Not correlational. Causal. And causal questions need either experiments (where you control what happens) or models that properly separate signal from the background noise.</p>
<p>Both approaches have a Bayesian core.</p>
<p>Experimental design (geo lift tests, holdout groups) tells you what works, but running them is expensive and slow. You’re splitting your market, holding back spend, and waiting weeks for results. Meanwhile your competitors aren’t waiting.</p>
<p>Models (marketing mix models at their best) tell you what’s happening right now, across all channels simultaneously, but they need honest priors and honest data. And honest data is hard to find when every dashboard is configured to make someone look good.</p>
</section>
<section id="the-bayesian-advantage-nobody-talks-about" class="level2">
<h2 class="anchored" data-anchor-id="the-bayesian-advantage-nobody-talks-about">The Bayesian Advantage Nobody Talks About</h2>
<p>In physics, when you measure something, you never get one clean number. You get an observation plus uncertainty. The uncertainty is not noise. The uncertainty is information.</p>
<p>Bayesian methods treat uncertainty as first-class <span class="citation" data-cites="gelman2013bayesian">(Gelman et al. 2013)</span>. Every parameter in a marketing mix model carries a posterior distribution, not a point estimate. That means when you ask “what’s the return on TV spend?” you don’t get “$4.20”. You get “$4.20, but it’s probably between $3.10 and $5.60 with 95% confidence, and here’s how confident we are in those bounds given the data you actually have.”</p>
<p>This is not a detail. This is the whole point.</p>
<p>When marketing leaders see a single number for campaign performance, they make decisions. Those decisions are often wrong because the uncertainty around that number matters more than the number itself. The point estimate is the least interesting thing about the result.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/roi_point_vs_distribution.light.png" alt="Left: bar chart of two channels with identical 4.2x ROAS. Right: their posterior distributions, one tight and one wide with 20% mass below break-even."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/roi_point_vs_distribution.dark.png" alt="Left: bar chart of two channels with identical 4.2x ROAS. Right: their posterior distributions, one tight and one wide with 20% mass below break-even.">
<figcaption class="figure-caption">
Two channels report the same point-estimate ROAS of 4.2x, so the dashboard says they are identical. The posteriors say otherwise: Channel A is a safe scale-up, while Channel B has a 20% chance of actually losing money. Same number, opposite decision.
</figcaption>
</figure>
</section>
<section id="marketing-mix-modeling-gets-a-bad-reputation-unfairly" class="level2">
<h2 class="anchored" data-anchor-id="marketing-mix-modeling-gets-a-bad-reputation-unfairly">Marketing Mix Modeling Gets a Bad Reputation (Unfairly)</h2>
<p>I know, I know. MMM has baggage. Everyone has a story where the model said spend more on OOH and growth flatlined.</p>
<p>Well, that’s total BS when it comes to the method itself. It’s great when executed properly with Bayesian foundations, honest data, and the humility to update the model when reality disagrees. It’s bad when you plug it into a dashboard, trust the outputs blindly, and never question the assumptions.</p>
<p>The old school MMM is coming back, because the alternatives broke. The privacy landscape forced the hand. Apple’s ATT, cookie deprecation, Google’s timeline delays then reversals, the GDPR reality on the ground. The tracking infrastructure that attribution depended on is crumbling, and the companies that built businesses on top of it are finally saying “maybe we need something else.”</p>
<p>The revival is real. The question is whether the new MMM will learn from the old mistakes or just repeat them with shinier priors. The good versions already exist in the literature: <span class="citation" data-cites="jin2017bayesian">Jin et al. (2017)</span> lay out a Bayesian MMM that handles carryover (adstock) and shape (saturation) effects properly, which is exactly the kind of structure the dashboard-era models skipped.</p>
</section>
<section id="what-i-actually-do-about-it" class="level2">
<h2 class="anchored" data-anchor-id="what-i-actually-do-about-it">What I Actually Do About It</h2>
<p>OK, I’ve complained enough. What do I actually do?</p>
<p>I run <a href="https://alviss.io">Alviss AI</a>. We provide decision infrastructure for marketing teams. Not dashboards, not reporting widgets, but systems that help companies separate what they want to believe from what’s actually happening. The product sits at the intersection of marketing science and proper measurement frameworks. The goal is to give marketing leaders models that carry their own uncertainty forward into the recommendations, so when the system says “shift budget from channel A to channel B,” it also tells you how confident it is in that shift and what could break the conclusion.</p>
<p>I’ll be the first to admit there’s still a lot more to understand in this space. The marketing measurement landscape is evolving fast, and the Bayesian tools need to keep up with the data problems, not the other way around.</p>
</section>
<section id="a-physics-lesson-for-marketing" class="level2">
<h2 class="anchored" data-anchor-id="a-physics-lesson-for-marketing">A Physics Lesson for Marketing</h2>
<p>Right, one more thought before I wrap this up.</p>
<p>In theoretical physics, we have this concept called a Hamiltonian. It’s a function that describes the total energy of a system. You write it down, you solve the equations of motion, and the system evolves. If your Hamiltonian is wrong, the whole simulation is wrong. No amount of compute fixes a wrong Hamiltonian.</p>
<p>Marketing mix modeling has the same problem. Your model structure is your Hamiltonian. If you get the structure wrong (wrong functional form for ad response, ignored saturation effects, no carry-over), the outputs are fiction, no matter how much data you pour in.</p>
<figure class="figure themed-figure">
<img class="figure-img img-fluid theme-light" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/saturation_curve.light.png" alt="Saturating ad-response curve versus a straight-line assumption, with the marginal return at current spend far below the average."> <img class="figure-img img-fluid theme-dark" src="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/saturation_curve.dark.png" alt="Saturating ad-response curve versus a straight-line assumption, with the marginal return at current spend far below the average.">
<figcaption class="figure-caption">
Get the functional form wrong and the numbers lie. Assume a straight line and the next dollar looks like it returns the average (1.07x). Model the saturation honestly and the marginal dollar at current spend returns less than half that (0.43x). Same spend, different structure, opposite call on whether to scale.
</figcaption>
</figure>
<p>The good news? There are principled ways to build the structure. Saturation curves from physics (Michaelis-Menten kinetics, if you want the nerdy reference) map perfectly to ad response curves. Bayesian hierarchical models let you borrow strength across channels while respecting their differences. The math exists. It’s been around. Nobody is inventing anything new.</p>
<p>We just need to use the right tools and stop pretending that click data is a proxy for truth.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Marketing science is not a sexy topic. It doesn’t generate keynotes or conference applause. But it is the backbone of how companies decide where money goes, which products get exposure, and whether growth is real or inflated by measurement artefacts.</p>
<p>The companies that get ahead are not the ones with the best dashboards. They’re the ones with the most honest measurement frameworks and the right infrastructure to make better decisions. That means Bayesian uncertainty, proper causal thinking, and the humility to admit when a model disagrees with reality.</p>
<p>The tools for better marketing measurement are already here. It’s time we used them properly.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-gelman2013bayesian" class="csl-entry">
Gelman, Andrew, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari, and Donald B. Rubin. 2013. <em>Bayesian Data Analysis</em>. 3rd ed. Chapman; Hall/CRC.
</div>
<div id="ref-gordon2019comparison" class="csl-entry">
Gordon, Brett R., Florian Zettelmeyer, Neha Bhargava, and Dan Chapsky. 2019. <span>“A Comparison of Approaches to Advertising Measurement: Evidence from Big Field Experiments at Facebook.”</span> <em>Marketing Science</em> 38 (2): 193–225. <a href="https://doi.org/10.1287/mksc.2018.1135">https://doi.org/10.1287/mksc.2018.1135</a>.
</div>
<div id="ref-jin2017bayesian" class="csl-entry">
Jin, Yuxue, Yueqing Wang, Yunting Sun, David Chan, and Jim Koehler. 2017. <em>Bayesian Methods for Media Mix Modeling with Carryover and Shape Effects</em>. Google Inc. <a href="https://research.google/pubs/pub46001/">https://research.google/pubs/pub46001/</a>.
</div>
</div></section></div> ]]></description>
  <category>marketing-science</category>
  <category>bayesian</category>
  <category>measurement</category>
  <category>mmm</category>
  <category>alviss</category>
  <guid>https://drmike.xyz/posts/marketing-science-what-actually-works/</guid>
  <pubDate>Fri, 29 May 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/marketing-science-what-actually-works/figs/attribution_vs_incrementality.dark.png" medium="image" type="image/png" height="68" width="144"/>
</item>
<item>
  <title>The Gradient, Jacobian, Hessian, and Laplacian</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/gradient-jacobian-hessian-laplacian/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>If you’ve spent any time training neural networks you’ve seen gradients everywhere. They’re the thing that makes learning happen. But gradients are just the beginning. There’s a whole family of mathematical operators sitting behind the scenes, and most ML practitioners only ever meet the first one. The rest (the Jacobian, the Hessian, and the Laplacian) tend to get a hand-wavy paragraph in a textbook and then everyone moves on.</p>
<p>I think that’s a shame. These operators aren’t abstract curiosities. They are the language physics uses to describe how fields change in space, how forces arise from potentials, and how heat flows through materials. The fact that machine learning rediscovered them independently should tell you something about how fundamental they are. So let’s walk through them properly. Not just “what they are” but where they come from, how they relate to each other, and why they matter when you’re building models.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/gradient-jacobian-hessian-laplacian/portrait-student-anime-style-attending-school.png" class="img-fluid figure-img"></p>
<figcaption>Image from Freepik</figcaption>
</figure>
</div>
<p>If you’ve read my earlier post on <a href="../../posts/a-quick-intro-to-derivatives/">derivatives</a> you’ll have the foundation we need. If not, the short version is: a derivative tells you how a function changes when you wiggle its input a little. Everything else builds from there.</p>
</section>
<section id="the-gradient" class="level2">
<h2 class="anchored" data-anchor-id="the-gradient">The gradient</h2>
<p>Ok so you have a function <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D)"> that takes a vector <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D%20=%20%5Bx_1,%20x_2,%20%5Cldots,%20x_n%5D%5ET"> and spits out a single number. A loss function, for instance. The gradient is just the vector of all partial derivatives of <img src="https://latex.codecogs.com/png.latex?f"> with respect to each input:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cnabla%20f(%5Cmathbf%7Bx%7D)%20=%20%5Cbegin%7Bbmatrix%7D%20%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20x_1%7D%20%5C%5C%20%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20x_2%7D%20%5C%5C%20%5Cvdots%20%5C%5C%20%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20x_n%7D%20%5Cend%7Bbmatrix%7D%0A"></p>
<p>That’s it. Each component tells you how much <img src="https://latex.codecogs.com/png.latex?f"> changes when you nudge the corresponding input variable. The gradient as a whole points in the direction of steepest ascent. If you want to minimize <img src="https://latex.codecogs.com/png.latex?f"> (which you usually do), you walk in the opposite direction. That’s gradient descent in a nutshell.</p>
<p>But here’s where the physics perspective adds something useful. In physics, the gradient of a scalar field gives you a vector field. If <img src="https://latex.codecogs.com/png.latex?f"> is a potential energy surface (think: a hilly landscape), then <img src="https://latex.codecogs.com/png.latex?-%5Cnabla%20f"> gives you the force field. A ball placed on that surface will roll in the direction of <img src="https://latex.codecogs.com/png.latex?-%5Cnabla%20f">. Gradient descent is literally simulating a ball rolling downhill on your loss surface. Not metaphorically. Literally. The math is the same.</p>
<blockquote class="blockquote">
<p>The gradient of a scalar field is a vector field pointing in the direction of steepest ascent. Negate it and you get the force that drives optimization.</p>
</blockquote>
<section id="a-concrete-example" class="level3">
<h3 class="anchored" data-anchor-id="a-concrete-example">A concrete example</h3>
<p>Let’s say <img src="https://latex.codecogs.com/png.latex?f(x_1,%20x_2)%20=%20x_1%5E2%20+%203x_1%20x_2%20+%20x_2%5E2">. The gradient is</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cnabla%20f%20=%20%5Cbegin%7Bbmatrix%7D%202x_1%20+%203x_2%20%5C%5C%203x_1%20+%202x_2%20%5Cend%7Bbmatrix%7D%0A"></p>
<p>At the point <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D%20=%20%5B1,%201%5D%5ET"> this evaluates to <img src="https://latex.codecogs.com/png.latex?%5B5,%205%5D%5ET">. So the function increases most steeply in the direction <img src="https://latex.codecogs.com/png.latex?%5B5,%205%5D%5ET">, and a gradient descent step would move you toward <img src="https://latex.codecogs.com/png.latex?%5B-5,%20-5%5D%5ET"> (scaled by some learning rate). Nothing mysterious.</p>
<p>Now, a question worth asking: the gradient tells you <em>which direction</em> to go, but does it tell you <em>how far</em>? No.&nbsp;And that’s where things get interesting.</p>
</section>
</section>
<section id="the-jacobian" class="level2">
<h2 class="anchored" data-anchor-id="the-jacobian">The Jacobian</h2>
<p>The gradient handles the case where your function maps <img src="https://latex.codecogs.com/png.latex?%5Cmathbb%7BR%7D%5En%0A%5Crightarrow%20%5Cmathbb%7BR%7D">: many inputs, one output. But what if you have many outputs too? A function <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bf%7D:%20%5Cmathbb%7BR%7D%5En%20%5Crightarrow%20%5Cmathbb%7BR%7D%5Em"> that maps <img src="https://latex.codecogs.com/png.latex?n"> inputs to <img src="https://latex.codecogs.com/png.latex?m"> outputs? This is exactly what a neural network layer does. It takes an input vector and produces an output vector.</p>
<p>The Jacobian is the natural generalization. Instead of stacking partial derivatives into a vector (gradient), you stack them into a matrix:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7BJ%7D%20=%20%5Cbegin%7Bbmatrix%7D%0A%5Cfrac%7B%5Cpartial%20f_1%7D%7B%5Cpartial%20x_1%7D%20&amp;%20%5Cfrac%7B%5Cpartial%20f_1%7D%7B%5Cpartial%20x_2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%20f_1%7D%7B%5Cpartial%20x_n%7D%20%5C%5C%0A%5Cfrac%7B%5Cpartial%20f_2%7D%7B%5Cpartial%20x_1%7D%20&amp;%20%5Cfrac%7B%5Cpartial%20f_2%7D%7B%5Cpartial%20x_2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%20f_2%7D%7B%5Cpartial%20x_n%7D%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Cfrac%7B%5Cpartial%20f_m%7D%7B%5Cpartial%20x_1%7D%20&amp;%20%5Cfrac%7B%5Cpartial%20f_m%7D%7B%5Cpartial%20x_2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%20f_m%7D%7B%5Cpartial%20x_n%7D%0A%5Cend%7Bbmatrix%7D%0A"></p>
<p>Each row <img src="https://latex.codecogs.com/png.latex?i"> is the gradient of the <img src="https://latex.codecogs.com/png.latex?i">-th output <img src="https://latex.codecogs.com/png.latex?f_i"> with respect to all inputs. So the Jacobian is really just a stack of gradients. If <img src="https://latex.codecogs.com/png.latex?m%20=%201"> (one output), the Jacobian collapses to the gradient (transposed). They’re the same thing in different clothes.</p>
<section id="why-this-matters-for-neural-networks" class="level3">
<h3 class="anchored" data-anchor-id="why-this-matters-for-neural-networks">Why this matters for neural networks</h3>
<p>Backpropagation is just repeated application of the chain rule through a composition of functions. Each layer in a neural network is a function, and the Jacobian of that layer tells you how its outputs change with respect to its inputs. When you chain layers together, the Jacobians multiply:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7BJ%7D_%7B%5Ctext%7Btotal%7D%7D%20=%20%5Cmathbf%7BJ%7D_L%20%5Ccdot%20%5Cmathbf%7BJ%7D_%7BL-1%7D%20%5Ccdots%20%5Cmathbf%7BJ%7D_2%20%5Ccdot%20%5Cmathbf%7BJ%7D_1%0A"></p>
<p>This is backpropagation. That’s literally all it is. A product of Jacobian matrices, evaluated at the current inputs, propagated backward through the network. When people talk about “vanishing gradients” in deep networks, they’re really talking about this product of Jacobians having eigenvalues less than 1, which causes the product to shrink exponentially with depth.</p>
</section>
<section id="the-jacobian-determinant" class="level3">
<h3 class="anchored" data-anchor-id="the-jacobian-determinant">The Jacobian determinant</h3>
<p>There’s another reason to care about the Jacobian (especially in physics and generative modeling): the determinant. When you apply a transformation <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bf%7D"> to a region of space, the absolute value of the Jacobian determinant <img src="https://latex.codecogs.com/png.latex?%7C%5Cdet(%5Cmathbf%7BJ%7D)%7C"> tells you how much the volume of that region changes.</p>
<p>This shows up directly in normalizing flows, a class of generative models where you transform a simple distribution (like a Gaussian) through a sequence of invertible functions to get a complex distribution. The change-of-variables formula requires the Jacobian determinant:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ap_Y(%5Cmathbf%7By%7D)%20=%20p_X(%5Cmathbf%7Bx%7D)%20%5Ccdot%20%7C%5Cdet(%5Cmathbf%7BJ%7D)%7C%5E%7B-1%7D%0A"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7By%7D%20=%20%5Cmathbf%7Bf%7D(%5Cmathbf%7Bx%7D)">. The entire architecture of normalizing flows is designed to make this determinant cheap to compute. So when someone says “we need a triangular Jacobian for efficiency,” now you know what they mean and why.</p>
</section>
</section>
<section id="the-hessian" class="level2">
<h2 class="anchored" data-anchor-id="the-hessian">The Hessian</h2>
<p>Ok so the gradient tells you the slope. But the slope itself can change. Is the surface curving sharply or gently? Is it curving the same way in all directions? The Hessian answers these questions.</p>
<p>The Hessian is the matrix of second-order partial derivatives of a scalar function <img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%5En%20%5Crightarrow%20%5Cmathbb%7BR%7D">:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7BH%7D%20=%20%5Cbegin%7Bbmatrix%7D%0A%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_1%5E2%7D%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_1%20%5Cpartial%20x_2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_1%20%5Cpartial%20x_n%7D%20%5C%5C%0A%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_2%20%5Cpartial%20x_1%7D%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_2%5E2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_2%20%5Cpartial%20x_n%7D%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_n%20%5Cpartial%20x_1%7D%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_n%20%5Cpartial%20x_2%7D%20&amp;%20%5Ccdots%20&amp;%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_n%5E2%7D%0A%5Cend%7Bbmatrix%7D%0A"></p>
<p>Or more compactly: <img src="https://latex.codecogs.com/png.latex?H_%7Bij%7D%20=%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_i%20%5Cpartial%20x_j%7D">. If <img src="https://latex.codecogs.com/png.latex?f"> is twice continuously differentiable (which it usually is in ML), then <img src="https://latex.codecogs.com/png.latex?H_%7Bij%7D%20=%20H_%7Bji%7D"> and the Hessian is symmetric. This is Schwarz’s theorem and it’s actually quite important because it means the Hessian has real eigenvalues, which we can interpret.</p>
<p>You might have noticed something. The Hessian is the Jacobian of the gradient. Just as the Jacobian generalizes the gradient to vector-valued functions, the Hessian is what you get when you apply the Jacobian operator to the gradient vector field:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7BH%7D%20=%20%5Cmathbf%7BJ%7D(%5Cnabla%20f)%0A"></p>
<p>These operators are nested. They build on each other.</p>
<section id="what-the-eigenvalues-tell-you" class="level3">
<h3 class="anchored" data-anchor-id="what-the-eigenvalues-tell-you">What the eigenvalues tell you</h3>
<p>Here’s where the Hessian becomes really powerful. The eigenvalues of the Hessian at a critical point (where <img src="https://latex.codecogs.com/png.latex?%5Cnabla%20f%20=%200">) tell you the nature of that point:</p>
<ul>
<li><strong>All eigenvalues positive</strong>: you’re at a local minimum. The surface curves upward in every direction. Congratulations.</li>
<li><strong>All eigenvalues negative</strong>: local maximum. Curves down everywhere. (Rare in ML loss landscapes, but it happens.)</li>
<li><strong>Mixed signs</strong>: saddle point. It’s a minimum in some directions and a maximum in others. In high-dimensional optimization, saddle points are far more common than local minima. This is one of the most important insights in modern deep learning theory.</li>
</ul>
</section>
<section id="newtons-method" class="level3">
<h3 class="anchored" data-anchor-id="newtons-method">Newton’s method</h3>
<p>The Hessian enables second-order optimization. While gradient descent uses only the slope to decide where to go, Newton’s method uses both the slope and the curvature:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7Bx%7D%5E%7Bnew%7D%20=%20%5Cmathbf%7Bx%7D%5E%7Bold%7D%20-%20%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cnabla%20f%0A"></p>
<p>The intuition is this: in a region where the surface curves sharply, you should take a small step (the curvature is large, so the gradient changes fast). In a flat region, you can take a big step. The Hessian inverse automatically scales the gradient by the curvature, giving you an adaptive step size per direction.</p>
<p>The catch? Computing the full Hessian for a neural network with millions of parameters means storing and inverting an <img src="https://latex.codecogs.com/png.latex?n%20%5Ctimes%20n"> matrix where <img src="https://latex.codecogs.com/png.latex?n"> is in the millions. That’s <img src="https://latex.codecogs.com/png.latex?O(n%5E2)"> memory and <img src="https://latex.codecogs.com/png.latex?O(n%5E3)"> for inversion. Not exactly practical. This is why methods like L-BFGS (which approximate the Hessian) and Adam (which approximates the diagonal of the Hessian with running averages) are so popular. They give you some of the curvature information without the full cost.</p>
</section>
<section id="a-physics-perspective" class="level3">
<h3 class="anchored" data-anchor-id="a-physics-perspective">A physics perspective</h3>
<p>In physics, the Hessian shows up when you study small oscillations around equilibrium. If you have a potential energy surface <img src="https://latex.codecogs.com/png.latex?V(%5Cmathbf%7Bx%7D)"> and a particle sitting at a minimum, the Hessian of <img src="https://latex.codecogs.com/png.latex?V"> at that point gives you the spring constants in every direction. The eigenvalues are the squared frequencies of the normal modes of vibration. This is how you analyze molecular vibrations, crystal lattice dynamics, and yes, the “vibrations” around minima in loss landscapes. Same math, different context.</p>
</section>
</section>
<section id="the-laplacian" class="level2">
<h2 class="anchored" data-anchor-id="the-laplacian">The Laplacian</h2>
<p>Now for the final member of our family. The Laplacian is the trace of the Hessian. Or equivalently, the sum of the unmixed second partial derivatives:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5CDelta%20f%20=%20%5Cnabla%5E2%20f%20=%20%5Csum_%7Bi=1%7D%5E%7Bn%7D%20%5Cfrac%7B%5Cpartial%5E2%20f%7D%7B%5Cpartial%20x_i%5E2%7D%20=%20%5Ctext%7Btr%7D(%5Cmathbf%7BH%7D)%0A"></p>
<p>Where the gradient gives you a vector, and the Hessian gives you a matrix, the Laplacian collapses everything back to a single scalar. It’s a measure of the average curvature at a point. Or more precisely: it tells you how much the value of <img src="https://latex.codecogs.com/png.latex?f"> at a point differs from the average value of <img src="https://latex.codecogs.com/png.latex?f"> in a small neighborhood around that point.</p>
<p>If <img src="https://latex.codecogs.com/png.latex?%5CDelta%20f%20%3E%200"> at a point, the function value is below the neighborhood average (the surface is concave up, like a valley). If <img src="https://latex.codecogs.com/png.latex?%5CDelta%20f%20%3C%200">, the function value is above the average (concave down, like a hilltop).</p>
<section id="diffusion-and-the-heat-equation" class="level3">
<h3 class="anchored" data-anchor-id="diffusion-and-the-heat-equation">Diffusion and the heat equation</h3>
<p>This is where the physics story really pays off. The heat equation, one of the most fundamental PDEs in physics, is:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cfrac%7B%5Cpartial%20u%7D%7B%5Cpartial%20t%7D%20=%20%5Calpha%20%5Cnabla%5E2%20u%0A"></p>
<p>It says that temperature <img src="https://latex.codecogs.com/png.latex?u"> changes over time in proportion to its Laplacian. If a point is hotter than its neighbors (<img src="https://latex.codecogs.com/png.latex?%5Cnabla%5E2%20u%20%3C%200">), it cools down. If it’s cooler (<img src="https://latex.codecogs.com/png.latex?%5Cnabla%5E2%20u%20%3E%200">), it heats up. The Laplacian is the engine of diffusion.</p>
<p>Why should you care? Because diffusion models (the kind behind Stable Diffusion, DALL-E, etc.) are literally built on this idea. They add noise to data (forward diffusion) and then learn to reverse the process (denoising). The score function that these models learn is closely related to the gradient of the log-density, and the dynamics of the diffusion process are governed by a stochastic differential equation that has the Laplacian baked in. When people say “score-based generative models,” the score is <img src="https://latex.codecogs.com/png.latex?%5Cnabla_%5Cmathbf%7Bx%7D%20%5Clog%20p(%5Cmathbf%7Bx%7D)"> and the diffusion process follows a Fokker-Planck equation involving <img src="https://latex.codecogs.com/png.latex?%5Cnabla%5E2">.</p>
</section>
<section id="graph-laplacians" class="level3">
<h3 class="anchored" data-anchor-id="graph-laplacians">Graph Laplacians</h3>
<p>There’s also a discrete version of the Laplacian that shows up in graph neural networks. For a graph with adjacency matrix <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BA%7D"> and degree matrix <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BD%7D">, the graph Laplacian is:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cmathbf%7BL%7D%20=%20%5Cmathbf%7BD%7D%20-%20%5Cmathbf%7BA%7D%0A"></p>
<p>This discrete Laplacian has the same interpretation as its continuous cousin: it measures how much a node’s value differs from its neighbors’ values. Graph convolution operations in GNNs are essentially applications of the graph Laplacian, smoothing signals over the graph topology. Spectral graph theory, which underlies many GNN architectures, is built entirely on the eigenvalues and eigenvectors of <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BL%7D">.</p>
</section>
<section id="regularization" class="level3">
<h3 class="anchored" data-anchor-id="regularization">Regularization</h3>
<p>The Laplacian also appears in regularization. Penalizing the Laplacian of a function (or its discrete approximation) encourages smoothness. This is the basis of Laplacian smoothing in image processing and mesh processing. In ML, Laplacian regularization in semi-supervised learning encourages the model to produce similar predictions for nearby points in the data graph.</p>
</section>
</section>
<section id="how-they-all-fit-together" class="level2">
<h2 class="anchored" data-anchor-id="how-they-all-fit-together">How they all fit together</h2>
<p>Let’s put the hierarchy in one place:</p>
<table class="caption-top table">
<colgroup>
<col style="width: 22%">
<col style="width: 15%">
<col style="width: 18%">
<col style="width: 43%">
</colgroup>
<thead>
<tr class="header">
<th>Operator</th>
<th>Input</th>
<th>Output</th>
<th>What it tells you</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Gradient</strong> <img src="https://latex.codecogs.com/png.latex?%5Cnabla%20f"></td>
<td><img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%5En%20%5Cto%20%5Cmathbb%7BR%7D"></td>
<td>Vector (<img src="https://latex.codecogs.com/png.latex?%5Cmathbb%7BR%7D%5En">)</td>
<td>Direction of steepest ascent</td>
</tr>
<tr class="even">
<td><strong>Jacobian</strong> <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BJ%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bf%7D:%20%5Cmathbb%7BR%7D%5En%20%5Cto%20%5Cmathbb%7BR%7D%5Em"></td>
<td>Matrix (<img src="https://latex.codecogs.com/png.latex?%5Cmathbb%7BR%7D%5E%7Bm%20%5Ctimes%20n%7D">)</td>
<td>How each output changes w.r.t. each input</td>
</tr>
<tr class="odd">
<td><strong>Hessian</strong> <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%5En%20%5Cto%20%5Cmathbb%7BR%7D"></td>
<td>Matrix (<img src="https://latex.codecogs.com/png.latex?%5Cmathbb%7BR%7D%5E%7Bn%20%5Ctimes%20n%7D">)</td>
<td>Curvature of <img src="https://latex.codecogs.com/png.latex?f"> in every direction</td>
</tr>
<tr class="even">
<td><strong>Laplacian</strong> <img src="https://latex.codecogs.com/png.latex?%5CDelta%20f"></td>
<td><img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%5En%20%5Cto%20%5Cmathbb%7BR%7D"></td>
<td>Scalar (<img src="https://latex.codecogs.com/png.latex?%5Cmathbb%7BR%7D">)</td>
<td>Average curvature (trace of Hessian)</td>
</tr>
</tbody>
</table>
<p>The relationships:</p>
<ul>
<li>The gradient is a special case of the Jacobian (when <img src="https://latex.codecogs.com/png.latex?m%20=%201">).</li>
<li>The Hessian is the Jacobian of the gradient.</li>
<li>The Laplacian is the trace of the Hessian.</li>
</ul>
<p>Each one peels back another layer of information about how your function behaves. The gradient gives direction. The Jacobian extends that to multi-output functions. The Hessian reveals curvature. The Laplacian summarizes that curvature into a single number.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>I’ve heard people say “you don’t need to understand the math to do machine learning.” That’s technically true, the same way you don’t need to understand combustion to drive a car. But if you’re building the engine, debugging a misfire, or trying to make the thing go faster, it helps to know what’s actually happening.</p>
<p>These four operators (the gradient, Jacobian, Hessian, and Laplacian) are the vocabulary that physics developed over centuries to describe how fields change in space. Machine learning borrowed this vocabulary, sometimes without realizing it. Backpropagation is Jacobian products. Adam approximates the Hessian diagonal. Diffusion models are Laplacian dynamics. Normalizing flows are Jacobian determinants. It’s all connected.</p>
<p>The more of this you internalize, the less “magical” these algorithms feel. And the less magical they feel, the better you get at building them, fixing them, and knowing when they’re lying to you.</p>
<p>Don’t hesitate to reach out if I’ve made any mistakes or if something could be explained more clearly. I’m always happy to be corrected.</p>


</section>

 ]]></description>
  <category>ai</category>
  <category>learning</category>
  <category>physics</category>
  <category>machine learning</category>
  <category>gradient</category>
  <category>jacobian</category>
  <category>hessian</category>
  <category>laplacian</category>
  <guid>https://drmike.xyz/posts/gradient-jacobian-hessian-laplacian/</guid>
  <pubDate>Sun, 05 Apr 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/gradient-jacobian-hessian-laplacian/portrait-student-anime-style-attending-school.png" medium="image" type="image/png" height="103" width="144"/>
</item>
<item>
  <title>A Law That Should Disturb Every One of Us</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/death-penalty-law-speak-up/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I don’t usually write about legislation. My usual territory is neural networks, Bayesian methods, and the occasional rant about European tech sovereignty. But some things cut through everything else. Some things demand that you stop what you’re doing and say something. This is one of those things.</p>
<p>On March 30, 2026, the Israeli Knesset passed a law making the death penalty the default sentence for Palestinians convicted in military courts of deadly attacks <span class="citation" data-cites="timesofisrael2026knesset">(The Times of Israel 2026)</span>. Not Israeli citizens. Not settlers. Palestinians. Exclusively.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/death-penalty-law-speak-up/Knesset-Ben-Gvir.webp" class="img-fluid figure-img"></p>
<figcaption>Israel’s Minister of National Security, Itamar Ben-Gvir, center, and lawmakers celebrate after Israel’s parliament passed a law approving the death penalty for Palestinians convicted of murdering Israelis, at the Knesset in Jerusalem Monday, March 30, 2026. (AP Photo/Itay Cohen)</figcaption>
</figure>
</div>
<p>Let me say that again so it lands. A state passed a law that imposes the death penalty on people based on who they are. Not what they did. Who they are.</p>
<p>I’m writing this because the Party of European Socialists <span class="citation" data-cites="pes2026condemns">(Party of European Socialists 2026)</span> and the S&amp;D Group in the European Parliament <span class="citation" data-cites="sd2026deathpenalty">(Socialists and Democrats 2026)</span> have condemned this law and called for the immediate suspension of the EU-Israel Association Agreement. I support that condemnation fully. And I think you should too.</p>
</section>
<section id="what-the-law-actually-does" class="level2">
<h2 class="anchored" data-anchor-id="what-the-law-actually-does">What the Law Actually Does</h2>
<p>Let’s be precise about what we’re talking about, because the details matter.</p>
<p>The law, pushed by far-right National Security Minister Itamar Ben-Gvir, makes execution the default sentence for Palestinians convicted of deadly attacks <span class="citation" data-cites="aljazeera2026whatis">(Al Jazeera 2026c)</span>. But here’s where it gets truly ugly.</p>
<p>Israeli citizens and settlers are explicitly excluded from military court jurisdiction. They get tried in civilian courts, with civilian protections, civilian appeals processes, and civilian legal standards. Palestinians face military tribunals. Two populations. Two completely different legal systems. One land.</p>
<p>The procedural provisions are staggering:</p>
<ul>
<li>Execution must be carried out within 90 days. Ninety days. That’s three months from conviction to death, with severely limited time for appeals.</li>
<li>Access to legal counsel is restricted.</li>
<li>Family visits are restricted.</li>
<li>Judicial discretion is gutted. Judges can only impose a life sentence instead of death in vague “exceptional cases.”</li>
<li>Sentence commutation is prohibited entirely.</li>
<li>Execution personnel receive legal immunity.</li>
</ul>
<p>These provisions are documented in detail by Human Rights Watch <span class="citation" data-cites="hrw2026discriminatory">(Human Rights Watch 2026)</span>.</p>
<p>Now, consider this in context. The Israeli human rights organization B’Tselem has documented that military trials of Palestinians carry an approximately 96% conviction rate. Ninety-six percent. Based largely on confessions extracted under duress and torture.</p>
<p>So what we’re looking at is a system where Palestinians are tried in military courts with a near-certain conviction rate, based on coerced confessions, with a mandatory death sentence, with almost no appeals window, and no possibility of commutation. And this system applies to Palestinians and Palestinians alone.</p>
<p>That’s not a justice system. That’s an apparatus.</p>
</section>
<section id="the-international-response" class="level2">
<h2 class="anchored" data-anchor-id="the-international-response">The International Response</h2>
<p>Credit where it’s due. The international community has not been silent on this one.</p>
<p>UN human rights experts condemned the law as constituting a “discriminatory regime of capital punishment” that “manifestly violates Israel’s obligations under international human rights law” <span class="citation" data-cites="ohchr2026discriminatory">(Office of the United Nations High Commissioner for Human Rights 2026)</span>. They called for its immediate repeal.</p>
<p>Human Rights Watch was characteristically direct. Their deputy Middle East director stated: “Israeli officials argue that imposing the death penalty is about security, but in reality, it entrenches discrimination and a two-tiered system of justice, both hallmarks of apartheid” <span class="citation" data-cites="hrw2026discriminatory">(Human Rights Watch 2026)</span>.</p>
<p>Apartheid. That’s not a word thrown around lightly by Human Rights Watch. When they use it, they mean it in the precise legal sense.</p>
<p>France, Germany, Italy, and the United Kingdom have all raised concerns <span class="citation" data-cites="aljazeera2026worldreacts">(Al Jazeera 2026a)</span>. Amnesty International has called for urgent EU measures <span class="citation" data-cites="amnesty2026urgent">(Amnesty International 2026)</span>.</p>
<p>And the Party of European Socialists <span class="citation" data-cites="pes2026condemns">(Party of European Socialists 2026)</span>, along with the S&amp;D Group in the European Parliament, have taken the strongest institutional European stance. They’ve called for the immediate suspension of the EU-Israel Association Agreement. Yannis Maniatis, the S&amp;D Group’s vice-president for foreign affairs, put it plainly: “Reintroducing the death penalty is a step back into the past and yet another blow to the values that underpin our partnership with Israel. We cannot and will not remain silent. When a partner repeatedly ignores the warnings from its friends and civil society alike, there must be consequences” <span class="citation" data-cites="sd2026deathpenalty">(Socialists and Democrats 2026)</span>.</p>
<p>The S&amp;D described the law as a “grave democratic regression.” I’d call it something worse, but that framing carries weight in the European institutional context where it matters most.</p>
</section>
<section id="why-this-should-concern-you-personally" class="level2">
<h2 class="anchored" data-anchor-id="why-this-should-concern-you-personally">Why This Should Concern You Personally</h2>
<p>I know what some of you might be thinking. “This is terrible, but what does it have to do with me? I’m a software engineer in Stockholm (or Berlin, or Copenhagen, or wherever).”</p>
<p>Here’s why it concerns you.</p>
<p>The EU-Israel Association Agreement, which governs trade and political relations between Europe and Israel, contains an Article 2. That article conditions the entire agreement on respect for human rights and democratic principles. It’s not decorative language. It’s a legal obligation. And every time the EU fails to enforce it, that article becomes more meaningless. Not just for Israel. For every agreement the EU signs with every partner.</p>
<p>When Europe trades with a state that institutes ethnically targeted death penalty laws and does nothing, it sends a message. That message is: our values are negotiable. Our principles are for show. And that message weakens the foundations of the European project itself.</p>
<p>Over 9,300 Palestinians are currently detained in Israeli prisons, reportedly experiencing torture, starvation, and medical neglect <span class="citation" data-cites="aljazeera2026apartheid">(Al Jazeera 2026b)</span>. This new law doesn’t exist in isolation. It’s the sharpest edge of a system that has been documented and condemned by virtually every major human rights organization on the planet.</p>
<p>As Europeans, we are connected to this. Our governments maintain diplomatic and trade relationships with Israel. Our tax money flows into institutions that could act but choose not to. Our silence is a form of participation.</p>
</section>
<section id="what-you-can-do" class="level2">
<h2 class="anchored" data-anchor-id="what-you-can-do">What You Can Do</h2>
<p>I’m not interested in writing posts that make people feel bad and then give them nothing to do with that feeling. Outrage without action is just entertainment. So here’s what you can actually do.</p>
<p><strong>Contact your elected representatives.</strong> If you’re in the EU, write to your MEPs. Tell them you support the suspension of the EU-Israel Association Agreement under Article 2. Be specific. Name the law. Name the article. MEPs pay attention to constituent mail more than you’d think, especially when it’s specific and informed. You can find your MEPs at the European Parliament’s website and most of them have public email addresses.</p>
<p><strong>Support the organizations doing the work.</strong> Human Rights Watch, Amnesty International, B’Tselem, and the Palestinian human rights organization Al-Haq are all on the ground documenting what’s happening. They need funding. Even small amounts matter. These organizations are the reason we have the documented facts I cited in this post.</p>
<p><strong>Demand your government takes a position.</strong> France, Germany, Italy, and the UK have “raised concerns.” Concerns are not enough. Push for your government to take concrete diplomatic action. Recall ambassadors. Suspend arms sales. Support referrals to the International Criminal Court. Diplomatic language is designed to sound like action while being none. Don’t let them get away with it.</p>
<p><strong>Amplify Palestinian voices.</strong> Palestinians have been telling the world about these systems for decades. Organizations like the Palestinian Centre for Human Rights, Addameer (the prisoner support organization), and Defence for Children International Palestine document these realities daily. Follow them. Share their work. Let the people most affected by this law be heard.</p>
<p><strong>Talk about it.</strong> I know this sounds simple, but social pressure is real. Bring it up with friends, colleagues, at dinner. Not to lecture. Just to make it visible. The machinery of oppression relies on people looking away. The single most subversive thing you can do is refuse to look away.</p>
<p><strong>Make purchasing decisions that reflect your values.</strong> Look into which companies operate in or profit from the occupation. There are well-documented guides from organizations like the BDS movement. You don’t have to agree with every position to use the information to make informed choices about where your money goes.</p>
</section>
<section id="a-note-on-courage" class="level2">
<h2 class="anchored" data-anchor-id="a-note-on-courage">A Note on Courage</h2>
<p>I spent years in the Swedish Navy special operations. One thing that experience burned into me is that courage isn’t the absence of risk. It’s the decision that something matters more than the risk.</p>
<p>Speaking up about this carries social risk. I know that. People will disagree. Some will be angry. Some will call this post one-sided.</p>
<p>But here’s what I know. When a state passes a law that imposes death on people based on their ethnicity, tried in courts with a 96% conviction rate based on coerced confessions, with 90 days to execution and no possibility of commutation, there is no “other side” that makes this acceptable. There is no framing that makes this compatible with basic human rights.</p>
<p>The PES and the S&amp;D Group understood this. The UN human rights experts understood this. Human Rights Watch understood this. It’s time the rest of us acted like we understood it too.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>This law is not an abstract policy debate. It is a concrete, operational framework for state-sanctioned killing along ethnic lines. Every major human rights institution in the world has said so. The question is whether we’re going to treat that consensus as something that demands action, or something we scroll past.</p>
<p>Europe has a particular responsibility here. We have the institutional mechanisms (the Association Agreement, the European Parliament, our diplomatic weight) to exert real pressure. The PES and S&amp;D have pointed the way. The question is whether the rest of European leadership will follow.</p>
<p>I don’t have all the answers. I’m a physicist who builds AI systems, not a diplomat. But I know this: when something is clearly, unambiguously wrong, the people who said nothing are remembered just as well as the people who did it.</p>
<p>Speak up. Act. Don’t look away.</p>



</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-aljazeera2026worldreacts" class="csl-entry">
Al Jazeera. 2026a. <em>’Dangerous Escalation’: World Reacts to <span>Israel</span> Passing Death Penalty Law — Aljazeera.com</em>. <a href="https://www.aljazeera.com/news/2026/3/30/dangerous-escalation-world-reacts-to-israel-passing-death-penalty-law" class="uri">Https://www.aljazeera.com/news/2026/3/30/dangerous-escalation-world-reacts-to-israel-passing-death-penalty-law</a>.
</div>
<div id="ref-aljazeera2026apartheid" class="csl-entry">
Al Jazeera. 2026b. <em>’This Is an Apartheid Regime’: Critics Decry <span class="nocase">Israel’s</span> New Death Penalty Law — Aljazeera.com</em>. <a href="https://www.aljazeera.com/news/2026/4/1/this-is-an-apartheid-regime-critics-decry-israels-new-death-penalty-law" class="uri">Https://www.aljazeera.com/news/2026/4/1/this-is-an-apartheid-regime-critics-decry-israels-new-death-penalty-law</a>.
</div>
<div id="ref-aljazeera2026whatis" class="csl-entry">
Al Jazeera. 2026c. <em>What’s <span class="nocase">Israel’s</span> Death Penalty Law That Only Applies to <span>Palestinians</span>? — Aljazeera.com</em>. <a href="https://www.aljazeera.com/news/2026/3/31/whats-israels-death-penalty-law-that-only-applies-to-palestinians" class="uri">Https://www.aljazeera.com/news/2026/3/31/whats-israels-death-penalty-law-that-only-applies-to-palestinians</a>.
</div>
<div id="ref-amnesty2026urgent" class="csl-entry">
Amnesty International. 2026. <em><span>EU/Israel</span>: Adoption of Death Penalty Law by the <span>Israeli</span> <span>Knesset</span> Requires Urgent <span>EU</span> Measures — Amnesty.org</em>. <a href="https://www.amnesty.org/en/latest/news/2026/04/eu-israel-adoption-of-death-penalty-law-by-the-israeli-knesset-requires-urgent-eu-measures-joint-statement/" class="uri">Https://www.amnesty.org/en/latest/news/2026/04/eu-israel-adoption-of-death-penalty-law-by-the-israeli-knesset-requires-urgent-eu-measures-joint-statement/</a>.
</div>
<div id="ref-hrw2026discriminatory" class="csl-entry">
Human Rights Watch. 2026. <em><span>Israel</span>: Discriminatory Death Penalty Bill Passes — Hrw.org</em>. <a href="https://www.hrw.org/news/2026/03/31/israel-discriminatory-death-penalty-bill-passes" class="uri">Https://www.hrw.org/news/2026/03/31/israel-discriminatory-death-penalty-bill-passes</a>.
</div>
<div id="ref-ohchr2026discriminatory" class="csl-entry">
Office of the United Nations High Commissioner for Human Rights. 2026. <em><span class="nocase">Israel’s</span> Death Penalty Law Constitutes Discriminatory Regime of Capital Punishment: <span>UN</span> Experts — Ohchr.org</em>. <a href="https://www.ohchr.org/en/press-releases/2026/04/israels-death-penalty-law-constitutes-discriminatory-regime-capital" class="uri">Https://www.ohchr.org/en/press-releases/2026/04/israels-death-penalty-law-constitutes-discriminatory-regime-capital</a>.
</div>
<div id="ref-pes2026condemns" class="csl-entry">
Party of European Socialists. 2026. <em><span>PES</span> Condemns <span>Israeli</span> Death Penalty Law Targeting <span>Palestinians</span> — Pes.eu</em>. <a href="https://pes.eu/international/pes-condemns-israeli-death-penalty-law-targeting-palestinians/" class="uri">Https://pes.eu/international/pes-condemns-israeli-death-penalty-law-targeting-palestinians/</a>.
</div>
<div id="ref-sd2026deathpenalty" class="csl-entry">
Socialists and Democrats. 2026. <em>Death Penalty Vote: The Tipping Point for Suspending the <span>EU-Israel</span> Association Agreement — Socialistsanddemocrats.eu</em>. <a href="https://www.socialistsanddemocrats.eu/newsroom/death-penalty-vote-tipping-point-suspending-eu-israel-association-agreement" class="uri">Https://www.socialistsanddemocrats.eu/newsroom/death-penalty-vote-tipping-point-suspending-eu-israel-association-agreement</a>.
</div>
<div id="ref-timesofisrael2026knesset" class="csl-entry">
The Times of Israel. 2026. <em><span>Knesset</span> Passes Death Penalty Law for <span>Palestinians</span> Convicted of Deadly Acts of Terror — Timesofisrael.com</em>. <a href="https://www.timesofisrael.com/knesset-passes-death-penalty-law-for-palestinians-convicted-of-deadly-acts-of-terror/" class="uri">Https://www.timesofisrael.com/knesset-passes-death-penalty-law-for-palestinians-convicted-of-deadly-acts-of-terror/</a>.
</div>
</div></section></div> ]]></description>
  <category>human-rights</category>
  <category>international-law</category>
  <category>europe</category>
  <category>accountability</category>
  <guid>https://drmike.xyz/posts/death-penalty-law-speak-up/</guid>
  <pubDate>Sat, 04 Apr 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/death-penalty-law-speak-up/Knesset-Ben-Gvir.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Of monsters and large language models</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/of-monsters-and-language-models/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>Recently, there’s been another surge of posts on social media subscribing to the Big AI narrative of OpenAI, Anthropic, Google etc. While of course people may say and think what they want, I feel that this talking point is really not helping anyone except these big corporations to maintain the illusionary moat of AI supremacy. I’m not contesting the results achieved by the massive LLMs on benchmark tasks. It’s impressive and useful in its own right. Let’s put aside all the benchmark hacking there is <span class="citation" data-cites="zheng2025cheating">(Zheng et al. 2025)</span> for a moment and just be impressed with what has been achieved with these large models. They have indeed broken boundaries we were facing before 2020 and as a consequence there’s been a myriad of products and services developed. In the midst of this the concept of “Agents” have surfaced again (it is not new) where several LLMs are linked together with tools, e.g., APIs and databases. The purpose here is to let the LLMs get access to functions that are deterministic by nature. As an example, it is utter nonsense to try to use an LLM to answer a question of what 3.17 + 6.912 is. They can do it today but it’s an enormous waste that they have this information stored when they really should be calling a tool <span class="citation" data-cites="schickToolformerLanguageModels2023">(Schick et al. 2023)</span> instead.</p>
<p>You might wonder how all of this would fit together: LLM, Chat interface, Agents, Tools, APIs etc. I’ve given it a shot at showing just how these things are typically connected. We’re still in the infancy of discovering all the types of setups we can do here and what they in turn will be capable of.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/of-monsters-and-language-models/agentarch.svg" class="img-fluid figure-img"></p>
<figcaption>An illustration of how AI Agents get access to external tools and databases.</figcaption>
</figure>
</div>
</section>
<section id="architecture-of-an-ai-assistant" class="level2">
<h2 class="anchored" data-anchor-id="architecture-of-an-ai-assistant">Architecture of an AI Assistant</h2>
<p>While there are many assistants out there, very few of them are actually able to do useful stuff. By stuff, I mean like answering your emails for you, prioritizing your day, paying your bills, cancelling subscriptions, call your mom, monitor your investments etc. The reason for this is twofold (i) it’s pretty darn hard to do right and (ii) the consequence of getting it wrong can be socially and financially catastrophic.</p>
<p>So what do we need for this to be practically achievable? Well, we need a language model that understands tool calling <span class="citation" data-cites="dingUnifiedToolIntegration2025">(Ding and Stevens 2025)</span>. This is an architecture that can emit tokens (text) that lets whoever is receiving that text know that they would like to call a tool. How this tool is supposed to be called can be learned either by a “Skill” or directly via an MCP server. The important thing here is that none of this requires a 5 trillion parameter model. The ability to understand when to call a tool and what arguments to pass is a capability that smaller models handle perfectly well. In fact, models like Qwen3:8b and Llama 3.1:8b have been specifically trained for tool calling and do a solid job of it.</p>
<p>And that brings me to the question I want to explore in this post: if a small model running on your laptop can do the things you actually need, why are we collectively pretending that only the biggest models matter?</p>
</section>
<section id="a-tale-of-david-and-goliath" class="level2">
<h2 class="anchored" data-anchor-id="a-tale-of-david-and-goliath">A tale of David and Goliath</h2>
<p>To put my money where my mouth is, I’m going to run a series of common tasks using both the biggest cloud models (GPT-5.2, Deepseek 2026) and a small local model (Qwen3:8b running via Ollama on my AMD Ryzen AI 7 350 with a Radeon 860M). No cherry-picking. I’ll show you the actual responses and let you judge.</p>
<p>The tasks I’ve chosen are deliberately mundane. Summarization, advice, and explaining a concept. These are the kinds of things people actually use LLMs for every day, not exotic benchmarks designed to stress-test reasoning at scale. My argument is simple: for everyday tasks, the small model does the job. And it does it at a fraction of the energy cost.</p>
</section>
<section id="summarization-task" class="level2">
<h2 class="anchored" data-anchor-id="summarization-task">Summarization task</h2>
<p>The text we’re going to summarize is the preface from Malcolm Gladwell’s “What the dog saw” <span class="citation" data-cites="gladwell2009what">(Gladwell 2009)</span>.</p>
<section id="preface" class="level3">
<h3 class="anchored" data-anchor-id="preface">Preface</h3>
<p>When I was a small child, I used to sneak into my father’s study and leaf through the papers on his desk. He is a mathematician. He wrote on graph paper, in pencil — long rows of neatly written numbers and figures. I would sit on the edge of his chair and look at each page with puzzlement and wonder. It seemed miraculous, first of all, that he got paid for what seemed, at the time, like gibberish. But more important, I couldn’t get over the fact that someone whom I loved so dearly did something every day, inside his own head, that I could not begin to understand.</p>
<p>This was actually a version of what I would later learn psychologists call the other minds problem. One-year-olds think that if they like Goldfish Crackers, then Mommy and Daddy must like Goldfish Crackers, too: they have not grasped the idea that what is inside their head is different from what is inside everyone else’s head. Sooner or later, though, children come to understand that Mommy and Daddy don’t necessarily like Goldfish, too, and that moment is one of the great cognitive milestones of human development. Why is a two-year-old so terrible? Because she is systematically testing the fascinating and, to her, utterly novel notion that something that gives her pleasure might not actually give someone else pleasure—and the truth is that as adults we never lose that fascination. What is the first thing that we want to know when we meet someone who is a doctor at a social occasion? It isn’t “What do you do?” We know, sort of, what a doctor does. Instead, we want to know what it means to be with sick people all day long. We want to know what it feels like to be a doctor, because we’re quite sure that it doesn’t feel at all like what it means to sit at a computer all day long, or teach school, or sell cars. Such questions are not dumb or obvious. Curiosity about the interior life of other people’s day-today work is one of the most fundamental of human impulses, and that same impulse is what led to the writing you now hold in your hands.</p>
</section>
<section id="prompt" class="level3">
<h3 class="anchored" data-anchor-id="prompt">Prompt</h3>
<blockquote class="blockquote">
<p>Summarize the text below in 2 sentences</p>
</blockquote>
<p>Locally on my computer this corresponds to running</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Summarize the text below in 2 sentences </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> mgv1.md<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">ollama</span> run qwen3:8b </span></code></pre></div></div>
<p>which is put in a script called <code>summary.sh</code> which I use for energy consumption measurement below.</p>
<section id="response-from-chatgpt---gpt-5.2" class="level4">
<h4 class="anchored" data-anchor-id="response-from-chatgpt---gpt-5.2">Response from ChatGPT - GPT-5.2</h4>
<blockquote class="blockquote">
<p>The author recalls childhood wonder at her mathematician father’s incomprehensible work, which sparked an early awareness that other people’s minds and inner experiences differ from one’s own. She connects this realization to a fundamental human curiosity about what it feels like to live and work inside someone else’s mind, a curiosity that motivates both everyday questions and the writing of this book.</p>
</blockquote>
</section>
<section id="response-from-qwen38b" class="level4">
<h4 class="anchored" data-anchor-id="response-from-qwen38b">Response from Qwen3:8b</h4>
<blockquote class="blockquote">
<p>The author recalls childhood fascination with their mathematician father’s work, highlighting the mystery of understanding others’ inner lives, which ties into the “other minds problem” in psychology. This curiosity about others’ experiences, from childhood to adulthood, drives the author’s exploration of human cognition and forms the basis of their book.</p>
</blockquote>
<p>I don’t know about you but to me these answers are both perfectly fine. One might even go so far as to say that the Qwen3:8b did a better job as it didn’t assume the author was female. Now, I want you to think about the fact that GPT-5.2 is estimated to be in the vicinity of 2 to 5 trillion parameters. That’s a minimum of 2,000,000,000,000 parameters. Compare this to Qwen3:8b which has 8 billion parameters. This means, in the 5 trillion case, that GPT-5.2 is a whoppin’ 625 times larger.</p>
<p>A single query sent to ChatGPT amounts to around 2.1 Wh <span class="citation" data-cites="surfsharkMuchEnergy">(Costa et al. 2025)</span>. That’s the equivalent of your 1000 W microwave running for 7.2 seconds. That may not sound like much but this should be seen in the context that nearly everyone is writing questions to LLMs today even if you’re only searching, as the search engines typically automatically provide you with LLM context. If you’re interested in more numbers I invite you to look at the research sheet <a href="https://docs.google.com/spreadsheets/d/1tQCdd1DjJ5gDzDypZzlBAsr4ma9Dnbq5OOoqoQM4aVQ/edit?usp=sharing">here</a>. When I run the local LLM on my computer (AMD Ryzen AI 7 350 w/ Radeon 860M) with the same query it consumes 0.2 Wh which is less than 10% of what the query would have used had I sent it to ChatGPT instead.</p>
<p>The energy was measured using the <code>perf</code> program on my Arch Linux machine as follows.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sudo</span> perf stat <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-e</span> power/energy-pkg/ ./summary.sh</span>
<span id="cb2-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Performance counter stats for 'system wide':</span></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#         794.12 Joules power/energy-pkg/</span></span>
<span id="cb2-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   39.278005283 seconds time elapsed</span></span></code></pre></div></div>
<p>There are many error margins to be aware of in my comparison here but I hope you can appreciate the magnitude of the difference.</p>
</section>
</section>
</section>
<section id="giving-advice-task" class="level2">
<h2 class="anchored" data-anchor-id="giving-advice-task">Giving advice task</h2>
<section id="prompt-1" class="level3">
<h3 class="anchored" data-anchor-id="prompt-1">Prompt</h3>
<blockquote class="blockquote">
<p>I want to wash my car. The car wash is just 200 meters down the street. Should I walk or drive there?</p>
</blockquote>
<p>Again the command on my local computer would be</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I want to wash my car. The car wash is just 200 meters </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-2"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">down the street. Should I walk or drive there?"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">ollama</span> run qwen3:8b </span></code></pre></div></div>
<p>which prints the response to the console or your chat app. But as before let’s start with the big gun. The latest Deepseek model from the website followed by the ChatGPT.</p>
<section id="response-from-deepseek---2026" class="level4">
<h4 class="anchored" data-anchor-id="response-from-deepseek---2026">Response from Deepseek - 2026</h4>
<blockquote class="blockquote">
<p>If the car wash is only 200 meters away, <strong>walking</strong> makes more sense:</p>
<ul>
<li><strong>Driving:</strong> You’d start the car, move it a short distance, likely wait, and use fuel/electricity for negligible benefit.<br>
</li>
<li><strong>Walking:</strong> You avoid moving a dirty car onto a clean one if you go after washing, get a bit of exercise, and save the hassle of parking.</li>
</ul>
<p>Unless you have heavy supplies to carry or mobility constraints, walking is quicker and simpler.</p>
</blockquote>
</section>
<section id="response-from-chatgpt-april-2-2026" class="level4">
<h4 class="anchored" data-anchor-id="response-from-chatgpt-april-2-2026">Response from ChatGPT (April 2, 2026)</h4>
<blockquote class="blockquote">
<p>If it’s literally <strong>200 meters</strong>, walking is the smarter move in almost every case.</p>
<p>Driving such a short distance means:</p>
<ul>
<li>You’ll spend almost as much time getting in/out and maneuvering as you would just walking</li>
<li>The engine doesn’t even warm up properly (not great for the car long-term)</li>
<li>You’ll burn fuel and create unnecessary wear for basically no benefit</li>
</ul>
<p>Walking, on the other hand:</p>
<ul>
<li>Takes maybe <strong>2–3 minutes</strong></li>
<li>Saves fuel and hassle</li>
<li>Gives you a quick bit of fresh air</li>
</ul>
<p>The only real reasons to drive would be:</p>
<ul>
<li>It’s freezing, pouring rain, or you’re carrying a lot of stuff</li>
<li>The car wash requires the car to already be inside (like an automated entrance setup)</li>
</ul>
<p>Otherwise, just walk over, bring your keys, and drive it into the wash when you get there 👍</p>
</blockquote>
</section>
<section id="response-from-qwen38b-1" class="level4">
<h4 class="anchored">Response from Qwen3:8b</h4>
<blockquote class="blockquote">
<p>To determine whether you should walk or drive to the car wash, consider the following:</p>
<h3 id="key-factors" class="anchored" data-anchor-id="response-from-qwen38b-1">Key Factors:</h3>
<ol type="1">
<li><strong>Distance</strong>: The car wash is <strong>200 meters</strong> away, which is a very short distance.</li>
<li><strong>Purpose</strong>: You want to <strong>wash your car</strong>, which typically requires bringing your car to the car wash (unless it’s a self-service option at the location).</li>
<li><strong>Efficiency</strong>: Driving is faster for such a short distance, especially if you need to bring your car to the car wash.</li>
</ol>
<h3 id="analysis" class="anchored">Analysis:</h3>
<ul>
<li><strong>Walking</strong>: While 200 meters is a short walk, walking would not allow you to <strong>bring your car</strong> to the car wash. Unless the car wash is located near your home and you can walk to it while keeping your car nearby (which is unlikely), walking is not practical for washing your car.</li>
<li><strong>Driving</strong>: Driving 200 meters is quick and efficient. You can start the car, drive to the car wash, park, and proceed to wash your car. This is the most straightforward method.</li>
</ul>
<h3 id="conclusion" class="anchored">Conclusion:</h3>
<p><strong>Drive to the car wash.</strong> Driving is faster and allows you to bring your car to the location, making it the more practical choice for washing your car. Walking would not be feasible unless you have an alternative way to transport your car, which is not indicated here.</p>
</blockquote>
<p>I don’t know about you but I didn’t like either of these responses. The one from Deepseek and ChatGPT completely misses the mark. It tells you to walk to the car wash which of course defeats the purpose of bringing the car. The local model gets the right answer but is rather confused about it and takes a long detour to get there. So again, very little benefit of a bigger model here. If anything, the small model outperformed the big one on basic common sense.</p>
</section>
</section>
</section>
<section id="explaining-a-concept" class="level2">
<h2 class="anchored" data-anchor-id="explaining-a-concept">Explaining a concept</h2>
<p>For the third task I asked both models to explain quantum mechanics in a short paragraph. This is a knowledge task where you might expect the bigger model to have an edge due to the sheer amount of training data it has absorbed.</p>
<section id="prompt-2" class="level3">
<h3 class="anchored" data-anchor-id="prompt-2">Prompt</h3>
<blockquote class="blockquote">
<p>Create a small paragraph explaining quantum mechanics.</p>
</blockquote>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Create a small paragraph explaining quantum mechanics."</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb4-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">ollama</span> run qwen3:8b </span></code></pre></div></div>
<section id="response-from-chatgpt---gpt-5.2-1" class="level4">
<h4 class="anchored" data-anchor-id="response-from-chatgpt---gpt-5.2-1">Response from ChatGPT - GPT-5.2</h4>
<blockquote class="blockquote">
<p>Quantum mechanics is a branch of physics that studies how matter and energy behave at extremely small scales, such as atoms and subatomic particles. Unlike everyday objects, particles in quantum systems can exist in multiple states at once (a concept called superposition) and can be linked across distances through entanglement, meaning the state of one instantly affects another. Instead of precise outcomes, quantum mechanics often deals with probabilities, describing what is most likely to happen rather than what definitely will happen. This framework has led to many modern technologies, including semiconductors, lasers, and quantum computing.</p>
</blockquote>
</section>
<section id="response-from-qwen38b-2" class="level4">
<h4 class="anchored" data-anchor-id="response-from-qwen38b-2">Response from Qwen3:8b</h4>
<blockquote class="blockquote">
<p>Quantum mechanics is a branch of physics that describes the behavior of matter and energy at the smallest scales, such as atoms and subatomic particles. Unlike classical physics, it reveals that particles can exist in multiple states simultaneously (superposition) and can be entangled, meaning the state of one particle is instantly linked to another, even across vast distances. These phenomena challenge classical intuitions, as measurements often yield probabilistic outcomes rather than definite results. It underpins modern technologies like semiconductors and lasers, and remains central to understanding the fundamental nature of reality at the quantum level.</p>
</blockquote>
<p>Ok so these are essentially the same answer. Both cover superposition, entanglement, probabilistic outcomes, and applications (semiconductors, lasers, quantum computing). The structure is similar, the accuracy is similar, and as someone with a doctorate in theoretical physics I’d say both are perfectly serviceable introductions. Neither says anything wrong. Neither says anything the other doesn’t.</p>
<p>And that’s exactly my point. For a knowledge task like this, the 8 billion parameter model running on my laptop produced output that is functionally indistinguishable from the trillion-parameter cloud model. Same content, same structure, same level of accuracy. The 625x size difference bought you nothing.</p>
</section>
</section>
</section>
<section id="what-the-numbers-tell-us" class="level2">
<h2 class="anchored" data-anchor-id="what-the-numbers-tell-us">What the numbers tell us</h2>
<p>Let’s put the results side by side.</p>
<table class="caption-top table">
<colgroup>
<col style="width: 13%">
<col style="width: 25%">
<col style="width: 43%">
<col style="width: 18%">
</colgroup>
<thead>
<tr class="header">
<th>Task</th>
<th>Big model</th>
<th>Qwen3:8b (local)</th>
<th>Winner</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Summarization</td>
<td>Good (assumed gender)</td>
<td>Good (gender neutral)</td>
<td>Qwen3:8b</td>
</tr>
<tr class="even">
<td>Advice</td>
<td>Wrong (walk to car wash)</td>
<td>Right (drive)</td>
<td>Qwen3:8b</td>
</tr>
<tr class="odd">
<td>Explanation</td>
<td>Good</td>
<td>Equally good</td>
<td>Tie</td>
</tr>
</tbody>
</table>
<p>Score: <strong>Qwen3:8b wins 2, ties 1, loses 0.</strong> Against models that are 625 times larger.</p>
<p>Now let’s talk about what this costs. As I showed earlier, a single ChatGPT query consumes roughly 2.1 Wh while my local query consumed about 0.2 Wh. If you scale this to an organization sending, say, 1000 queries per day, the cloud approach burns 2,100 Wh (2.1 kWh) per day while the local approach uses 200 Wh (0.2 kWh). Over a year that’s 766 kWh versus 73 kWh. Multiply that across every company, every developer, every casual user, and you start to see why the energy argument matters even if you don’t care about the environmental angle (you should, but that’s a different post).</p>
<p>And the energy is only part of the story. There’s also the question of where your data goes. Every query you send to OpenAI, Anthropic, or Google travels to their servers, gets logged, and feeds their systems. When you run a local model, your data stays on your machine. For anyone working with sensitive business data, customer information, or anything remotely confidential, this isn’t a nice-to-have. It’s a requirement.</p>
</section>
<section id="conclusion-1" class="level2">
<h2 class="anchored" data-anchor-id="conclusion-1">Conclusion</h2>
<p>Look, I’m not saying big models are useless. They clearly have their place in complex reasoning tasks, multilingual generation, and problems where you genuinely need the breadth of knowledge that comes from training on the entire internet. I use them myself for certain things.</p>
<p>What I am saying is that the narrative of “bigger is always better” is convenient for the companies selling API access at scale and inconvenient for everyone else. The truth, as these simple experiments show, is that for the vast majority of what people actually use LLMs for (summarizing text, answering questions, drafting content, explaining concepts) a small model running locally does the job just as well. Sometimes better.</p>
<p>This matters for Europe especially (I’ve <a href="../../posts/european-alternatives/">written about this before</a>). If we accept the premise that only trillion-parameter models from American corporations can do useful AI work, then we’ve already lost. We become permanent API consumers, sending our data and our money across the Atlantic in exchange for a service we could provide ourselves. The small model movement (and it is a movement, with Mistral, Qwen, Llama, and others leading the way) is one of the most important developments in AI precisely because it breaks this dependency.</p>
<p>Run your own models. Measure the actual difference on your actual tasks. I think you’ll find, as I did, that the monster under the bed isn’t nearly as scary as they want you to believe.</p>
</section>
<section id="references" class="level2">




</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-surfsharkMuchEnergy" class="csl-entry">
Costa, Luís, Emilija Kucinskaite, and Vaidas Ruzgas. 2025. <em><span>H</span>ow Much Energy Does Generative <span>A</span><span>I</span> Use? - <span>S</span>urfshark — Surfshark.com</em>. <a href="https://surfshark.com/research/chart/chatbots-energy-consumption" class="uri">Https://surfshark.com/research/chart/chatbots-energy-consumption</a>.
</div>
<div id="ref-dingUnifiedToolIntegration2025" class="csl-entry">
Ding, Peng, and Rick Stevens. 2025. <em>Unified <span>Tool Integration</span> for <span>LLMs</span>: <span>A Protocol-Agnostic Approach</span> to <span>Function Calling</span></em>. arXiv:2508.02979. arXiv. <a href="https://doi.org/10.48550/arXiv.2508.02979">https://doi.org/10.48550/arXiv.2508.02979</a>.
</div>
<div id="ref-gladwell2009what" class="csl-entry">
Gladwell, Malcolm. 2009. <em>What the Dog Saw: And Other Adventures</em>. Hachette UK.
</div>
<div id="ref-schickToolformerLanguageModels2023" class="csl-entry">
Schick, Timo, Jane Dwivedi-Yu, Roberto Dessì, et al. 2023. <em>Toolformer: <span>Language Models Can Teach Themselves</span> to <span>Use Tools</span></em>. arXiv:2302.04761. arXiv. <a href="https://doi.org/10.48550/arXiv.2302.04761">https://doi.org/10.48550/arXiv.2302.04761</a>.
</div>
<div id="ref-zheng2025cheating" class="csl-entry">
Zheng, Xiaosen, Tianyu Pang, Chao Du, Qian Liu, Jing Jiang, and Min Lin. 2025. <em>Cheating Automatic LLM Benchmarks: Null Models Achieve High Win Rates</em>. <a href="https://arxiv.org/abs/2410.07137">https://arxiv.org/abs/2410.07137</a>.
</div>
</div></section></div> ]]></description>
  <category>language models</category>
  <category>llms</category>
  <category>neural networks</category>
  <category>energy</category>
  <category>european sovereignty</category>
  <guid>https://drmike.xyz/posts/of-monsters-and-language-models/</guid>
  <pubDate>Wed, 01 Apr 2026 22:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/of-monsters-and-language-models/agentarch.png" medium="image" type="image/png" height="123" width="144"/>
</item>
<item>
  <title>How I got rid of American Technology and why you should too</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/european-alternatives/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>For those living in Europe, it’s no secret that we are navigating a complex and volatile global landscape. Recent actions by the United States including its inhumane stance on Gaza <span class="citation" data-cites="theguardianGenocideGaza">(Segal 2025)</span>, missile strikes in Iran <span class="citation" data-cites="theconversationStrikesIran">(Rothwell 2025)</span>, and the kidnapping of Venezuela’s leader <span class="citation" data-cites="independentTrumpsAttack">(Mascaro et al. 2026)</span> have raised serious concerns. Add to this the problematic TikTok acquisition and content controls <span class="citation" data-cites="arstechnicaTikTokUsers">(Belanger 2026)</span>, and even the surreal speculation about purchasing Greenland <span class="citation" data-cites="politifactFactcheckingTrumps">(Abels 2026)</span>. It’s understandable to feel a sense of dismay.</p>
<div class="quarto-video"><video id="video_shortcode_videojs_video1" width="300" class="video-js vjs-default-skin vjs-big-play-centered " controls="" preload="auto" data-setup="{}" title=""><source src="tiktok-ceo-comments.webm"></video></div>
<p>Yet in moments like these, action matters more than despair. As businesses and consumers, we hold more power than we might realize. If Europe collectively shifts away from American software and cloud services toward homegrown alternatives, we can send a clear message while building a more independent, self-sufficient digital economy.</p>
</section>
<section id="finding-alternatives" class="level2">
<h2 class="anchored" data-anchor-id="finding-alternatives">Finding alternatives</h2>
<p>It’s easy to think that we don’t have alternatives here in Europe, but this is simply not true. There’s a long list of alternatives <span class="citation" data-cites="europeanalternativesEuropeanAlternatives">(Graf 2025)</span> which can be utilized. Both commercial and open source software and solutions are available. Even if you don’t really know what to look for you can use the categories to navigate when looking for “Cloud” replacements for example.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/european-alternatives/scrot.png" class="img-fluid figure-img"></p>
<figcaption>A website for <a href="https://european-alternatives.eu">European alternatives</a>.</figcaption>
</figure>
</div>
<p>This should be enough for anyone to get started. I cannot say that it doesn’t involve work, but I can say that it’s worth it. Every second of it.</p>
<section id="key-advantages-of-eu-alternatives" class="level3">
<h3 class="anchored" data-anchor-id="key-advantages-of-eu-alternatives">Key Advantages of EU Alternatives:</h3>
<ul>
<li>✅ GDPR Compliance by design</li>
<li>✅ EU Data Sovereignty (data stays within EU borders)</li>
<li>✅ Avoids US Cloud Act jurisdiction</li>
<li>✅ Often open-source and self-hostable</li>
<li>✅ Privacy-focused by default</li>
</ul>
</section>
</section>
<section id="what-about-hardware" class="level2">
<h2 class="anchored" data-anchor-id="what-about-hardware">What about hardware?</h2>
<p>Hardware often comes up as a problematic area on our way towards independence, and while it’s true that when it comes to mobile phones and laptops we have few optionshere in the EU these options do exist. One example of a european phone maker is <a href="https://commerce.jolla.com/">Jolla</a> which is a bunch of ex Nokia guys making a cool new phone. Another is <a href="https://www.hmd.com/">HMD</a> which is part of the <a href="https://www.hmd.com/en_int/better-phone-project">Better Phone Project</a> and creates european phones.</p>
<p>When it comes to computers there are also alternatives of course. One cool supplier here is <a href="https://slimbook.com/en/">Slimbook</a> who produce beautiful computers that come with Linux or Windows preinstalled. Naturally, since this is about European alternatives I would strongly suggest that you choose a Linux based operating system.</p>
</section>
<section id="what-i-have-done" class="level2">
<h2 class="anchored" data-anchor-id="what-i-have-done">What I have done</h2>
<p>I have a pretty large setup where I have used a bunch of different technologies but I will list the ones I think most people will want an alternative to.</p>
<div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div>
<p></p><figure class="figure"><p></p>
<div>
<pre class="mermaid mermaid-js">mindmap
  root((European&lt;br&gt;Software))
    Cloud Providers
        Hetzner
        Contabo
        Nextcloud
    Communication
        Proton Mail
        Mailbox.org
        Thunderbird
    Social Networks
        Signal
        Mostodon.Social
    Office Productivity
        Libreoffice
        Nextcloud
    Photo &amp; Video &amp; Music
        Immich
        Synchthing
        Deezer
        JellyFin
    Browsers
        Firefox
        Zen-Browser
    Maps
        OpenStreetMap
        HERE WeGo
    Search
        Startpage
        Qwant
</pre>
</div>
<p></p></figure><p></p>
</div>
</div>
</div>
<section id="communication" class="level3">
<h3 class="anchored" data-anchor-id="communication">Communication</h3>
<p>Email is obviously the elephant in the room as I assume many are using Gmail today. I replaced my Gmail with <a href="https://proton.me/">Proton</a> mail. They have a free alternative which was good enough for me and my family.</p>
<p>For instant messaging I replaced Whatsapp, Google Chat etc. with <a href="https://signal.org/">Signal</a> wich is free and <strong>secure</strong>.</p>
</section>
<section id="productivity" class="level3">
<h3 class="anchored" data-anchor-id="productivity">Productivity</h3>
<p>This was a no brainer as Microsoft Office (Excel, Word, PowerPoint et. al.) was easily replaced with <a href="https://www.libreoffice.org/">LibreOffice</a>.</p>
<p>Cloud versions like Teams, Sharepoint I replaced with <a href="https://nextcloud.com/">Nextcloud</a> which can be self-hosted or commercially hosted for you. In my opinion this is also much easier and safer to work with than Microsoft or Google cloud. Or as they themselves put it:</p>
<div class="callout callout-style-simple callout-none no-icon callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">None</span>Regain control over your data
</div>
</div>
<div class="callout-body-container callout-body">
<p>The better Microsoft 365 for private clouds.</p>
</div>
</div>
</section>
<section id="photos-and-videos" class="level3">
<h3 class="anchored" data-anchor-id="photos-and-videos">Photos and Videos</h3>
<p>I replaced Google Photos with a self-hosted Immich server. This allows me to keep all my photos backed up and they are sitting safely on my own hardware on my own network. My whole family is synching their photos from their phone to our family drive where each of them have their own passwords and accounts. We can also use shared folders to share memories and events with our extended family and loved ones. Again this was super easy to setup and all it took was a Raspberry PI with a 4 TB drive and some docker knowledge. If you don’t know how to do it I bet you know someone around you that does. I don’t know about you, but I feel much better knowing the photos of my children do not end up in Google’s or any other big cloud providers drives.</p>
</section>
<section id="hardware" class="level3">
<h3 class="anchored" data-anchor-id="hardware">Hardware</h3>
<p>I replaced my OnePlus Nord (which I really love by the way) with a Jolla C2. It took some getting used to but in general all is working well.</p>
<p>My laptop I got from Slimbook as mentioned above and as I’m running Arch Linux this was not only a good alternative, it was a better choice altogether since I didn’t have to deal with compatibility issues with computers made for Microsoft Windows.</p>
</section>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>Switching to European and open-source alternatives is an important move toward two vital goals:</p>
<ul>
<li>Building a strong, independent Europe capable of digital self-reliance.</li>
<li>Peacefully protesting harmful policies promoted by the current US administration.</li>
</ul>
<p>As the old saying goes:</p>
<blockquote class="blockquote">
<p>A friend who bullies us is no longer a friend.</p>
</blockquote>
<p>The tools for change are already here. It’s time we used them.</p>
</section>
<section id="references" class="level2">




</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-politifactFactcheckingTrumps" class="csl-entry">
Abels, Grace. 2026. <em><span>F</span>act-Checking <span>T</span>rump’s Text on <span>G</span>reenland and <span>D</span>enmark — Politifact.com</em>. <a href="https://www.politifact.com/article/2026/jan/20/denmark-greenland-trump-written-documents-own/" class="uri">Https://www.politifact.com/article/2026/jan/20/denmark-greenland-trump-written-documents-own/</a>.
</div>
<div id="ref-arstechnicaTikTokUsers" class="csl-entry">
Belanger, Ashley. 2026. <em><span>T</span>ik<span>T</span>ok Users <span>“Absolutely Justified”</span> in Fearing <span>M</span><span>A</span><span>G</span><span>A</span> Makeover, Experts Say — Arstechnica.com</em>. <a href="https://arstechnica.com/tech-policy/2026/01/tiktok-claimed-bugs-blocked-anti-ice-videos-epstein-mentions-experts-call-bs" class="uri">Https://arstechnica.com/tech-policy/2026/01/tiktok-claimed-bugs-blocked-anti-ice-videos-epstein-mentions-experts-call-bs</a>; Ars Technica.
</div>
<div id="ref-europeanalternativesEuropeanAlternatives" class="csl-entry">
Graf, Constantin. 2025. <em><span>E</span>uropean <span>A</span>lternatives — European-Alternatives.eu</em>. <a href="https://european-alternatives.eu/" class="uri">Https://european-alternatives.eu/</a>.
</div>
<div id="ref-independentTrumpsAttack" class="csl-entry">
Mascaro, Lisa, Joshua Goodman, and Ben Finley. 2026. <em><span>W</span>as <span>T</span>rump’s Attack on <span>V</span>enezuela Illegal? — Independent.co.uk</em>. <a href="https://www.independent.co.uk/news/world/americas/trump-illegal-venezuela-attack-international-law-maduro-b2894605.html" class="uri">Https://www.independent.co.uk/news/world/americas/trump-illegal-venezuela-attack-international-law-maduro-b2894605.html</a>.
</div>
<div id="ref-theconversationStrikesIran" class="csl-entry">
Rothwell, Donald. 2025. <em><span>W</span>hy the <span>U</span><span>S</span> Strikes on <span>I</span>ran Are Illegal and Can Set a Troubling Precedent — Theconversation.com</em>. <a href="https://theconversation.com/why-the-us-strikes-on-iran-are-illegal-and-can-set-a-troubling-precedent-259542" class="uri">Https://theconversation.com/why-the-us-strikes-on-iran-are-illegal-and-can-set-a-troubling-precedent-259542</a>.
</div>
<div id="ref-theguardianGenocideGaza" class="csl-entry">
Segal, Raz. 2025. <em><span>T</span>he Genocide in <span>G</span>aza Is Far from over | <span>R</span>az <span>S</span>egal — Theguardian.com</em>. <a href="https://www.theguardian.com/commentisfree/2025/nov/28/the-genocide-in-gaza-is-far-from-over" class="uri">Https://www.theguardian.com/commentisfree/2025/nov/28/the-genocide-in-gaza-is-far-from-over</a>.
</div>
</div></section></div> ]]></description>
  <category>cloud</category>
  <category>technology</category>
  <category>european</category>
  <category>infrastructure</category>
  <category>nextcloud</category>
  <guid>https://drmike.xyz/posts/european-alternatives/</guid>
  <pubDate>Fri, 30 Jan 2026 23:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/european-alternatives/scrot.png" medium="image" type="image/png" height="79" width="144"/>
</item>
<item>
  <title>The cacophony around us</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/the-cacaophony-around-us/</link>
  <description><![CDATA[ 






<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/the-cacaophony-around-us/diverse-people-addicted-their-smart-devices-scrolling-through-looking-into-their-screens.jpg" class="img-fluid figure-img"></p>
<figcaption>Image from Freepik</figcaption>
</figure>
</div>
<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<blockquote class="blockquote">
<p>Never before have I heard so many people speak of so many things they know so little about.</p>
</blockquote>
<p>A colleague said this to me over coffee a while back and it’s been stuck in my head ever since. Not because it’s clever (it is), but because I keep seeing evidence for it everywhere I look.</p>
<p>I open LinkedIn and someone with “AI Enthusiast” in their bio is explaining why Bayesian methods are outdated. I scroll further and a marketing director who discovered ChatGPT six months ago is telling physicists how neural networks work. I check Twitter (sorry, “X”) and an influencer with a million followers is confidently explaining that p-values prove causation. Each of these posts gets thousands of likes, hundreds of shares, and a comment section full of people nodding along.</p>
<p>This is what I mean by cacophony. Not silence, not even misinformation exactly. Just an overwhelming volume of confident noise from people who haven’t done the work to earn that confidence.</p>
</section>
<section id="the-problem-isnt-ignorance" class="level2">
<h2 class="anchored" data-anchor-id="the-problem-isnt-ignorance">The problem isn’t ignorance</h2>
<p>Let me be clear about something: I’m not calling people stupid. That’s a lazy take and it’s not what I mean. Most people sharing opinions online genuinely believe what they’re saying. They’ve read an article, watched a YouTube video, maybe skimmed a paper’s abstract. They’ve formed a view. The problem is that forming a view and understanding a topic are wildly different activities, and our current information landscape makes it almost impossible to tell them apart.</p>
<p>I’ve been guilty of this myself. When I first got into drug discovery I had opinions about molecular properties that I’d formed from reading a few papers. It took months of actually working with chemists, running simulations, and getting things wrong before I realized how shallow my initial understanding was. I wrote about <a href="../../posts/navigating-logp-logd-pka-and-logs-a-physicists-guide/">LogP and LogD</a> partly to force myself through that process. Writing it down was brutal because it revealed every gap I’d been casually ignoring.</p>
<p>And that’s the thing. The gap between “I’ve heard of this” and “I understand this” is enormous. But on social media it’s invisible. A confident 280-character take looks the same whether it comes from someone who has spent a decade on the problem or someone who read a blog post yesterday.</p>
</section>
<section id="the-internet-made-it-worse" class="level2">
<h2 class="anchored" data-anchor-id="the-internet-made-it-worse">The internet made it worse</h2>
<p>People have always been prone to holding opinions they can’t defend. This is not new. What is new is the scale.</p>
<p>When I was doing my PhD in Lund, if you wanted to spread a bad take about physics, you had to stand up in a seminar and say it out loud in front of people who could immediately challenge you. That’s a pretty effective filter. The social cost of being wrong in a room full of experts is high enough that most people either do the work or keep quiet.</p>
<p>Social media removed that filter entirely. You can broadcast opinions to millions of people without ever facing someone who actually knows the field. The feedback you get isn’t “that’s wrong because…” it’s likes, shares, and algorithmic amplification. The platforms are optimized for engagement, not accuracy. Confident, simple, slightly provocative takes get rewarded. Nuanced, careful, qualified statements get ignored. So the incentive structure actively selects for the kind of noise I’m complaining about.</p>
<p>And then there’s the confirmation bias machine. Whatever you already believe, the internet will find you a community of people who believe it too, and a steady stream of content that reinforces it. Want to believe that transformers are conscious? There’s a subreddit for that. Want to believe that all of statistics is a fraud? You’ll find your people. The information is technically available to correct these views, but it has to compete with an algorithm that knows exactly what will keep you scrolling.</p>
</section>
<section id="ai-is-pouring-gasoline-on-this" class="level2">
<h2 class="anchored" data-anchor-id="ai-is-pouring-gasoline-on-this">AI is pouring gasoline on this</h2>
<p>Here’s where it gets really fun. We now have AI systems that can generate fluent, confident, well-structured text on any topic. A person who knows nothing about Bayesian inference can ask an LLM to write a LinkedIn post about it and get something that sounds authoritative. They post it. People who also don’t know about Bayesian inference read it and think “this person knows their stuff.” The cycle accelerates.</p>
<p>I’m not anti-AI (I build AI systems for a living, that would be a weird position to take). But I do think we need to be honest about what this means for the signal-to-noise ratio. When the cost of producing confident-sounding content drops to zero, the volume of that content explodes. And if most of it is produced by people who don’t understand the topic, or by machines that can’t understand anything at all, the noise gets louder while the signal stays the same.</p>
</section>
<section id="writing-as-an-antidote" class="level2">
<h2 class="anchored" data-anchor-id="writing-as-an-antidote">Writing as an antidote</h2>
<p>Ok, enough complaining. What do we actually do about this?</p>
<p>I think the single most powerful thing you can do is write. And I don’t mean tweets or LinkedIn posts (though those have their place). I mean long-form writing where you have to actually develop an argument, anticipate counterpoints, and deal with the uncomfortable realization that you don’t know as much as you thought you did.</p>
<p>I’ve been writing this blog since 2016 and I can tell you from direct experience: nothing reveals the gaps in your understanding faster than trying to explain something to someone else in writing. When I wrote about <a href="../../posts/on-the-equivalence-of-bayesian-priors-and-ridge-regression/">the equivalence of Bayesian priors and Ridge regression</a>, I thought I had a clear picture going in. Three hours later I was back in the derivations because writing it down had exposed an assumption I’d been making for years without examining it. That’s the value. Not the finished post (though that’s nice too), but the process of getting there.</p>
<p>Writing forces you to be specific. You can’t hide behind vague gestures when you have to put actual words on a page. “AI will change everything” is easy to say. Try writing 2000 words about exactly what will change, for whom, through what mechanisms, and with what evidence. Suddenly the confident take doesn’t feel so confident anymore.</p>
</section>
<section id="cultivating-honest-skepticism" class="level2">
<h2 class="anchored" data-anchor-id="cultivating-honest-skepticism">Cultivating honest skepticism</h2>
<p>The other thing I’d advocate for is what I’ll call honest skepticism. Not cynicism (that’s just laziness wearing a trench coat), but a genuine willingness to ask “how do you know that?” of everything, including your own beliefs.</p>
<p>When someone tells you something, especially something that confirms what you already think, ask yourself: what would have to be true for this to be wrong? What evidence would change my mind? If you can’t answer those questions, you don’t have a belief. You have a feeling. Feelings are fine for picking a restaurant. They’re not fine for making claims about how the world works.</p>
<p>This applies to experts too, by the way. I have a PhD in theoretical physics and I’m wrong about things regularly. The difference (I hope) is that I try to notice when I’m wrong and update accordingly. That’s what being a scientist actually means. Not having the right answers, but having a reliable process for getting closer to them.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>I don’t have a tidy solution for the cacophony. I don’t think there is one. The platforms are the way they are, the incentives are the way they are, and AI is only going to make the content flood worse.</p>
<p>But I do think we each have a choice about how we participate. We can add to the noise or we can resist it. We can share things we haven’t read properly or we can take the time to understand before we speak. We can optimize for likes or we can optimize for truth.</p>
<p>Write things down. Subject your ideas to the test of putting them into words. Read things written by people who actually did the work, not by people who are good at sounding like they did. And when you catch yourself about to share a confident opinion on something you learned about twenty minutes ago, maybe pause for a second. The world has enough noise.</p>


</section>

 ]]></description>
  <category>ai</category>
  <category>learning</category>
  <category>personal development</category>
  <category>rant</category>
  <category>cacophony</category>
  <guid>https://drmike.xyz/posts/the-cacaophony-around-us/</guid>
  <pubDate>Mon, 30 Dec 2024 23:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/the-cacaophony-around-us/diverse-people-addicted-their-smart-devices-scrolling-through-looking-into-their-screens.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Learning a new skill: A thing of the past?</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/learning-the-skill/</link>
  <description><![CDATA[ 






<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>I’ve been hearing the same thing from all directions lately: “Why would I learn X when AI can do it for me?” I hear it from students, from colleagues, from people at conferences. And every time it makes me wince a little.</p>
<blockquote class="blockquote">
<p>Never before have I heard so many people speak about so many things they know so little about.</p>
</blockquote>
<p>That’s from a guy at the office, but it might as well be the motto of our era.</p>
<p>The argument goes something like this: AI is getting better at everything, so why invest time and effort into skills that a machine will eventually handle? Just learn to prompt well and let the model do the heavy lifting. Sounds reasonable on the surface. It’s also dangerously wrong.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/learning-the-skill/anxiety-inducing-imagery-with-angst-feelings.jpg" class="img-fluid figure-img"></p>
<figcaption>Image from Freepik</figcaption>
</figure>
</div>
</section>
<section id="the-calculator-didnt-replace-mathematicians" class="level2">
<h2 class="anchored" data-anchor-id="the-calculator-didnt-replace-mathematicians">The calculator didn’t replace mathematicians</h2>
<p>Let me tell you what I’ve actually seen happen. I’ve spent 25 years building neural networks. I’ve watched the field go from niche academic curiosity to front-page news to dinner table conversation. And in all that time, the people who thrived weren’t the ones who learned to use the latest tool. They were the ones who understood why the tool worked, where it broke, and what to do when it broke.</p>
<p>This isn’t unique to AI. When calculators showed up, nobody stopped teaching mathematics. When compilers showed up, nobody stopped teaching computer science. The tools changed the baseline of what you could accomplish, but they didn’t remove the need to understand the foundations. They raised the floor. They didn’t lower the ceiling.</p>
<p>AI is a tool. A powerful one, sure. Possibly the most powerful one we’ve ever built. But it is still a tool. And the thing about tools is that they’re only as good as the person wielding them. Give a chainsaw to someone who doesn’t understand wood and you’ll get firewood at best, a trip to the hospital at worst.</p>
</section>
<section id="what-ive-learned-from-martial-arts" class="level2">
<h2 class="anchored" data-anchor-id="what-ive-learned-from-martial-arts">What I’ve learned from martial arts</h2>
<p>I taught martial arts for over a decade. One of the things you learn very quickly as an instructor is that there’s no shortcut to skill. You can watch a thousand YouTube videos of a technique, you can have someone explain the biomechanics in perfect detail, but until your body has done the movement a few thousand times, you don’t own it. It’s not yours. Under pressure, you will revert to whatever your body actually knows, not what your head thinks it knows.</p>
<p>The same applies to intellectual skills. You can ask an LLM to write code for you, and it’ll produce something that looks right. But when it breaks (and it will break), you need to understand why. When the output is subtly wrong (and it often is), you need to catch it. When the problem doesn’t fit neatly into what the model has seen before (and real problems rarely do), you need to improvise. And you can’t improvise with knowledge you don’t have.</p>
<p>I’ve watched junior developers paste LLM output into production without understanding what it does. It works for a while. Then it doesn’t, and they have no idea where to start debugging. They skipped the part where you learn the thing, and now they’re stuck. The model gave them a fish, but nobody taught them to fish.</p>
</section>
<section id="the-skills-that-matter" class="level2">
<h2 class="anchored" data-anchor-id="the-skills-that-matter">The skills that matter</h2>
<p>Ok so if AI handles the routine stuff, what’s left? Quite a lot, actually.</p>
<p>The most valuable people I’ve worked with over the years share a common trait: they can think across domains. They see connections that specialists miss. A physicist who understands finance. A programmer who understands biology. A martial artist who understands leadership. These intersections are where the interesting work happens, and they require deep skill in multiple areas, not surface-level prompting ability in one.</p>
<p>Here’s what I think actually matters:</p>
<p><strong>Understanding the fundamentals.</strong> Not because you’ll manually compute gradients every day (though I do enjoy it), but because when your model behaves unexpectedly, the person who understands backpropagation will diagnose the problem in minutes while the person who only knows the API will spend days guessing.</p>
<p><strong>Critical thinking.</strong> AI is confident. Impressively, fluently, dangerously confident. It will give you wrong answers with the same tone and structure as right ones. If you can’t evaluate the output independently, you’re not using a tool. You’re being used by one.</p>
<p><strong>Building things from scratch.</strong> The ability to start from a blank page and create something that didn’t exist before. This requires deep understanding, creativity, and the willingness to sit with discomfort while you figure it out. LLMs can help you iterate faster, but they can’t replace the generative spark.</p>
<p><strong>Physical and embodied skills.</strong> This one might sound odd coming from someone who spends most of his day at a computer, but I genuinely believe it. The discipline you develop through martial arts, through sport, through any practice that demands full-body engagement, transfers directly to how you think and work. Patience, persistence, attention to detail, the ability to stay calm under pressure. These aren’t soft skills. They’re the foundation everything else is built on.</p>
</section>
<section id="the-electricity-analogy-but-for-real-this-time" class="level2">
<h2 class="anchored" data-anchor-id="the-electricity-analogy-but-for-real-this-time">The electricity analogy (but for real this time)</h2>
<p>People love comparing AI to electricity. Usually in a breathless “this will change everything” kind of way. But the analogy is actually useful if you take it seriously.</p>
<p>When electricity became widespread, it didn’t make human labor obsolete. It made new kinds of labor possible. It created entirely new industries, new professions, new ways of thinking about problems. But the people who benefited most weren’t the ones who just plugged things in. They were the electrical engineers, the inventors, the people who understood the technology deeply enough to push it into places nobody had imagined.</p>
<p>AI will follow the same pattern. The people who just “use” it will do fine. The people who understand it, who can build on it, extend it, and critically evaluate it, will do dramatically better. And the people who gave up learning because “AI will handle it” will find themselves dependent on systems they can’t control, can’t inspect, and can’t fix.</p>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>I’m not arguing against using AI. I use it every day. I’m building companies around it. What I am arguing against is the idea that AI makes learning unnecessary. That’s a story being told by people who benefit from you being a passive consumer of their product.</p>
<p>The truth is simpler and less comfortable: the skills that matter most are the ones that are hardest to acquire. They require time, effort, frustration, and the willingness to be bad at something before you’re good at it. No shortcut has ever changed that, and AI won’t either.</p>
<p>So learn the thing. Do the hard work. Build the muscle memory, whether it’s physical or intellectual. The people who do will be the ones shaping the future. The people who don’t will be along for the ride, hoping the driver knows where they’re going.</p>


</section>

 ]]></description>
  <category>ai</category>
  <category>learning</category>
  <category>personal development</category>
  <guid>https://drmike.xyz/posts/learning-the-skill/</guid>
  <pubDate>Sun, 29 Dec 2024 23:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/learning-the-skill/anxiety-inducing-imagery-with-angst-feelings.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Evidential musings</title>
  <dc:creator>Michael Green</dc:creator>
  <link>https://drmike.xyz/posts/evidential_musings_with_multinomial/</link>
  <description><![CDATA[ 






<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://drmike.xyz/posts/evidential_musings_with_multinomial/dice.webp" class="img-fluid figure-img"></p>
<figcaption>Image by unsplash</figcaption>
</figure>
</div>
<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p>As outlined in <span class="citation" data-cites="sensoy2018evidential">Sensoy et al. (2018)</span> there’s some work done in Evidential Deep Learning to quantify uncertainty in classification applications. The evidential framework depends on the ability to specify conjugate priors for the parameters of the likelihood of interest. In classification tasks we naturally lean on the Categorical distribution in the general case and the Bernoulli distribution in the binary classification case. The Bernoulli and the Categorical distribution are both useful for describing an individual sample of a class outcome, i.e., true or false for a given class. But what if your data are not individual classification samples but rather aggregations of the number of times a given class came up in several samples? Let’s take the example of a cancer classification problem. In the individual classification example we would get a true (for cancer) or false (for not cancer) per individual we test. If we have have a dataset showing how many patients had the diagnosis cancer vs not cancer per region then we would have a Binomial distribution that would best describe this data. The same logic would hold true for the Categorical distribution which would then map to the multinomial distribution.</p>
</section>
<section id="a-quick-primer-on-bayesian-probability" class="level2">
<h2 class="anchored" data-anchor-id="a-quick-primer-on-bayesian-probability">A quick primer on Bayesian probability</h2>
<p>There are of course terminology in Bayesian modeling that’s necessary to know and be able to relate to. I will follow <span class="citation" data-cites="tu2014dirichlet-multinomial">Tu (2014)</span> and outline the most important ones to know.</p>
<p>The <strong>likelihood</strong> is a measure of how well a chosen distribution and it’s given parameters explain the observed data. It is strictly speaking not a probability since it usually operates of several samples from a given distribution. As such, it is not normalized.</p>
<p>The <strong>prior</strong> is the assumed distribution you put on your parameters <em>before</em> observing the data. It can be interpreted as a kind of regularization of your model to make sure it doesn’t do anything crazy.</p>
<p>The <strong>posterior</strong> is the distribution of your parameters after observing the data. Thus, it’s a distribution over your parameters where your assumptions and data has been weighted together to form a coherent opinion about the problem.</p>
<p>The <strong>evidence</strong> or <strong>marginal</strong> is the probability of observing the data after all parameters have been integrated out. This is important as it is arguable what we would like to maximize for a given problem. Note that this is distinct from the <strong>likelihood</strong> which doesn’t factor the prior assumptions in.</p>
<p>Mathematically we can put these items into one glorious equation</p>
<p><span id="eq-multpostdist"><img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%A9%7C%F0%9D%90%B1)=%5Cfrac%7BP(%F0%9D%90%B1%7C%F0%9D%90%A9)P(%F0%9D%90%A9)%7D%7B%E2%88%ABP(%F0%9D%90%B1%7C%F0%9D%90%A9)P(%F0%9D%90%A9)d%F0%9D%90%A9%7D=%5Cfrac%7BP(%F0%9D%90%B1%7C%F0%9D%90%A9)P(%F0%9D%90%A9)%7D%7BP(%F0%9D%90%B1)%7D%20%5Ctag%7B1%7D"></span></p>
<p>where I have chosen a parameterization that matches the one we will use for the Multinomial distribution. Usually you would have written this with <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%89"> instead of <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%A9">.</p>
<p>Now, there’s one more I would like to mention which is also an integration exercise where we instead are interested in the marginal predictive distribution of a new datapoint <img src="https://latex.codecogs.com/png.latex?x">. It’s called <strong>marginal predictive</strong>. In this setting we will use <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%97"> as representing the entire dataset of <img src="https://latex.codecogs.com/png.latex?%5B%F0%9D%90%B1_i%5D">.</p>
<p><span id="eq-multpostpreddist"><img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%B1_i%7C%F0%9D%90%97)=%E2%88%ABP(%F0%9D%90%B1_i,%F0%9D%90%A9%7C%F0%9D%90%97)d%F0%9D%90%A9=%E2%88%ABP(%F0%9D%90%B1_i%7C%F0%9D%90%A9)P(%F0%9D%90%A9%7C%F0%9D%90%97)d%F0%9D%90%A9%20%5Ctag%7B2%7D"></span></p>
<p>In order to really seal the deal here I want to be explicit about the <strong>marginal</strong> distribution which is over an entire dataset. We will use the same formalism as in the above equation. In this case we can state the marginal data distribution as</p>
<p><span id="eq-multmarginaldist"><img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%97)=%E2%88%ABP(%F0%9D%90%97,%F0%9D%90%A9)d%F0%9D%90%A9=%E2%88%ABP(%F0%9D%90%A9)%E2%88%8F_%7B%F0%9D%90%B1_i%E2%88%88%F0%9D%90%97%7DP(%F0%9D%90%B1_i%7C%F0%9D%90%A9)d%F0%9D%90%A9%20%5Ctag%7B3%7D"></span></p>
<p>where you can see the inclusion of each datapoint <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1_i"> in the dataset <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%97">.</p>
</section>
<section id="the-multinomial-distribution" class="level2">
<h2 class="anchored" data-anchor-id="the-multinomial-distribution">The Multinomial distribution</h2>
<p>In order to describe the multinomial distribution for a random variable <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1"> we need the total number of cases <img src="https://latex.codecogs.com/png.latex?n"> as well as the probability of each class to occur <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%A9">. In this case <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1"> and <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%A9"> are vectors of <img src="https://latex.codecogs.com/png.latex?K"> elements representing the <img src="https://latex.codecogs.com/png.latex?K"> classes.</p>
<p><span id="eq-multdist"><img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BMult%7D(%F0%9D%90%B1;%F0%9D%90%A9,n)=%5Cfrac%7B%20%CE%93(n+1)%20%7D%7B%E2%88%8F_%7Bi=1%7D%5EK%20%CE%93(x_i+1)%7D%E2%88%8F_%7Bi=1%7D%5EK%20p_i%5E%7Bx_i%7D%20%5Ctag%7B4%7D"></span></p>
<p>This is the probability mass function for the Multinomial distribution. The gamma functions you see in the equations are just better ways of expressing the numbers to the <img src="https://latex.codecogs.com/png.latex?K"> classes. Just to get a feel for what is happening it’s worth remembering that <img src="https://latex.codecogs.com/png.latex?%CE%93(n+1)=n!">.</p>
<p>The Multinomial distribution is a generalized form (<img src="https://latex.codecogs.com/png.latex?K%E2%89%A52">) of the Binomial (<img src="https://latex.codecogs.com/png.latex?K=2">) distribution. Conversely, it’s also a generalization (<img src="https://latex.codecogs.com/png.latex?n%E2%89%A51">) of the Categorical (<img src="https://latex.codecogs.com/png.latex?n=1">) distribution. Table&nbsp;1 shows a summary of the different distributions mentioned here.</p>
<div id="tbl-distros" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-distros-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;1: Description of when the different distributions are applicable as well as their relation.
</figcaption>
<div aria-describedby="tbl-distros-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<table class="caption-top table">
<thead>
<tr class="header">
<th>K</th>
<th>n</th>
<th>Distribution</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>2</td>
<td>1</td>
<td>Bernoulli</td>
</tr>
<tr class="even">
<td>2</td>
<td>&gt;1</td>
<td>Binomial</td>
</tr>
<tr class="odd">
<td>&gt;2</td>
<td>1</td>
<td>Categorical</td>
</tr>
<tr class="even">
<td>&gt;2</td>
<td>&gt;1</td>
<td>Multinomial</td>
</tr>
</tbody>
</table>
</div>
</figure>
</div>
</section>
<section id="conjugate-priors" class="level2">
<h2 class="anchored" data-anchor-id="conjugate-priors">Conjugate priors</h2>
<p>There’s a lot of research put into the conjugate distributions for the exponential family which in my opinion is really good. In fact I would argue we still need a lot more.. Anyway, the point here is that if you looked at the equations above you might wonder where the heck the prior distribution comes from? You’d be forgiven for wondering. This can in principle be any distribution you like. As long as you can write it down. Sounds great! The problem is that it’s very often expensive to compute as the integrals we showed in the posterior and the marginals are quite hard to solve and most of the choices do not have a closed form solution. This is where conjugate priors comes into the pictures. Conjugate priors are priors matched with a likelihood which has a closed form expression for the resulting posterior. This is a big thing since we won’t have to rely on MCMC techniques to do the integrations.</p>
<p>Ok, but so what, what is the darn prior distribution that we want to use? Well, in the case of the Multinomial likelihood the conjugate prior is the Dirichlet distribution. In our notation above we will parameterize this distribution with <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82">. Thus the prior distribution for our parameters of the Multinomial distribution will be <img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%A9)=P(%F0%9D%90%A9%7C%F0%9D%9B%82)=%5Cmathrm%7BDir%7D(%F0%9D%90%A9;%F0%9D%9B%82)">. It’s written out explicitely as</p>
<p><span id="eq-dirdist"><img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BDir%7D(%F0%9D%90%A9;%F0%9D%9B%82)=%5Cmathrm%7BDir%7D%5Cleft(p_%7B1%7D,%5Cldots,p_%7BK%7D;%CE%B1_%7B1%7D,%5Cldots,%CE%B1_%7BK%7D%5Cright)=%7B%5Cfrac%7B1%7D%7B%5Cmathrm%7BB%7D(%7B%5Cboldsymbol%7B%CE%B1%7D%7D)%7D%7D%5Cprod_%7Bi=1%7D%5E%7BK%7Dp_%7Bi%7D%5E%7B%CE%B1_%7Bi%7D-1%7D%20%5Ctag%7B5%7D"></span></p>
<p>where</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BB%7D(%F0%9D%9B%82)=%7B%5Cfrac%7B%5Cprod_%7Bi=1%7D%5E%7BK%7D%CE%93(%CE%B1_i)%7D%7B%CE%93%7B%5Cbigl%20(%7D%CE%B1_0%7B%5Cbigr%20)%7D%7D%7D"></p>
<p>and <img src="https://latex.codecogs.com/png.latex?%CE%B1_0=%E2%88%91_%7Bi=1%7D%5EK%20%CE%B1_i">.</p>
<p>The <img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BB%7D(%F0%9D%9B%82)"> is the multivariate beta function <span class="citation" data-cites="enwiki:beta">(Wikipedia contributors 2024a)</span> which you can read about in <span class="citation" data-cites="enwiki:dirichlet">Wikipedia contributors (2024b)</span>. A rather convenient yet annoying fact is that the Dirichlet distribution is the conjugate prior for both the Categorical distribution as well as the Multinomial.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The Dirichlet distribution is the conjugate prior for both the Categorical and the Multinomial distribution.</p>
</div>
</div>
</section>
<section id="the-closed-form-solutions-weve-been-waiting-for" class="level2">
<h2 class="anchored" data-anchor-id="the-closed-form-solutions-weve-been-waiting-for">The closed form solutions we’ve been waiting for</h2>
<p>With the Bayesian primer and our Multinomial distribution (Equation&nbsp;4) out of the way we’re now ready to have a look at the model that this whole post is motivated by, namely the “Dirichlet-Multinomial”. It’s a model for several samples from a Categorical distribution with a prior on the class probabilities.</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%7B%5Cbegin%7Barray%7D%7Brcc%7D%0A%F0%9D%90%A9&amp;%5Csim&amp;%5Cmathrm%7BDir%7D(%F0%9D%9B%82)%5C%5C%0A%F0%9D%90%B1&amp;%5Csim&amp;%5Coperatorname%7BMult%7D(%F0%9D%90%A9,n)%0A%5Cend%7Barray%7D%7D%0A"></p>
<p>Since we know from the section on conjugate priors that this model indeed is conjugate we can get explicit analytical expressions for the posterior (Equation&nbsp;1) and marginal (Equation&nbsp;3). The posterior distribution is also Dirichlet.</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%A9%7C%F0%9D%90%B1)%5Csim%5Cmathrm%7BDir%7D(%F0%9D%9B%82%5E%E2%80%B2)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82%5E%E2%80%B2=%5B%CE%B1_1%5E%E2%80%B2,%5Cldots,%CE%B1_K%5E%E2%80%B2%5D">, such that <img src="https://latex.codecogs.com/png.latex?%CE%B1_k%5E%E2%80%B2=%CE%B1_k+%E2%88%91_%7Bi=1%7D%5ENx_i%5Ek"> and <img src="https://latex.codecogs.com/png.latex?x_i%5Ek"> is the number of observed instances of class <img src="https://latex.codecogs.com/png.latex?k"> in sample <img src="https://latex.codecogs.com/png.latex?i">. Thus, the posterior distribution is formed from the prior pseudocount <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82"> and the observed counts from dataset <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%97">.</p>
<p>With this it’s time to move on to the marginal. It’s where we integrate the parameters <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%A9"> out. Below you can see the procedure for a single datapoint <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1">.</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%F0%9D%90%B1%5Cmid%20n,%F0%9D%9B%82)=%5Cint%5Cmathrm%7BMult%7D(%F0%9D%90%B1%7Cn,%F0%9D%90%A9)%5Cmathrm%7BDir%7D(%F0%9D%90%A9%7C%F0%9D%9B%82)d%F0%9D%90%A9%E2%89%A1%5Cmathrm%7BDM%7D(%F0%9D%90%B1%7Cn,%F0%9D%9B%82)"></p>
<p><img src="https://latex.codecogs.com/png.latex?%E2%87%A9"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BDM%7D(%F0%9D%90%B1%5Cmid%20n,%F0%9D%9B%82)=%5Cfrac%7B%CE%93%5Cleft(%CE%B1_0%5Cright)%CE%93%5Cleft(n+1%5Cright)%7D%7B%CE%93%5Cleft(n+%CE%B1_0%5Cright)%7D%5Cprod_%7Bk=1%7D%5E%7BK%7D%5Cfrac%7B%CE%93(x_k+%CE%B1_k)%7D%7B%CE%93(%CE%B1_k)%CE%93%5Cleft(x_k+1%5Cright)%7D"></p>
<p>Again, <img src="https://latex.codecogs.com/png.latex?%CE%B1_0=%E2%88%91%CE%B1_k"> like before. It’s important to note here that there’s no conditioning on the data going on here. This is because the likelihood only enters through the one <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1"> here. This is the marginal data distribution. The posterior predictive distribution is achieved by utilizing the conditioned <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82%5E%E2%80%B2=%F0%9D%9B%82+%E2%88%91_%7Bi=1%7D%5E%7BN%7D%F0%9D%90%B1_i"> instead of <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82">.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The posterior predictive distribution of a new datapoint <img src="https://latex.codecogs.com/png.latex?%F0%9D%90%B1_i"> is given by</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathrm%7BDM%7D(%F0%9D%90%B1%5Cmid%20n,%F0%9D%9B%82)=%5Cfrac%7B%CE%93%5Cleft(%CE%B1_0%5Cright)%CE%93%5Cleft(n+1%5Cright)%7D%7B%CE%93%5Cleft(n+%CE%B1_0%5Cright)%7D%5Cprod_%7Bk=1%7D%5E%7BK%7D%5Cfrac%7B%CE%93(x_k+%CE%B1_k)%7D%7B%CE%93(%CE%B1_k)%CE%93%5Cleft(x_k+1%5Cright)%7D"></p>
</div>
</div>
<p>This is crazy useful as this compound distribution allows us to model overdispersed data that the original Multinomial distribution would have a hard time capturing.</p>
</section>
<section id="how-to-apply-with-neural-networks" class="level2">
<h2 class="anchored" data-anchor-id="how-to-apply-with-neural-networks">How to apply with Neural Networks</h2>
<p>Now, none of this really matters unless we bring some conditioning in to deliver the <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82">. This is what we want a model to do. To look at input data and predict the <img src="https://latex.codecogs.com/png.latex?%F0%9D%9B%82"> that can be fed into the Dirichlet-Multinomial to explain the data. In this section I will be using Julia <span class="citation" data-cites="bezanson2017julia">(Bezanson et al. 2017)</span> which in my opinion is a nice language for playing around with these concepts.</p>
<p>First I’ll define some dummy data inspired from <span class="citation" data-cites="guinney2015consensus"><span class="nocase">Guinney et al.</span> (2015)</span> where they define four main consensus molecular subtypes (CMSs) of Colorectal cancer.</p>
<ul>
<li>CMS1 (microsatellite instability immune, 14%), hypermutated, microsatellite unstable and strong immune activation.</li>
<li>CMS2 (canonical, 37%), epithelial, marked WNT and MYC signaling activation.</li>
<li>CMS3 (metabolic, 13%), epithelial and evident metabolic dysregulation.</li>
<li>CMS4 (mesenchymal, 23%), prominent transforming growth factor–β activation, stromal invasion and angiogenesis.</li>
</ul>
<p>I will generate a fake dataset for modeling these four types as a Multinomial distribution.</p>
<div class="cell" data-message="false" data-execution_count="1">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">DataFrames</span></span>
<span id="cb1-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Tables</span></span>
<span id="cb1-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Markdown</span></span>
<span id="cb1-4"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">MarkdownTables</span></span>
<span id="cb1-5"></span>
<span id="cb1-6">df <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">DataFrame</span>(Gender<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], Income<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], CMS1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>], </span>
<span id="cb1-7">           CMS2<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>], CMS3<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>], CMS4<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>])</span>
<span id="cb1-8"></span>
<span id="cb1-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">markdown_table</span>(df)</span></code></pre></div></div>
<div id="tbl-cancer" class="cell quarto-float quarto-figure quarto-figure-center anchored" data-execution_count="1" data-message="false">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-cancer-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;2: A fake cancer dataset for illustration purposes.
</figcaption>
<div aria-describedby="tbl-cancer-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output cell-output-display cell-output-markdown" data-execution_count="2">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th>Gender</th>
<th>Income</th>
<th>CMS1</th>
<th>CMS2</th>
<th>CMS3</th>
<th>CMS4</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>1</td>
<td>4</td>
<td>10</td>
<td>3</td>
<td>15</td>
</tr>
<tr class="even">
<td>1</td>
<td>2</td>
<td>5</td>
<td>15</td>
<td>7</td>
<td>11</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
<p>With this small dataset from Table&nbsp;2 we can start to define a model for this. We have 4 classes so we need 4 outputs. I’ll show a small piece of code below which implements a stupid overparameterized neural network for this problem. Don’t judge me. It’s for illustration purposes. But I’m also getting ahead of myself, we need to implement the marginal data distribution (which we want to maximize). Since this is indeed just the compound DirichletMultinomial from above we can implement that probability mass function and take the negative logarithm to get a kind of type II likelihood that we want to maximize (or well who’s negative likelihood to minimize).</p>
<div id="69e862da" class="cell" data-message="false" data-execution_count="3">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">SpecialFunctions</span></span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dmlogpmf</span>(x, α)</span>
<span id="cb2-4">    α₀ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(α, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb2-5">    n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(x, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb2-6">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># First term</span></span>
<span id="cb2-7">    ft <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(α₀) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> α₀)</span>
<span id="cb2-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Second term</span></span>
<span id="cb2-9">    st <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(α <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> x) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(α) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loggamma</span>.(x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)), dims <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb2-10">    ft <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> st</span>
<span id="cb2-11"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb2-12"></span>
<span id="cb2-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dmnegloglik</span>(x, α) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">-dmlogpmf</span>(x, α))</span></code></pre></div></div>
<div class="cell-output cell-output-display" data-execution_count="4">
<pre><code>dmnegloglik (generic function with 1 method)</code></pre>
</div>
</div>
<p>Next we’ll define the neural network and the training of it.</p>
<div id="4a1879e2" class="cell" data-message="false" data-execution_count="4">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Flux</span></span>
<span id="cb4-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">using</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">Zygote</span></span>
<span id="cb4-3"></span>
<span id="cb4-4">X <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">permutedims</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Matrix</span>(df[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>])))</span>
<span id="cb4-5">Y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">permutedims</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Float32</span>.(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Matrix</span>(df[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span>])))</span>
<span id="cb4-6">n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(Y, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>]</span>
<span id="cb4-7"></span>
<span id="cb4-8">model <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Chain</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, relu), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Dense</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, softplus))</span>
<span id="cb4-9">opt <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">setup</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Adam</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.001</span>), model)</span>
<span id="cb4-10"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">println</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Loss Before: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loss</span>(Y,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">model</span>(X)))<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-11"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> epoch <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span></span>
<span id="cb4-12">    val, grads <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">withgradient</span>(model) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> m</span>
<span id="cb4-13">        𝛂 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">m</span>(X)</span>
<span id="cb4-14">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dmnegloglik</span>(Y, 𝛂)</span>
<span id="cb4-15">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-16">    Flux.<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update!</span>(opt, model, grads[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span>
<span id="cb4-17"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb4-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">println</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Loss After: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">loss</span>(Y,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">model</span>(X)))<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Loss Before: 19.188679
Loss After: 12.59213</code></pre>
</div>
</div>
<p>Let’s unpack this a bit. First we made sure that we put the training data in a format that Flux prefers. Then we define a loss function based on the compound distribution we got due to conjugacy. That’s the DirichletMultinomial distribution. We want a neural network that produces the parameters of this distribution. We then evaluate the negative log likelihood for the observed counts we have and update the network until it matches the data better.</p>
<p>As you can see the loss decreased so the network indeed got trained. I know, big surprise right? Appears that 704 parameters can help when you have 2 datapoints. 😄</p>
<p>Now let’s see a more understandable performance metric than likelihood. For this type of output I would just use the standard MAPE per class. We’re also interested in the epistemic uncertainty for each datapoint. This represents the models uncertainty about it’s own prediction. In order to do this we define a <code>predict</code> and an <code>uncert</code> function to use for predictions and estimating epistemic uncertainty.</p>
<div id="48b007e1" class="cell" data-message="false" data-execution_count="5">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb6-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">predict</span>(m, X, n)</span>
<span id="cb6-2">    𝛂 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">m</span>(X)</span>
<span id="cb6-3">    α₀ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(𝛂, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb6-4">    p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>.(𝛂 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">./</span> α₀ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.*</span> n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">'</span>, digits<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb6-5">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> p</span>
<span id="cb6-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb6-7"></span>
<span id="cb6-8"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">uncert</span>(m, X)</span>
<span id="cb6-9">    𝛂 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">m</span>(X)</span>
<span id="cb6-10">    α₀ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(𝛂, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb6-11">    u <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">first</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">size</span>(𝛂)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">./</span> α₀</span>
<span id="cb6-12">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> u[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>]</span>
<span id="cb6-13"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">end</span></span>
<span id="cb6-14"></span>
<span id="cb6-15"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mape</span>(p, o) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">abs</span>.(p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> o) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">./</span> o, dims<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span></code></pre></div></div>
<div class="cell-output cell-output-display" data-execution_count="6">
<pre><code>mape (generic function with 1 method)</code></pre>
</div>
</div>
<p>With these functions we can now see how well our model fits the data. Since we have such a simple and nice dataset we can just print it out and inspect what the predicted numbers look like in Table&nbsp;3. Comparing this to Table&nbsp;2 it’s clear to see that the predicted numbers are in the vicinity of the observed ones. It’s also not obvious to see which data point that’s better or worse predicted. However, due to our ability to estimate epistemic uncertainty we can now have a computational view on uncertainty. By inspecting the uncertainty column we can see that the model is a lot more confident regarding the second datapoint.</p>
<div class="cell" data-message="false" data-execution_count="6">
<div id="tbl-pred" class="cell quarto-float quarto-figure quarto-figure-center anchored" data-execution_count="6" data-message="false">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-pred-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;3: The predicted counts for all types of the cancer we modeled with included epistemic uncertainty.
</figcaption>
<div aria-describedby="tbl-pred-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output cell-output-display cell-output-markdown" data-execution_count="7">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th>CMS1</th>
<th>CMS2</th>
<th>CMS3</th>
<th>CMS4</th>
<th>Uncertainty</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>11</td>
<td>4</td>
<td>12</td>
<td>0.17</td>
</tr>
<tr class="even">
<td>5</td>
<td>13</td>
<td>7</td>
<td>12</td>
<td>0.08</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
<p>Now we might also ask with the classwise performance is, i.e., how well are the counts in each class predicted? Here, we’ll turn to MAPE and use the function from above. The numbers are in Table&nbsp;4 below.</p>
<div class="cell" data-message="false" data-execution_count="7">
<div id="tbl-perf" class="cell quarto-float quarto-figure quarto-figure-center anchored" data-execution_count="7" data-message="false">
<figure class="quarto-float quarto-float-tbl figure">
<figcaption class="quarto-float-caption-top quarto-float-caption quarto-float-tbl" id="tbl-perf-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Table&nbsp;4: The performance and prevalence of each class.
</figcaption>
<div aria-describedby="tbl-perf-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<div class="cell-output cell-output-display cell-output-markdown" data-execution_count="8">
<table class="cell caption-top table table-sm table-striped small">
<thead>
<tr class="header">
<th>CMS1</th>
<th>CMS2</th>
<th>CMS3</th>
<th>CMS4</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>12%</td>
<td>12%</td>
<td>17%</td>
<td>15%</td>
<td>MAPE</td>
</tr>
<tr class="even">
<td>13%</td>
<td>36%</td>
<td>14%</td>
<td>37%</td>
<td>Prevalence</td>
</tr>
</tbody>
</table>
</div>
</div>
</figure>
</div>
</div>
</section>
<section id="conclusion" class="level2">
<h2 class="anchored" data-anchor-id="conclusion">Conclusion</h2>
<p>So we’ve seen that using a conjugate prior distribution allows us to get an explicit solution for our posterior probability as well as the marginal data distribution. We’ve also seen how the resulting compound distribution can be used as a loss function through the negative log likelihood. This lends itself nicely to using arbitrarily complex models like neural networks to predict the parameters of the posterior distribution.</p>
<p>As a bonus we can readily estimate the epistemic uncertainty of our model, which in the case of cancer prediction can be pretty darn important.</p>
</section>
<section id="references" class="level2">




</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-bibliography"><h2 class="anchored quarto-appendix-heading">References</h2><div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-bezanson2017julia" class="csl-entry">
Bezanson, Jeff, Alan Edelman, Stefan Karpinski, and Viral B. Shah. 2017. <span>“<span class="nocase">Julia: A fresh approach to numerical computing</span>.”</span> <em>SIAM Review</em> 59 (1): 65–98. <a href="https://doi.org/10.1137/141000671">https://doi.org/10.1137/141000671</a>.
</div>
<div id="ref-guinney2015consensus" class="csl-entry">
<span class="nocase">Guinney, Justin, Rodrigo Dienstmann, Xin Wang, et al.</span> 2015. <span>“The Consensus Molecular Subtypes of Colorectal Cancer.”</span> <em>Nature Medicine</em> 21 (11): 1350–56.
</div>
<div id="ref-sensoy2018evidential" class="csl-entry">
Sensoy, Murat, Lance Kaplan, and Melih Kandemir. 2018. <em>Evidential Deep Learning to Quantify Classification Uncertainty</em>. <a href="https://arxiv.org/abs/1806.01768">https://arxiv.org/abs/1806.01768</a>.
</div>
<div id="ref-tu2014dirichlet-multinomial" class="csl-entry">
Tu, Stephen. 2014. <span>“The Dirichlet-Multinomial and Dirichlet-Categorical Models for Bayesian Inference.”</span> <a href="https://api.semanticscholar.org/CorpusID:18254798">https://api.semanticscholar.org/CorpusID:18254798</a>.
</div>
<div id="ref-enwiki:beta" class="csl-entry">
Wikipedia contributors. 2024a. <em>Beta Function — <span>Wikipedia</span><span>,</span> the Free Encyclopedia</em>.<a href="
	       https://en.wikipedia.org/w/index.php?title=Beta_function&amp;oldid=1261431046
	       ">https://en.wikipedia.org/w/index.php?title=Beta_function&amp;oldid=1261431046 </a>.
</div>
<div id="ref-enwiki:dirichlet" class="csl-entry">
Wikipedia contributors. 2024b. <em>Dirichlet Distribution — <span>Wikipedia</span><span>,</span> the Free Encyclopedia</em>.<a href="
	       https://en.wikipedia.org/w/index.php?title=Dirichlet_distribution&amp;oldid=1239280064
	       ">https://en.wikipedia.org/w/index.php?title=Dirichlet_distribution&amp;oldid=1239280064 </a>.
</div>
</div></section></div> ]]></description>
  <category>conjugacy</category>
  <category>bayesian</category>
  <category>multinomial</category>
  <category>dirichlet-multinomial</category>
  <guid>https://drmike.xyz/posts/evidential_musings_with_multinomial/</guid>
  <pubDate>Wed, 25 Dec 2024 23:00:00 GMT</pubDate>
  <media:content url="https://drmike.xyz/posts/evidential_musings_with_multinomial/dice.webp" medium="image" type="image/webp"/>
</item>
</channel>
</rss>
