<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sajana Yasas on Medium]]></title>
        <description><![CDATA[Stories by Sajana Yasas on Medium]]></description>
        <link>https://medium.com/@ddsyasas?source=rss-eef48573a9ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z1oPSWOUGt_uZEjt4aJd5Q.png</url>
            <title>Stories by Sajana Yasas on Medium</title>
            <link>https://medium.com/@ddsyasas?source=rss-eef48573a9ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 23:35:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ddsyasas/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The AI "Loop" Paper Everyone Shared in 2026 (And What It Actually Says)]]></title>
            <link>https://medium.com/@ddsyasas/the-ai-loop-paper-everyone-shared-in-2026-and-what-it-actually-says-a42c1e73b901?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/a42c1e73b901</guid>
            <category><![CDATA[ai-feedback-loops]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[loop-engineering]]></category>
            <category><![CDATA[alpha-evolve]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 11:20:14 GMT</pubDate>
            <atom:updated>2026-06-27T11:20:14.956Z</atom:updated>
            <content:encoded><![CDATA[<h3>The AI “Loop” Paper Everyone Shared in 2026 (And What It Actually Says)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Rca1iA8faHAio6C3-pBIA.png" /></figure><p>I keep seeing this paper shared everywhere lately, and I think I know why.</p><p>The title is “<strong><em>Agentic Auto-Scheduling: An Experimental Study of LLM-Guided Loop Optimization</em></strong><em>”</em>. And the moment people see the words “agentic” and “loop” together, their brain fills in the blank. We have all spent the last year hearing about agent loops, context engineering, and the endless debate about how to keep an AI agent on track without it spinning forever. So “loop optimization” sounds like it is going to be about that. About tuning the agent’s reasoning loop.</p><p>It is not. And that is the fun part.</p><p>This paper uses “loop” in the old, boring, beautiful sense. The for-loop. The nested loops inside real programs that do the heavy lifting in scientific computing, image processing, and machine learning. The kind of loop a compiler spends decades of research trying to make faster.</p><p>So we have two loops sitting in one title. The loop in the code. And the feedback loop in the method. Most people clicked because of the first word. The real story is the second. Let me walk you through it, because once you see it, you cannot unsee how much of 2026 it quietly predicted.</p><h3>What the paper actually does, in plain language</h3><p>Making loops fast is one of the oldest hard problems in computing. You can reorder them, split them into tiles, run them in parallel, unroll them, and so on. There are a huge number of valid combinations, and picking the right one for a specific piece of code on specific hardware is brutally difficult. Traditional compilers use fixed rules of thumb. They are good, but they are not always right.</p><p>The researchers (Massinissa Merouani, Islem Kara Bernou, and Riyadh Baghdadi at NYU Abu Dhabi) built a system called <strong>ComPilot</strong>, short for Compiler Pilot. Here is the whole idea in one breath:</p><ol><li>The LLM looks at a loop and suggests a sequence of transformations.</li><li>A compiler (Tiramisu) checks if that change is legal, meaning it will not break the program, and then actually runs it to measure the real speedup or slowdown.</li><li>That hard, measured result is handed back to the LLM, which uses it to propose a smarter next move.</li></ol><p>Round and round. No special training. No fine-tuning. Just a general model like Gemini Flash, grounded by a compiler telling it the truth after every guess.</p><p>That is the loop that matters. Not the loop in the code. The loop in the conversation.</p><h3>The beautiful points I noticed</h3><p>A few things in this paper genuinely made me stop and think.</p><p><strong>It worked, and not by a little.</strong> Across 150 benchmark programs, ComPilot made code run 2.66x faster on average in a single run, and 3.54x faster when you let it try five times and keep the best. It even beat Pluto, a respected traditional optimizer that has been refined for years, winning on 119 of 150 cases.</p><p><strong>The feedback is the engine, not a nice-to-have.</strong> They ran the same system with the feedback turned off, so the model proposed changes but never learned how they did. Performance dropped from 2.66x to about 2.01x. Without the loop, the model is basically guessing in the dark. With it, it learns inside a single conversation.</p><p><strong>They let the compiler do the dangerous part.</strong> This is the design choice I admire most. They did not ask the LLM to rewrite the code directly. They asked it to suggest a transformation, and let the compiler prove it was safe. When they tested the alternative, letting the model rewrite code itself, roughly 18% of the “working” outputs were actually wrong, and it cost substantially more tokens, since writing full C code takes far more output than a short transformation command. The lesson is sharp. Use the model for ideas. Use a real tool for truth.</p><p><strong>It knew how to push, but not always when to stop.</strong> One oddly human detail: the model often quit too early, sometimes turning cautious right after a big speedup, sometimes getting stuck repeating failed attempts. The researchers had to nudge it to keep exploring. The loop worked, but it still needed a push now and then to avoid settling too soon.</p><p>There is something almost philosophical in that. The model did not need to be handed the rules of the world in advance. It needed a fast, honest way to find out when it was wrong, and once in a while, a reminder not to give up too early.</p><h3>Now the important part: the paper is from late 2025</h3><p>This is where I have to be honest with you. The paper landed in November 2025, with a small update in December. In AI time, that is ancient history. A lot happened between then and now. So the paper does not mention the things that proved its point at a much bigger scale. Let me close that gap.</p><h3>Google DeepMind took the same idea to production with AlphaEvolve</h3><p>If ComPilot is the careful lab experiment, <strong>AlphaEvolve</strong> is the heavyweight, deployed version of the same philosophy. It is a Gemini-powered coding agent that pairs the model’s creativity with automated evaluators that verify every answer, then evolves the best ideas. Same loop. Propose, verify, refine.</p><p>The difference is it ran on Google’s actual infrastructure and earned its keep. It sped up a key matrix multiplication kernel inside Gemini’s own architecture by 23%, which translated to a 1% cut in Gemini’s training time. It found a 32.5% speedup on a FlashAttention kernel. It improved data center scheduling and hardware circuit design. This is no longer a benchmark. This is the method paying for itself.</p><h3>Anthropic pointed a team of agents at building a whole compiler</h3><p>In early 2026, Anthropic ran an experiment where 16 Claude agents, working in parallel, built a 100,000-line C compiler from scratch in Rust, capable of compiling the Linux 6.9 kernel. The way they kept the agents honest is the same trick ComPilot used. They gave the agents an oracle, comparing their compiler’s output against GCC to catch mistakes and self-correct.</p><p>And here is the humbling footnote that ties straight back to the paper. The code their compiler produced was slow, slower than GCC even with optimizations off, because the agents chased correctness and ignored performance. In other words, building a compiler turned out to be easier for agents than making one that optimizes well. The exact problem ComPilot was poking at is still genuinely hard.</p><h3>OpenAI’s models showed up in the GPU kernel version of the story</h3><p>The same pattern jumped to GPUs. A research system called Astra used a multi-agent setup powered by OpenAI’s o4-mini to optimize real GPU kernels, hitting an average 1.32x speedup with zero-shot prompting, no extra training. It autonomously applied loop transformations, reorganized memory access, and exploited hardware tricks. Meanwhile OpenAI’s own Codex (running the GPT-5 series) made the agentic loop a daily tool for millions of developers, even if it is aimed at general software work rather than this narrow optimization niche.</p><h3>The real lesson hiding in the word “loop”</h3><p>Here is the reframe I want to leave you with.</p><p>The paper is titled around loop optimization. But the thing that made it work, and the thing that exploded across 2025 and 2026, was never the loop in the code. It was the loop in the method. Propose. Verify against reality. Learn. Repeat.</p><p>Strip away the compiler jargon and you are left with a recipe that now powers almost everything interesting in AI:</p><ul><li>A model that generates ideas, which it is great at.</li><li>A trusted, automatic way to check those ideas, which the model is bad at on its own.</li><li>A tight loop between the two.</li></ul><p>The model is the creative engine. The verifier is the load-bearing wall. ComPilot delegated verification to a compiler. AlphaEvolve delegated it to automated evaluators. Anthropic’s agents delegated it to a differential test against GCC. Same shape, every time.</p><p>So if you are building anything with AI agents right now, the takeaway is not “use a loop.” Everyone uses a loop. The takeaway is: <strong>your agent is only as good as the thing that tells it the truth.</strong> A weak verifier gives you confident nonsense. A strong, fast, honest verifier gives you something that actually improves over time.</p><p>That is the quiet message in a paper most people clicked on for the wrong reason. The loop everyone misread points to the loop that matters most.</p><h3>What this means for you if you build with AI</h3><p>A few practical things I am taking from all of this:</p><ul><li><strong>Stop optimizing the prompt and start optimizing the feedback.</strong> A clearer signal after each attempt beats a cleverer instruction before it.</li><li><strong>Find your oracle.</strong> Tests, a compiler, a reward function, a comparison against a known-good output. Whatever proves your agent right or wrong cheaply and automatically. That is your most important asset.</li><li><strong>Let the model propose, let a tool verify.</strong> Do not trust an AI’s own claim that its work is correct. The paper measured the cost of that trust at roughly 18% wrong answers.</li><li><strong>Iteration beats intelligence, within limits.</strong> A modest model in a good loop often beats a smarter model with no feedback. But there are diminishing returns, so do not loop forever.</li></ul><h3>Frequently asked questions</h3><p><strong>What is the paper “Agentic Auto-Scheduling” actually about?</strong> It is about using off-the-shelf large language models to optimize loops in code by having them propose transformations to a compiler, which checks legality and measures the real speedup, then feeds that result back to the model so it can improve.</p><p><strong>Does “loop optimization” mean optimizing an AI agent’s loop?</strong> No, and this is the common mix-up. Here “loop” means the for-loops inside ordinary programs. The agent feedback loop is the method, not the subject. The double meaning is why the title travels so well.</p><p><strong>How much faster did it make code?</strong> On the PolyBench benchmark suite, an average of 2.66x faster in a single run and 3.54x with a best-of-five strategy, beating the traditional Pluto optimizer in most cases.</p><p><strong>Did the model need special training?</strong> No. It used general models like Gemini Flash with no fine-tuning. The compiler feedback did the teaching inside the conversation.</p><p><strong>How does this connect to AlphaEvolve and the 2026 agent boom?</strong> They share one engine: propose, verify against reality, refine, repeat. AlphaEvolve scaled that loop into Google’s production systems, and Anthropic and OpenAI’s tools rely on the same propose-and-verify shape. The 2025 paper was an early, clean demonstration of the idea.</p><p><strong>What is the single most important takeaway for builders?</strong> Your AI agent is only as good as the thing that tells it the truth. Invest in a fast, honest verifier, not just a clever prompt.</p><p>The original paper is open access on arXiv (2511.00592), was published at PACT 2025, and has a reproducibility package on Zenodo. If you are into the agent-building space, it is worth twenty minutes of your time, just read it for the method, not only the word “loop.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a42c1e73b901" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Loop Engineering? The Shift From Prompting AI to Building Self-Running Agents]]></title>
            <link>https://medium.com/@ddsyasas/what-is-loop-engineering-the-shift-from-prompting-ai-to-building-self-running-agents-8eaa7de69f7b?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eaa7de69f7b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Tue, 23 Jun 2026 23:00:25 GMT</pubDate>
            <atom:updated>2026-06-23T23:00:25.233Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is Loop Engineering? The Complete Guide to the Shift From Prompts to Self-Running AI Agents</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsB4xcfubQ_ht7_abPljVA.png" /></figure><p>I have been deep in AI research lately because I build in this space, and one idea kept surfacing on my timeline under a dozen different headlines: <strong>loop engineering</strong>. Same quotes, same diagrams, same framework, recycled by everyone. So I went back to the primary sources, read the essay that started it, checked the claims, and wrote the version I wish existed: one article that takes you from the origin of the idea to where it stands now, with the actual disagreements between the people building it.</p><p>If you only have ten seconds: loop engineering is the practice of building a system that prompts your AI agent for you, on a schedule, checks the result, and decides what to do next, so you stop being the person typing prompts one at a time. That is the whole thing. The rest is detail, and the detail is where the money and the mistakes live.</p><h3>What Is Loop Engineering in Simple Terms?</h3><p>Loop engineering is designing a system that repeatedly prompts an AI agent toward a goal, verifies the output against a real check, remembers what happened, and decides the next move, all without you sitting in the chair. A prompt gives you one answer and then waits for you. A loop gives you a process that keeps working after you close the laptop.</p><p>The clearest way to hold it in your head is the phrase used by Addy Osmani, the Google engineer who named the practice: a loop is a <em>recursive goal</em>. You define a purpose once, and the agent iterates against it until a real stopping condition is met. You are no longer the engine pushing each step. You become the architect who designs the engine.</p><p>That single shift, from operating the agent to designing the system that operates it, is what every post on this topic is circling. The leverage point moved one floor up. The skill that matters in 2026 is not crafting a clever prompt, it is building a reliable, self-correcting loop. But to understand why this exploded when it did, you have to know where it came from, and it did not come from nowhere.</p><h3>Where Did Loop Engineering Come From?</h3><p>Loop engineering was named in June 2026, but the underlying idea is years old. What changed was not the concept. It was that the models finally got good enough to make the concept pay off.</p><p>The lineage runs deeper than the hype suggests. The reason-act-observe cycle traces back to the <strong>ReAct</strong> pattern from research at Princeton and Google, and <strong>Reflexion</strong> in 2023 added the twist that an agent could write a lesson to memory after a failure and read it on the next attempt. The same year, the first consumer wave of autonomous agents (AutoGPT and BabyAGI) tried to put an LLM in a loop and let it run. They mostly failed, because the models of 2023 drifted, hallucinated, and burned tokens without finishing. The idea was right and the engine was too weak.</p><p>The engineering vocabulary matured next. In December 2024, Anthropic published <strong>Building Effective Agents</strong>, which laid out five composable workflow patterns, including the evaluator-optimizer (one model generates, another critiques in a loop). That paper is the quiet foundation under half of today’s loop content, published roughly eighteen months before the term went viral.</p><p>Then in mid-2025, an Australian engineer named Geoffrey Huntley shipped a deceptively dumb technique he called the <strong>Ralph Wiggum loop</strong>, which we will come back to, because most write-ups get it wrong. Ralph went viral in the final weeks of 2025.</p><p>The naming moment came on June 7 and 8, 2026. That is the spark. Here is what actually lit it.</p><h3>Who Started the Loop Engineering Movement?</h3><p>Three people get credited, and each said the same thing from a different seat. The movement was named in two days, but it reflects what frontier engineers had already been doing for months.</p><p><a href="https://x.com/bcherny"><strong>Boris Cherny</strong></a>, who leads Claude Code at Anthropic, supplied the quote that travels in every thread. He said he no longer prompts Claude directly; he has loops that prompt Claude and figure out what to do, and that his job is to write loops. Coming from the person who runs the most popular coding agent on earth, that line carried weight.</p><p><a href="https://x.com/steipete"><strong>Peter Steinberger</strong></a>, founder of OpenClaw, posted the sloganized version on June 7 that reportedly hit five million views in a day: stop prompting your coding agents, start designing the loops that prompt them.</p><p><a href="https://x.com/addyosmani"><strong>Addy Osmani</strong></a>, a director-level engineer at Google Cloud, published the long-form essay titled <em>Loop Engineering</em> the very next day. That essay is the canonical source. It systematized the practice, supplied the vocabulary, and listed the components everyone now repeats. Crucially, Osmani was not a hype man about it. He wrote that it was still early, that he was skeptical, and that you have to be careful about token costs. Hold onto that, because the honesty in the original got lost as the idea spread.</p><p>Nearly every article you have seen since, including the wave of X threads, is a second-order read of Osmani’s piece. So what does that piece actually say a loop is made of?</p><h3>What Is the Difference Between Prompt Engineering and Loop Engineering?</h3><p>Prompt engineering optimizes a single instruction you type by hand. Loop engineering optimizes the autonomous system that decides what to prompt, when to prompt it, and whether the result is good enough. One is a message. The other is a machine.</p><p>The cleanest mental model treats these as nested layers, each wrapping the one before it rather than replacing it. Prompt engineering is about the words you send. Context engineering is about everything the model sees. Harness engineering is about the environment the agent runs in. Loop engineering sits one floor above the harness: it is about the iterative cycle that drives the agent toward a goal over time, across many runs, without you.</p><p>This is why “loop engineering is just prompt engineering with extra steps” misses the point. A prompt hands the AI an instruction. A loop hands the AI a job, a way to know when the job is done, and a rule for when to give up. The instruction is a moment. The job is a process. Once you see that distinction, the anatomy of a working loop becomes obvious.</p><h3>How Does a Loop Actually Work?</h3><p>A loop runs a five-stage cycle on its own: discover what needs doing, plan how to do it, execute the work, verify the result against the goal, and iterate by feeding the result back in if it is not there yet. Three of those five stages do all the real work, and they are exactly where people get loops wrong.</p><p><strong>Verify is the heart of the loop.</strong> Without a real check on the output, you do not have a loop, you have an agent agreeing with itself on repeat. The check has to be something objective: a test that passes or fails, a measurable threshold, a build that compiles or does not. If the only judge is the same model that did the work, you are letting it grade its own homework, and it is a generous grader.</p><p><strong>State is what makes the loop learn.</strong> The model forgets everything between runs. A real loop writes a small record to the side (what is done, what failed, what is next) so tomorrow’s run resumes instead of starting from zero. The agent forgets. The file does not.</p><p><strong>A stop condition is what keeps it sane.</strong> Every serious loop has two exits: success, and a hard limit such as “after eight tries, stop and report.” A loop with no exit runs until it succeeds, breaks, or drains your account.</p><p>That is the skeleton. But before you build one, there is a more important question almost every hype thread skips.</p><h3>Do You Actually Need a Loop?</h3><p>Most people do not need a loop yet, and that is the honest version of this whole topic. A loop only earns its setup cost when four conditions are all true at once. Miss one and a single good prompt beats the loop on cost and speed.</p><p>The four conditions, in plain English: the task repeats at least weekly, so the setup amortizes. Something can automatically reject bad output, such as a test, type check, linter, or build. The agent can do the work end to end without handing half of it back to you. And “done” is objective rather than a matter of taste.</p><p>This is where the experts quietly disagree, and it matters. The people who call loop engineering obvious tend to have effectively free tokens. The people for whom it is reckless are usually on a metered consumer plan trying to run heavy verification loops without triggering a surprise invoice. The technique scales with budget. AlphaSignal’s analysis put it bluntly: loop engineering is real, and most developers do not need the heavy version yet.</p><p>So who is it actually for? Teams with repetitive, machine-checkable work and the budget to run it: continuous test triage, dependency bumps, lint-and-fix passes, issue-to-pull-request drafts on a codebase with strong test coverage. Who should skip it for now: solo builders on consumer plans, anyone with no automated verification, and teams whose real bottleneck is review capacity rather than typing speed, because a loop just makes the review queue longer. If you pass the test, here are the parts you will assemble.</p><h3>What Are the Building Blocks of a Loop?</h3><p>Every working loop is built from the same six pieces, drawn directly from Osmani’s framework. Miss one and the loop tends to fail quietly rather than loudly.</p><h4>1. Automations (the heartbeat)</h4><p>This is the trigger that turns a one-off into a loop: a schedule, a webhook, a git event, or a command that fires without you. In Claude Code, /loop re-runs a prompt on a cadence and /goal keeps a session going until a condition you wrote is actually true. Codex has an Automations tab that runs on a schedule and drops findings into a triage inbox. Runs that find something come to you. Runs that find nothing archive themselves.</p><h4>2. Worktrees (parallel without chaos)</h4><p>The moment you run more than one agent on the same repo, their edits collide. A git worktree gives each agent its own working directory on its own branch, sharing the same history, so one agent’s changes cannot touch another’s checkout. This is what lets loops scale from one background task to a fleet running at once.</p><h4>3. Skills (write the project knowledge once)</h4><p>A skill is a file the loop reads every run instead of you re-explaining the project every session. It holds your conventions, your patterns, and a hard list of what the agent must never touch. Without skills, every run re-derives your context from zero. With skills, intent compounds.</p><h4>4. Connectors (so it acts, not suggests)</h4><p>Built on the Model Context Protocol (MCP), connectors let the loop reach your real tools: open a pull request, update a Linear ticket, query a database, post to Slack. This is the difference between an agent that says “here is the fix” and a loop that ships the fix and pings the channel when the build is green.</p><h4>5. Sub-agents (keep the maker away from the checker)</h4><p>The single most useful structural trick in a loop is splitting the agent that does the work from the agent that checks it. Your writer can be fast and cheap; your reviewer can be slow, strict, and running a stronger model. That separation is most of the quality, which brings us to a pattern older than the hype.</p><h4>6. State and memory (the spine)</h4><p>A markdown file, a Linear board, or a JSON record that lives outside the single conversation and holds what is done and what is next. It sounds too dumb to matter and it is the spine of every working loop. Pair it with a standing high-level spec the agent rereads each run, so state tells the agent where it is and the spec tells it where to go.</p><h3>What Is the Maker-Checker Pattern in AI Agents?</h3><p>The maker-checker pattern means one agent produces the work and a separate agent, with different instructions and ideally a different model, verifies it. The reason is simple: the model that wrote the code is too nice grading its own homework.</p><p>This is not a 2026 invention. It is the evaluator-optimizer pattern that Anthropic documented in Building Effective Agents back in December 2024: one model generates, another evaluates and feeds back in a loop, repeating until an objective check passes. The vocabulary went viral eighteen months after the pattern was written down.</p><p>There is a real-world analogy that makes it stick. Every serious prop trading shop runs this way internally. At firms like Jane Street, the trader who proposes a trade does not approve the trade. At Citadel, the researcher who builds the model does not validate the model. Separation of maker and checker is how high-stakes work has always been verified. Loop engineering just applies it to agents. And the wildest application of running agents in a loop has its own name.</p><h3>What Is the Ralph Wiggum Loop?</h3><p>The Ralph Wiggum loop is an autonomous coding technique created by Geoffrey Huntley in mid-2025, in which a coding agent runs in an endless shell loop, reading the same prompt file every iteration and using the file system instead of conversation history as its memory. In its purest form it is a few lines of bash that pipe a prompt file into a coding agent, over and over.</p><p>This is the part most articles get wrong, so let me correct the record clearly. Several popular threads use “Ralph Wiggum loop” as a name for the failure mode where an agent quits early and the loop spins uselessly. That is a misattribution. Ralph is a deliberate, working technique, not the name of a bug. Huntley calls it “deterministically bad in an undeterministic world,” and named it after the cheerful, dim Simpsons character on purpose: a dumb, persistent loop that is surprisingly effective. The secret is that each iteration starts with a fresh context window, which sidesteps the quality drop that hits long agent sessions once the context fills up.</p><p>The results are genuinely startling, and they make excellent proof points. A team at a Y Combinator hackathon ran six concurrent Ralph loops in git worktrees and shipped six framework ports overnight, racking up more than a thousand commits for around 600 dollars in API spend. Huntley reportedly shipped a 50,000 dollar client MVP for 297 dollars in API costs, and built an entire programming language, including a self-hosting compiler, over roughly three months of continuous Ralph runs. Huntley’s blunt framing is that software development, the act of typing code, is dying, while software engineering, the act of designing systems that safely leverage these loops, is more alive than ever. That power comes with a bill, and the bill is where the demos go quiet.</p><h3>How Much Does Running an AI Loop Cost?</h3><p>A loop costs far more than the prompts it runs, because the cost compounds. Every iteration re-reads the full context (the goal, the code, the last result, what failed) and sends that growing pile through the model again. A loop that runs ten times is not ten prompts. It is ten prompts that each keep getting bigger, and the maker-checker split doubles the bill because two models now read the work.</p><p>The metric that actually matters, and that almost nobody tracks, is <strong>cost per accepted change</strong>. Not tokens spent, not loops run, not tasks attempted. If the loop hands you ten results and you throw six away, you are doing the review work it was supposed to save. Below a fifty percent accept rate, the loop costs more than it gives back.</p><p>This is the real reason the heavy version belongs to teams with budgets and guardrails: iteration caps, token budgets, cheap models on the boring steps, and monitoring. Osmani himself, the person who named the field, flags token cost as the first risk and notes that usage varies wildly depending on whether you are token rich or token poor. If a metered plan is your reality, you are not missing out. The core idea works at a fraction of the cost, which we will get to. First, you should know exactly how loops break.</p><h3>How Do AI Loops Fail?</h3><p>Loops rarely crash. They fail quietly while continuing to spend, which is what makes the failure modes dangerous. There are a handful of named ones worth memorizing.</p><p>The early-exit failure (the one often misnamed after Ralph) is when an agent emits its “done” signal too soon and the loop exits on a half-finished job, or keeps running and billing while producing nothing. The fix is the gate: an objective check that can actually fail the work, not a second agent asked to “review,” which is just two optimists agreeing.</p><p>Then there is <strong>goal drift</strong>, where each summarization step is lossy and a “do not do X” constraint quietly disappears around turn forty-seven; the fix is a standing spec file reread every run. <strong>Self-preferential bias</strong> is the maker grading its own homework; the fix is the separate verifier. <strong>Agentic laziness</strong> is the loop declaring “done enough” at partial completion; the fix is an objective stop condition checked by a fresh model.</p><p>Two deeper risks are not technical, and both come from Osmani. <strong>Comprehension debt</strong> is the gap between what your repository now contains and what anyone on your team actually understands, growing every time the loop ships code faster than you can read it. The bill that hurts is not the token bill, it is the day you have to debug a system nobody has read. <strong>Cognitive surrender</strong> is the pull to stop forming an opinion and just accept whatever the loop returns. Designing a loop is the cure when you do it with judgment and the accelerant when you do it to avoid thinking.</p><p>And because an unattended loop is also an unattended attack surface, there is a security tax: generated code merging unreviewed, skills acting as prompt-injection vectors, credentials leaking into logs you do not monitor, and permission scope quietly creeping. The mitigations are boring and mandatory: security checks in the gate, audited skill sources, sanitized logs, and permissions re-reviewed on a schedule. Knowing all this, how should a normal person actually start?</p><h3>How Do You Build Your First Loop?</h3><p>Build the smallest loop that works, and build it in a strict order: get one manual run reliable, turn that into a skill, wrap the skill in a loop with a gate and a stop condition, and only then put it on a schedule. Skipping ahead, automating something you have not proven by hand, is exactly how loops blow up while you sleep.</p><p>The minimum viable loop is four parts and no swarm: one automation, one skill, one state file, one gate. Good first loops are things like nightly continuous-integration failure triage, weekly dependency-bump pull requests, and lint-and-fix passes on every pull request. Bad first loops are architecture rewrites, auth or payments code, production deploys, and anything where “done” is a judgment call. Keep humans in the chair for those.</p><p>You do not even need a coding agent to feel how this works. You can run a self-checking loop by hand in any LLM right now by giving it three things at once: a goal, strict success criteria, and a protocol that forces it to score its own work before it is allowed to stop. Tell it to plan one step, do the work, verify by scoring each criterion harshly, and either print “FINAL” when everything clears the bar or print “ITERATING” and fix the weakest point first. Watch it draft, grade itself, find the weak spot, and rewrite until it actually clears the bar. That is a loop. You just built one with a paragraph.</p><p>But notice what is missing: you are still the trigger. Close the tab and it is gone. To get a loop that runs on its own, on a schedule, triggered by real events, you step into the heavier world. And the heavier world is where the different camps really split.</p><h3>What Do the Experts Disagree About?</h3><p>The experts agree on the mechanics and disagree sharply on how far to push them. This is the part the recycled threads flatten, and it is the most useful part to understand.</p><p>On one end sits <strong>Geoffrey Huntley</strong>, who runs agents with full permissions on a bare-metal box, does not use continuous integration, lets agents push straight to master with no branches, and does not review the code. His bet is on self-evolving software and orchestration at scale (he and Steve Yegge describe “fleets” of agents). On the other end sits <strong>Addy Osmani</strong>, who is openly cautious and whose closing advice is to build the loop like someone who intends to stay the engineer, not just the person who presses go. Between them sits <strong>Boris Cherny</strong>, whose autonomy ladder is the pragmatic middle path: level one suggests only, level two drafts changes for you to apply, level three applies low-risk changes but needs approval before merge, level four runs fully automatically with audit logs. His rule is that level four is earned, not assumed.</p><p>Then there is the budget divide, which is really a worldview divide. If your tokens are effectively free, loops look obvious. If you are on a metered plan, heavy verification loops look reckless. Both camps are right about their own situation, which is why “should I build loops” has no universal answer. The honest synthesis, and my own take after reading all of this: start with the free, light version, stay the engineer, and only reach for the heavy machinery once you can feel that the simple version is no longer enough. Because the most interesting frontier is not unattended code at all. It is what happens when loops start running a whole business.</p><h3>What Does Loop Engineering Look Like Beyond Coding?</h3><p>Beyond code, loop engineering becomes an operating system for continuous improvement, where multiple loops share what they learn and compound. This is where the most original thinking is happening, and it comes from people applying the same six pieces to entirely different domains.</p><p><a href="https://x.com/jasonzhou1993"><strong>Jason Zhou</strong></a>, building SuperDesign, makes the sharpest non-coding case. He splits the system into two nested layers: the <em>agent loop</em> (helping one agent complete a task well) and the <em>outer loop</em> (deciding what the agent should work on next and how the system learns). His teams run loops across support, SEO, product growth, and ads, and the magic is that each loop writes to a shared artifact system: structured signals, tickets, and a global log. The support loop notices five people struggling to export something and files a signal; the product-growth loop reads that signal alongside analytics and reprioritizes. The loops stop being isolated automations and start operating from a shared knowledge base of what the business is learning. He reports an SEO loop producing twenty to forty pages a day, and pull requests landing at 1 a.m. without anyone prompting them.</p><p><a href="https://x.com/RohOnChain"><strong>Roan</strong></a>, a quant systems builder, points the same framework at trading, where the cycle (pull data, generate signals, backtest, execute, monitor risk, repeat) was already a loop that funds run with hundreds of humans inside it. His self-improving system writes every loss back to a skill file as a new rule, so the strategy compounds, and a separate verifier agent (ideally a stronger model) decides whether a signal is real alpha or noise before any capital moves.</p><p><a href="https://x.com/AnatoliKopadze"><strong>Anatoli Kopadze</strong></a> takes the most consumer-friendly angle, reframing loops as everyday automations anyone can describe in plain words: a 7 a.m. brief from your inbox and calendar, a habit tracker that holds a streak, a flight watcher that buys at your price. It is a useful framing, though worth reading with the knowledge that the piece doubles as a promotion for a specific no-code agent product. The underlying point stands: strip away the code and the cost, and what is left is one genuinely useful idea, a task that runs itself.</p><h3>What Does Loop Engineering Mean for Your Career?</h3><p>Loop engineering means your job moves up a level, from doing the work to designing the system that does the work, and from per-task decisions to loop-design decisions. You stop opening a chat to ask a question and start opening a triage inbox to review what your loops found overnight.</p><p>This does not mean you stop deciding what matters. It means the deciding happens at a higher altitude. You are not writing fewer prompts because you are doing less; you are writing fewer prompts because the loop writes them for you, and your attention moves to the parts that genuinely need a human: the verifier you trust, the stop condition, the review checkpoint, and the next loop worth building. The leverage moved. Your job moved with it. The engineers who thrive from here will not be the ones with the cleverest prompts. They will be the ones who design the most reliable, self-correcting systems, and who keep reading what those systems ship.</p><h3>Key Points</h3><ul><li><strong>Loop engineering</strong> is building a system that prompts an AI agent for you, verifies the result, remembers state, and decides the next step, so you design the process instead of operating it.</li><li>It was <strong>named on June 7 to 8, 2026</strong> by way of Peter Steinberger’s viral post and Addy Osmani’s canonical essay, anchored by Boris Cherny’s line that his job is to write loops. The underlying idea is older (ReAct, Reflexion, the 2023 autonomous-agent wave, and Anthropic’s December 2024 Building Effective Agents).</li><li>A loop runs <strong>discover, plan, execute, verify, iterate</strong>. Verify, state, and a stop condition are where loops succeed or fail.</li><li>Only build a loop when <strong>four conditions</strong> hold: the task repeats, output can be auto-rejected, the agent can do it end to end, and “done” is objective. Otherwise a single good prompt wins.</li><li>The <strong>six building blocks</strong>: automations, worktrees, skills, connectors, sub-agents, and state/memory.</li><li>The <strong>maker-checker (evaluator-optimizer) pattern</strong> is the quality lever and predates the hype by eighteen months.</li><li>The <strong>Ralph Wiggum loop</strong> (Geoffrey Huntley, 2025) is a deliberate, working bash-loop technique, not the name for an early-exit bug. Real results include six repos shipped overnight for about 600 dollars.</li><li>The metric that matters is <strong>cost per accepted change</strong>. Below a fifty percent accept rate, the loop loses money.</li><li>Loops <strong>fail quietly</strong>: early exit, goal drift, self-preferential bias, comprehension debt, cognitive surrender, and a security tax on anything unattended.</li><li><strong>Build small, in order</strong>: one reliable manual run, then a skill, then a loop with a gate, then a schedule.</li><li>The experts split between <strong>Huntley’s radical autonomy</strong> and <strong>Osmani’s stay-the-engineer caution</strong>, with <strong>Cherny’s autonomy ladder</strong> as the middle path. Beyond code, <strong>Jason Zhou’s compounding business loops</strong> are the most interesting frontier.</li></ul><h3>Frequently Asked Questions</h3><p><strong>Is loop engineering just a fancy name for cron jobs or RPA?</strong> No. A cron job runs the same fixed steps on a timer, and robotic process automation follows rigid rules. A loop is adaptive: the agent decides what to do, checks whether it worked, and changes its next move based on the result. The schedule is only one of six parts, and the verifier and state are what make it a loop rather than a scheduled script.</p><p><strong>How is this different from AutoGPT and BabyAGI from 2023?</strong> The architecture is similar; the difference is that the models are now capable enough to make it work. The 2023 autonomous agents drifted, hallucinated, and rarely finished because the underlying models were too weak and there was little discipline around verification, state, and stop conditions. Loop engineering is the same idea with stronger models and hard-won operational guardrails.</p><p><strong>What tools do I need to build a loop?</strong> At minimum, an agent runtime (Claude Code or Codex are the two most common), a way to schedule runs, a place to store state (a markdown file is fine to start), and an objective gate such as a test suite or linter. Frameworks like LangGraph or CrewAI encode these patterns if you do not want to build the orchestration yourself.</p><p><strong>Will loop engineering replace software developers?</strong> It is more likely to change the job than erase it. The mechanical part (typing code from a clear spec) is increasingly automatable, while the higher-order work (designing systems, defining verification, reviewing what ships, and owning judgment calls) becomes more valuable, not less. The recurring advice from the people closest to it is to move up a level and stay the engineer.</p><p><strong>How many agents can I run in parallel?</strong> Technically, git worktrees remove the file-collision limit, so you can run many. Practically, your own review bandwidth is the real ceiling. If you cannot review what the loop produces, running more agents just lengthens the queue and grows comprehension debt.</p><p><strong>Is it safe to let a loop run unattended overnight?</strong> Only with guardrails. Before running unsupervised, test a few iterations manually, set a hard iteration cap and a token budget, restrict the agent’s command and permission scope to what the task needs, include security checks in the gate, and require human approval before anything irreversible like a merge, deploy, or dependency change.</p><p><strong>What is the single most common mistake?</strong> Building a loop with no objective gate. A second agent asked to “review” without a test, build, or type check is just a second optimist. If nothing can fail the work for you, the loop is the agent agreeing with itself on repeat, and it will confidently spend your money shipping work you cannot trust.</p><p><strong>Do I need to be a developer to use loops?</strong> No. The self-checking loop you can paste into any chatbot needs zero code, and consumer tools increasingly let you describe a recurring automation in plain language. The heavy, unattended, code-shipping version is where developer skills and budget become necessary.</p><p>If this was useful, the primary sources worth reading next are Addy Osmani’s original “<a href="https://addyosmani.com/blog/loop-engineering/">Loop Engineering</a>” essay, Anthropic’s “<a href="https://www.anthropic.com/engineering/building-effective-agents">Building Effective Agents</a>,” and Geoffrey Huntley’s writing on the <a href="https://ghuntley.com/loop/">Ralph technique</a>. I distilled and fact-checked the whole landscape here so you would not have to. Save it, share it, or paste it into your favorite AI and keep asking questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eaa7de69f7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Large Language Models Are Actually Built, Everything I Learned From Stanford’s CS229 LLM…]]></title>
            <link>https://medium.com/@ddsyasas/how-large-language-models-are-actually-built-everything-i-learned-from-stanfords-cs229-llm-5886997a5f42?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/5886997a5f42</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 19:51:05 GMT</pubDate>
            <atom:updated>2026-06-21T19:51:05.011Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Large Language Models Are Actually Built, Everything I Learned From Stanford’s CS229 LLM Lecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TCwX39k8Js_XgtTh6-F_uw.png" /></figure><h3>How I Fell Down This Rabbit Hole</h3><p>I have been researching large language models a lot lately. Not casually, but with intent, because I am building in the AI startup space and I am tired of talking about LLMs like they are magic. If you are going to build on top of something, you should understand what is actually happening under the hood.</p><p>So a few nights ago I was scrolling Twitter (X, whatever we are calling it this week) and a post stopped me. It was a clip from a lecture that explained, in plain language, how models like ChatGPT and Claude are really trained. I did what any obsessive person would do. I tracked the clip back to its original source.</p><p>It turned out to be a full Stanford lecture on YouTube: <strong>CS229: Machine Learning, “Building Large Language Models (LLMs)”</strong>, a guest lecture delivered by <strong>Yann Dubois</strong> in Summer 2024. Dubois is a Stanford PhD student advised by Percy Liang and Tatsu Hashimoto, and he was part of the team behind Alpaca, AlpacaFarm, and AlpacaEval. In other words, he has actually trained and evaluated these things, so he is not guessing.</p><p>The lecture is roughly an hour and a half. Dense, fast, occasionally chaotic with student questions. I watched it twice and took notes like my startup depended on it (it kind of does).</p><p>But here is the thing about a ninety-minute technical lecture: most people will never finish it. So I wrote the version I wish I had found first.</p><h3>You Do Not Actually Have to Watch It (Here Is the Hack)</h3><p>Before we dive in, let me save you some time and be honest about how to use this article.</p><p>You have three options. One, watch the full Stanford lecture on YouTube and absorb it the slow way. Two, read this article top to bottom, where I have organized everything into clean sections that build on each other. Three, and this is my favorite, copy the entire text of this article, paste it into whatever LLM you use most (ChatGPT, Claude, Gemini, take your pick), and start asking questions.</p><p>That third option is genuinely powerful. Drop this in and ask things like “explain tokenization to me like I am twelve,” or “quiz me on scaling laws,” or “what would change if I trained a model on only 2 trillion tokens instead of 15.” You turn a static article into an interactive tutor. The irony of using an LLM to learn how LLMs are built is not lost on me, and that is exactly the point Dubois keeps making throughout the lecture.</p><p>So whichever path you pick, you are covered. This article is designed to be both a standalone read and a high-quality prompt.</p><p>Now let us get into the actual substance, starting with the single mental model that reframed how I think about this entire field.</p><h3>The Five Things That Actually Matter (And the One Everyone Obsesses Over)</h3><p>Dubois opens with a framework that quietly does a lot of work. When you train an LLM, five components matter: <strong>architecture, the training loss and algorithm, data, evaluation, and systems.</strong></p><p>Architecture is the neural network design. Almost every modern LLM is some flavor of the Transformer. The training loss and algorithm is how you actually optimize the model. Data is what you feed it. Evaluation is how you know whether you are making progress. Systems is how you make all of this run on real hardware without setting your budget on fire.</p><p>Here is the part that stuck with me. Dubois, who spent a big chunk of his career on architecture research, basically says: academia obsesses over architecture and fancy new losses because they feel important and publishable, but in practice the three components that decide whether your model is good are data, evaluation, and systems. That is where industry quietly pours its effort.</p><p>He even skips the architecture section of his own lecture, partly because he already gave a transformers lecture, and partly because there is endless material on transformers online while the other four topics are weirdly underexplained.</p><p>That reframing is worth sitting with if you build in AI. The shiny part (the model architecture) is mostly commoditized. The moat is in data quality, honest evaluation, and infrastructure.</p><p>So if data and training are king, where does the journey actually begin? It begins with a deceptively simple task: predicting the next word.</p><h3>Pretraining: Teaching a Machine to Predict the Next Word</h3><p>Pretraining is the classic language modeling phase. You take a model and train it to, in effect, model all of the internet. This is the GPT-2 and GPT-3 era of thinking, before chatbots became assistants.</p><p>At its core, a language model is just a probability distribution over sequences of words (or tokens). Give it “the mouse ate the cheese” and it tells you how likely that sentence is to appear in human text. Feed it “the mouse ate cheese” with broken grammar and it should assign lower probability. Feed it “the cheese ate the mouse” and a good model knows that is semantically unlikely. So the model implicitly absorbs both syntax and meaning.</p><p>Modern LLMs are <strong>autoregressive</strong>. That means they decompose the probability of a whole sentence into a chain: the probability of word one, times the probability of word two given word one, times word three given the first two, and so on. This is just the chain rule of probability, no approximation involved. The model predicts the next token given everything that came before.</p><p>The downside is that generation is a loop. To write a long passage, the model produces one token, feeds it back in, produces the next, and repeats. Longer outputs take longer to generate. That is the price of the current paradigm.</p><p>Training itself uses <strong>cross-entropy loss</strong>, which mathematically is the same thing as maximizing the likelihood of the real text. You nudge the weights to make the correct next token more probable and everything else less probable.</p><p>Simple idea, enormous consequences. But there is a hidden step before any of this works, and it is the part almost nobody talks about.</p><h3>Tokenization: The Unsexy Step That Quietly Decides Everything</h3><p>Before a model sees text, the text gets chopped into tokens. Dubois spends real time here because tokenization is more important than people assume.</p><p>Why not just use whole words? Because typos break you. If “running” is one token and someone types “runnning,” your model has no token for it. And languages like Thai do not put spaces between words, so word-splitting falls apart fast. Why not go character by character then? Because your sequences become enormously long, and Transformer compute grows quadratically with sequence length. Long sequences are expensive.</p><p>So tokenizers split text into common sub-word chunks, averaging roughly three to four characters per token. The most common method is <strong>Byte Pair Encoding (BPE)</strong>. You start with a large text corpus, treat every character as its own token, then repeatedly find the most frequent adjacent pair of tokens and merge them into a new token. Repeat thousands of times and you end up with a vocabulary where “token” might be one unit while “tokenizer” splits into “token” and “izer.”</p><p>Why care as a builder? Because tokenization silently shapes capability. Numbers are a great example. If “327” gets its own token, the model does not see digits the way we do, which hurts arithmetic generalization. GPT-4 notably changed how it tokenized code (those leading spaces in Python were handled badly before), and it improved the model’s ability to handle code.</p><p>Tokenization is the kind of detail that looks trivial and turns out to be load-bearing. Once your model can read and predict text, the next obvious question is brutal: how do you even know if it is any good?</p><h3>Evaluation in Pretraining: Perplexity and Its Discontents</h3><p>The classic metric is <strong>perplexity</strong>. Think of it as the validation loss made interpretable. You take the average per-token loss and exponentiate it. The intuition Dubois gives is lovely: perplexity is roughly the number of tokens the model is hesitating between when it predicts the next one.</p><p>A perfect model has a perplexity of 1 (it always knows the next token). A clueless model has a perplexity equal to the vocabulary size (it is guessing uniformly). Between 2017 and 2023, perplexity on a standard dataset dropped from hesitating between about 70 tokens to fewer than 10. That is a staggering improvement, and it maps neatly onto how much better these models got at sounding human.</p><p>The catch is that perplexity depends on your tokenizer and your evaluation data, so you cannot cleanly compare two different models with it. A model with a 100,000-token vocabulary and one with a 10,000-token vocabulary are not on the same scale. So while perplexity is still vital when you are developing your own model, academia has largely moved to <strong>aggregated benchmarks</strong>.</p><p>The big ones are HELM (from Stanford), the HuggingFace Open LLM Leaderboard, and especially <strong>MMLU</strong>, a massive collection of multiple-choice questions across domains like physics, medicine, and astronomy. You measure how likely the model is to produce the correct answer versus the wrong ones.</p><p>Clean in theory. In practice, evaluation is a minefield, and the next two problems should make anyone reading benchmark tweets a little more skeptical.</p><h3>Why You Should Distrust Benchmark Numbers</h3><p>Two evaluation problems from the lecture are worth tattooing on your brain.</p><p>First, <strong>inconsistent evaluation methods</strong>. Even for a standard benchmark like MMLU, different organizations score it differently. You can ask the model which of A, B, C, or D is most likely, or you can compare the probability of generating each full answer, or you can constrain the output tokens. These are not the same. Dubois cites Meta’s first Llama 65B model scoring 63.7 on HELM but 48.8 on another setup. Same model, same benchmark name, fifteen-point swing, purely from how it was evaluated. And that is before you even get into prompting differences.</p><p>Second, <strong>train-test contamination</strong>. How do you know a model was not trained on the very benchmark you are testing it on? For companies this is less of a problem (they know their training data), but for everyone else it is serious. One clever detection trick from the Tatsu lab: most datasets online appear in a fixed order. Since a language model just predicts the next token, you can check whether the model finds the test examples more likely in their original order than in a shuffled order. If order matters, the data was probably seen during training.</p><p>The takeaway is uncomfortable but useful. When you see a tweet bragging that some model “beats GPT-4 on MMLU,” your first question should be “evaluated how, and was the test set clean?” Benchmarks are signal, not gospel.</p><p>If evaluation is shaky, what about the fuel that drives the whole engine? This is where the real work, and the real secrecy, lives.</p><h3>Data: The “Train On the Internet” Lie</h3><p>Everyone says LLMs are “trained on the internet.” Dubois makes it clear that this phrase hides an enormous, gnarly pipeline. The raw internet is filthy. Download a random web page and you would be horrified at what is actually on it. It is nothing like clean Wikipedia prose.</p><p>The pipeline roughly goes like this. You start by crawling the web, often using Common Crawl as a base, which adds new pages monthly and amounts to around 250 billion pages, roughly a petabyte of data. Then the hard part begins.</p><p>You extract the actual text from messy HTML (extracting math correctly is genuinely difficult). You filter undesirable content like not-safe-for-work material, harmful content, and personally identifiable information, usually with long blacklists plus trained classifiers. You deduplicate aggressively, because headers, footers, mirrored URLs, and book passages get repeated thousands of times. You apply heuristic quality filters, throwing out pages with weird token distributions, absurd word lengths, or only three words.</p><p>Then it gets clever. <strong>Model-based filtering</strong> trains a classifier to recognize text that resembles pages linked from Wikipedia (a proxy for quality) and upweights it. You classify data into domains and deliberately upweight some (code and books, which seem to boost reasoning) while downweighting others (entertainment). Finally, at the end of training, you lower the learning rate and overfit slightly on very high-quality data like Wikipedia.</p><p>Every single bullet point above is months of work. And here is the kicker, which leads directly into why this stage is the real battleground.</p><h3>How Much Data, and Why Nobody Will Tell You</h3><p>The numbers tell a story of explosive growth. Early datasets started around 150 billion tokens (roughly 800 gigabytes). The best models today train on around <strong>15 trillion tokens</strong>. Llama 2 used about 2 trillion. Llama 3 used 15 trillion. GPT-4’s count is unknown, but leaks suggest something in the same ballpark, perhaps around 13 trillion.</p><p>Two themes from the lecture matter for builders.</p><p>First, <strong>secrecy</strong>. Companies do not disclose their data recipes, for two reasons. One is competitive: the data mixture is arguably the single biggest lever on model quality, so it is a trade secret. The other is legal: they really do not want to admit they trained on copyrighted books, because that invites lawsuits. As Dubois puts it bluntly, they trained on the books, they just will not say so.</p><p>Second, <strong>we have not solved data</strong>. This is not a finished science. Open problems include processing data efficiently at petabyte scale, balancing domains optimally, generating useful synthetic data (a hot area because we are genuinely running low on fresh internet text), and using multimodal data to improve even text performance.</p><p>That last point is huge for anyone building. The frontier is not “invent a better Transformer.” It is “find or create better data.” Of the roughly 70 people on a team like Llama’s, Dubois estimates maybe 15 work on data, and data work needs enormous CPU resources too.</p><p>So if more data and bigger models keep helping, the obvious question is: how much better, and can we predict it? The answer turned out to be shockingly precise.</p><h3>Scaling Laws: The Closest Thing AI Has to a Crystal Ball</h3><p>Around 2020, researchers confirmed something wild. The more data you train on and the larger the model, the better the performance, and crucially, <strong>there is no overfitting at this scale</strong>. Bigger is just better. (Yes, this contradicts everything a normal machine learning class teaches about overfitting. Dubois jokes that overfitting still exists for the exam.)</p><p>Even wilder, the improvement is predictable. Plot test loss against compute on a log-log scale and you get a straight line. This means you can forecast how much better your model will be if you add more compute, more data, or more parameters. There is no deep theory for why this holds, but empirically it has not plateaued, and no one knows exactly when it will.</p><p>This unlocked a new way to work. The old pipeline was to train many full-size models with different settings and pick the best, which wasted most of your compute. The new pipeline is to find a scaling recipe, tune hyperparameters on many small models of different sizes, fit a scaling law, extrapolate to predict which setup wins at full scale, and only then train one giant model for the long haul. You can even use this to decide between architectures (Transformer versus LSTM) before committing.</p><p>The famous <strong>Chinchilla</strong> result found that compute-optimal training uses about 20 tokens per parameter. But if you also account for inference costs (a smaller model is cheaper to serve forever), the sweet spot shifts to around 150 tokens per parameter, which is closer to what deployed models actually use.</p><p>Scaling laws lead to a philosophical punchline that should shape your strategy. It is called the bitter lesson.</p><h3>The Bitter Lesson and the Real Cost of a Frontier Model</h3><p>Richard Sutton’s 2019 “bitter lesson” argues that, over the long run, methods that simply leverage more computation beat clever hand-designed methods. Combine that with scaling laws and Chinchilla, and the conclusion is stark: since more compute reliably yields better models, what matters most is having architectures and systems that can soak up computation. The tiny architectural tweaks academics love mostly just shift the intercept of the curve a little. Better data, on the other hand, genuinely improves the slope.</p><p>Then Dubois does the math on what a frontier model actually costs, using Llama 3 405B as the example. It was trained on 15.6 trillion tokens with 405 billion parameters (about 40 tokens per parameter). Using the rule of thumb that FLOPs equal roughly six times parameters times tokens, that lands at about 3.8 x 10²⁵ FLOPs. Notably, that is just under the 10²⁶ threshold from the Biden executive order that triggers extra government scrutiny, so they likely stayed deliberately below it.</p><p>The hardware was 16,000 H100 GPUs running for roughly 70 days, about 26 to 30 million GPU hours. Renting H100s at a floor of around 2 dollars per hour, that is roughly 52 million dollars in compute. Add about 25 million in salaries (say 50 employees at 500K), and you land near <strong>75 million dollars</strong> to train one model. Carbon-wise, it is around 4,000 tons of CO2, which Dubois notes is currently modest (about 2,000 round-trip flights from New York to London), though that will matter more as each generation multiplies compute roughly tenfold.</p><p>Now we hit the turning point. A pretrained model can predict text beautifully, but it is not yet an assistant. Ask GPT-3 to “explain the moon landing to a six-year-old” and it might just list more similar questions. Fixing that is a whole second phase.</p><h3>Post-Training Part 1: Supervised Fine-Tuning (SFT)</h3><p>Post-training is what turns a raw language model into a helpful, aligned assistant. This is the leap from GPT-3 (known mostly to researchers) to ChatGPT (known to your grandmother).</p><p>The first step is <strong>supervised fine-tuning (SFT)</strong>. The idea is simple: take the pretrained model and fine-tune it on examples of the kind of answers you actually want, written by humans. It is still plain language modeling (next-token prediction), just on curated question-answer pairs instead of raw internet text. That is why it is “supervised.”</p><p>The fascinating result, from a paper called LIMA, is that <strong>you do not need much data</strong>. Scaling SFT examples from 2,000 to 32,000 barely helps. Why? Because SFT is not teaching the model new knowledge. The knowledge is already baked in from pretraining. SFT mostly teaches the model which format and which “type of user” to imitate. The pretrained model has effectively modeled every kind of writer on the internet, and SFT just says “be this kind of helpful responder, not that random forum poster.”</p><p>Collecting human-written answers is slow and expensive, though. So Dubois and his team pioneered a workaround with <strong>Alpaca</strong>: start with 175 human-written examples, ask a strong existing model to generate 52,000 more synthetic question-answer pairs, then fine-tune a base model (LLaMA 7B) on them. It worked surprisingly well and helped kick off the entire field of synthetic data generation.</p><p>SFT has real limitations, though. It can only clone what humans would write, and it might even cause hallucinations. The fix for that is the technique that quietly powers every chatbot you use.</p><h3>Post-Training Part 2: RLHF, Reward Models, PPO, and DPO</h3><p>SFT just clones human behavior, which caps the model at human ability and can encourage hallucination (if a human cites a reference the model never saw in pretraining, SFT teaches it to confidently invent plausible-sounding references). The smarter approach is <strong>reinforcement learning from human feedback (RLHF)</strong>, which optimizes for human <em>preference</em> rather than imitation.</p><p>The pipeline: for a given prompt, generate two answers, ask human labelers which one is better, then train the model to produce more of the preferred kind. To turn sparse “this one is better” signals into something richer, you train a <strong>reward model</strong>, a classifier that scores outputs. Using the Bradley-Terry setup, the reward becomes the logits of a softmax, giving you continuous information about how much better one answer is, not just a binary thumbs up.</p><p>Then you optimize the model against that reward using <strong>PPO</strong> (Proximal Policy Optimization), with a regularization term to prevent the model from over-optimizing a reward model that only imperfectly captures human taste. This is exactly the three-step recipe (SFT, train reward model, run PPO) that created ChatGPT. The problem is that PPO is a notoriously messy beast: rollouts, clipping, instability, poor documentation.</p><p>So Stanford researchers introduced <strong>DPO</strong> (Direct Preference Optimization), a dramatic simplification. Instead of training a reward model and doing RL, you directly maximize the likelihood of preferred answers and minimize the likelihood of dispreferred ones. Under reasonable assumptions, DPO shares the same optimal solution as PPO, but it is just maximum likelihood, far simpler to implement. It performs about as well, so it became the open-source standard.</p><p>Now the hardest question of all returns: once a model can say anything, how do you measure whether it is good?</p><h3>Evaluating Chatbots: Chatbot Arena, AlpacaEval, and the Length Bias Trap</h3><p>Evaluating an aligned chatbot is genuinely hard. Perplexity no longer works (post-PPO models are not calibrated probability distributions, they are policies optimized to produce one good answer). And the space of valid answers is huge, with many equally good responses to an open-ended question.</p><p>The gold standard is <strong>Chatbot Arena</strong>: real users chat blindly with two models, vote on which response is better, and over hundreds of thousands of votes you get reliable rankings. The downsides are that it is slow, expensive, and skewed toward tech-savvy users who ask a lot of coding questions.</p><p>So, following the same trick as Alpaca, the team built <strong>AlpacaEval</strong>, which replaces human judges with an LLM judge. You generate outputs from a baseline and your model, ask a strong model like GPT-4 which is better, average over a benchmark, and get a win rate. It hits about <strong>98 percent correlation with Chatbot Arena</strong>, runs in under three minutes, and costs under 10 dollars. Compared to humans (who agree with each other only about 66 percent of the time and cost around 300 dollars per 1,000 examples), LLM judges are roughly 50 times cheaper and more consistent.</p><p>The big catch is <strong>length bias</strong>. Both humans and LLM judges prefer longer answers, but LLM judges, once biased, keep amplifying it, which is why RLHF-tuned chatbots tend to ramble. The same GPT-4 prompted to “be concise” scored a 20 percent win rate against itself, while “be verbose” scored 64 percent. AlpacaEval now uses regression to control for length.</p><p>One more layer remains, the one that decides whether any of this is even affordable to run.</p><h3>Systems: Why GPUs Are the Real Bottleneck</h3><p>Compute is the bottleneck, and you cannot just buy your way out. The best GPUs are expensive and scarce, and connecting many of them introduces communication overhead. So squeezing more out of the hardware you have is essential.</p><p>A quick mental model: GPUs are optimized for <strong>throughput</strong> (one instruction across thousands of cores in parallel), while CPUs are optimized for <strong>latency</strong>. GPUs are blazing fast at matrix multiplication specifically, which is why everything in deep learning gets expressed as matrix multiplies. The crucial trend is that compute power has been improving faster than memory and communication speed, so most GPUs sit partly idle waiting for data unless you optimize carefully. The metric to watch is <strong>Model FLOPs Utilization (MFU)</strong>: hitting 50 percent is considered good, and even Meta’s Llama runs around 45 percent.</p><p>Two tricks stood out. First, <strong>low precision</strong>. Instead of storing everything in 32-bit floats, you do the heavy matrix math in 16-bit (fewer bits means faster communication and less memory), while keeping the master weights in 32 bits so tiny updates are not lost. This “mixed precision” approach is standard. Second, <strong>operator fusion</strong>. Normally each PyTorch operation ships data from the GPU’s main memory to its compute cores and back, repeatedly, which is wasteful. Fusion sends the data once, does all the operations, and ships it back once. The practical magic: wrap your model in torch.compile and it often runs about twice as fast.</p><p>Dubois ran out of time before tiling, parallelization, and mixture-of-experts, all of which matter too. But the lesson is clear: at frontier scale, systems engineering is not a footnote, it is a core competitive advantage.</p><p>That is the whole stack, top to bottom. Here is what to actually remember.</p><h3>Key Takeaways</h3><ul><li><strong>Five components build an LLM:</strong> architecture, training loss/algorithm, data, evaluation, and systems. Architecture gets the hype, but data, evaluation, and systems decide who wins.</li><li><strong>Pretraining is next-token prediction.</strong> Autoregressive models trained with cross-entropy loss, which is just maximizing the likelihood of real text.</li><li><strong>Tokenization is load-bearing.</strong> Byte Pair Encoding balances vocabulary size against sequence length, and bad tokenization quietly cripples math and code ability.</li><li><strong>Perplexity measures hesitation,</strong> but it is tokenizer-dependent. Benchmarks like MMLU and HELM are the academic standard, but inconsistent scoring methods and train-test contamination make benchmark numbers fragile.</li><li><strong>“Trained on the internet” hides a brutal data pipeline:</strong> crawl, extract, filter, deduplicate, quality-filter, model-filter, reweight domains, and finish on high-quality data. Data recipes are secret for competitive and legal reasons.</li><li><strong>Scaling laws are predictable.</strong> More compute, data, and parameters reliably lower loss with no plateau yet. Chinchilla says about 20 tokens per parameter is compute-optimal, around 150 once you factor in inference.</li><li><strong>The bitter lesson:</strong> bet on compute and systems, not clever architecture tweaks. A frontier model like Llama 3 405B costs roughly 75 million dollars to train.</li><li><strong>Post-training makes assistants.</strong> SFT teaches format with surprisingly little data. RLHF (via PPO or the simpler DPO) optimizes for human preference and is the real jump from GPT-3 to ChatGPT.</li><li><strong>Evaluation is the hardest part.</strong> Chatbot Arena is the gold standard, AlpacaEval approximates it cheaply with LLM judges, and length bias is a constant trap.</li><li><strong>Systems are a moat.</strong> GPUs are bottlenecked by memory and communication. Low precision and operator fusion (torch.compile) are easy, high-impact wins.</li></ul><h3>Frequently Asked Questions (FAQ)</h3><p><strong>Who gave this lecture and where can I watch it?</strong> The lecture is “Building Large Language Models (LLMs)” by Yann Dubois, a guest lecture in Stanford’s CS229: Machine Learning course from Summer 2024. It is freely available on Stanford Online’s YouTube channel.</p><p><strong>Do I need a machine learning background to understand it?</strong> Not really. A little familiarity with probability and neural networks helps, but the lecture (and this article) is built around intuition. If a section feels dense, paste it into your favorite LLM and ask for a simpler explanation.</p><p><strong>What is the difference between pretraining and post-training?</strong> Pretraining teaches a model to predict the next token across massive internet-scale data, producing a general language model. Post-training (SFT plus RLHF) then aligns that model to follow instructions and behave like a helpful assistant. Technically, post-training is just fine-tuning on different data with different hyperparameters.</p><p><strong>What are scaling laws in simple terms?</strong> They are empirical rules showing that as you increase compute, data, and model size, performance improves in a predictable, straight-line way on a log scale. They let labs forecast results and plan billion-dollar training runs before committing.</p><p><strong>What is the difference between PPO and DPO?</strong> Both align models to human preferences. PPO uses a separate reward model and reinforcement learning, which is powerful but messy. DPO skips the reward model and directly optimizes the model to prefer good answers over bad ones. It is far simpler and now the open-source default.</p><p><strong>Why do chatbots give such long, rambling answers?</strong> Because of length bias in RLHF. Human and AI judges both tend to rate longer answers as better, and the training process amplifies that preference over time.</p><p><strong>How much does it cost to train a frontier model?</strong> For Llama 3 405B, Dubois estimates roughly 75 million dollars all in (about 52 million in GPU compute plus around 25 million in salaries), using 16,000 H100 GPUs for about 70 days.</p><p><strong>Can I really just feed this article to an LLM to learn more?</strong> Yes, and you should. Copy the full text, paste it into ChatGPT, Claude, or Gemini, and ask follow-up questions, request quizzes, or have it explain any concept at your level. It is one of the most efficient ways to turn passive reading into active learning.</p><p>If this helped, the original Stanford CS229 lecture by Yann Dubois is the definitive source. This article is my distilled, founder’s-eye view of it. Save it, share it, or hand it to your favorite AI and keep the conversation going.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5886997a5f42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Computers Learned to Simulate Matter. A Journey Through Density Functional Theory]]></title>
            <link>https://medium.com/@ddsyasas/how-computers-learned-to-simulate-matter-a-journey-through-density-functional-theory-f93161f5dd5e?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/f93161f5dd5e</guid>
            <category><![CDATA[computational-chemistry]]></category>
            <category><![CDATA[quantum-physics]]></category>
            <category><![CDATA[material-physical]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[computational-physics]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Wed, 17 Jun 2026 14:36:20 GMT</pubDate>
            <atom:updated>2026-06-17T14:36:20.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFtLxpWXM0tzEtW-HdzS4Q.png" /><figcaption>How Computers Learned to Simulate Matter</figcaption></figure><p>There is a strange and wonderful fact about the physical world, in principle, everything about a material, why diamond is hard and transparent, why oxygen is magnetic, what colour a molecule absorbs, is hidden inside a single equation. And in practice, that equation is completely impossible to solve.</p><p>This is the story of how physicists got around that impossibility. It is the story of <strong>Density Functional Theory</strong> (DFT), the framework that quietly powers most of modern materials science, drug discovery, and battery research. I want to walk you through it from the very beginning, the way it was built up historically and conceptually, and then show you it actually working on real atoms and molecules I simulated during my computational physics learning.</p><h3>The equation that breaks computers</h3><p>Quantum mechanics gives us one master equation for any collection of electrons and nuclei. It is called the Schrödinger equation, and in its compact form it looks deceptively friendly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*ttIqpTTZ7y8UkSD1-hRpjQ.png" /><figcaption>The Schrödinger equation: the master equation of quantum mechanics. Solve it and you know everything about the system.</figcaption></figure><p>Here <strong>H</strong> (the “Hamiltonian”) is a recipe that adds up all the energy in the system: the motion of the electrons and nuclei, and all the electric forces pulling and pushing between them. Solve this equation and you get <strong>Ψ</strong> (psi), the <em>wave-function</em>, which contains absolutely everything that can be known about the system.</p><p>So what’s the problem? The problem is what Ψ actually depends on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*4T1y3QtBQA2DOC1LOQsTow.png" /><figcaption>The wavefunction depends on the positions of all N electrons simultaneously, so it lives in 3N dimensions. This is the root of the “exponential wall.”</figcaption></figure><p>The wavefunction depends on the positions of <strong>every single electron at the same time</strong>. For one electron, that’s 3 numbers (its x, y, z position). For N electrons, it lives in a space of <strong>3N dimensions</strong>.</p><p>Let’s feel how bad this is. Take a single oxygen atom: 8 electrons, so 24 dimensions. Suppose you wanted to store the wavefunction on a modest grid of just 10 points along each dimension. That would require 1²⁴ numbers. There aren’t enough atoms in a thousand human bodies to build that much memory. And that’s <em>one atom</em>. This catastrophe has a name: the <strong>exponential wall</strong>.</p><p>So here is the situation physicists faced. The theory of everyday matter was complete, the equation was known, and it was also permanently, structurally unsolvable for anything bigger than a couple of electrons. The rest of this article is about the clever escapes.</p><h3>First escape, freeze the nuclei (Born and Oppenheimer)</h3><p>The first simplification is almost embarrassingly intuitive once you hear it.</p><p>In any atom or molecule there are two very different kinds of particle: light, fast electrons and heavy, sluggish nuclei. A single proton is about <strong>1,836 times heavier</strong> than an electron. The nuclei lumber around like elephants while the electrons dart about like flies.</p><p>Max Born and J. Robert Oppenheimer turned this into a method in 1927: since the nuclei barely move on the timescale of electron motion, just <strong>freeze them in place</strong>. Pick a fixed arrangement of nuclei, solve for the electrons alone, and treat the nuclear positions as fixed knobs you can turn by hand.</p><p>The payoff is enormous. The electronic energy now becomes a <em>function of where you placed the nuclei</em>. Slide two atoms closer together, recompute the electrons, and you get a different energy. Map this out and you obtain a <strong>potential energy surface</strong>, an energy landscape whose valleys are the stable shapes of molecules and crystals.</p><p>This is not an abstraction. Later in this article, when I find the bond length of an oxygen molecule, I do it by placing the two atoms at a chosen distance, solving the electrons, recording the energy, then nudging the distance and repeating. The lowest point of the resulting curve <em>is</em> the bond length. None of that is even meaningful without the Born-Oppenheimer idea that “the energy at a fixed geometry” is a sensible thing.</p><h3>The big leap, stop tracking electrons individually (Hohenberg and Kohn)</h3><p>Freezing the nuclei helped, but the electrons are still stuck behind the exponential wall. We still have a wavefunction in a ridiculous number of dimensions.</p><p>In 1964, Pierre Hohenberg and Walter Kohn proposed something that sounds, at first, too good to be true. Forget the monstrous wavefunction. Track instead the <strong>electron density</strong>, written ρ(r): simply <em>how much electron charge sits at each point in space</em>.</p><p>Notice how radical this is. The density is a function of just <strong>3 coordinates</strong>, the position in ordinary space, no matter whether you have 2 electrons or 2 billion. We would be trading an object in 3N dimensions for an object in 3 dimensions. If it works, the exponential wall is gone.</p><p>Hohenberg and Kohn proved two theorems showing it does work.</p><p><strong>The first theorem</strong> says that the ground-state electron density contains, secretly, <em>all</em> the information in the full wavefunction. If you know the density, you know the arrangement of the nuclei, you know the Hamiltonian, you know everything. In other words, the energy of the system can be written purely as a function of the density:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*agXx75eVbafNevutg0ZXxA.png" /><figcaption>Hohenberg-Kohn: the ground-state energy can be written as a functional of the electron density alone, a function of just three spatial coordinates.</figcaption></figure><p>(A quantity that takes a whole function as input and returns a number is called a <em>functional</em>, which is where DFT gets its name.)</p><p><strong>The second theorem</strong> hands us a way to actually find the ground state: among all possible densities, the true ground-state density is the one that gives the <strong>lowest energy</strong>. Any wrong guess for the density gives an energy that is too high. So finding the ground state becomes a minimization, roll downhill in energy until you reach the bottom.</p><p>There was just one catch, and it was a serious one. The theorems prove the magical energy functional <em>exists</em>, but they give no recipe for what it looks like. In particular, nobody knew how to write down the kinetic energy of interacting electrons in terms of the density alone. The map existed; the roads were blank.</p><h3>The masterstroke (Kohn and Sham)</h3><p>A year later, in 1965, Walter Kohn and Lu Jeu Sham found the trick that turned DFT from a beautiful theorem into a practical tool. It is one of the great sleights of hand in physics.</p><p>Their idea: invent a <strong>fake system of electrons that don’t interact with each other</strong>, but rig it so that this fake system has <em>exactly the same density</em> as the real, interacting one.</p><p>Why on earth would that help? Because non-interacting electrons are easy. They don’t feel each other, so each one lives in its own simple orbital, and their kinetic energy can be computed exactly. The hopeless part of the problem, the interactions, gets quarantined into a single correction term.</p><p>Concretely, the total energy gets split into four pieces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HR6yWjU1EtYffiN5vsIhZw.png" /><figcaption>The Kohn-Sham energy, split into four parts: the non-interacting kinetic energy, the electron-nucleus attraction, the classical Hartree repulsion, and the exchange-correlation term that holds all the hard physics.</figcaption></figure><p>Reading left to right: the kinetic energy of the easy non-interacting electrons; the attraction between electrons and nuclei; the ordinary classical electrostatic repulsion of the charge cloud with itself; and finally <strong>E xc</strong>, the <strong>exchange-correlation energy</strong>.</p><p>That last term is the famous one. It is the junk drawer where every hard piece of physics gets swept: the quantum-mechanical tendency of same-spin electrons to avoid each other (exchange, from the Pauli principle), the way all electrons dodge one another to reduce repulsion (correlation), and the small leftover difference between the true kinetic energy and the fake one. Everything we don’t know how to do is in E xc.</p><p>The genius of the bookkeeping is that the first three terms are large and computed exactly or nearly so, while E xc, though it contains the deepest physics, is relatively small. Even a crude approximation of it gives remarkably good answers.</p><p>Minimizing this energy produces the equation that sits at the heart of essentially every materials simulation run today, the <strong>Kohn-Sham equation</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bBbp5cjMNpZdUQVGoBffSg.png" /><figcaption>The Kohn-Sham equation. One impossible many-body problem becomes a set of single-particle equations, each electron moving in an effective potential.</figcaption></figure><p>It looks like a single-particle Schrödinger equation, and that’s the point. Each electron orbital ψᵢ feels an <strong>effective potential</strong> built from three parts,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HkJu39Q3bf5ggLK51fGyA.png" /><figcaption>The effective potential felt by each Kohn-Sham orbital: external (nuclei) plus Hartree (classical repulsion) plus exchange-correlation.</figcaption></figure><p>and the density is rebuilt from the occupied orbitals,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*ZRISH_g217XcLPzmM-IMdg.png" /><figcaption>The density is rebuilt from the occupied orbitals, where the f_i are the occupation numbers. This closes the self-consistency loop.</figcaption></figure><p>where the fᵢ are the occupation numbers (how full each orbital is). We have replaced one impossible equation in 3N dimensions with N very manageable equations in 3 dimensions each. The εᵢ that pop out are the <strong>Kohn-Sham eigenvalues</strong>, the approximate energy levels of the system, and we will be reading them straight off the screen shortly.</p><h3>The one honest complication, self-consistency</h3><p>Look carefully at the Kohn-Sham equation and you’ll spot a snake eating its own tail.</p><p>To write down the effective potential, you need the density. To get the density, you need the orbitals. To get the orbitals, you need to solve the equation, which requires the effective potential, which requires the density. Everything depends on everything.</p><p>The way out is to iterate, a procedure called the <strong>self-consistent field</strong> cycle:</p><ol><li>Guess a starting density (or just start from random orbitals).</li><li>Build the effective potential from that guess.</li><li>Solve the Kohn-Sham equations to get new orbitals.</li><li>Compute a new density from those orbitals.</li><li>Blend it with the old one and go back to step 2.</li></ol><p>Round and round until the density stops changing, until it produces the very potential that reproduces it. At that point the calculation is “converged,” and the answer is trustworthy. Every result in this article came out of exactly this loop, repeated until the energy settled to within a millionth of an electron-volt.</p><h3>Filling in the junk drawer, LDA, GGA and PBE</h3><p>We still haven’t said what the mysterious exchange-correlation energy <em>is</em>. Since nobody knows its exact form, physicists build approximations, and the quality of a DFT calculation lives or dies by this choice.</p><p>The first and simplest is the <strong>Local Density Approximation (LDA)</strong>. At each point in space, it pretends the electrons locally behave like a uniform sea of electrons of that same density, a system whose exchange-correlation energy is known very accurately. Crude, since real densities are far from uniform, but astonishingly serviceable. Its characteristic flaw is <strong>overbinding</strong>: it tends to glue atoms together a little too tightly, predicting bonds slightly too short.</p><p>The next rung up is the <strong>Generalised Gradient Approximation (GGA)</strong>. It improves on LDA by looking not only at the density at each point but also at <em>how quickly the density is changing</em> there, its gradient. The most widely used GGA recipe is called <strong>PBE</strong>, after Perdew, Burke and Ernzerhof, who published it in 1996. PBE is the workhorse functional behind a huge fraction of all materials calculations, and it is the one I used throughout.</p><p>GGA fixes much of LDA’s overbinding, but it has its own signature quirks, and I want to flag them now because we will watch them appear in the real data:</p><ul><li>It tends to make bonds and lattice spacings come out <strong>slightly too long</strong>.</li><li>It <strong>underestimates the energy gap</strong> between filled and empty electronic states.</li><li>It contains <strong>no van der Waals forces</strong>, the faint attraction between neutral atoms, which matters for layered materials.</li></ul><p>A good scientist doesn’t hide the limitations of the tool. Part of the fun ahead is catching PBE in the act.</p><h3>How the calculation is actually set up</h3><p>Before the results, a quick tour of the practical machinery. The calculations were run with a widely used plane-wave code called <strong>VASP</strong> (the Vienna Ab initio Simulation Package). Three ideas make a code like this tick.</p><p><strong>Periodic boxes and Bloch’s theorem.</strong> The code assumes whatever you put in the simulation box is repeated infinitely in all directions. That’s perfect for a crystal, which really is a repeating pattern. The relevant theorem, due to Felix Bloch, says that in a repeating environment the electron orbitals take a particular wave-like form,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*pPce_wjGa5jYYS0qQITp-w.png" /><figcaption>Bloch’s theorem: in a periodic crystal the orbitals are plane waves modulated by a lattice-periodic function, labelled by the crystal momentum k.</figcaption></figure><p>labelled by a “crystal momentum” <strong>k</strong>. But what if you want a <em>single, isolated</em> atom, not a crystal? You use a trick: put the atom alone in a big empty box, with so much vacuum around it that its repeated copies are too far apart to notice each other. Make the box bigger and bigger, and the atom behaves as if truly alone. (I’ll show this convergence happening in a moment, it’s one of my favourite plots.)</p><p><strong>Plane waves and a cutoff.</strong> The orbitals are built out of simple waves. You can’t use infinitely many, so you keep all waves below an energy cutoff, <strong>E cut</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*_ghKR1ArLDt69Klj0M40fg.png" /><figcaption>The plane-wave cutoff: keep all waves with kinetic energy below E_cut. A higher cutoff means a more accurate, more expensive calculation.</figcaption></figure><p>A higher cutoff means a more accurate, more expensive calculation. It is a knob you converge, just like box size.</p><p><strong>Pseudopotentials and PAW.</strong> Near a nucleus, electron waves wiggle violently, and capturing those wiggles would demand an absurd cutoff. But the innermost “core” electrons are chemically inert, they don’t participate in bonding. So we freeze them and replace the nucleus-plus-core with a smooth effective potential that acts only on the chemically active outer (valence) electrons. The modern, accurate version of this idea is the <strong>Projector Augmented Wave (PAW)</strong> method. A nice side effect: in the results below, the deep 1s core electrons of carbon, nitrogen and oxygen simply never appear, because they’ve been folded into the frozen core. Only the valence electrons are computed.</p><h3>Watching it work, the eigenvalues of single atoms</h3><p>Time for real numbers. The first thing I did was the simplest possible quantum chemistry: put a single atom alone in a box and ask the code for its electronic energy levels. Here is oxygen, in a box about 9 Å across:</p><p>Level Energy (eV) Occupation Identity 1 −23.88 full 2s 2, 3, 4 −8.94 partial 2p (three of them) 5+ ~0 empty unoccupied</p><p>Three things in this little table tell a real story.</p><p><strong>The core is missing, as promised.</strong> There is no 1s level. It’s been frozen into the PAW core. We only see the outer 2s and 2p electrons, the ones chemistry cares about.</p><p><strong>The three 2p levels have identical energy.</strong> Why? An atom’s three 2p orbitals point along the x, y and z directions. Inside a cubic box, those three directions are perfectly equivalent by symmetry, so the three levels must share the same energy. They are <em>degenerate</em>. This is a beautiful, concrete instance of a deep rule: <strong>degeneracy is a fingerprint of symmetry</strong>. Break the symmetry, by squashing the cubic box into one with three unequal sides, and the three levels split apart. I tried exactly that, and they did. The link between symmetry and degeneracy isn’t abstract algebra; you can watch it happen in the output file.</p><p><strong>The occupations look weird, and that’s a clue.</strong> The 2p level came out with a fractional occupation, which is physically odd for an isolated atom. It happens because this first calculation forced both spin directions to be identical. To recover the right number of electrons you have to remember that each level here holds two (one spin up, one spin down):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*ZfsThvwW839FvpT4cO9P0w.png" /><figcaption>Recovering the true number of valence electrons from the printed occupations. In the spin-unpolarized setup each level holds two electrons, hence the factor of 2.</figcaption></figure><p>That fractional, spin-averaged result is a red flag, and it leads directly to the most interesting physics in the atomic calculations: <strong>magnetism</strong>.</p><h3>Why oxygen is magnetic, spin enters the story</h3><p>When I allowed the two spin directions, “up” and “down”, to behave independently, the atoms came to life.</p><p>Electrons obey <strong>Hund’s first rule</strong>: when filling a set of equal-energy orbitals, they spread out one per orbital with their spins aligned in parallel <em>before</em> any pairing up. Parallel spins keep electrons apart (the Pauli principle forbids them from being in the same place), which lowers their mutual repulsion and the energy. The net magnetic moment is the imbalance between up and down electrons:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*FM-tE5JTy1RP25kNLlo9Rw.png" /><figcaption>The net magnetic moment: the imbalance between spin-up and spin-down electrons, in units of the Bohr magneton.</figcaption></figure><p>Run the numbers and the free atoms snap into their textbook magnetic states. Carbon ends up with 2 unpaired electrons, nitrogen with 3 (its three 2p orbitals each singly filled, the maximally magnetic case), and oxygen with 2. Helium, a closed shell, has none.</p><p>Letting the spins differ also splits each energy level into a lower “majority” and higher “minority” version, an <strong>exchange splitting</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*cGzyps3EE3C9b7fiP5wKaw.png" /><figcaption>The exchange splitting: the energy gap that opens between the minority (spin-down) and majority (spin-up) channels once the two spins are allowed to differ.</figcaption></figure><p>The splitting was largest for nitrogen, exactly as expected: with all three of its 2p spins parallel, the exchange effect is at full strength.</p><p>The lesson generalises into a rule of thumb you can carry anywhere: for <strong>closed-shell, non-magnetic</strong> systems, you can ignore spin and save effort. For <strong>open-shell</strong> atoms, radicals, and magnetic materials, you <em>must</em> treat the two spins separately or you’ll get physically meaningless answers, the tell-tale sign being those fractional occupations from before. Hold onto this, because the oxygen molecule is about to make the point unforgettable.</p><h3>Building a molecule, the bond as a tug of war</h3><p>A single atom is a warm-up. The real magic is watching two atoms form a bond.</p><p>When two atoms approach, each pair of matching atomic orbitals merges in two ways. The <strong>in-phase</strong> combination piles electron density in the space <em>between</em> the two nuclei, which is energetically favorable, this is a <strong>bonding</strong> orbital, lowered in energy. The <strong>out-of-phase</strong> combination carves a node between the nuclei, pushing density away, this is an <strong>anti-bonding</strong> orbital, raised in energy. Two atomic levels in, one stabilising and one destabilising level out.</p><p>I watched this happen directly by computing the oxygen molecule’s energy levels as I slowly pulled the two atoms apart. At large separation the levels collapsed onto the bare atomic values. As the atoms drew together, each level visibly <strong>split</strong> into a bonding branch diving downward and an anti-bonding branch rising upward. That fan-out <em>is</em> the act of chemical bonding, rendered as a graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxVaUYiuYr9jqUKQIByr2g.png" /></figure><p>How strong is the resulting bond? Count the electrons in bonding versus anti-bonding orbitals and take the difference, the <strong>bond order</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*IxXKfHC_E3AeAFhQqhQZzw.png" /><figcaption>The bond order: half the difference between bonding and antibonding electrons. One for a single bond, two for a double, three for a triple.</figcaption></figure><p>For oxygen, the tally comes out to 8 bonding electrons and 4 antibonding, giving a bond order of 2, a double bond. The full electron configuration, filling the molecular orbitals from lowest to highest, is written out as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*x5P6J64o7hmf_q1bKqZY8A.png" /><figcaption>The molecular-orbital configuration of O₂. The two electrons in the topmost (doubly degenerate, antibonding) level are unpaired, which is why oxygen is magnetic.</figcaption></figure><p>And buried in that configuration is one of the most celebrated successes of this picture.</p><h3>The triumph, oxygen’s hidden magnetism</h3><p>The simple dot-and-line chemistry most of us learned in school predicts that oxygen, O₂, should have all its electrons neatly paired up, and therefore be non-magnetic. It is wrong.</p><p>The molecular-orbital picture gets it right. Look at the top of the configuration: the last two electrons land in a <strong>pair of equal-energy antibonding orbitals</strong>. By Hund’s rule, those two electrons go in one each, with parallel spins. So the oxygen molecule has <strong>two unpaired electrons</strong>. It is magnetic, a <em>triplet</em> state, paramagnetic.</p><p>This isn’t a textbook curiosity. Pour liquid oxygen between the poles of a magnet and it visibly clings to the field. That magnetism, mysterious to the naive picture, falls straight out of counting orbitals.</p><p>It also has a hard computational consequence. Because oxygen has a genuine net spin, a calculation that forces the two spin directions to be identical <em>cannot describe its true ground state</em>. I checked this directly: at the bond length, the spin-aware calculation gave an energy <strong>1.12 eV lower</strong> than the spin-blind one. Lower energy means more stable means more correct. That single number is the proof, in cold data, that O₂ demands a spin-polarized treatment, whereas a contented closed-shell molecule like carbon monoxide does not.</p><h3>Measuring a bond length on a laptop</h3><p>Now the satisfying part: extracting a real, physical, measurable number, the length of a chemical bond.</p><p>The method follows straight from Born-Oppenheimer. I computed the molecule’s total energy at a series of interatomic distances, then fit a parabola through the points near the bottom. Why a parabola? Because near the minimum of <em>any</em> smooth energy valley, the curve always looks quadratic (it’s the leading term once the slope has vanished). The bottom of that fitted parabola pinpoints the equilibrium bond length more precisely than the raw grid of points could.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xn2NrHV4MqeapI7NzvDZYg.png" /></figure><p>The verdict, against experiment:</p><p>Molecule My DFT bond length Experiment Error O₂ 1.255 Å 1.201 Å +4.5% CO 1.150 Å 1.128 Å +1.9%</p><p>Look at the sign of the error. <strong>Both bonds came out slightly too long.</strong> Remember the warning from Part 6? That GGA tends to overestimate bond lengths is not a mistake in my setup, it is the known, characteristic fingerprint of the PBE functional. Catching it red-handed, in my own numbers, is oddly satisfying. The agreement is still excellent, within a few percent of reality, from nothing but the Schrödinger equation and a stack of approximations.</p><h3>One energy curve, three physical quantities</h3><p>Here is the most elegant thing in the whole molecular story. That single energy-versus-distance curve I computed for the bond length secretly contains <em>three</em> different physical properties, hiding in its <strong>position</strong>, its <strong>depth</strong>, and its <strong>curvature</strong>.</p><p>The <strong>position</strong> of the minimum, we just used: the bond length.</p><p>The <strong>depth</strong> of the well gives the <strong>binding energy</strong>, how much energy it takes to rip the molecule apart:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*JWgeUXkN0HzX_wyRtsyrgQ.png" /><figcaption>The binding energy: how much energy holds the molecule together, measured as the difference between the dissociated and bound states.</figcaption></figure><p>For oxygen this came out around 9.7 eV, considerably more than the experimental ~5.1 eV. That overshoot is itself instructive. Part of it is PBE’s tendency to overbind oxygen specifically. But part is a subtle reference-point issue: a clean binding energy should compare the molecule against two properly spin-polarized, magnetic free atoms, and my dissociation reference didn’t fully account for that. The honest takeaway is that binding energies are delicate, and knowing <em>why</em> a number is off is more valuable than the number itself.</p><p>The <strong>curvature</strong> of the well, how sharply it bends at the bottom, gives the <strong>stiffness</strong> of the bond, its force constant. A stiffer bond is a tighter spring. And once you have the spring, you have the vibration.</p><h3>Hearing the molecule vibrate</h3><p>A chemical bond is a spring connecting two masses. Near equilibrium, the energy well is a perfect harmonic-oscillator potential:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y--2PLy9-deOlzJOep6S8A.png" /><figcaption>Near its minimum, the bond behaves as a harmonic oscillator. The stiffness k is the curvature of the energy well.</figcaption></figure><p>The stiffness <strong>k</strong> in that expression is precisely the curvature of the energy well I already computed, the second derivative at the bottom of the parabola. From the stiffness, the vibration frequency follows from the standard oscillator formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*NxXgL6xl0J60H6rHUGkOsA.png" /><figcaption>The vibration frequency of a harmonic oscillator, set by its stiffness and mass.</figcaption></figure><p>with one subtlety: since <em>both</em> atoms move when the bond vibrates, the relevant mass is not one atom’s mass but the <strong>reduced mass</strong> of the pair:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*IKS9zAi4IuFnM6DMkJEGAw.png" /><figcaption>The reduced mass: because both atoms move when the bond vibrates, the two-body problem reduces to a single effective mass.</figcaption></figure><p>For two identical oxygen atoms this is just half an oxygen mass; for the lopsided carbon-oxygen pair it works out to about 6.86 atomic mass units. Plugging through, the predicted vibration frequencies landed within a few percent of the measured ones, oxygen about 2% low, carbon monoxide about 4% high.</p><p>The small leftover discrepancy has two honest sources. One is the same imperfect curvature from the GGA functional. The other is that a real bond isn’t a perfect spring, it’s easier to stretch than to compress, a subtlety called <em>anharmonicity</em> that the simple harmonic model ignores. Both effects are tiny here, which is why a model as simple as “two masses on a spring” reproduces a measured molecular vibration so well.</p><p>Stop and appreciate what just happened: starting from an equation too big to solve, through a chain of clever approximations, a computer predicted the rate at which an oxygen molecule vibrates, and got it right to within a fiftieth. That is the quiet triumph of density functional theory.</p><h3>What I actually take away from this</h3><p>It would be easy to read all this as a story about software. It isn’t. It’s a story about a particular style of thinking that physics keeps rewarding: <strong>when a problem is impossible, change what you’re solving for.</strong></p><p>The wave-function was impossible, so Hohenberg and Kohn solved for the density instead. The interactions were impossible, so Kohn and Sham solved a fake non-interacting system instead. The exact exchange-correlation energy was unknown, so we solved an approximate one, and then learned to recognise the precise scars that approximation leaves on the answers, the bonds a touch too long, the gaps a touch too small.</p><p>That last part is, to me, the real education. Density functional theory is not a black box that spits out truth. It is an instrument with a known personality: brilliant at structure and trends, predictably biased in specific, understandable ways. Learning to use it well means learning to read its results <em>and</em> its lies in the same breath, to see a bond length that’s 4.5% too long and smile, because you know exactly which approximation is responsible.</p><p>We started with an equation that no computer in the universe could ever solve directly. We ended by computing the length of a chemical bond and the pitch of a molecule’s vibration, on ordinary hardware, in minutes. The gap between those two facts is filled entirely with good ideas. That gap is what computational physics <em>is</em>.</p><p>Thanks for reading. The calculations described here were carried out with the VASP plane-wave DFT code using PBE pseudopotentials, during my hands-on computational physics learning. If you enjoyed this, the natural sequels are the world of solids, crystals, band structures, and why the same carbon atom can be a diamond, a pencil lead, or a metal. Perhaps next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f93161f5dd5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Shipped More Code Than Ever in 2026. We Also Shipped More Risk.]]></title>
            <link>https://medium.com/@ddsyasas/we-shipped-more-code-than-ever-in-2026-we-also-shipped-more-risk-906f00dda61f?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/906f00dda61f</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Fri, 05 Jun 2026 08:29:47 GMT</pubDate>
            <atom:updated>2026-06-05T09:11:50.459Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Two charts: open-source vulnerabilities per codebase doubled to 581 in 2026, and reported security incidents rise with heavier AI use, from 26% to 50%." src="https://cdn-images-1.medium.com/max/1024/1*NaysHF7qstsliqoOLFw_5g.png" /><figcaption>Two charts: open-source vulnerabilities per codebase doubled to 581 in 2026, and reported security incidents rise with heavier AI use, from 26% to 50%.</figcaption></figure><p>In early March 2026, Amazon went down twice in the span of a few days. The second outage was the ugly one. For about six hours, US order volume dropped by nearly 99%, and by the time it was over the company had lost something in the range of 6.3 million orders. Both incidents were eventually traced back to the same root cause: AI-assisted code changes that were pushed to production without proper approval. Amazon’s response tells you how seriously they took it. They launched a 90-day code safety reset across 335 critical systems, and made AI-assisted changes require sign-off from a senior engineer before they could ship.</p><p>When I first read about it, my reaction was not “how could Amazon let that happen.” My reaction was a small, uncomfortable flicker of recognition. Because if you build software right now, you already know that feeling. The AI writes something in seconds. It looks right. You are moving fast, the demo is tomorrow, and the code goes in. Most of the time it is fine. And every so often it is the thing that takes the whole system down at the worst possible moment.</p><p>I want to make an argument in this piece that I think gets lost in the noise. The story of AI and software in 2026 is not that AI made engineers faster. It is that AI moved the hard part of the job somewhere new, and most teams have not noticed where it went. The bill for all this speed is real, it is coming due, and the data on exactly how is now sitting in front of us.</p><h3>50% more security incidentsThe seductive part</h3><p>So let me start there, I am not here to tell you AI coding tools are bad. I use them every day. For a small team, they are genuinely a gift. They flatten the blank-page problem, they handle the boilerplate nobody wants to write, and they let a couple of people punch far above their weight. When you are under-resourced and under pressure, that help is not a luxury, it is survival.</p><p>So when I push back in the rest of this article, understand that I am not pushing back on the tools. I am pushing back on a habit we have built up around them, which is treating the output of an AI as if it came from a trusted senior engineer. It did not. And the gap between how much code we now generate and how much of it we can actually trust is the whole story.</p><h3>This is not a freak accident. It is a pattern</h3><p>The easy thing to do with the Amazon outage is to file it under “big company, bad process, not me.” But the moment you look at the research, that comfort disappears. What happened to Amazon is just the visible tip of something happening everywhere.</p><p>Start with the code itself. Veracode’s 2025 GenAI Code Security Report is the most rigorous look we have at how secure AI-written code actually is. They had more than 100 large language models complete around 80 real coding tasks, then ran the output through security testing. The result: in about 45% of cases, the AI introduced a vulnerability from the OWASP Top 10, the industry’s standard list of the most dangerous web application flaws. Some categories were far worse. Cross-site scripting failed roughly 86% of the time, and log injection around 88%. Java was the worst performer, failing on more than 70% of tasks.</p><p>Here is the part that should stop you. The newer, bigger, more capable models were not meaningfully more secure than the smaller ones. That tells us this is not a temporary limitation that the next model release quietly fixes. It is structural, baked into how these systems generate code. Other research backs this up: independent analysis has put AI-generated code at roughly 2.74 times more vulnerabilities than human-written code.</p><p>Now scale that single-snippet finding up to entire real-world codebases, and you get Black Duck’s 2026 Open Source Security and Risk Analysis report, released this February. It is based on audits of 947 commercial codebases across 17 industries, so this is not a lab toy. For the first time in the report’s history, the average number of open-source vulnerabilities per codebase more than doubled, jumping 107% to an average of 581 per codebase. Eighty-seven percent of the applications they audited contained at least one known vulnerability.</p><p>Why the sudden doubling? Black Duck points directly at the explosion in code volume from AI-assisted development. In a single year, the average number of files per codebase grew by 74%, and the number of open-source components grew by 30%. We are pouring code into our projects faster than ever, and a meaningful slice of it is arriving with flaws already inside. CircleCI’s 2026 report, which looked at 28 million CI/CD workflows across 22,000 teams, found development activity rose 59% in 2025, the biggest jump they had ever recorded. More code, faster, every day. The security pipeline was never built for that flood.</p><p>There is even a legal version of this problem hiding underneath. Black Duck found that two-thirds of audited codebases now contain open-source license conflicts, the highest rate they have ever measured, partly because AI assistants reproduce snippets derived from restrictively licensed code without carrying the license along. They call the underlying behavior a kind of “license laundering.” Most teams are not checking for it.</p><h3>The work did not disappear, it moved downstream</h3><p>Here is where it gets interesting, and where I think most of the conversation goes wrong. The promise of AI coding was that it would reduce the work. What the 2026 data actually shows is that it relocated the work.</p><p>The clearest evidence comes from Harness’s State of DevOps Modernization report, based on a survey of 700 engineering practitioners at large enterprises conducted in February 2026. Look at what happens to the people who use AI coding tools most heavily. Sixty-nine percent of them say their teams frequently hit deployment problems when AI-generated code is involved. Fifty-three percent report more security incidents since adopting the tools, and 51% report more quality problems. When something breaks, it takes them longer to fix: heavy AI users average 7.6 hours to resolve a production incident, compared to 6.3 hours for occasional users.</p><p>And it lands on the humans. Ninety-six percent of the heaviest AI users said they are pulled into evening or weekend work multiple times a month because of release-related issues. Read that number again. The tool that was supposed to give engineers their time back is, for the heaviest users, eating their evenings.</p><p>This is the shape of the whole thing. AI did not make the work go away. It changed your job from writing code to reviewing code, and then it generated far more code for you to review than you ever wrote by hand. The bottleneck did not vanish. It slid downstream, from the keyboard to the pull request, from the pull request to the deploy, from the deploy to the 2 a.m. incident call.</p><h3>Why this keeps happening</h3><p>If you want one idea to explain all of these numbers, it is this: AI can write code, but it cannot inherit a system.</p><p>When a good engineer joins a mature codebase, they slowly absorb the invisible stuff. Which parts are fragile and why. What will explode if you touch it. The unwritten rule that this service must never block on that one. The architectural decisions that are not in any document because they live in people’s heads and in scar tissue from past outages. None of that is in the prompt. The AI sees the text in front of it and produces something that is locally plausible and globally dangerous. It is, as the software thinker Martin Fowler has put it, a bit like accepting a pull request from a collaborator who is enormously productive and whom you cannot quite trust.</p><p>The core problem is that AI is extremely good at being almost right. Almost right is the most expensive kind of wrong, because it sails through a quick glance, passes the happy-path test, and only reveals itself in production, in the edge case, under load. A human junior engineer who is almost right gets caught in review because they are slow enough to review. An AI that is almost right ships ten times as much almost-right code in the same window, and the review process drowns.</p><h3>So what actually works</h3><p>I do not want to leave you with a problem and no exits, because the teams that handle this well are not the ones who refuse to use AI. They are the ones who changed how they trust it. A few things that genuinely move the needle:</p><p>Treat AI output like a pull request from a fast but unproven contributor, not as finished work. The mental shift from author to skeptical reviewer is the single most important change, and it is free.</p><p>Run security scanning specifically on AI-generated code. Tools like static analysis scanners exist for exactly this, and pointing them at AI output before merge catches a large share of the OWASP-class issues that the model cheerfully introduced.</p><p>Put guardrails between the code and production. Feature flags, automated rollbacks, and required senior review for anything with a large blast radius are what stand between you and an Amazon-style afternoon. Amazon’s own fix was not “stop using AI,” it was “a human signs off before it ships.”</p><p>Ask for security in the prompt. A surprising amount of the insecure-by-default behavior comes from developers never stating security requirements, leaving the model to make those calls silently. State them.</p><p>Watch your dependencies and licenses. The volume of components is exploding, so an automated check on what you are pulling in, and under what license, is no longer optional.</p><p>None of this is glamorous. All of it is the unsexy infrastructure of trust, and trust is precisely the thing AI cannot manufacture for you.</p><h3>The honest caveat</h3><p>I want to be careful not to oversell my own case, because there is a famous counter-data point worth knowing. A 2025 study from the research nonprofit METR found that AI tools actually made experienced developers about 19% slower on familiar codebases, even though those same developers felt about 20% faster. That perception gap is real and it is humbling. But METR themselves have since softened the headline: their newer data on late-2025 tools showed the slowdown shrinking toward roughly neutral, and they now believe developers are likely getting a real, if hard-to-measure, speedup. So I am not claiming AI makes you slower. I am claiming something narrower and, I think, more durable: it makes you feel more done than you are, and the gap between feeling done and being done is exactly where vulnerabilities live.</p><h3>What I actually think?</h3><p>Put all of it together and a clean picture emerges. AI did not replace engineers and it did not make the hard part of software easy. It took the hard part, writing trustworthy code that fits a living system, and it hid that part behind a wall of fluent, fast, plausible output. We got faster at producing code and no faster at trusting it, and the entire 2026 data set is the sound of that gap catching up with us.</p><p>The skill that matters now is not generating code. The machines have that. The skill is judgment: knowing what to accept, what to throw away, and what to never, ever ship without a second pair of human eyes. The bottleneck moved from writing to trusting, and the engineers who thrive in the next few years will be the ones who treat trust as the actual job.</p><p>Which brings me to the question I keep landing on, in this and in almost everything about AI right now. We spend endless energy asking what the machine can produce. We spend almost none asking the question that actually matters when it goes wrong. Not who wrote the code.</p><p>Who is accountable when it ships?</p><h3>Sources</h3><ul><li>Veracode, <em>2025 GenAI Code Security Report</em> (100+ LLMs, ~80 tasks; 45% OWASP Top 10 failure rate): veracode.com</li><li>Black Duck, <em>2026 Open Source Security and Risk Analysis (OSSRA) Report</em>, Feb 25, 2026 (vulnerabilities per codebase up 107% to avg 581; 947 codebases): blackduck.com</li><li>Harness, <em>State of DevOps Modernization 2026</em> (survey of 700 practitioners, Coleman Parkes, Feb 2026): harness.io/state-of-modernization-2026</li><li>Lightrun survey via VentureBeat, April 2026 (43% of AI code changes need debugging in production; Amazon March 2026 outages): venturebeat.com</li><li>CircleCI, <em>2026 Software Delivery Report</em> (28M CI/CD workflows; development activity up 59% in 2025)</li><li>METR, <em>Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity</em> (July 2025) and the Feb 2026 follow-up: metr.org</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=906f00dda61f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[God-Level AI Promises Abundance. But Who Actually Decides?]]></title>
            <link>https://medium.com/@ddsyasas/god-level-ai-promises-abundance-but-who-actually-decides-134b71556f79?source=rss-eef48573a9ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/134b71556f79</guid>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sajana Yasas]]></dc:creator>
            <pubDate>Mon, 01 Jun 2026 02:59:20 GMT</pubDate>
            <atom:updated>2026-06-01T02:59:48.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="What the Dream of God-Level AI Gets Right, and the Question It Keeps Dodging" src="https://cdn-images-1.medium.com/max/1024/1*7r8hGVwtLZd4qIgTKpA-jA.png" /></figure><p>A few days ago I was listening to the All-In podcast. The guest was the investor Bill Gurley, and the conversation turned to Anthropic, the company behind the Claude AI models. Gurley said something that stuck with me. He called Anthropic a mystery, a company that is both leading its field and, in his words, “the most negatively outspoken commenter on what they do.” Then he went further. He said he had spent the past month reading everything he could about the company, and he had a theory. He called it the “Dr. Frankenstein theory.” His claim, put simply, was that the people building this technology do not think they are writing software. He said, “I think they’re midwifing a deity.”</p><p>The table laughed, then got serious. Jason Calacanis called it “the ultimate level of narcissism and delusion of grandeur to think you can create God.” There was a lot of mockery in the room. And I get the instinct. When billionaires start talking about building gods, the natural reaction is to roll your eyes.</p><p>But I want to do something different in this article. I want to put the mockery down for a minute and take the idea seriously. Not because I think these people are right, and not because I think they are dangerous lunatics either. I want to take it seriously because the vision they are selling is the entire reason this race exists. If we never look at it directly, we are arguing about the weather without ever looking out the window.</p><p>So here is my opinion, stated up front, before I have earned it. I think the dream of building a god-level intelligence is being sold to all of us on a single promise, that it will create abundance for everyone. And I think that promise is strongest exactly where nobody is looking closely, and weakest exactly where it matters most. The hard question is not whether the machines can be built. The hard question is who decides what happens after they are.</p><p>Let me walk through it.</p><h3>What they are actually saying</h3><p>Before I push on anything, I owe you a fair description of the idea. It would be easy to make it sound silly. It is not silly. It is bold, and parts of it are beautiful.</p><p>The clearest version of this dream comes from Dario Amodei, the CEO of Anthropic. In October 2024 he published a long essay, called “Machines of Loving Grace.” The title is borrowed from a 1967 poem by Richard Brautigan. I will not quote the poem here, but the picture it paints is gentle and strange. It imagines a future where people are freed from work and live peacefully alongside nature, while calm and caring computers quietly watch over everything. That is the mood Amodei is reaching for. Not robot armies. Not a takeover. A kind of paradise managed by machines.</p><p>Amodei does not like the word “AGI,” so he uses his own phrase: “powerful AI.” He defines it carefully. He means a system that is smarter than any human at basically every mental task, something on the level of a Nobel Prize winning scientist, except faster, and you can run millions of copies at once. His famous summary for this is “a country of geniuses in a datacenter.”</p><p>Now sit with that image for a second. A whole country of geniuses, never sleeping, working in parallel. What would they do? Amodei’s answer is the heart of his optimism. He thinks they would crush problems that have stumped us for centuries. His big claim is that AI could take the medical progress we would have made over the next fifty to a hundred years and compress it into five to ten. He calls this the “compressed 21st century.” Most diseases are prevented or cured. Mental illness understood and treated. Lifespans extended. Poverty reduced. He lays it all out as something close to a roadmap.</p><p>And then comes the part the podcast hosts could not stand. If the geniuses in the datacenter end up doing most of the work, both thinking work and eventually physical work, then what is left for humans to do? Amodei’s answer drifts into the economics of a world after work. He talks about abundance, about people no longer needing to labor to survive, about new ways to share out the wealth that the machines create. The hosts on All-In summarized this in the harshest way possible. They described it as “a computational reward function for humans,” a system that “decides how much you’re worth.” That is their phrasing, not Amodei’s, and it is unfair to him in its tone. But it is pointing at something real in the essay, and I will come back to it, because it is the crack that runs through the whole thing.</p><p>To understand where this mindset comes from, the hosts told an old story. Around 2015, before OpenAI even existed, Elon Musk and Google’s Larry Page reportedly argued at a birthday party. Musk said humanity needed protection from advanced AI. Page accused him of being a “speciesist,” of unfairly favoring humans over the new kind of mind we might create. Whether or not the details are exact, the argument captures a real split in Silicon Valley. To some of these people, AI is not a tool. It is a successor. A new species. And if you genuinely believe that, then “midwifing a deity” stops sounding like an insult and starts sounding like a job description.</p><p>That is the vision. Now let me tell you what I think.</p><p>I am a builder. I spend my days turning ideas into things that work. So I have a soft spot for ambition, and I refuse to pretend this vision has nothing going for it. It has plenty.</p><p>First, the upside is not a fantasy, it is a question of degree. Suppose Amodei is wildly too optimistic. Suppose his “compressed 21st century” is really a compressed couple of decades instead of a few years. That would still be one of the greatest events in human history. If a country of geniuses in a datacenter helped cure even a handful of the diseases that kill and cripple people, the value of that would be almost impossible to measure. Dismissing this because the man saying it works at an AI company is lazy. The disease does not care who funds the cure.</p><p>Second, there is real moral weight in trying to free people from work they hate. Most people on earth do not have meaningful, fulfilling jobs. They have jobs that exhaust them and pay too little. A future where survival is not chained to labor is not automatically a nightmare. For a lot of humanity, it would be a release. If you have ever watched someone you love break their body for a paycheck, you cannot honestly call the end of forced labor a bad dream.</p><p>Third, and this is the part I respect the most, at least someone is planning ahead. The usual way technology arrives is that it lands on us, breaks things, and then we scramble to clean up. Cars, factories, social media, all of it hit first and got managed later. Whatever you think of Amodei, he is at least trying to describe the destination before we get there. That is more than most people building this technology are willing to do. You cannot steer toward a future you refuse to imagine.</p><p>So no, I do not think these are stupid people chasing a stupid dream. I think they are serious people chasing a serious dream.</p><p>Here is where I part ways with the optimists. The vision has three cracks, and they all come from the same place. They are not about the machines. They are about us.</p><h3>Crack one: abundance has never been the thing that divides us</h3><p>The whole promise rests on one quiet assumption, that if we make enough of everything, the fighting stops. More medicine, more food, more energy, more wealth. Plenty for all.</p><p>But look at history honestly. We already live in the most abundant moment the human race has ever known. We grow more food than we can eat, and people still go hungry, not because the food does not exist but because of how it is shared out. We are richer than any generation before us, and the gap between the top and the bottom has been getting wider, not narrower. Abundance did not fix that. In some ways it made it sharper, because now the unfairness is impossible to blame on shortage.</p><p>The truth is that humans do not only fight over things that are scarce because there is not enough. We fight over status, over power, over who is above whom. Those things stay scarce no matter how much pie you bake. There is only one top. A bigger pie does not settle the question of who carves it. So when someone tells me that god-level AI will end conflict by creating abundance, my honest reaction is that they have misread the entire history of our species. The problem was never the size of the pie.</p><h3>Crack two: work is not only a paycheck</h3><p>The post-work dream assumes that the main thing work gives people is money, and that if you replace the money, you have replaced the work. I think that is wrong, and I think most people who have actually worked know it is wrong.</p><p>Work gives people more than income. It gives them a reason to get up. It gives them a place in the world, people who depend on them, a story about who they are. Take that away and hand someone a monthly payment instead, and you have solved their grocery bill while quietly removing their sense of purpose. We have small previews of this already. Look at what happens to people, and especially to men, when their industry dies and the jobs leave town. The cheques sometimes keep coming. The despair comes anyway.</p><p>I am not saying this means we should keep people chained to pointless jobs forever. I am saying that “the machines will work so you don’t have to” is not the gift it sounds like, unless someone has thought very hard about what people are supposed to do with themselves instead. And in the essay, that is the thinnest part. Amodei admits, more or less, that the meaning question is the hardest one, and then he does not really answer it. I do not blame him. Nobody has answered it. But you cannot promise paradise and leave the most important room in the house empty.</p><h3>Crack three: someone owns the geniuses</h3><p>This is the one that worries me most, and it is the one the podcast was clumsily circling.</p><p>A country of geniuses in a datacenter is still a datacenter. It has an owner. It runs on hardware somebody paid for, trained by a company somebody controls. So when we talk about all this abundance flowing to humanity, we have to ask the obvious question. Flowing through whom? Decided by whom? On what terms?</p><p>The optimistic answer is that it will be shared fairly and the machines will be benevolent. But notice what that word is doing. “Benevolent” is not a plan. It is a hope. It hides the entire question of power behind a warm adjective. Amodei himself knows this. In a more recent essay he worries openly that powerful AI could be used by governments to watch and control their own people in ways that would be almost impossible to undo. He has admitted the bounty might not be shared, that whether it spreads fairly is, in his own framing, a political choice and not a guarantee. So even the chief optimist has quietly conceded the weak point. The technology does not distribute itself. People do. And people, historically, are not great at sharing power they do not have to share.</p><p>This is why the hosts’ ugly phrase, “a computational reward function for humans,” lands even though it is unfair. Strip away the sneer and you are left with a real fear. If a small number of companies build something this powerful, and that something ends up shaping who gets what, then we have not built a god of loving grace. We have built the most concentrated form of power in human history and asked it nicely to be kind. You cannot audit a deity. You cannot vote one out. “Trust us, it will be good” is the oldest unsafe promise there is.</p><p>Here is the turn I most want you to take away from this article, the thing I did not see anyone on the podcast say clearly.</p><p>The reason it is morally okay to build a god-level intelligence, according to its builders, is the wonderful world it will produce afterward. The cures, the abundance, the freedom. That promised world is the moral permission slip for the whole project.</p><p>But that promised world is also the part of the plan that has had the least serious thought put into it.</p><p>Think about how strange that is. The engineering side is covered in detail. Scaling laws, capabilities, timelines, careful definitions of “powerful AI.” Page after page. But the part that is supposed to justify all of it, the part about how billions of actual humans will live, eat, find meaning, and share power in this new world, is a sketch. A few hopeful paragraphs. A borrowed poem.</p><p>So am I a doomer or a believer? Neither, and I think that is the only honest place to stand.</p><p>I am not going to mock these people, because the upside they describe is real enough that mocking it is a kind of cowardice. If there is even a chance of compressing a century of medical progress into a decade, that chance deserves respect, not jokes.</p><p>But I am also not going to clap along, because the moral case for the whole project rests on questions its champions have barely begun to answer. Not the engineering questions. The human ones. How is the abundance shared? Who controls the geniuses in the datacenter? What do people do with their lives? Who, in the end, decides?</p><p>Bill Gurley is afraid that these builders think they are midwifing a deity. I am less worried about whether they think they are building a god. I am worried that they have spent ten times more effort on the god than on the world it is supposed to save. A benevolent ruler you cannot question is still a ruler you cannot question, no matter how loving the grace.</p><p>So here is my ask, to them and to anyone who takes this seriously. Spend as much care on the after as you spend on the build. Show your work on distribution the way you show your work on capabilities. Treat “who decides” as the central engineering problem, because it is. Until that happens, the right response to the dream of god-level AI is not worship and not mockery. It is a simple, stubborn, unanswered question, asked again and again until someone actually answers it.</p><p>Who decides?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=134b71556f79" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>