<?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 ravikiran veldanda on Medium]]></title>
        <description><![CDATA[Stories by ravikiran veldanda on Medium]]></description>
        <link>https://medium.com/@ravikiran.veldanda?source=rss-9647b1a10db1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cCMWI6IM_BSwjTVG.jpg</url>
            <title>Stories by ravikiran veldanda on Medium</title>
            <link>https://medium.com/@ravikiran.veldanda?source=rss-9647b1a10db1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 21:30:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ravikiran.veldanda/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[I fine-tuned my RCA model. It got better, and stopped listening.]]></title>
            <link>https://medium.com/@ravikiran.veldanda/i-fine-tuned-my-rca-model-it-got-better-and-stopped-listening-8c201da41b3a?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c201da41b3a</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 19:59:59 GMT</pubDate>
            <atom:updated>2026-11-21T19:59:59.610Z</atom:updated>
            <content:encoded><![CDATA[<p><em>NetCortex, Part 3. A 41-incident AWS experiment on what fine-tuning a small LLM buys you in network root cause analysis, and what it quietly takes away.</em></p><p><em>Nov 21, 2026 · @Ravi Kiran Veldanda</em></p><h3>Prologue</h3><p>This is the third NetCortex article. <a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf">Part 1</a> introduced NetCortex, a multi-agent platform that investigates network incidents and writes the root cause analysis (RCA). <a href="https://medium.com/@ravikiran.veldanda/netcortex-part-2-our-agents-found-causes-nobody-wrote-a-rule-for-then-drafted-the-rule-9b9dab31f739">Part 2</a> showed the agents finding causes nobody had written a rule for, and then drafting that rule.</p><p>Since then NetCortex has moved off simulation. It now runs against real infrastructure in AWS, investigating faults I inject into a live lab network. That gave me something I didn’t have before: real incidents with a known answer key.</p><p>So this part asks a question every team with an LLM in its ops pipeline eventually asks: <strong>should we fine-tune it?</strong></p><h3>TL;DR</h3><ul><li><strong>Fine-tuning worked on the task.</strong> Nova Micro, tuned on 300 verified answers from Nova Pro, beat few-shot prompting on held-out incidents: valid JSON 63/63, answer accepted 62/63 (few-shot 58/63), real culprit named 48/51 (few-shot 44/51).</li><li><strong>It came close to its teacher at the student’s price.</strong> Nova Pro named the culprit 50/51 but costs about 20x more per token. The tuned model trained for about $4, bills per token like base Micro, and needs about a third of few-shot’s input.</li><li><strong>Then I tested false alarms.</strong> Every model, the big one included, blamed a harmless DNS change for an outage it had nothing to do with.</li><li><strong>One prompt sentence fixed the teacher and mostly fixed few-shot. The tuned model ignored it.</strong> 300 labels had taught it to always name a culprit, and that now outweighs the instruction.</li><li><strong>Lesson:</strong> fine-tune behaviour that has settled, never behaviour you’re still changing. Version the prompt and the training labels together, as one release.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_4U4_Wb0kP5BfQL56LUEQ.png" /><figcaption>NetCortex With FIne Tuned Model</figcaption></figure><h3>The experiment at a glance</h3><p>One small model, measured before and after fine-tuning, on incidents it never saw in training. Everything else stays fixed: same prompts, same test incidents, same scorer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gJ1B16dNbJD0zzXC9oQ3Rg.png" /><figcaption>Experiment details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*uAORFvgA2jKPyCSNQaB9sA.png" /><figcaption>Train and validation flow</figcaption></figure><p>Only r1 incidents feed training. The tuned model meets r2 and the false-alarm probes for the first time at test.</p><h3>The setup: an LLM that isn’t allowed to guess</h3><p>When a CloudWatch alarm fires, EventBridge drops it into an SQS queue. A small bridge groups the burst of alarms one fault trips into a single incident. Four domain agents (metrics, logs, routing, config) then pull telemetry for the window around the alarm over MCP: CloudWatch metrics and logs, CloudTrail, Transit Gateway routes.</p><p>The design rule that shapes everything below: <strong>rules detect, the LLM explains</strong>. Each agent runs deterministic checks (thresholds, state checks, z-scores against a baseline, change-event detection) and emits evidence items with ids like [E3]. The orchestrator ranks candidate causes by evidence, topology and timing. Only then does an LLM write the narrative, and NetCortex keeps it only if:</p><ul><li>every evidence id it cites exists, and</li><li>its root cause names the top-ranked cause.</li></ul><p>Otherwise NetCortex falls back to a deterministic sentence. The LLM can improve the report; it can’t invent one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*WDhWjdUWWvB6cMNoGLqwOQ.png" /><figcaption>NetCortex Architecture Flow</figcaption></figure><p>The LLM is one box in the middle of the pipeline. Everything before it is deterministic, and the guards after it decide whether its words ship.</p><p>That makes the LLM step narrow and well defined: read structured evidence, produce strict JSON, cite correctly, name the right culprit, and don’t name one when the evidence doesn’t hold one. Narrow tasks are exactly where people reach for fine-tuning. So: does it pay off?</p><h3>The data: break things on purpose, twice</h3><p>I wrote 20+ fault scripts that break the lab the way people break real networks: a deleted NAT route, a removed security group rule, a BGP neighbor shut down, an IKE proposal mismatch, a Transit Gateway blackhole route, a swapped subnet route table, a deleted private DNS record. Each fault reverts in place, so the lab returns to a known-good state.</p><p>An overnight campaign runner works through the faults one at a time. For each one it:</p><ol><li>injects the fault;</li><li>waits for NetCortex’s report;</li><li>scores the report against the fault log, the answer key NetCortex never sees;</li><li>reverts the fault;</li><li>confirms the lab is healthy again, then moves on.</li></ol><p>I ran two campaigns on two different days:</p><ul><li><strong>r1 (training):</strong> 20 drills, split <strong>by drill</strong> into 17 train and 3 validation.</li><li><strong>r2 (test):</strong> 21 drills on a different day, with different alarms and noise. Never trained on.</li></ul><p>Splitting by drill matters. One incident produces dozens of near-identical training examples, because I shuffle the order of the agents’ findings (agents finish in any order in real life) and that renumbers the evidence ids. Split those randomly and validation examples leak into training.</p><p><strong>What about class imbalance?</strong> Faults are rare in production, so you’d expect to need a balanced set. But this model only runs <em>after an alarm fires</em>; healthy periods never reach it. So every example is an incident, and the balance that matters is <em>what kind</em>:</p><ul><li>the cause is visible in the evidence (47%);</li><li>only symptoms are visible (37%);</li><li>the cause isn’t visible at all (8%);</li><li>a negative control, where nothing is actually wrong (8%).</li></ul><p>The last two come from one fault type each. That turned out to matter more than I expected.</p><h3>Labels: a teacher proposes, NetCortex verifies</h3><p>Nobody hand-labels hundreds of RCA narratives. Instead:</p><ol><li>Rebuild the exact prompt NetCortex sent for each drill.</li><li>Ask a <strong>teacher model</strong> for the answer, several times per finding order.</li><li>Keep only answers that pass NetCortex’s own guards and the drill scorer: the citations resolve, the top-ranked cause is named, and the true culprit is named whenever the evidence holds it.</li></ol><p>The teacher decides how many answers pass and how they read. The <strong>verifier</strong> decides what counts as correct. With Nova Pro as the teacher, 383 of 423 answers passed (91%). I capped the training set at 300 examples, with 40 for validation.</p><p><strong>Why Nova, and not an open model?</strong> My first plan was to fine-tune Qwen2.5–7B with QLoRA on a rented GPU. But my existing labels and baselines all came from the Nova family, so I stayed with Nova and kept the comparison to one model, before and after. The Qwen run, with full control over LoRA rank and quantization, is parked for a later article.</p><h3>Experiment design: four arms, four metrics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYGz-tf5mS1i5xLTgzJ1WA.png" /><figcaption>Nova Micro as a model under test.</figcaption></figure><p>Gemini Flash Lite had already been run against the same test round, so it appears in the results as an outside reference, not as an arm.</p><p>All four metrics are computed by NetCortex’s own code:</p><ul><li><strong>strict_json</strong>: the reply parses with plain json.loads.</li><li><strong>accepted</strong>: NetCortex would keep the model’s root cause (its citations exist and it names the top-ranked cause).</li><li><strong>headline_raw</strong>: on drills where the evidence holds the culprit, the model’s own sentence names it.</li><li><strong>headline_final</strong>: what NetCortex finally reports, after falling back on rejected answers.</li></ul><p>With 21 test drills, one drill is about 5%. So I report counts, not percentages, and I read the failures.</p><h3>Results on the test round</h3><p>The tuned model beat few-shot by 4 accepted answers and 4 correct culprits, and came within 2 culprits of its teacher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yC7TICJRYU7EF5cUeF72PA.png" /><figcaption>Results with Nova Micro Fine tuning beat everyone</figcaption></figure><p><strong>Training run:</strong> training loss fell from 0.33 to 0.17. Validation loss was 0.186 after epoch 1 and 0.184 after epoch 2. Flat validation loss means no overfitting, but also that the second epoch added little.</p><p><strong>Where it missed:</strong> the tuned model’s 3 misses fall on 2 drills: a deleted private DNS record (twice) and a BGP max-prefix fault. Few-shot missed those plus 5 more drills.</p><p><strong>Against the teacher:</strong> 48/51 against Nova Pro’s 50/51 on naming the culprit, and slightly ahead on acceptance (62 vs 59). Its final headline, 49/51, is the one metric where it trails both Nova Pro and Gemini (51/51).</p><p><strong>What it buys even at equal quality:</strong> few-shot puts three full incidents in front of every call, which makes the input about 2.9x longer. The tuned model needs none of that. You save tokens, cut latency, and have no example set to maintain inside the prompt.</p><p>So far this reads like a fine-tuning success story. Then I tested something my training data barely contained.</p><h3>The false-alarm test</h3><p>Real operations are full of alarms without a neat cause: a blip that recovers, or a symptom whose cause isn’t in the telemetry. The right answer to those is “no root cause identified”. My test set had exactly one such case, so I built a probe offline from the test round.</p><p>I took 5 real incidents and kept only the symptom on the alarmed entity. I removed everything that pointed at the real fault, including summaries that named the culprit (my first version leaked it there, so read your probes). Each incident became three probes:</p><ul><li><strong>transient</strong>: the symptom only, status “recovered”.</li><li><strong>no-cause</strong>: the symptom only, status “ongoing”, nothing ranked.</li><li><strong>red herring</strong>: transient, plus one harmless change 25 minutes earlier, a DNS TXT record upsert for domain verification on a name nothing uses.</li></ul><p>That’s 15 probes, and the correct answer to every one is “no specific root cause”. Each model answers each probe 3 times: 45 answers, 15 of them on red-herring probes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*syQaEhG4S7SIVBWpi6lgPw.png" /></figure><p>Not one model abstained, and the biggest one was the most confident about the wrong culprit. That isn’t a model-size problem; it’s a design problem. The prompt asks for “one concise sentence naming the specific root cause”, the guard rewards naming the top cause, and every label I trained on was produced under that prompt.</p><p>So I added one sentence to the root-cause instruction: if nothing is ranked and no cited evidence shows a change that explains the alarm, say that no root cause was identified, and say the degradation was transient if it recovered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsDjtNne8i4lLQCn4-NJYA.png" /><figcaption>Simple Prompt change</figcaption></figure><p>The sentence fixed the teacher completely and mostly fixed few-shot Micro. Zero-shot Micro barely moved: it started noting recoveries but still blamed the DNS change. On the normal test round, few-shot with the sentence named the culprit 45/51 (from 44) and NetCortex’s final headline reached 51/51, at the cost of 2 accepted answers (56/63, from 58).</p><p><strong>The fine-tuned model ignored the sentence.</strong> It had learned “always blame something” from 300 examples that all did exactly that, and that habit now outweighs the instruction. A one-line prompt fix that works in minutes on the other models now needs new labels and a new training job for the tuned one.</p><h3>What I’d tell a team before they fine-tune</h3><p><strong>1. Build the verifier first.</strong> The guards that reject an uncited or wrong root cause did more for reliability than any model choice. Look at headline_final: Gemini Flash Lite was rejected on half its answers and still ends at 51/51, because the deterministic fallback catches it. A verifier also gives you trustworthy labels from any teacher.</p><p><strong>2. Fine-tune what has settled, not what you’re still changing.</strong> Tuning won on format, citations and naming the culprit: behaviour I’m not going to change. It lost the moment I wanted to change behaviour, because it had learned the old behaviour more strongly than a prompt can override.</p><p><strong>3. Version the prompt and the labels together.</strong> Training labels are produced under a prompt. Change the prompt and your labels are stale, even when they still pass the verifier. In MLOps terms, prompt + label set + model is one release, and your eval gate has to cover all three.</p><p><strong>4. Test what your training data doesn’t contain.</strong> My 41 drills held one “nothing is wrong” case. The headline metrics looked great, and the false-alarm probe failed on every model. Build negative and false-alarm cases on purpose, both in the eval and in the labels.</p><p><strong>5. Check your guards for bias.</strong> Gemini’s low acceptance is mostly a format problem, not a reasoning problem. It writes citations as [E4, E17], and NetCortex only accepts [E4]. A guard that&#39;s stricter than it needs to be makes one vendor look worse than it is.</p><p><strong>6. Compare one model before and after, with the teacher as a ceiling.</strong> Comparing a tuned model against a different untuned model doesn’t tell you what tuning did.</p><p><strong>7. Try few-shot before you tune.</strong> It moved Nova Micro from 46/63 to 63/63 strict JSON with no training job, and it kept the model steerable.</p><p><strong>8. Count drills, not percentages.</strong> With 21 test incidents, “+5%” is one incident. Say which one.</p><h3>Limits</h3><ul><li>One lab, 20 training drills, one test round, 3 samples per drill.</li><li>The false-alarm probe is offline: real incidents with the culprit’s evidence removed and one planted change. It isn’t a live campaign of real noisy alarms, and the text check that scores it has at least one known false positive.</li><li>One fine-tune run, one learning rate.</li></ul><h3>What’s next</h3><p>For NetCortex, the fix comes in order:</p><ol><li>Put the abstain sentence into the synthesizer prompt.</li><li>Add verified “no root cause” labels for transient, no-cause and red-herring incidents.</li><li>Retrain only if the tuned model is still worth keeping.</li><li>Run a live false-alarm campaign: real blips and harmless changes in the lab.</li></ol><p>This closes the AWS side.</p><p>Next I’m rebuilding the pipeline end to end on GCP as an MLOps / LLMOps exercise: label versions tied to prompt versions, an evaluation gate in CI that includes false-alarm probes, a model registry. I’ll apply the same pattern to a few unrelated domains.</p><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c201da41b3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Where to Land on the Moon, and When: Building Sightline at NASA Space Apps 2026]]></title>
            <link>https://medium.com/@ravikiran.veldanda/where-to-land-on-the-moon-and-when-building-sightline-at-nasa-space-apps-2026-0fbad1a7724c?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fbad1a7724c</guid>
            <category><![CDATA[moon-landing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nasa-space-apps-challenge]]></category>
            <category><![CDATA[nasa]]></category>
            <category><![CDATA[space]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 23:14:10 GMT</pubDate>
            <atom:updated>2026-11-15T23:14:10.527Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How team Shackleton Station turned NASA terrain data into a landing-plan checker anyone can use</em></p><p>Nov 15, 2026 · @Ravi Kiran Veldanda</p><p>A few days ago, <strong>Rodrigo Pimenta</strong> invited me to join his team, <strong>Shackleton Station</strong>, for the NASA Space Apps Challenge 2026 Bethesda event, held online on November 14–15. The team built <a href="https://lunarsightline.com/">Sightline · Lunar landing site planner</a>, a web tool that checks a Moon landing plan before launch. Pick a site, a date and a mission, and it answers one question: <em>does this landing work?</em></p><p>This is Rodrigo’s team and Rodrigo’s project. He led it, and the real work came from him and a talented group: <strong>Patrick O’Donnell</strong>, <strong>Mikhail Sorokin</strong>, <strong>Jessica Marrucho</strong> and <strong>Sebastian Pituscan</strong>. My own part was small. This article explains what Sightline does, why it matters, and how it was built.</p><p>Try it live at <a href="https://lunarsightline.com/"><strong>lunarsightline.com</strong></a>. The code is open at <a href="https://github.com/shackleton-station/sightline"><strong>sightline</strong>.</a></p><figure><img alt="The sightline landing page" src="https://cdn-images-1.medium.com/max/938/1*BSpHyc0n2ujzRjwuwZR5BQ.png" /></figure><h3>Why the lunar south pole?</h3><p>Many new Moon missions, including NASA’s Artemis program and several commercial landers, are headed to the south pole. There are good reasons. The region has water ice, a possible source of drinking water and rocket fuel. Some ridges also get long stretches of sunlight for power.</p><p>But landing there is hard. At the pole, the Sun and Earth barely clear the horizon. A lander needs the Sun for power and Earth for a radio link, and a nearby hill can block either one. A small change in place or date can flip a landing from safe to fatal.</p><h3>What past landings taught us</h3><p>Before building anything, the team studied what had already happened. As of November 2026, five missions have aimed for the region. Two were lost before touching down: India’s Chandrayaan-2 (2019) and Russia’s Luna 25 (2023). Three reached the surface:</p><ul><li><strong>Chandrayaan-3 (2023)</strong> landed cleanly soon after local sunrise and worked for about 11 days, until sunset.</li><li><strong>Odysseus (2024)</strong> tipped over on touchdown, but came to rest in sunlight and in radio contact with Earth. It kept working for about a week and returned data from all six NASA instruments.</li><li><strong>Athena (2025)</strong> also tipped over, but a few hundred meters off target, in a shadowed crater. Its solar panels could not charge, and it died within a day.</li></ul><p>From these, four lessons stood out:</p><ol><li><strong>Sun and Earth decide survival.</strong> Odysseus and Athena both fell over. The one with sunlight and a radio link lived longer.</li><li><strong>A few hundred meters matter.</strong> Athena’s miss was the difference between a lit plateau and a dark crater.</li><li><strong>Timing matters.</strong> Landing soon after sunrise gave Chandrayaan-3 its full working window.</li><li><strong>Terrain matters.</strong> Two of the three landers tipped over, so the ground itself must be part of the plan.</li></ol><p>So a landing plan has to get four things right: <strong>power, communication, timing and terrain.</strong> Sightline is built to test all four.</p><h3>What Sightline does</h3><p><strong>It gives a verdict.</strong> Choose a past or planned landing site, or click any point on the Moon. Sightline answers “fits” or “does not fit”, shows why, and gives the time left until sunset and Earthset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*XK6REaFcu_GbgLpxKNIiJQ.png" /><figcaption>Verdict image.</figcaption></figure><p><strong>It lets you define the mission in detail.</strong> A verdict is only as good as the mission behind it. You can start from a preset (a short stay, a long stay, or a real example based on Canada’s lunar utility rover) or set each limit yourself:</p><ul><li>Mission length: how many days the lander must work.</li><li>Longest dark spell it can survive without sunlight.</li><li>Longest radio silence it can survive without Earth.</li><li>Whether the Sun, Earth or both must be in view at touchdown.</li><li>The steepest ground it can handle.</li><li>How far Earth must sit above the skyline for a reliable link.</li><li>The height of the solar panel and antenna, since a taller mast sees over more terrain.</li></ul><p><strong>It finds when to land.</strong> Launches slip. The Planner asks “where and when could I land?” and answers for every site at once, mapping each site against each month for any year through 2049. Where nothing fits, it says why: ground too steep, or Earth out of view at landing. The results show how narrow the windows really are. Under the default mission in 2026, 45 of the 120 site-months that have a valid landing offer it on only one or two days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*6bv4Wt7_ar7E2xjSr_csPA.png" /><figcaption>Planner Grid</figcaption></figure><p><strong>It tests the margin for error.</strong> No lander hits its mark exactly. Landing Accuracy takes how close a lander can get to its aim point and shows what share of touchdowns still work, what goes wrong in the rest, and a safer place to aim. At one ridge site, moving the aim point 1.2 km raised the share of good touchdowns from 61% to 100%.</p><p><strong>It shows the problem, not just the answer.</strong> 3D views show the terrain, the full 360° skyline, and the Sun and Earth moving across it hour by hour. You can see <em>why</em> a site works or fails on the real horizon, instead of reading a table of angles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mv14Rvh7ZCtVfTUXBPQGQg.png" /><figcaption>Sun and Earth surface view</figcaption></figure><p><strong>It compares options.</strong> Up to four sites or dates side by side, with the best value in each row marked. There is no single blended score: the trade-offs stay with the planner.</p><h3>Scout, the AI guide</h3><p>Sightline includes <strong>Scout</strong>, a built-in AI guide powered by Claude from Anthropic. You can ask it questions in plain words, and it explains any result. It also runs a short guided tour for first-time visitors.</p><p>The design rule behind Scout is my favourite part of the project: <strong>the AI is never allowed to write a number.</strong> Scout can only call Sightline’s own read-only lookups, and Sightline’s code fills in every figure from the same data the screen uses. All AI output is labeled. Language models are good at understanding questions and explaining answers, but they can get numbers wrong, so the numbers stay with validated code.</p><h3>How the calculation works</h3><p>Every result comes from four steps:</p><ol><li><strong>Terrain.</strong> NASA’s LOLA laser altimeter gives the shape of the ground: 20 m per pixel across the south pole and 5 m at the main ridge sites.</li><li><strong>Skyline.</strong> From each site, the terrain is traced outward in 720 directions, out to 150 km, over a curved Moon. This gives the true outline of the land as the lander would see it.</li><li><strong>Sun and Earth.</strong> NASA’s SPICE data gives their positions for every hour from 2026 through 2049, corrected for the time light takes to arrive.</li><li><strong>The check.</strong> For each hour: is the Sun or Earth above that skyline?</li></ol><p>Several details matter at the pole, and each one is built in. The Moon has no atmosphere, so the skyline is a hard edge and sunlight switches on and off as the Sun passes behind each ridge. The Moon’s wobble (libration) carries Earth up and down across the horizon. The Sun and Earth are discs, not points, so Sightline computes how much of each disc clears the skyline. Ground slope comes from the same terrain data. Around the south pole, the same calculation runs at 2.1 million points, which is what makes the landing-error analysis possible.</p><h3>Can it be trusted?</h3><p>The team tested the results against NASA’s own, in three ways:</p><ul><li>Sun and Earth positions match <strong>JPL Horizons</strong> to within 0.01°.</li><li>Long-run sunlight is within 1.2 percentage points of <strong>NASA’s illumination maps</strong> on average, across more than a million points.</li><li>Against <strong>dated orbiter photos</strong> of the pole, the model calls 92% of clear images correctly.</li></ul><p>Where Sightline’s numbers and NASA’s disagree, the site says so openly.</p><h3>Who it is for</h3><ul><li><strong>Mission planners and engineers</strong> can test site and date combinations quickly, re-check a plan when the schedule slips, and see how much landing error a mission can absorb.</li><li><strong>Students and educators</strong> can see why the south pole is both attractive and difficult, using real NASA data.</li><li><strong>Space enthusiasts</strong> following Artemis and commercial landers can explore why a mission picked its site and date.</li></ul><p>Every plan can be shared as a link, so a teacher can send a class to a specific site and hour, and an engineer can send a colleague an exact scenario.</p><h3>The tech stack</h3><ul><li><strong>NASA data:</strong> LOLA terrain, NAIF SPICE kernels, JPL Horizons, NASA illumination maps and LROC photos (for testing), plus Moon Trek and LROC Quickmap for map layers and deeper analysis.</li><li><strong>Data pipeline:</strong> Python, SpiceyPy, NumPy and Numba (fast enough for 2.1 million polar points), Rasterio and PyProj.</li><li><strong>Web app:</strong> TypeScript and React, Three.js with a custom shader that lights the ground for the chosen hour, and D3 for timelines and charts.</li><li><strong>Server and hosting:</strong> Node.js with Hono in Docker on Google Cloud Run, Cloud Storage and Cloud CDN for terrain tiles, Redis and Firestore for caching and saved plans, Terraform for the whole infrastructure, and GitHub Actions for testing and gradual releases with automatic rollback.</li><li><strong>AI:</strong> Claude (Anthropic) powers Scout, with read-only access to Sightline’s own lookups.</li></ul><h3>The team</h3><ul><li><strong>Rodrigo Pimenta (team owner and lead).</strong> Rodrigo led the project from start to finish. He built the data pipeline that every number depends on, made the key decisions on design and scope, and kept the whole team moving.</li><li><strong>Mikhail Sorokin.</strong> Owned the web app; the globe view of the whole Moon started as his idea.</li><li><strong>Patrick O’Donnell.</strong> Owned the build and deploy setup, suggested the typed-question idea that grew into Scout, and pushed hard on accuracy.</li><li><strong>Sebastian Pituscan.</strong> Worked on the simulated landers part of “Landing accuracy”</li><li><strong>Jessica Marrucho.</strong> Owned the pitch and the story.</li><li><strong>Ravi Kiran Veldanda (me).</strong> A small, supporting role, helping on pieces like site comparison and the explainer text.</li></ul><h3>What I took away</h3><p>I came into this a few days back from a background in networks and distributed systems, and I left with three lessons.</p><p>First, <strong>a clear question beats a pile of features.</strong> Sightline does a lot, but everything points back to one verdict: does this landing work?</p><p>Second, <strong>AI is most useful when it is fenced in.</strong> Scout can talk freely, but the numbers always come from validated code. That pattern is worth copying in any AI product where accuracy matters.</p><p>Third, <strong>say what you cannot tell.</strong> The team published where the model disagrees with NASA. That honesty makes the tool more trustworthy, not less.</p><p>A big thank you to <strong>Rodrigo Pimenta</strong> for inviting me and making me part of the team.</p><p><strong>Try Sightline:</strong> <a href="https://lunarsightline.com/">lunarsightline.com</a> <strong>Code:</strong> <a href="https://github.com/shackleton-station/sightline">sightline</a></p><p><em>#NASASpaceApps #SpaceApps2026 #Artemis #Moon #OpenSource #AI<br></em>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fbad1a7724c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your GPU Says 100 % Busy. It’s Delivering 14 % of Its Spec.]]></title>
            <link>https://medium.com/@ravikiran.veldanda/your-gpu-says-100-busy-its-delivering-14-of-its-spec-3fb6a72b95f7?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fb6a72b95f7</guid>
            <category><![CDATA[goodput]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 03:53:17 GMT</pubDate>
            <atom:updated>2026-11-06T03:53:17.920Z</atom:updated>
            <content:encoded><![CDATA[<p>Nov 3, 2026 · @Ravi Kiran Veldanda</p><p><em>GPU utilization says the card is busy, not how much it produces. Tokens per second says how much it produces, not how many tasks it finishes. I tested both on a free T4, an H100, a Kubernetes autoscaler and an emulated network fabric to find what to watch instead, and why every faster GPU pushes the bottleneck onto the network.</em></p><p>I tuned Qwen2.5–3B model on a free T4 across many combinations: batch sizes, scheduler limits, quantization, attention backends, CUDA graphs. The best one produced 1,459 output tokens per second for Qwen2.5–3B, 14 % of what the card’s datasheet allows for this model. At that point the utilization panel read 97–100 % busy.</p><p>That is because util.gpu reports the share of time any kernel was running. It measures activity. A user waiting for an answer cares about finished work: the token that arrived, the task that completed. Most of the control loops in an inference stack act on activity anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZHjHANBxMjLfC3zKhXByQ.png" /><figcaption>goodput-stack</figcaption></figure><p>This is the last article in the series. It follows the same gap through four layers:</p><ol><li><strong>The card:</strong> busy at a capped clock, on a T4 and an H100.</li><li><strong>The cluster:</strong> what to scale on, how to allocate GPUs, when to share one.</li><li><strong>The task:</strong> tokens per second vs cost per completed task.</li><li><strong>Scale-out:</strong> why a faster GPU makes the network a bigger share of every token.</li></ol><p>Every number carries a label for how real it is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anhLXsFrqFLkUcVvXvS79Q.png" /><figcaption>catalogue</figcaption></figure><h3>Layer 1. The card: busy at a capped clock</h3><p>A free T4 delivered 1,459 output tokens per second for Qwen2.5–3B in FP16, 13.8 % of its datasheet decode ceiling. Every percent of the gap is now accounted for, and utilization showed none of it.</p><p><strong>The clock is set by power, not by the datasheet.</strong> The T4’s 70 W software power cap was active in 98–100 % of samples, with no thermal throttling. Under vLLM decode the SM clock sat near 1 GHz; a dense matrix multiply ran at 557–669 MHz. The less power a kernel draws per clock, the higher the clock under the same cap. So the workload sets the clock.</p><p><strong>Throughput follows the clock.</strong> Across six runs on two cards in three sessions, output was 1.50–1.51 tokens per second per MHz. Kaggle refused clock locking, so the spread between cards is the experiment: it is all clock.</p><p><strong>Attention, not matrix multiplies, is the T4’s problem.</strong> At 384 sequences per step, attention took 52 % of GPU time, matrix multiplies 44 %, idle 0.2 %. FlashAttention doesn’t support the T4 (compute capability 7.5). vLLM’s Triton attention kernel read the KV cache at about 29 GB/s, 12 % of the card’s copy bandwidth. The matrix multiplies were fine at 75 % of peak per clock.</p><p><strong>The same questions on one H100 SXM.</strong> I ran the same model and workload on Modal’s free credit (2.39 GPU-hours, about $11):</p><ul><li><strong>Throughput:</strong> 45,365 output tokens per second at 2,048 sequences per step. That is 31× the T4 comparing each card’s best point, or 25.8× at the same 384 sequences.</li><li><strong>Also power-bound:</strong> 668–689 W of 700 W at large batch, clock 1.6–1.8 GHz in decode and 1.3 GHz in a dense matrix multiply, not the 1,980 MHz maximum.</li><li><strong>Matrix multiplies:</strong> cuBLAS reached 100 % of peak per clock. The whole gap to the 989 TFLOP/s datasheet figure is the power-capped clock.</li><li><strong>Attention:</strong> FlashAttention 3 read the KV cache at 2,240 GB/s, 74 % of copy bandwidth, against the T4’s 29 GB/s.</li></ul><p>The losses moved, yet the destination didn’t. The T4 loses most to its clock, then to attention. The H100 loses most to matrix-multiply efficiency at the batch shape, attention and small kernels. Both land at 41–45 % of their achievable compute roof.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QsBwKhkAUCgtFnlacvjI7g.png" /><figcaption>waterfall effeciency calculation.</figcaption></figure><p>The steps are attributed from one profiler trace per card, so the chart explains the gap rather than predicting it. The independent checks are that the matrix-multiply rate inside vLLM matches a standalone benchmark per clock, and that output per MHz stayed constant across runs.</p><p>One method lesson from the H100: the profilers showed 23–46 % idle time, but vLLM’s own step counter showed about 0 % at the best points. The idle time was the profilers’ own overhead. Trust the engine’s counters for idle; use the profiler for which kernels ran.</p><h3>Layer 2a. The cluster: scale on the queue, not on utilization</h3><p>On the same pool and the same load, scaling on queue depth matched the CPU-based autoscaler’s latency with half the replicas under light load. Under heavy load it halved median time to first token, for the same replica-seconds.</p><p>The test (real CPU, laptop): a pool of llama.cpp pods serving Qwen2.5–0.5B on k3s, two request slots per pod, minimum 1 and maximum 3 replicas. Three autoscalers took turns owning it:</p><ul><li><strong>KEDA on queue depth</strong>, the configuration the platform runs.</li><li><strong>The standard HPA on CPU utilization</strong>, target 50 %.</li><li><strong>The same HPA</strong>, target 80 %.</li></ul><p>Both HPAs copied KEDA’s scale-up and scale-down behavior exactly, so only the signal differed. Each ran a light load (2 requests at a time, which one pod serves without queueing) and a heavy load (6 at a time), three cycles each. That makes 18 cycles in random order, with 0 failed requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i2qdlCvNTyHrhNurzyQCHw.png" /><figcaption>KEDA CPU Scaling.</figcaption></figure><p><strong>Why CPU utilization fails here.</strong> A llama.cpp pod pushes its CPU to 99–100 % of its request as soon as one slot is busy. Two requests in flight and six requests in flight look identical. The CPU-based autoscaler adds pods when nobody is waiting, and can’t tell how many are. GPU utilization fails the same way on a batched engine: one running kernel reads as “busy”.</p><p><strong>Getting a clean measurement took several runs.</strong> The first cycles didn’t match what the queue numbers predicted: time to first token stayed at 3–4 s even with 3 replicas. Repeating them showed why. With the same prompts in every cycle, the gateway’s prefix-cache scorer sent about 4.4 of every 6 requests to the one pod that survived between cycles, because it already held those prompts. The results above use a unique prompt per request. Routing and autoscaling interact: the router from <a href="https://medium.com/@ravikiran.veldanda/web-metrics-cant-keep-a-gpu-busy-4fd2cb3083bc">Web Metrics Can’t Keep a GPU Busy</a> was quietly deciding the autoscaling result.</p><p>Scale-from-zero needs the gateway to hold requests while a pod starts, and the gateway’s external-processing call times out at 10 s.</p><p>Limits: one laptop, so replicas share CPU cores; pods not CPU-pinned; three cycles per cell. The p95 is similar across all three under heavy load, so the gain is in the median and the first minute.</p><h3>Layer 2b. Allocate whole GPUs, share only with evidence</h3><p>Kubernetes treats a GPU as an integer, so a scheduler has to answer who gets whole cards and when. Sharing one card is a separate decision that needs its own measurement.</p><p><strong>Allocation (SIMULATED).</strong> On fake GPU nodes, five one-GPU replicas on four GPUs left one Pending. Kueue added the rules a shared cluster needs:</p><ul><li>per-team quotas, with borrowing of idle quota and reclaim within 25 s</li><li>priority preemption</li><li>gang admission, so a multi-pod job starts whole or not at all</li><li>topology-aware placement on rack and block labels</li></ul><p>A health controller fenced a node with a faked GPU fault; its replacement pod was Ready 3.8–6.7 s after the signal. That’s with a cached image and no model weights. On real GPUs, image pull and weight load dominate.</p><p><strong>Fencing order matters.</strong> Tainting the node NoExecute first let the job exit 0 on SIGTERM, so Kubernetes marked it Complete instead of requeuing it. The runs didn&#39;t show the expected requeue until the order changed to: cordon the node, requeue the Kueue workload, then evict.</p><p><strong>Sharing one T4 (Kaggle T4, real).</strong> Two vLLM instances on one card can share it by plain time-slicing or under NVIDIA MPS, which runs both processes’ kernels concurrently. I ran single, time-sharing and MPS in alternating order (S T M M T S) in one session. Then I repeated it on a different physical T4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GH79GhMXT_lianVI5i6OA.png" /><figcaption>Single T4 with 2 Instances.</figcaption></figure><p>MPS beat time-sharing by about 13 % on both cards, with about 12 % lower inter-token latency at the same power. Both stayed well below one instance using the whole card.</p><p><strong>The per-MHz trap.</strong> Per MHz, MPS looked 26–29 % better. But MPS always ran at an 11–12 % lower clock, and per-MHz output rises when the clock drops: one single-instance run with a 5.8 % lower clock scored 2.7 % higher per MHz. So the raw +13 % is the number to quote. Only locked clocks would separate the two effects, and Kaggle doesn’t allow locking them.</p><p>Not shown: Kubernetes time-slicing through the device plugin (the fake GPU operator ignored it), and MIG, which the T4 doesn’t have.</p><h3>Layer 3. The task: tokens are not answers</h3><p>For multi-step work, the unit that matters is cost per completed task, and it can move the opposite way to tokens per second. Every cost-saving policy I tried cost more per solved task than doing nothing: a hard budget cut by 16 %, cheap-model-first cascades by 4–9×.</p><p><strong>The setup (Kaggle T4, real).</strong></p><ul><li><strong>Tasks:</strong> 150 GSM8K maths problems, each solved in three LLM calls: extract the quantities as JSON, write an arithmetic expression, state the answer.</li><li><strong>Checks:</strong> each step has a checker, and the last one compares with the known answer.</li><li><strong>Models:</strong> a strong model (Qwen2.5–3B AWQ) and a cheap one (Qwen2.5–0.5B), both on one T4.</li><li><strong>Budget:</strong> 951 tokens per task, the 75th percentile of tokens per solved task when the strong model does everything.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NclaGRf3HNxbwVyZLsND8A.png" /><figcaption>Token/Task budget</figcaption></figure><p>The dollars split the T4’s busy time between the two models by each one’s share, at $0.526 per T4-hour. Both models ran on one card at the same time, so this split is an approximation.</p><p><strong>Why the cheap-first policies lost.</strong> The small model passed the first step on its first try in only 34 of 150 tasks. Retries and escalations spent the budget before the last step, so tasks were cut mid-way and all their tokens were wasted. A cascade pays only when the cheap model usually succeeds. This is a result about these models and this budget, not about escalation in general.</p><p><strong>A hard cut at the budget</strong> lowered tokens per attempted task but raised tokens per solved task by 16 %. Only 23 of the 52 tasks it cut would have succeeded.</p><p><strong>Escalation needs a fresh prompt.</strong> The first escalation results were far below what I calculated, so I reran them to find out why. Passing the cheap model’s wrong answer into the strong model’s prompt made the strong model copy the mistake. It passed the escalated step 36 % of the time with the failed reply in context, and 93 % with a fresh prompt. The table uses fresh prompts.</p><p><strong>The early warning that wasn’t.</strong> Could a per-step check spot doomed tasks early? With checkers like mine, which check format rather than meaning, the first step’s result predicted the final outcome no better than a coin: area under the curve 0.504. Format checks passed for failures and successes alike.</p><p><strong>The operations detail.</strong> Cutting a task only saves money if cancelling the stream frees the engine’s slot. vLLM exposes no metric that counts cancelled streams. HTTP requests to the completions endpoint minus vllm:request_success_total does, and it matched the client&#39;s own count exactly.</p><h3>Layer 4. Scale-out: a faster GPU hands the bottleneck to the network</h3><p>Every GPU fix in Layer 1 shortens the compute part of a step. The bytes a split model must exchange stay the same, so the network becomes a bigger share of every token. This section is design analysis: the GPU speed-up is measured, and the network side is CALCULATED from models I validated in earlier articles.</p><p><strong>Where inference touches the network.</strong></p><ul><li><strong>Tensor parallelism</strong> splits each layer across GPUs, with two all-reduces per layer for every decode step. It is latency-critical, on every token.</li><li><strong>Mixture-of-experts</strong> models send an all-to-all per layer.</li><li><strong>Disaggregated serving</strong> runs prefill and decode on different pods, so each request’s KV cache crosses the network once.</li><li><strong>Replicas</strong> exchange nothing per token; routing between them is the subject of <a href="https://medium.com/@ravikiran.veldanda/web-metrics-cant-keep-a-gpu-busy-4fd2cb3083bc">Web Metrics Can’t Keep a GPU Busy</a>.</li></ul><p><strong>Bytes per step.</strong> Each all-reduce carries batch × hidden size × 2 bytes. For Qwen2.5–3B (36 layers, hidden size 2,048) at 64 sequences and tensor parallelism 2, that is 72 all-reduces of 256 KiB: 18.9 MB per GPU per step. For Qwen2.5–72B at 384 sequences across 8 GPUs, it is 1.76 GB per GPU per step.</p><p><strong>Time per step.</strong> I fed those bytes into the ring all-reduce model I validated on two T4s, where it had a 3 % median error. The links:</p><ul><li>PCIe through host memory: the measured fit, 3.89 GB/s and 8.7 µs per hop</li><li>NVLink 4 at 80 % of 450 GB/s</li><li>one 400G RoCE link per GPU at 80 % of line rate, 40 GB/s</li></ul><p>The compute side is the T4’s measured step time: 60.6 ms at 64 sequences. The H100 ran the same model 15× faster at 64 sequences and 26× faster at 384. So the chart also shows the compute step divided by 10, a conservative stand-in for a modern GPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Eip07roSf1qelrZpG0gMA.png" /><figcaption>Step time measurement.</figcaption></figure><p>Read it as an upper bound: it assumes no overlap of communication with compute, and that splitting the model doesn’t shorten compute. Real engines overlap some of it; splitting shortens compute, which makes the network share larger, not smaller.</p><p><strong>The 72B case.</strong> On 8 GPUs at 384 sequences, the all-reduces take 7.1 ms per step over NVLink and 55.2 ms over 400G. To keep the network under 10 % of the step, compute would have to take at least 64 ms on NVLink, or 497 ms over 400G. That is why tensor parallelism stays inside the NVLink domain of one server, and the scale-out fabric carries replicas, pipeline stages or KV transfers instead.</p><p><strong>KV transfer for disaggregated serving.</strong> Qwen2.5–3B holds 36 KiB of KV cache per token; Qwen2.5–72B holds 320 KiB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gV1V-6LncOb7D2wk8Np78w.png" /><figcaption>Time taking at different data transfers</figcaption></figure><p>The same prompt on Qwen2.5–72B is 640 MiB, about 17 ms over 400G (CALCULATED). That is a visible slice of the time to first token.</p><p><strong>One slow link.</strong> In <a href="https://medium.com/@ravikiran.veldanda/your-gpus-are-waiting-on-one-cable-79f12fd02741">Your GPUs Are Waiting on One Cable</a>, my model showed one link at half speed making a ring collective 55 % slower, because a ring runs at its slowest hop. Applied to these steps, a slow link adds 8–99 % to the communication time. On the T4 step at 384 sequences, that is 12–19 % over PCIe, at most 2.3 % over 400G and 0.3 % over NVLink. On a GPU ten times faster, the same slow link costs a share of every step closer to its full communication penalty.</p><p><strong>How to improve, as one system.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5cUgZLMQZHkYEknLu6J90w.png" /><figcaption>GPU performance imporvements.</figcaption></figure><p><strong>Measure the path before you model it.</strong> The first collective model, built from datasheet PCIe numbers, predicted NCCL 69–89 % faster than measured. Repeated runs and NCCL’s own logs showed why: the traffic went through host memory, not directly GPU to GPU. The numbers in this section use the measured path.</p><h3>What this doesn’t show</h3><ul><li>One T4 type and one H100 type, one GPU at a time. No NVLink, network card, RDMA or multi-node run, so the scale-out numbers are CALCULATED.</li><li>Kueue and fencing on simulated GPUs; topology from labels, not real racks.</li><li>Autoscaling on CPU pods on one laptop, three cycles per case. GPU-utilization scaling wasn’t tested; CPU utilization is the analog.</li><li>The task budget: GSM8K only, a policy in the client rather than the gateway, two small models, checkers that test format.</li><li>FP8 on the H100 measured for throughput only, not accuracy.</li></ul><h3>What changes at thousands of GPUs</h3><ul><li><strong>Power caps set fleet capacity.</strong> Both cards here ran power-bound, so the clock, not the datasheet, sets throughput. Benchmarks need clock and power next to every number.</li><li><strong>Big models put per-token traffic on the fabric.</strong> Once a model spans servers, the slowest link sets the time of every token, not just of a training step.</li><li><strong>Disaggregated serving turns the fabric into a KV-cache transport.</strong> KV bytes per request become a capacity input for the network design.</li><li><strong>Cost per completed task becomes the unit.</strong> Agent workloads are billed and routed per task, so budgets and cascades move from the client into the gateway.</li></ul><h3>Conclusion: watch finished work, not activity</h3><p>At every layer, the number on the dashboard measured activity, and the number that mattered was one step further along. The T4 read 97–100 % busy at 14 % of its spec. CPU utilization added pods with nobody waiting. Tokens kept flowing while tasks failed. And a GPU ten times faster would turn a 400G link into a third of every step for a model split across 4 GPUs.</p><p>The fix at each layer was the same: measure the unit closest to the user.</p><ul><li><strong>Card:</strong> record the clock and the throttle reasons with every throughput number, and compare per MHz only within one session. Use the engine’s step counters for idle time.</li><li><strong>Cluster:</strong> scale on queue depth; allocate whole GPUs with quotas; fence a node in the order cordon, requeue, evict. Share a card only on same-session evidence.</li><li><strong>Task:</strong> report tokens or dollars per completed task. Cut a task only where cancelling frees the slot. Cascade to a cheap model only when it usually passes, and never carry a failed reply forward.</li><li><strong>Scale-out:</strong> choose tensor parallelism or replicas by the measured link. Place by topology, and size the fabric for the busiest link.</li></ul><h3>Closing the series</h3><p>The series started with one claim: goodput is lost at the seams between layers, and the defaults hide where. Each article found a default that measures activity at its own layer:</p><ul><li><a href="https://medium.com/@ravikiran.veldanda/equal-cost-is-a-lie-the-strange-physics-of-gpu-traffic-b7ae2cc18ce5"><strong>Equal Cost Is a Lie: The Strange Physics of GPU Traffic</strong></a><strong>:</strong> equal-cost paths that weren’t equal.</li><li><a href="https://medium.com/@ravikiran.veldanda/your-gpus-are-waiting-on-one-cable-79f12fd02741"><strong>Your GPUs Are Waiting on One Cable</strong></a><strong>:</strong> a collective that runs at the speed of its busiest link.</li><li><a href="https://medium.com/@ravikiran.veldanda/web-metrics-cant-keep-a-gpu-busy-4fd2cb3083bc"><strong>Web Metrics Can’t Keep a GPU Busy</strong></a><strong>:</strong> a router that counted requests, not tokens.</li><li><a href="https://medium.com/@ravikiran.veldanda/bgp-converged-the-gpus-didnt-823f387ad66b"><strong>BGP Converged. The GPUs Didn’t.</strong></a><strong>:</strong> a fabric that converged while the GPUs stalled.</li><li><a href="https://medium.com/@ravikiran.veldanda/you-pay-for-the-hour-not-the-token-c54c6230919c"><strong>You Pay for the Hour, Not the Token</strong></a><strong>:</strong> a GPU billed by the hour, whatever it produced.</li><li><strong>This article:</strong> utilization, throughput and step checks.</li></ul><p>The common fix is to measure the unit closest to the user: the queue, the completed task, the busiest link. At scale, the seams meet in the network. That’s where a networking background stops being a side skill and becomes the job.</p><h3>References</h3><p><strong>Code, data and commands:</strong> <a href="https://github.com/veldanda3415/goodput-stack">github.com/veldanda3415/goodput-stack</a>. Each result below has its raw data and the predictions written before the run:</p><ul><li>T4 bottlenecks and waterfall: benchmarks/results/t4/bottlenecks.md</li><li>H100 on Modal: benchmarks/results/h100/h100.md</li><li>Queue vs CPU autoscaling: autoscaling/results/queue_vs_util.md</li><li>Kueue and node fencing (SIMULATED): scheduling/</li><li>MPS vs time-sharing: benchmarks/results/t4/two_instances.md</li><li>Cost per completed task: benchmarks/results/t4/task_budget.md</li><li>Scale-out calculator: fabric/design/scaleout.md</li><li>NCCL on two T4s: fabric/design/nccl_check.md</li></ul><p><strong>External references:</strong></p><ul><li>Kwon et al., <a href="https://arxiv.org/abs/2309.06180">Efficient Memory Management for Large Language Model Serving with PagedAttention</a>, SOSP 2023 (vLLM)</li><li>Shah et al., <a href="https://arxiv.org/abs/2407.08608">FlashAttention-3</a>, 2024</li><li>Narayanan et al., <a href="https://arxiv.org/abs/2104.04473">Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM</a>, SC 2021</li><li>Zhong et al., <a href="https://arxiv.org/abs/2401.09670">DistServe: Disaggregating Prefill and Decoding</a>, OSDI 2024</li><li><a href="https://keda.sh/">KEDA</a> and <a href="https://kueue.sigs.k8s.io/">Kueue</a></li></ul><p><strong>Earlier articles in this series:</strong></p><ol><li><a href="https://medium.com/@ravikiran.veldanda/equal-cost-is-a-lie-the-strange-physics-of-gpu-traffic-b7ae2cc18ce5">Equal Cost Is a Lie: The Strange Physics of GPU Traffic</a></li><li><a href="https://medium.com/@ravikiran.veldanda/your-gpus-are-waiting-on-one-cable-79f12fd02741">Your GPUs Are Waiting on One Cable</a></li><li><a href="https://medium.com/@ravikiran.veldanda/web-metrics-cant-keep-a-gpu-busy-4fd2cb3083bc">Web Metrics Can’t Keep a GPU Busy</a></li><li><a href="https://medium.com/@ravikiran.veldanda/bgp-converged-the-gpus-didnt-823f387ad66b">BGP Converged. The GPUs Didn’t.</a></li><li><a href="https://medium.com/@ravikiran.veldanda/you-pay-for-the-hour-not-the-token-c54c6230919c">You Pay for the Hour, Not the Token</a></li></ol><p><strong>Models:</strong> <a href="https://huggingface.co/Qwen/Qwen2.5-3B-Instruct">Qwen2.5–3B-Instruct</a> on Hugging Face, at the revisions pinned in the repo.</p><p><strong>Link speeds:</strong> NVLink 4 and 400G figures from NVIDIA’s published specifications, cited in fabric/design/sources.md.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fb6a72b95f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Pay for the Hour, Not the Token]]></title>
            <link>https://medium.com/@ravikiran.veldanda/you-pay-for-the-hour-not-the-token-c54c6230919c?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c54c6230919c</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 22:33:49 GMT</pubDate>
            <atom:updated>2026-10-31T22:42:46.271Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How memory and the serving engine decide what a self-hosted token costs, measured on a free T4</em></p><p>Oct 29, 2026 · @Ravi Kiran Veldanda</p><h3>You pay for the hour</h3><p>Call a model API and you pay per token: send nothing, pay nothing. Self-host open weights, and the bill arrives by the hour instead. A rented GPU costs the same whether it serves a thousand requests or none.</p><p>Teams in regulated, air-gapped or sovereign settings often have no choice; they have to run the model themselves. For them, the price of a token is not on a pricing page. It is a number they work out.</p><p>The card I tested on, an NVIDIA T4, rents for $0.526 an hour on-demand (Azure NC4as_T4_v3, Linux, list price fetched 2026–10–15). On-demand means no contract, not no meter.</p><p>Buying the card does not change the logic. Power, cooling, rack space, the people who run it, and the card’s own loss of value over three to five years add up to a cost per hour of its life. Rent by the hour or buy and spread the cost: either way each GPU-hour costs the same whether it is busy or idle.</p><pre>$ per 1M output tokens = $ per GPU-hour ÷ (output tokens per second × 3,600) × 1,000,000</pre><p>A worked example from my runs: Qwen2.5–3B in FP16 on vLLM, with 16 users at once, produced 342 output tokens per second, sustained. Kept that busy for a full hour, it would produce about 1.23 million output tokens, so a million output tokens cost $0.428. That is the fully utilized cost for this workload, and it counts output tokens only: the prompt tokens processed along the way are not priced separately.</p><p>Two things follow from the formula:</p><ul><li><strong>Idle time is billed.</strong> The $0.428 assumes the card is busy for the whole hour. Busy for a quarter of it, the same $0.526 buys a quarter of the tokens: about $1.71 per million (the formula, not a measurement).</li><li><strong>The tokens per second that sets cost is the total across everyone sharing the card</strong>, not how fast one user’s answer streams.</li></ul><p>So the number that sizes self-hosted inference is how many useful tokens one card produces per hour, and what stops it producing more. This article turns that into a method you can repeat on your own model and traffic: predict the card’s capacity from the model’s config file, measure tokens per second with your own prompt and answer lengths and number of users, check that the engine’s settings let it use the memory it has, then divide. Keeping the card busy across a whole day is the next article.</p><p>Every number here comes from real runs on a free Kaggle T4 (vLLM 0.31.0, and llama.cpp b11146 built for CUDA on the same card). Costs are calculated from those measured rates. Where a session was throttled, I say so.</p><h3>Predict it before you rent it</h3><p>How many users a GPU can hold for a given model can be worked out from the model’s config file before you pay for an hour. My predictions landed within ±2.3 % of what vLLM actually allocated (−2.0 % on one model, +2.3 % on the other).</p><p>Two facts about generating text do most of the work.</p><p><strong>Speed: every new token reads all the weights.</strong> Producing one token streams every weight from GPU memory through the cores once. With one user, the cores mostly sit waiting for memory. NVIDIA’s datasheet gives the T4 300 GB/s of memory bandwidth, and Llama-3.2–3B in FP16 is 6.4 GB of weights.</p><pre>Tokens per second for one user ≤ memory bandwidth ÷ weight bytes = 300 GB/s ÷ 6.4 GB ≈ 47</pre><p>Before the run I used 320 GB/s, the figure many spec sheets quote, and predicted at most 50 tokens per second (expecting 30–35). The datasheet figure lowers that ceiling to about 47.</p><p>Compute is not the limit. A T4 can do about 65 TFLOPS in FP16, roughly 217 operations for every byte it reads (65 TFLOPS ÷ 300 GB/s). Decoding for one user does about one operation per byte. Batching lets the requests in one decode step share a single read of the weights, so total throughput grows almost for free as requests are added. That is why sharing a card is cheap, until memory runs out.</p><p><strong>Room: every user’s context lives in memory too.</strong> The KV cache keeps the attention keys and values for every token of every conversation in flight.</p><pre>KV bytes per token = 2 × layers × KV heads × head size × 2 bytes</pre><p>For Llama-3.2–3B that is 2 × 28 × 8 × 128 × 2 = 114,688 bytes per token. Qwen2.5–3B has more layers but only 2 KV heads: 2 × 36 × 2 × 128 × 2 = 36,864 bytes per token.</p><p><strong>How big the KV cache gets.</strong> vLLM takes a share of the whole card’s memory, set by --gpu-memory-utilization, and gives the KV cache whatever is left after the weights and its working memory:</p><pre>KV cache tokens = (GPU memory × utilization − weights − working memory) ÷ KV bytes per token</pre><p>For Llama-3.2–3B on a T4 at the default setting of 0.90:</p><ol><li>vLLM sees 14.56 GiB on this 16 GB card; 14.56 GiB × 0.90 = 13.1 GiB for vLLM.</li><li>Minus 6.0 GiB of FP16 weights (6.4 GB) leaves 7.1 GiB.</li><li>Minus vLLM’s working memory (activations and CUDA graphs), the rest becomes the KV cache. My prediction assumed about 6 GiB would be left.</li><li>6.0 GiB ÷ 114,688 bytes ≈ 56,000 tokens, which I rounded to about 55,000 tokens: roughly the room for 13 conversations of 4,000 tokens each, if each held its full context at once.</li></ol><p>The setting applies to the whole card, not to what is left after the weights. Working back from what vLLM actually allocated, its working memory came to about 1.3 GiB on both models. For Qwen2.5–3B: 13.1 GiB − 5.79 GiB of weights − 6.01 GiB of KV cache = 1.30 GiB. (I first did this arithmetic with 15 GiB, a common rounding for this card; a later run’s startup log showed vLLM sees 14.56 GiB.)</p><p>That led to the prediction I carried into the runs: <strong>on a T4, memory for the KV cache caps how many users share the card before compute does.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKoMGE_dycSGhViFTmLtSw.png" /><figcaption>Prediction vs Measured</figcaption></figure><p>The one-user speeds are medians of five runs (3.9 % and 1.0 % spread). Both models reached about three-quarters of the bandwidth ceiling; the rest goes to overheads I did not break down.</p><p>The Qwen column shows why architecture matters as much as size. Qwen2.5–3B keeps only 2 KV heads across its 36 layers, so it needs 36,864 bytes per token, a third of Llama’s. On the same card at the same setting, it holds 3.25× more tokens of context.</p><p><strong>The KV cache is what is left over, so it moves faster than the setting.</strong> On an 8B model in 4-bit AWQ, raising vLLM’s memory setting from 0.80 to 0.95 grew the KV cache from 37,744 to 62,192 tokens: 15 points more memory, 65 % more room. The maximum context length does not change the cache at all. At setting 0.90 it held 56,224 tokens whether I allowed 2K or 16K tokens per conversation. Only the number of full-length conversations that fit changed: 27 at 2K, 3 at 16K.</p><h3>The GPU had room. The queue didn’t.</h3><p>The first limit I hit was not memory. In a controlled test, one scheduler setting I lowered on purpose cut the card’s output to about a third for this workload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OfQ3_g2XnDu8JVVnqt5oIQ.png" /><figcaption>goodput-stack idea</figcaption></figure><p><strong>First, the workload, because every number here depends on it.</strong> These runs used 256-token prompts and answers of 96 to 160 tokens, a prompt-heavy mix. At 64 users the KV cache averaged about 11 % full (13 % at peak), so each conversation in flight held a few hundred tokens. A question that asks for a long answer, say a country’s whole history instead of one name, holds ten times that.</p><p>With vLLM’s defaults, Qwen2.5–3B in FP16 went from 35 tokens per second for one user to 615 for 64 users, and it was still climbing. vLLM never had to evict a conversation. The GPU itself was busy, though: 100 % utilized, at about 1 GHz and 66 W. The ridge section below shows why that matters.</p><p>Then the deliberate experiment: --max-num-seqs 8. That caps how many conversations vLLM decodes together in one step; everyone past the eighth waits in vLLM&#39;s own queue for a seat. The default cap is far higher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yEkSibppoNdpKJOdRWlYPA.png" /><figcaption>vLLM — max-num-seq test to verify TTFT</figcaption></figure><p>Output went flat at about 210 tokens per second from eight users on. In this test, every user beyond eight only added time in the queue, and that queue is the whole first-token wait. At 64 users, half of them waited more than 34 seconds before seeing a word.</p><p>One decode step reads all the weights whether it serves 8 users or 64, so the cap threw away the reuse that makes sharing a card cheap. In money, with the same $0.526 an hour: 615 tokens per second is about $0.24 per million, and 210 is about $0.70. That is nearly three times the price for the same card and the same hour.</p><p>This demonstrates a trade-off; it is not a rule that a cap of eight is wrong. A low cap keeps each step short and limits contention, and when per-user latency matters more than total output it can be the right setting. Here it cost throughput and added queueing, because the card had room to spare.</p><h3>The ridge point: predicted, then measured</h3><p>Each request adds compute, and batching lets the requests in one decode step share a single read of the weights, so the work done per byte rises as requests are added. At some point the cores, not memory, become the bottleneck. In a simplified roofline model that turning point is the ridge: for a T4, 65 TFLOPS ÷ 300 GB/s ≈ 217 operations per byte.</p><p>Every request also reads its own KV cache on every step, and that grows with conversation length:</p><pre>Operations per byte = (B × 2 × parameters) ÷ (weight bytes + B × L × KV bytes per token)</pre><p>Here B is requests decoding together and L is tokens per conversation. For Qwen2.5–3B: about 3.1 billion parameters, 6.2 GB of weights and 36,864 KV bytes per token.</p><p>With datasheet peaks, that model gave me two predictions to test:</p><ul><li><strong>Short conversations</strong> (128-token prompts, 256-token answers): the compute ridge at about 330 requests, and an output ceiling of about 7,000 tokens per second, since a third of the compute goes to prompts.</li><li><strong>Long conversations</strong> (about 4,000 tokens): the compute ridge is never reached; the KV cache fills first, at roughly 47–50 requests. Measured once, with 3,840-token prompts and a cap of 64: the cache filled with 53 requests running, vLLM evicted 3, and the batch produced only 47 output tokens per second, because processing the long prompts dominated a single wave.</li></ul><p>Then I measured the short case with vLLM’s offline benchmark, which takes HTTP and the client out of the picture. Same card, memory setting 0.95, 128-token prompts, 256-token answers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*y4Bn8RKgm9d2umyFQkGwhg.png" /><figcaption>RidgePoint measurement</figcaption></figure><p><em>Measured offline throughput (blue) against my two predictions: the datasheet ceiling (red dashed) and the range I expected (grey band). Kaggle T4, real; run 20261031–082141 in the repo.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ujv320ej22-ht6ghlBk-og.png" /><figcaption>Ceiling Measurement</figcaption></figure><p>Output stopped growing between 256 and 384 requests: only 2.6 % more for the last 128. The shape matched the model, with the bend near its predicted 330. The level did not. 1,459 tokens per second is about a fifth of the predicted 7,000.</p><p><strong>The datasheet assumes a clock the card did not run.</strong> The 65 TFLOPS figure assumes the T4’s 1.59 GHz boost clock. Under full load this 70 W card held about 1 GHz at 65–67 W while fully busy, consistent with its power limit. I did not record the GPU’s own throttle-reason flags, so that cause is likely rather than proven. Working back (CALCULATED), it processed about 2,190 tokens per second including prompts, roughly 13.6 TFLOP/s. That is 21 % of the datasheet peak, or about a third of the peak at the clock it actually ran. The rest is kernel efficiency on an older architecture and per-step overheads, which I did not break down.</p><p>The planning lesson: the roofline tells you the shape and roughly where the bend sits. Only a measurement on your card, under sustained load, tells you the level. Plan with measured ceilings, not spec sheets.</p><p>It also explains the 615 tokens per second at 64 users. In that run the GPU was already 100 % busy at about 1 GHz, spending much of each step on 256-token prompts. The engine’s step time offline at 64 requests, about 66 ms (CALCULATED), matches that run’s median inter-token latency of 64.6 ms. To check, I replayed that run with client CPU measured: 610 tokens per second (−0.9 %), the GPU 100 % busy, and the client using 9 % of one CPU core. That run was limited by the GPU, not by the client. Going through HTTP cost nothing measurable either: at 384 users the served engine delivered 1,464 tokens per second against 1,459 offline (different sessions).</p><p>Two differences keep the offline and served numbers from being compared step for step: the offline tool fixes the temperature at 1.0, and it packed up to 8,192 tokens per step against 2,048 in the served runs.</p><h3>A first-pass setting for the cap</h3><p>--max-num-seqs caps how many requests vLLM schedules in one step. It is not the number of users a service can support. As a first guess:</p><pre>max-num-seqs ≈ the smaller of: KV cache tokens ÷ tokens per conversation, or the number of requests at the compute ridge</pre><p>This assumes every conversation holds its full context at the same time. In practice vLLM allocates KV blocks as tokens are generated and frees them as requests finish, so real cache use is usually lower. Prompt lengths, answer lengths and arrival times vary, and prompt processing and decoding compete for the same steps.</p><ul><li><strong>Too low:</strong> memory sits unused while requests queue (the run capped at 8, for this workload).</li><li><strong>Too high for long conversations:</strong> vLLM runs out of cache and evicts requests to recompute later, which shows up as latency spikes.</li><li><strong>Once the card is saturated:</strong> extra requests are expected to add queueing rather than throughput. Where that point falls depends on the workload and the scheduler.</li></ul><p>Treat the formula’s answer as a starting point. Then tune the cap against measured throughput, TTFT, inter-token latency, queue depth and KV-cache usage for your own traffic.</p><p>On this card, with short requests, output stopped growing between 256 and 384 requests per step. The latency you can accept will usually put the cap well below that.</p><h3>Same GPU, same hour, different price</h3><p>The cheapest change I found was a model swap. Moving Qwen2.5–3B from FP16 to 4-bit AWQ on vLLM cut the cost per million tokens by 36 %, on the same card at the same hourly price.</p><p>If decode is limited by bytes read, then fewer bytes per weight should mean faster tokens. Quantization stores each weight in fewer bits; the maths still runs in FP16, but every step reads far less memory.</p><p>I ran four versions of the same model on one T4, in one Kaggle session, at one user and at 16 users. I compare each engine only against itself. vLLM and llama.cpp batch users differently, so a cross-engine ranking would mostly measure the engine, not the quantization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1GC2swt1A2UxTIanABRPqA.png" /><figcaption>GPU Cost with Quantization</figcaption></figure><p>Fewer bits helped on both engines, but by very different amounts once the card was shared:</p><ul><li><strong>vLLM, FP16 → AWQ:</strong> 2.3× faster for one user, 1.6× more total output at 16 users, <strong>−36 %</strong> per token.</li><li><strong>llama.cpp, Q8_0 → Q4_K_M:</strong> 1.3× faster for one user, only 1.07× more at 16 users, <strong>−6 %</strong> per token.</li></ul><p>Two things stand out. First, the one-user speed-up is real but smaller than the cut in bytes: 4-bit weights are far smaller than FP16, yet speed rose 2.3×, not 4×. Unpacking 4-bit weights back to FP16 on every step costs time. Second, the gain shrinks as users are added. My reading is that a bigger share of each step goes to work quantization does not shrink, such as each user’s KV cache reads; I have not measured that split.</p><p>The lesson for planning is the column that sets cost. A quantization judged on one user’s speed would have looked good on both engines. At 16 users, it was worth a third off the bill on one and almost nothing on the other.</p><p>One more effect is not in the table. Smaller weights leave more of the card’s memory for the KV cache, which moves the memory limit from section three further out. I did not measure that cache size for the 3B AWQ model, so I leave it as arithmetic.</p><h3>Cheaper isn’t free</h3><p>The cheapest version also lost the most quality on the one test sensitive enough to show it, and my task test was too small to say whether that matters.</p><p>I checked quality two ways, in the same session as the speed runs. Perplexity measures how surprised the model is by a fixed piece of real text: lower is better, and it moves with small changes. The task tests ask real questions and score the answers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNe8OuFmpa2wMdMAlygxPg.png" /><figcaption>Quality Measurement.</figcaption></figure><p><em>hellaswag could not run against llama.cpp’s API, so those cells are empty.</em></p><p>Perplexity separates the versions cleanly: going to 4 bits cost 8 % on vLLM’s AWQ and 3.4 % on llama.cpp’s Q4_K_M. The task scores do not. On 250 maths questions, one score has a standard error of about three points, so a three-point drop is inside the noise. Telling apart two versions three points apart would take roughly 2,000 questions each, more than gsm8k’s whole 1,319-question test set.</p><p>One result I cannot explain yet: scored with the strict answer format instead of the flexible one, gsm8k gave 0.12 on vLLM and 0.25–0.33 on llama.cpp. A scoring rule moved the result more than any quantization did, which is its own warning.</p><p>For planning, the 36 % saving is real, but it is not free. Before switching, test the cheaper version on your own task, with enough questions that a few points of difference would show.</p><h3>What I got wrong, what this doesn’t show, and what’s next</h3><p><strong>One T4 is not every T4.</strong> My first concurrency sweep on Llama-3.2–3B ran on a Kaggle card that was power-capped near 500 MHz. One user got 12 tokens per second instead of 36.65, and every number in that session was depressed. Nothing in the results looked broken; the clock log gave it away. Since then I compare numbers only within one session, label throttled sessions, and ran the whole quantization comparison in a single session.</p><p><strong>I trusted the datasheet.</strong> I predicted an output ceiling of about 7,000 tokens per second from peak specs and measured 1,459. The shape of the prediction held; the constants did not, because the card ran near 1 GHz, consistent with its power cap, instead of at its 1.59 GHz boost clock.</p><p><strong>A benchmark can measure its own settings.</strong> vLLM’s own benchmark tool reported a 95th-percentile first-token wait of 7.1 s at 16 users, against 1.86 s from my harness. A fresh server’s first wave of requests waited about 12 s when the request set no temperature. With the same sampling setting on both sides, the two tools agreed. I have not confirmed the mechanism.</p><p><strong>What these runs don’t show:</strong></p><ul><li>One 16 GB T4 (Turing): FP16 only, no BF16 or FP8.</li><li>3B models for speed and cost; the 8B model for KV cache size only.</li><li>Short requests only: 256-token prompts with 96–160-token answers in the served runs, 128 in and 256 out offline. The long-conversation case was measured once: a single wave of 64 requests.</li><li>Output tokens only; prompt tokens are not priced.</li><li>A card busy for the whole hour, at an on-demand list price.</li><li>GPU activity sampled with NVML, not DCGM; small samples per point; prefix caching off.</li></ul><p><strong>At 1,000s of GPUs the arithmetic is the same; the numbers move.</strong> Data-centre GPUs read memory at several TB/s, so the speed ceiling rises. Compared with FP16, FP8 weights and an FP8 KV cache halve the bytes per value, where the model, GPU, engine and kernels support them. A T4 does not. Long contexts make the KV cache the bigger tenant: an 8B model serving 32 conversations of 4,000 tokens holds about 16 GiB of KV cache, as much as its own FP16 weights. Models too big for one card are split across several with tensor parallelism, which keeps those GPUs talking every step, so they stay inside one fast NVLink domain. Capacity planning becomes KV tokens per GPU, divided by tokens per conversation, against the number of users you need to serve.</p><p><strong>The method, in four steps:</strong></p><ol><li>Predict: speed ceiling from weight bytes and memory bandwidth; KV cache size from the config file and memory left over.</li><li>Measure: tokens per second with your own prompt and answer lengths, at the number of users you expect.</li><li>Check the settings: start --max-num-seqs from the KV-cache and ridge arithmetic, then tune it on measured TTFT, inter-token latency, queueing and KV usage.</li><li>Divide, and only then pick a quantization, tested for quality on your own task.</li></ol><p>Next I want to finish the long-conversation sweep at 32 and 48 requests, to see where eviction starts. The next article takes the other half of the bill: one card filled is not a fleet kept busy. It scales on the queue, not on GPU utilization, and schedules GPUs that can only be handed out whole.</p><h3>References</h3><ul><li>Code, configs and raw results for every run: <a href="https://github.com/veldanda3415/goodput-stack">goodput-stack on GitHub</a></li><li>NVIDIA, <a href="https://nvidia.com/content/dam/en-zz/Solutions/Data-Center/tesla-t4/t4-tensor-core-datasheet.pdf">T4 Tensor Core GPU datasheet</a>: 65 TFLOPS mixed-precision FP16, 16 GB GDDR6, 300 GB/s</li><li>vLLM, <a href="https://docs.vllm.ai/en/latest/models/engine_args.html">Engine arguments</a>: --max-num-seqs, --gpu-memory-utilization</li><li>Kwon et al., <a href="https://arxiv.org/abs/2309.06180">Efficient Memory Management for Large Language Model Serving with PagedAttention</a> (SOSP 2023)</li><li>Lin et al., <a href="https://arxiv.org/abs/2306.00978">AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration</a></li><li>Williams, Waterman and Patterson, <a href="https://www2.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-134.html">Roofline: An Insightful Visual Performance Model for Floating-Point Programs and Multicore Architectures</a> (UC Berkeley, 2008)</li><li>Cobbe et al., <a href="https://arxiv.org/abs/2110.14168">Training Verifiers to Solve Math Word Problems</a> (GSM8K); test split size from the <a href="https://www.tensorflow.org/datasets/catalog/gsm8k">TensorFlow Datasets catalog</a></li><li>Azure Standard_NC4as_T4_v3 on-demand Linux price, $0.526/h: <a href="https://instances.vantage.sh/azure/vm/nc4ast4-v3?currency=USD">Vantage instance listing</a> (the runs used the Azure Retail Prices API response saved in the repo, fetched 2026–10–15)</li></ul><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c54c6230919c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NetCortex Part 2: Our Agents Found Causes Nobody Wrote a Rule For, Then Drafted the Rule]]></title>
            <link>https://medium.com/@ravikiran.veldanda/netcortex-part-2-our-agents-found-causes-nobody-wrote-a-rule-for-then-drafted-the-rule-9b9dab31f739?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b9dab31f739</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Thu, 29 Oct 2026 21:07:58 GMT</pubDate>
            <atom:updated>2026-10-29T21:07:58.872Z</atom:updated>
            <content:encoded><![CDATA[<h4>On a real AWS network with a sealed answer key, the LLM proposes, the agents verify in code, and every verified finding becomes a draft rule</h4><p>NetCortex as one read-only boundary: alarms from CloudWatch, Alertmanager or a ticket come in; four AI agents (metrics, logs, routing, config) fetch history before the alarm and current state from the network’s telemetry over MCP; catalog rules judge known signals, an LLM proposes hypotheses for unexplained evidence, code verifies them with four checks, candidates are ranked, and a verified root cause comes out, with a draft rule for a human to approve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsFQFVkgYP_zQgjZAVWl9g.png" /><figcaption>Idea of NetCortex</figcaption></figure><p>In <a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf?sharedUserId=ravikiran.veldanda">Part 1</a> we said: “We are not including evaluation results in this version; they will be added in future articles.” This is that article. No simulation this time: a real AWS network, real faults injected into it, and NetCortex asked to explain each one without seeing the answer. That includes faults its catalog had never heard of.</p><h3><strong>TL;DR:</strong></h3><p>Every rule-based RCA tool hits the same wall. It only explains the failures someone already wrote a rule for. The incident that pages you at 2am is usually the one nobody anticipated: an API call that isn’t on any watch list, a log line from a router feature you’ve never seen fail. A rules engine shows you the symptoms and stops there.</p><p>NetCortex gets past that wall. When no rule explains an incident, its agents show an LLM the evidence no rule judged. The LLM proposes a hypothesis: this signal, on this entity, caused it, and here is a rule that says so. The agent that owns the data then checks the hypothesis in code. The cited evidence must exist, the rule must fire now and not before, and the entity must sit upstream of the alarm. Only a hypothesis that passes counts as evidence. Each one that passes is also written out as a draft catalog rule. Once a human approves it, the next incident of that kind is caught with no LLM at all. With a human approving each draft, the catalog grows one verified rule at a time.</p><p>We tested it on a hybrid-cloud lab we built on AWS: a Transit Gateway, five VPCs, and a simulated on-prem data center over a BGP Site-to-Site VPN. We broke it on purpose, and every fault went to a sealed answer key that NetCortex is blocked from reading by IAM.</p><p><strong>Faults with no rule for their cause:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*As1jCbthNR6uHKuhtNYY1A.png" /><figcaption>Results with NetCortex</figcaption></figure><p><strong>How big these tests are: </strong>The offline “24” is 8 kinds of fault, each run 3 times, not 24 independent faults. The repeats measure how consistently the LLM proposes the right hypothesis, not how many kinds of failure it can handle. The live test is smaller still: 3 new faults with a culprit, each run once, plus one fault (MTU black hole) where the right answer was “no cause”. These results show the mechanism works on real telemetry. They don’t yet show how often it works across the failures a real network throws at you. That takes more fault types, more runs and other networks, so if you run a lab or a staging network, we’d like you to stress-test it. The fault library and the ablation eval are in the repo for exactly that.</p><p>And where a rule already exists, NetCortex is as dependable as a rules engine. Across 17 live faults the catalog covers, every one of the 15 culprits was found, ranked first and named, and the healthy and no-culprit cases stayed quiet. That held with the LLM on and off, and the median from fault to finished RCA was 4.7 minutes.</p><p>So the LLM isn’t there to write a nicer paragraph. It finds causes no rule knew about, it can’t assert anything code hasn’t checked, and it drafts the catalog’s next rules as it goes (see Where the automation stops).</p><h3>What Changed Since <em>Part 1:</em></h3><p><a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf?sharedUserId=ravikiran.veldanda"><em>Part 1</em></a> was simulation-first: four domain agents (metrics, logs, routing, config), A2A collaboration rounds, and a deterministic synthesizer, all running against 14 bundled scenarios. Getting to a real network took five changes. One of them reverses something<a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf?sharedUserId=ravikiran.veldanda"> <em>Part 1</em></a> said: there, the LLM was used exactly once, to write the narrative. In this it gets a second job, proposing rules for evidence no rule explains. It still never decides anything; code does.</p><ol><li>Telemetry is a contract, not a function call. Agents query a telemetry server over MCP (Model Context Protocol, Streamable HTTP), and every answer comes back in one vendor-neutral envelope:</li></ol><pre>{<br> &quot;signal_type&quot;: &quot;metric&quot;,<br> &quot;timestamp&quot;: &quot;2026–10–28T14:44:00Z&quot;,<br> &quot;entity&quot;: {&quot;type&quot;: &quot;tgw_route_table&quot;, &quot;id&quot;: &quot;tgw-rtb-0ab9…&quot;},<br> &quot;name&quot;: &quot;tgw_route&quot;,<br> &quot;attributes&quot;: {&quot;state&quot;: &quot;blackhole&quot;, &quot;destination_cidr&quot;: &quot;10.10.0.0/20&quot;},<br> &quot;source&quot;: &quot;tgw_routes&quot;,<br> &quot;evidence_ref&quot;: &quot;tgw_routes:tgw-rtb-0ab9…/10.10.0.0/20@…&quot;<br>}</pre><p>Each response also carries a coverage entry per source, so NetCortex can tell “I looked and nothing happened” apart from “I couldn’t look.” A domain whose telemetry failed is never reported as clean; the report says “inconclusive” instead.</p><p>2. Detection is data. All four agents run the same generic code. What a signal means lives in a JSON catalog: which names exist, and which rule judges each one. There is no eval and no expression language; a rule is one of five types (threshold, state equals, z-score against a baseline, rate change, event presence). Adding “Direct Connect connection down” is one JSON entry:</p><pre>&quot;ConnectionState&quot;: {<br> &quot;signal_type&quot;: &quot;metric&quot;, &quot;domain&quot;: &quot;metrics&quot;, &quot;entity_types&quot;: [&quot;dx_connection&quot;],<br> &quot;description&quot;: &quot;AWS/DX ConnectionState: 1 when up, 0 when down.&quot;,<br> &quot;rule&quot;: {&quot;type&quot;: &quot;state_equals&quot;, &quot;value&quot;: 0, &quot;reason&quot;: &quot;Direct Connect connection down&quot;}<br>}</pre><p>Log lines are named at the source rather than matched as free text. A line like <em>%NOTIFICATION: sent to neighbor 169.254.100.1 2/2 (OPEN Message Error/Bad Peer AS)</em> becomes a signal called <em>bgp_open_error,</em> and an AWS VPN log saying <em>“maximum prefix limit was exceeded</em>” becomes vpn_bgp_prefix_limit. Parsing lives at the edge; judgment lives in the catalog.</p><p>3. Real source plugins. The telemetry server fans each query out to plugins: Plugin Reads Domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGXo9UfopgqBOlSsUDGADQ.png" /><figcaption>Plugins for different domains</figcaption></figure><p>4. Agents investigate together. This is the part that makes it multi-agent, so it gets its own section.</p><p>5. The LLM proposes, the agents verify. When no rule explains an incident, the LLM proposes one, and code decides whether it holds. This is the core of the article, and it gets its own section after the investigation.</p><h3><strong>How the Agents Investigate</strong></h3><p>A real alarm fires on a symptom: a synthetic flow failing, a tunnel down. The cause is usually somewhere else: another device, another domain, sometimes before the window you queried. So after each agent’s first look,</p><p>NetCortex runs up to two collaboration rounds:</p><ol><li><strong>Publish: </strong>Every agent sees every other agent’s findings.</li><li><strong>Ask:</strong> Each agent walks the topology from the entities its evidence (or the alarm) names, following only depends-on edges: a flow depends on its load balancer, which depends on its target group, its instances, their security group. For each upstream entity it asks the agent that can see it a scoped question: “Any config change on route table rtb-0a7c…, starting 15 minutes before the first symptom?”</li><li><strong>Answer: </strong>The asked agent re-runs its own detection rules on a query scoped to that one entity and window. It answers supported, refuted or inconclusive, and can name new leads for round two, such as a route table ID it found inside a CloudTrail request.</li><li><strong>Revise:</strong> Each agent revises its finding once.</li><li><strong>Rank:</strong> Every entity with rule-fired evidence becomes a candidate cause, scored on four things: evidence strength, topology (does the alarm depend on it?), timing (did it fire just before the symptoms started?), and role (is this signal usually a cause or a symptom?). Roles can be conditional: “zero prefixes advertised” is a cause while the BGP session is up, and only a symptom while it is down.</li></ol><p>Then the synthesizer writes the report. The rules-only root cause names the top-ranked candidate and its chain to the alarm:</p><pre>Config domain: DisableTransitGatewayRouteTablePropagation on tgw_route_table tgw-rtb-0ab9…, upstream of the alarm on flow:onprem-iperf-app-a, flow:onprem-to-nlb …</pre><p>The LLM sees the same ranked candidates and numbered, rule-fired evidence, and must follow two rules: it may only reorder candidates the rules scored as a near-tie, and its sentence must cite the evidence ([E2]) and name the top-ranked cause. Otherwise the rules-only sentence is used. With Gemini on, it wrote 10 of the 16 root causes and was held back on the other 6:</p><pre>Transit Gateway route table propagation was disabled on tgw-rtb-0ab9… by user &lt;operator&gt; [E2].</pre><p><strong>NetCortex also reads the minutes after the alarm</strong>, so every report says whether the incident is ongoing, recovered or flapping. A BGP session that dropped and came back on its own is reported as recovered, not as an outage.</p><h3><strong>The Core Idea: The LLM Proposes, the Agents Verify</strong></h3><p>Investigation, as described above, works with the catalog: rules judge signals, and topology and time rank the results. That’s dependable, but it only explains failures someone wrote a rule for. If you wrote the catalog and the faults together, as we first did, rules alone look perfect. Real networks aren’t like that.</p><p>So NetCortex gives the LLM a job inside the collaboration rounds that already exist: read the evidence no rule judged, and propose a rule that would explain the incident. The agents then check that rule with code before it counts for anything. Nothing new is bolted on: a hypothesis travels as one more peer question.</p><p><strong>What the LLM sees</strong><br>Every agent already kept the signals its catalog doesn’t know as unclassified evidence. Two small changes make that evidence readable:</p><p>Each unclassified row now carries its text (the log line, the API request), and repeats collapse into one row with a count.<br>On quiet log groups (the router’s FRR and strongSwan logs, the AWS VPN BGP log, Network Manager events), lines that no parsing rule matches are passed through under a neutral name such as frr_unmatched, instead of being dropped at the source. Flow logs stay filtered; they’re too busy.<br>What the LLM proposes<br>In its collaboration round, an agent holding unclassified evidence asks the LLM for hypotheses. A hypothesis is small and structured: one raw signal on one entity, the evidence it cites, and a temporary rule drawn from the same closed set the catalog uses.</p><pre>{<br> &quot;signal&quot;: &quot;ModifySecurityGroupRules&quot;,<br> &quot;entity&quot;: {&quot;type&quot;: &quot;security_group&quot;, &quot;id&quot;: &quot;sg-0d47…&quot;},<br> &quot;evidence_refs&quot;: [&quot;cloudtrail:bb9d76e9-…&quot;],<br> &quot;rule&quot;: {&quot;type&quot;: &quot;event_presence&quot;, &quot;min_severity&quot;: &quot;info&quot;},<br> &quot;why&quot;: &quot;The web SG&#39;s on-prem rule was narrowed just before the flows failed.&quot;<br>}</pre><p>There is no free-form reasoning to trust and no new rule language. If the rule isn’t one of the existing types, the hypothesis is dropped.</p><p><strong>What the agents check:</strong><br>The hypothesis travels like any other peer question, as a validation request to the agent that owns the data. That agent answers it by running four checks in code, on fresh reads scoped to that entity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wRiMWQXuEb9bKdoHs5zy4w.png" /></figure><p>All four must pass. A hypothesis that passes becomes evidence like any other rule hit, marked as found by a verified hypothesis. It ranks below a catalog cause and above a symptom, so it can’t outrank something the rules already know. A hypothesis that fails is still listed, in a separate, labeled hypotheses section of the report, with the check it failed, and it never reaches the root cause.</p><p>Why the checks are code and not a second LLM call: each one is a question with a factual answer. Is this reference in the data? Does this rule fire? Did it fire yesterday too? Does the alarm depend on this entity? Code answers those the same way every time, and an engineer can read exactly why a hypothesis was accepted. The LLM is good at the step code can’t do: reading an unfamiliar line and guessing what it means. It is never the one deciding whether the guess was right.</p><p>The “new” check carries most of the weight against false blame. Routine noise, such as a BGP keepalive message or a periodic rekey, also fires in the earlier window, so a hypothesis built on it fails.</p><p><strong>Rules that grow the catalog:</strong></p><p>A verified hypothesis is also a draft catalog entry. NetCortex writes it to output/&lt;incident&gt;/proposed_signals.json, already valid against the catalog schema, for a human to review:</p><pre>&quot;security_group_rule_modified&quot;: {<br> &quot;signal_type&quot;: &quot;event&quot;, &quot;domain&quot;: &quot;config&quot;,<br> &quot;description&quot;: &quot;Security group rule modifications that can drop traffic&quot;,<br> &quot;match_names&quot;: [&quot;ModifySecurityGroupRules&quot;],<br> &quot;rule&quot;: {&quot;type&quot;: &quot;event_presence&quot;, &quot;min_severity&quot;: &quot;info&quot;}<br>}</pre><p><strong>Where the automation stops:</strong><br>This is the part to be precise about, because “the catalog grows itself” would overstate it. Here’s the whole path from an unknown failure to a rule, and who does each step:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwBcdxCOx_FEzghjOPDraw.png" /><figcaption>Steps for total Agentic RCA</figcaption></figure><p>Steps 1–4 run on every incident with no one involved. Steps 5 and 6 are deliberate human gates. Nothing the LLM proposes changes the catalog, or how telemetry is parsed, until someone approves it.</p><p>Step 6 is the one that’s easy to miss. An API call or a metric already arrives under its own name (AssociateRouteTable), so an approved draft works as is. A log line from the passthrough arrives under a neutral name shared by every unmatched line in that group. A draft that matches frr_unmatched would fire on any new FRR line, so it only becomes a real rule once the source gives that line a name of its own. Today that’s a manual edit. Automating it, still behind the same approval, is in Future Work.</p><p>Do that, and the LLM’s job shrinks one rule at a time.</p><h3><strong>The Lab:</strong></h3><p>Everything is Terraform, roughly 220 resources, brought up for the test and torn down after.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZeo0NbcSH85NjIulD_04w.png" /><figcaption>Lab Topology</figcaption></figure><p>Synthetic traffic runs continuously: HTTP through the NLB from on-prem, east-west DNS-dependent calls, UDP iperf bursts and a peering flow, each publishing success rate, latency and loss. Twenty-one CloudWatch alarms watch the healthy steady state. Access is SSM only, with no SSH, so every operator action leaves an audit trail.</p><p><strong>Fault injection with a sealed answer key: </strong><br>Each fault is an idempotent inject.sh / revert.sh pair:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-AxLS-KOD84sMF5PzKP1w.png" /><figcaption>Fault Library</figcaption></figure><p>Every inject and revert writes a JSON event to a dedicated CloudWatch log group. That log group is the answer key, and NetCortex is kept out of it three ways: its read-only IAM role has an explicit deny on it, the logs plugin refuses to start if any query names it, and the CloudTrail plugin keeps only an allow-list of event sources (SSM SendCommand events carry the fault script’s name, so without the allow-list NetCortex could have “solved” host faults by reading our tooling’s audit trail).</p><p><strong>Alarms to incidents:</strong><br>When an alarm fires, EventBridge sends it to an SQS queue. A small bridge groups each burst of alarms into one incident, maps each alarm’s dimensions to the entities it watches (flow:onprem-to-nlb, tunnel:3.226.61.62), and posts it to NetCortex, which needs no public endpoint. If a fault trips no alarm at all, the drill files a vague “users report problems, no alarm has fired” ticket instead, the way a real engineer would.</p><p><strong>Scoring and method:</strong><br>For each fault we wrote down in advance which evidence points at the cause (for a security group fault, the CloudTrail ModifySecurityGroupRules call) and which only shows symptoms (flow-log rejects, failing probes). A drill scores:</p><ol><li>Verdict: cause (the culprit’s evidence fired), symptom (only the impact), miss, or for the negative control clean / false positive.</li><li>Ranked first: is the top candidate the culprit’s entity?</li><li>Named: does the root-cause sentence itself name the culprit? That’s what an on-call engineer reads at 2am.</li></ol><p>We iterated on NetCortex during the campaign. So that every fault is judged by the same code, NetCortex recorded every telemetry response it received live, and the numbers in this article are the final code re-run on exactly those recordings, once with rules only and once with Gemini. Detection and RCA times come from the live drills. We used Gemini, but the model is a configuration setting: nothing in the checks depends on which model does the proposing.</p><p><strong>A second, faster campaign:</strong><br>For the live test on faults the catalog never knew, we ran the lab a second time, with the new faults added and a faster pace. Two things changed:</p><ol><li><strong>No VPC peering:</strong> The account’s VPC quota (five, one of them the default VPC) left no room for the partner VPC, so peering was switched off in Terraform. Its two faults (peering route deleted, and the flow that tests it) didn’t run, nor did the two optional firewall faults.</li><li><strong>Paced by recovery, not by the clock:</strong> Each drill reverts the moment NetCortex’s report is in, then waits until the lab is confirmed healthy: every alarm clear, and the flows, BGP sessions and tunnels clean in two fresh datapoints. The next fault starts a fixed gap after that.</li></ol><p>The gap comes from the query window. An RCA reads back 8 minutes from its alarm, and a peer question reaches 2 minutes further. The fastest alarm in the lab fires about [CHECK: 1.5 or 2] minutes after a fault. So the next fault starts 8 + 2 − [CHECK: same number] = [CHECK: result] minutes after recovery, and the previous fault’s revert can never fall inside the next report’s window. Eight minutes is also about as short as the window can go: the slowest alarm (NLB health, 6.8 minutes) still has to land inside it, along with the change that caused it. To check that the gap really is clean, we ran healthy checks at the same pace right after two faults, one of them reverted by a Terraform apply. Both came back “No anomaly detected.” A full drill cycle took about 18 minutes.</p><h3><strong>Results: Faults Nobody Wrote a Rule For</strong></h3><p>Here’s the main test: can NetCortex explain a failure its catalog doesn’t cover, without blaming anything it shouldn’t? We measured it two ways, offline on recorded lab incidents and live on new faults. The two are kept separate below.</p><p><strong>Offline: take the answer out of the catalog</strong><br>To measure this we took the lab’s ten replay cases and, for every case with a culprit, deleted the culprit’s cause signal from the catalog through the override directory. Where the source’s own name for a line gave the answer away (bgp_open_error), we renamed it to the neutral name the passthrough would use (frr_unmatched). CloudWatch metric names and CloudTrail API names stay as they are, since any source would show them. Each case ran three times rules-only and three times with Gemini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VOvGxMJBI5ZuTXr41uWclQ.png" /><figcaption>Offline and LLM with the Reason</figcaption></figure><p>Rules-only still ranked the right entity first in three of the eight cases, because other evidence happened to sit on the same entity. For example, BGP-down metrics sit on the neighbor whose ASN was wrong. But it couldn’t say why. With the LLM, the security group change, the deleted peering route, the disabled TGW propagation, the “Bad Peer AS” line and the zero-prefix advertisement all came back as verified hypotheses and ranked first.</p><p>The DNS case needed one more step. It’s a case we built from the lab’s recordings (see How much did the questions matter?): the record was deleted 19 minutes before the alarm, outside every agent’s window. Only the peer question with its longer lookback reaches it. So an agent also triages the unclassified evidence its answers to peers turned up, and the hypothesis window reaches back to the cited line.</p><p>The one miss, the route-map case’s second run, is the LLM correcting itself the wrong way. The hypothesis was verified, but the synthesizer’s near-tie rerank moved a TGW route table above it.</p><p><strong>Live: faults the catalog never knew:</strong></p><p>The offline test is controlled, but we deleted the rules ourselves. So we built the lab back up and added four faults the catalog has no rule for, then ran them live with the hypothesis step switched on:</p><p><strong>Subnet route table swapped:</strong> A private subnet is moved onto the VPC’s main route table, which has no route to on-prem. The CloudTrail calls are DisassociateRouteTable and AssociateRouteTable, and neither is on the watch list.<br><strong>NAT gateway deleted:</strong> The security VPC loses its NAT gateway. DeleteNatGateway isn’t on the watch list either.<br><strong>FRR max-prefix: </strong>The router’s BGP neighbor gets maximum-prefix 1, so FRR tears the session down with a log line no parsing rule matches. It reaches NetCortex only as frr_unmatched.<br><strong>MTU black hole:</strong> The router drops every packet over 1,200 bytes on the tunnels. Nothing logs it and no API call is made, so the correct answer is “no cause verified.”<br>As in the offline test, the rules-only answer is the same live telemetry replayed with the LLM switched off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ahYdWrgF0Z_qbAlvA5uZg.png" /><figcaption>Fault Catalog</figcaption></figure><p>On the subnet fault, the LLM proposed both calls. The code accepted AssociateRouteTable, on the route table the subnet’s traffic now uses, and refuted DisassociateRouteTable. That call’s request names only an association ID, so it resolves to no network entity, and code can’t place it upstream of anything. For the FRR fault it wrote a draft signal. The review notes carry the line it saw, %NOTIFICATION: sent to neighbor 169.254.100.5 6/1 (Cease/Maximum Number of Prefixes Reached), and a classify pattern the agent checked against that line:</p><blockquote><em>“bgp_max_prefix_exceeded”: {<br> “signal_type”: “event”, “domain”: “log”, “entity_types”: [“bgp_neighbor”],<br> “description”: “BGP neighbor exceeded maximum prefix limit resulting in session termination”,<br> “match_names”: [“frr_unmatched”],<br> “rule”: {“type”: “event_presence”, “min_severity”: “info”}<br>}</em></blockquote><p>The NAT gateway miss is the checks being cautious. The gateway is gone from the topology once it’s deleted, and the cut-off spokes can’t report, so no alarm fires and nothing names an entity the deleted gateway sits upstream of. The hypothesis was right, but the placed check had nothing to place it against, so it was refuted, as it should be when nothing ties a guess to the incident.</p><p>We also re-ran 14 catalog-covered faults with the hypothesis step on (peering was off; see A second, faster campaign under The Lab). The question was whether the step makes things worse where the rules already work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gqVnrTFhZ65qnjWiIEwa1w.png" /><figcaption>Live Campaign</figcaption></figure><p>Two of the four verified hypotheses were extra findings on covered faults: the AWS VPN BGP line for the route-map fault, and the FRR line for the prefix-limit fault. Both sat on that fault’s own tunnel or neighbor, and neither displaced the catalog cause. Of the six refuted, two failed new: the FRR keepalive chatter had fired in the earlier window too. Four failed placed: DisassociateRouteTable and DeleteNatGateway (both above), a strongSwan line during the NACL fault that resolved only to the router instance, and a Network Manager event during the IKE fault that came with an empty route table ID.</p><h3><strong>Results: When the Catalog Already Knows</strong></h3><p>The other half of the claim: where a rule does exist, NetCortex has to be as dependable as a rules engine, because those rules are what the drafts above turn into. This is the first campaign, 17 faults with every cause in the catalog:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4ayxotQlfGK_Ri-pJCayw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFcXLTkHkVlULJucSM9fsQ.png" /></figure><p><strong>Timing: </strong>The lab’s own alarms took a median of 2.5 minutes to fire (2-of-3 one-minute periods), and for the 13 faults that did fire an alarm, NetCortex finished its RCA a median of 4.7 minutes after the fault (3.4–8.4 min). Four faults fired no alarm, and their RCAs started from the vague ticket.</p><h3><strong>What It Shows</strong></h3><p><strong>Upstream causes, not loudest symptoms: </strong>When the route-map stops advertising, alarms fire on failing flows and the TGW drops packets. All of that is symptom. NetCortex ranked first the BGP neighbor whose PrefixesSent went to 0 while the session stayed up. That is the only signal that explains the rest, and it’s on a different device and in a different domain from every alarm.</p><p>When the IKE proposal is changed, the tunnel goes down, BGP drops and flows fail. NetCortex ranked the VPN connection’s ModifyVpnTunnelOptions call above the tunnel-down symptoms, because the tunnel depends on it and the call came first.</p><p><strong>The decisive line, even when it’s buried: </strong>For the wrong-ASN fault, the AWS side logs a generic “BGP session DOWN” line dozens of times. The router logs the diagnosis, Bad Peer AS, a handful of times. NetCortex collapses repeated lines into one piece of evidence with a count, puts cause signals first, and keeps every rule hit (not just the top few) for ranking. The root cause names the BGP neighbor and bgp_open_error.</p><p><strong>Causes that never touch an API:</strong>Six of the faults with a culprit happen entirely on a host (five on the on-prem router, one on an app server), so CloudTrail sees nothing. NetCortex found all six from host metrics, router logs, AWS VPN logs and Network Manager events. For the prefix-limit fault, AWS’s own log carries the smoking gun: “maximum prefix limit was exceeded — received 1001 prefixes from neighbor 169.254.100.2, limit is 1000.”</p><p><strong>Causes when monitoring goes blind:</strong>Deleting the NAT route cuts the spoke VPCs off from the internet, including from CloudWatch, so their metrics stop and no alarm fires. From the vague ticket alone, NetCortex went to the DeleteRoute on the security VPC’s route table.</p><p><strong>When nothing is wrong:</strong></p><ol><li>MSS clamp removed: a real config change on the router with no user impact. NetCortex reported no anomaly; it didn’t blame the change just because one happened.</li><li>150 ms + 5% loss: no change caused it, and NetCortex blamed none. It reported the latency and loss on the on-prem flows and pointed at the tunnel path, the right place.</li><li>Healthy network: with no fault injected and every alarm clear, “No anomaly detected across all monitored domains,” with every domain’s telemetry verified complete.</li></ol><p>With every cause in the catalog, the LLM had nothing to propose here. It wrote the root-cause sentences, and the confidence score is always computed, never generated.</p><p><strong>How much did the questions matter?</strong></p><p>Honestly: in this lab, every fault’s cause was already somewhere in a first-pass finding. Across the 17 incidents the agents asked about 350 targeted questions, and about 95% were answered no. That ruled suspects out, and the few yes answers corroborated evidence another agent already had. The live win came from collaboration’s other half: ranking causes by topology and time across all the agents’ evidence, which is what turned “the evidence is somewhere in the report” into “the headline names the culprit.”</p><p>Where questions do find what no agent saw is a cause older than the window. We built that case offline from the lab’s own recordings: a DNS record deleted 19 minutes before the alarm, still served from cache until its TTL ran out. In the first pass, the config agent saw no change in its 15-minute window. The log agent saw NXDOMAINs for app.lab.internal., walked the topology to the hosted zone, and asked the config agent about it with a longer lookback. The answer was the ChangeResourceRecordSets call, which then ranked first. The repository’s replay cases (eval — cases) include it.</p><h3><strong>Making It Yours:</strong></h3><p>Nothing above the plugins knows it’s talking to AWS. The repository has a one-page adoption guide. Each step works on its own and adds one capability:</p><ol><li>Try it offline: <em>python app/main.py eval — cases evals/cases replays </em>the lab’s faults through the full pipeline, with no cloud account.</li><li>Connect telemetry: Enable the plugins you have (AWS, Prometheus/Mimir), or write one: a plugin is one class that returns signals plus honest coverage. The most useful minimum is metrics plus change records, because most outages are a change.</li><li>Send alerts with the alarm time and the entities they fired on. One adapter per alerting system: CloudWatch is done; Alertmanager or Azure Monitor is the same shape.</li><li>Add topology: On AWS, enable aws_topology. Elsewhere, an inventory export (NetBox, a CMDB, even a YAML file) is enough. The one rule: use the same IDs your metrics and logs use, and put other names in labels.</li><li>Start small and let the catalog grow: You don’t need a full catalog on day one. Begin with the defaults, turn on hypotheses, and review the proposed_signals.json drafts each incident writes. Approve one, and that failure is caught by rules from then on. Your own error classes and metrics are JSON entries too, validated at startup.</li><li>Record and replay. Turn on recording, and every live incident becomes an offline regression test.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8O8wB-igUtOMFFFt3xyP5g.png" /></figure><h3>Future Work:</h3><p>What these campaigns didn’t cover, or covered only partly:</p><ol><li>Several faults at once, at fleet scale. Today alarms are grouped into incidents by time, and each incident gets one headline. With thousands of devices, unrelated faults will overlap. <br>The plan: <br><strong>Group by topology:</strong> Group alarms by whether their entities are connected in the topology, not by when they fired.<br><strong>Scope the first pass:</strong> Query only each incident’s topology neighborhood, as the follow-up questions already do.<br><strong>Report several causes:</strong> When causes explain different alarms, report each with its own chain.<br><strong>Fold in downstream alarms:</strong> A new alarm downstream of an open incident joins it instead of starting another RCA.<br>Two recorded faults replayed together make a cheap first test.</li><li>Use the “no” answers: About 95% of the agents’ questions came back refuted. Today that only avoids asking again; it should also lower a candidate’s rank.</li><li>Mechanism, not just location, for degradations: For the latency + loss fault NetCortex found the right path (the VPN tunnels) but can’t name the mechanism, because nothing in the lab sees the router’s queueing. Interface queue and drop counters (SNMP, gNMI) would.</li><li>Live proof of the cause-before-the-window case: It’s shown on replayed lab data; a live drill with a long DNS TTL would close the loop.</li><li>Alerting hygiene: One very slow request can push an average-latency alarm over threshold; percentile alarms are better. That’s alerting configuration, not NetCortex, but NetCortex inherits the noise.</li><li>Several runs per fault, to put variance bars on these numbers, and Containerlab and EKS stages for multi-vendor routers and Kubernetes networking.</li><li>Hypotheses about things that disappeared. A deleted NAT gateway leaves the topology, so the placed check can’t tie it to anything, and the live NAT fault was a miss. A topology snapshot from before the window, or placing a deletion by the subnets that used to route through it, would fix that. The same goes for calls like DisassociateRouteTable that name only an association ID.</li><li>Don’t let the rerank undo a verified hypothesis. In one offline run, the synthesizer’s near-tie rerank moved a TGW route table above a verified cause. A verified hypothesis should be exempt from the LLM’s own rerank.</li><li>Close the loop on draft rules. A draft for a log line still matches the neutral frr_unmatched name. It needs its classify pattern applied at the telemetry source, under a real name, before approving it actually teaches the catalog. Today that step is manual.</li></ol><h3><strong>Run It Yourself</strong></h3><p>The offline path needs no cloud account:</p><pre>python app/main.py eval --cases evals/cases           # the lab&#39;s faults, replayed<br>python app/main.py run --scenario 1 --no-require-llm  # a simulated incident<br>python -m evals.ablation --runs 3                     # delete each culprit&#39;s rule; rules-only vs rules + LLM (needs a Gemini key)</pre><h4><strong><em>Against the AWS lab (Terraform in infra/, roughly 220 resources, about 15 minutes to build):</em></strong></h4><pre>cd infra &amp;&amp; make plan &amp;&amp; make up # review the plan, then apply<br>python -m mcp_telemetry_server - config config/telemetry.aws-lab.yaml - port 9001<br>python app/main.py serve - config config/config.aws-lab.yaml<br>python app/main.py alarm-bridge - profile netcortex-lab \<br> - queue-url &quot;$(terraform -chdir=infra/live/lab output -raw alarm_queue_url)&quot;<br>infra/faults/drill.sh tgw-blackhole # inject, wait for the RCA, revert, score<br>make down</pre><p>A drill prints one JSON line: alarm detection time, recovery time, and NetCortex’s verdict and root cause against the answer key. Every incident’s telemetry is saved under output/recordings, so you can re-run it offline with python -m evals.replay_recordings.</p><h3><strong>Closing Thought:</strong></h3><p><a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf"><em>Part 1</em></a> made a bet: structured multi-agent reasoning with deterministic confidence, and an LLM kept on a short leash.</p><p>Part 2 shows where the leash goes. The LLM reads what no rule understood and proposes a rule, and code decides whether the rule holds: the evidence exists, the rule fires now and not before, and the entity sits upstream of the alarm. With that, NetCortex found causes its catalog had never seen, offline and on a live network, without falsely blaming anything. Where a rule already existed, it found, ranked first and named every culprit.</p><p>That’s the shift we think matters. The catalog isn’t something you have to write before the tool is useful. It’s something the tool helps you write: every verified hypothesis is a draft rule, and every approved rule means one less question for the LLM.</p><p>The lesson we’d pass on: let the model propose, never let it decide. What the model is shown, and the checks its guesses have to pass, matter more than the model.</p><p>The code, the lab and the fault library are open. Break your own network with it, and tell us what NetCortex misses.</p><p>GitHub: <a href="https://github.com/veldanda3415/net_cortex">https://github.com/veldanda3415/net_cortex</a></p><p><a href="https://medium.com/@ravikiran.veldanda/netcortex-autonomous-network-ops-intelligence-platform-b8570d75e9cf?sharedUserId=ravikiran.veldanda"><em>Part 1</em></a>: NetCortex: Autonomous Network Ops Intelligence Platform</p><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b9dab31f739" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BGP Converged. The GPUs Didn’t.]]></title>
            <link>https://medium.com/@ravikiran.veldanda/bgp-converged-the-gpus-didnt-823f387ad66b?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/823f387ad66b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Wed, 28 Oct 2026 02:37:14 GMT</pubDate>
            <atom:updated>2026-10-28T02:37:14.618Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What a fabric fault really costs an AI job</em></p><p>Oct 27, 2026 · @Ravi Kiran Veldanda</p><p><em>Lab note: every number here comes from an emulated fabric carrying synthetic, all-reduce-shaped TCP traffic. No real GPUs or switches were involved. Section 2 explains what transfers and what doesn’t.</em></p><h3>1. Two clocks</h3><p>A network engineer and a training job measure the same fault on two different clocks. In my lab, a link flapped five times in 20 seconds. On the network’s clock, routing reconverged in about 0.28 seconds after each flap, about 1.4 seconds in all. On the job’s clock, the step took 11.5 seconds longer, and 17.7 in a run where a BGP session also got stuck. (Here “the job” is synthetic traffic shaped like a training step; section 2 defines it.)</p><p>The network’s clock stops when routing reconverges. BFD notices a dead path in well under a second, BGP withdraws it, and ECMP spreads traffic over the paths that are left. For web traffic, that is the end of the story. Thousands of short, independent flows retry, and users never notice. Most of us learned to run data centres on this model, and it is a good one.</p><p>A GPU job runs on a different clock. Each training step ends in a collective, such as an all-reduce, where every GPU sends its share and waits for everyone else’s. The step ends when the slowest exchange ends. My previous article, <a href="https://medium.com/@ravikiran.veldanda/your-gpus-are-waiting-on-one-cable-79f12fd02741?sharedUserId=ravikiran.veldanda"><em>Your GPUs Are Waiting on One Cable</em></a>, showed this in steady state: job time tracks the busiest link. This one asks what happens when that link fails, flaps, or comes back.</p><p>The short answer is that the two clocks disagree, by a factor of eight or more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iVldL9oVwwUXi54JICl19w.png" /><figcaption>Two clocks for same fault</figcaption></figure><p>The fabric had redundancy everywhere: two spines, ECMP on every leaf, two NICs per host. It still didn’t protect the job. <strong>Redundancy keeps the network’s paths alive. It doesn’t keep the job’s timing, and some redundancy the job can’t use at all.</strong></p><p>Every second on the job’s clock is a second of GPUs you paid for, sitting idle. That is why the network’s view of “recovered” isn’t good enough for an AI cluster.</p><p>One honest caveat before the details: none of these numbers come from real GPUs or real switches. The fabric is emulated and the “job” is synthetic traffic shaped like an all-reduce. Section 2 says exactly what is real, what is emulated, and why the pattern still holds.</p><p>The rest of the article covers what I broke, what the job felt, why the repair was the outage, the faults I couldn’t see, and what to change so the GPUs stay busy.</p><h3>2. Faults on demand</h3><p>I broke a small emulated AI fabric in six common ways, three times each, and timed both clocks. These six aren’t every way a fabric can fail. They are the faults an operator meets first.</p><p><strong>The fabric.</strong> Two spines and four leaves, built with containerlab and FRR on one machine. The design is rail-optimized: each host’s NICs land on separate leaves, one per rail. Every leaf–spine link runs eBGP unnumbered, with BFD at 100 ms × 3. Spines share one AS and each leaf has its own, as in RFC 7938.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*PE-Ps9BCMnwE-3wFKWZIpQ.png" /><figcaption>Leaf and Spine connectivity</figcaption></figure><p>Each host has one NIC on rail A (leaves 1 and 2) and one on rail B (leaves 3 and 4). Traffic between hosts on different leaves crosses a spine, and ECMP picks which one. Two RoCE test VMs and two tenant endpoints also hang off the leaves; they’re left out of the picture because this article doesn’t need them.</p><p><strong>The links.</strong> I shaped each leaf–spine link to 500 Mbit/s. Unshaped, the bottleneck was the laptop’s CPU, not the network: one flow topped out at 8.2 Gbit/s with its sender at 99 % of a core. Shaping makes the network the slowest part again, as it is in a real cluster during a collective.</p><p><strong>The job.</strong> Synthetic traffic shaped like a ring all-reduce, on rail A. Four hosts send in a ring (host 1 → 3 → 2 → 4 → 1), each pair over 16 parallel TCP flows (iperf3), with ECMP hashing on L4 ports, which gave the most even spread in the previous article. Every pair crosses a spine, and all four start within 4 ms of each other. A step ends when the slowest pair has received 1.204 GB, interpolated from the receivers’ 0.5 s throughput reports; with no fault, that takes 20.0 s. The pairs don’t wait on each other the way GPUs in a real collective do. The step rule is what models that: the slowest pair sets the step time.</p><p><strong>The faults.</strong> I wrote down a prediction for each fault before running it. Link down, silent loss, spine loss and leaf loss each started 10 s into a step and lasted 10 s. The flap ran from 5 s to 25 s as five 2-second outages. Partial loss stayed on for 80 s of a longer run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q7GBbR8nNSfMS_ldrXvvLg.png" /><figcaption>Injection methods of Faults</figcaption></figure><p>For each run I recorded four things. The <strong>loss window</strong> came from six ping probes, one packet every 0.1 s, running alongside the job. <strong>Reconvergence</strong> came from FRR’s BGP and BFD logs. <strong>Step time</strong> came from the job itself. <strong>Blast radius</strong> is which hosts, rails and tenants were hit, and which weren’t.</p><p><strong>What is real here, and what isn’t.</strong> The routing is real software: FRR’s BGP, BFD and ECMP, and the Linux kernel’s forwarding table. Everything below that is emulated: no switch ASICs, no line rate, no switch buffers, no PFC, no RoCE NICs, no GPUs. The traffic is iperf3 TCP streams, not NCCL over RDMA. RDMA reacts to loss differently from TCP, so the exact seconds won’t transfer to a real cluster.</p><p>What should transfer is the mechanism, with care. A synchronous collective waits for its slowest member on any hardware. The order in which routing, the kernel and the neighbour table came back after a repair comes from standard components: FRR, the Linux kernel, IPv6 neighbour discovery. Exact timing and ordering still depend on implementation and configuration, so verify them on your own platform. Those two ideas are what this article is about.</p><p><strong>How it was measured.</strong> containerlab 0.78.2 on rootful Podman 5.7.0, FRR 10.2.1, iperf 3.18, one WSL2 VM (kernel 6.18, 16 CPUs) with the host kept quiet during runs. Each drill runs the job for 30 s; the flap reruns ran 60 s so every step could finish. Loss windows are gaps in 0.1 s ping replies; route and neighbour changes come from ip monitor and a 10 Hz poller on one host clock; BGP and BFD state from FRR&#39;s logs. Three runs per condition. Some faults were rerun in a second round, also three runs each, and the text says which round a number comes from. The article shows ranges; per-run values are in the repo. Loss-window timing is only as precise as the 0.1 s probe interval. Per-run data, scripts and raw output are in the repo under fabric/experiments/ (E6 failure drills, E8 restore and flap fixes).</p><h3>3. Small fault, whole job</h3><p>After link, silent-loss, spine and leaf faults, routes reconverged within about a second. Getting traffic flowing again took longer: a returning link needs about 3 s before it carries traffic, and in some runs one BGP session stalled for about 100 s. The job took longer still. Most faults cost more than I predicted. Partial loss was the exception, and the flap landed close to my estimate once I measured it properly. One lost leaf left the job far from done when the run ended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*itHkIgN6BGgt3h5GED1RJQ.png" /><figcaption>Predicted Vs Measured</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YiqxzQnoq40Xczqu4BVDFg.png" /><figcaption>BGP Converges but GPUs Didn’t</figcaption></figure><p><strong>Rerouting was fast; the job still paid.</strong> BGP moved traffic off a dead link in 0.25 s. The step was still 7–9 s longer, because four ring pairs then shared half the uplink capacity for the 10 s the link was down, and for about 3 s after it came back. That is how long a returning link takes to carry traffic again; section 4 shows why. That cost depends on how long the fault lasts, not on how fast routing reacts. So the honest fabric metric is loss window plus reconvergence time. A step-time cost means something only when it’s quoted with the fault’s duration.</p><p><strong>BFD turned a silent failure into a clean one.</strong> With carrier up and every packet dropped, BFD (single-hop, active, 100 ms × 3, echo off) detected the fault in 0.54–0.57 s. After that, the job saw the same cost as an ordinary link-down. In an earlier run without BFD, the same silent fault lost traffic for 7–9 s, until BGP’s 9 s hold timer expired. That was the clearest win in this lab. It isn’t free: aggressive BFD timers can raise false alarms and load the control plane, so real fabrics tune them per platform.</p><p><strong>A flapping link was a dead link for the whole storm.</strong> The link went down and up every 2 s for 20 s. On the network’s clock, each flap cost up to 0.1 s of loss and 0.28 s of reconvergence. But a returning link needs about 3 s before it carries traffic, and each up phase lasted only 2 s. In those up phases the link carried 0–4 Mbit/s, against 500 Mbit/s before the fault. So for the job the link was gone for the whole 20 s, even though it reported up half the time. Half capacity for about 22 s predicts about +11 s; two runs measured +11.5 and +11.9 s. The third took +17.7 s, because a BGP session got stuck after the last flap (section 4 explains why).</p><p>I got this one wrong twice. My first measurement said “more than +30 s”, but I had misread an unfinished 30 s window as 30 s of extra time. Rerun with a longer window, every step finished. I had also guessed that TCP backing off after each flap explained the cost. Retransmission timeouts did rise on every flap, but they didn’t grow from flap to flap. The cost was lost capacity, not TCP.</p><p><strong>One leaf took the whole job down.</strong> Taking leaf 1’s links down cut off only a quarter of the NICs: the rail-A NICs of hosts 1 and 2. In this ring every pair has one end on host 1 or host 2, so every pair stopped. That’s partly our ring order: a different order would cut fewer pairs, but the step would still stall on the slowest one. Their rail-B NICs stayed up, but the traffic was pinned to rail A. That matches a standard rail-optimized cluster, where each GPU’s NIC connects to one leaf and the collective library doesn’t move a live connection to another rail. When the run ended, 10 s after the repair, the step was only 66–71 % done. A real collective adds one more layer: each GPU waits on data from its neighbour, so even a ring with a single pair cut would stop.</p><p>The physical damage grows with the number of GPUs behind the leaf. The damage to a job doesn’t, and the lab backs that up. I ran a second job on rail B, sharing no link with leaf 1, alongside the first. While leaf 1 was down, it finished in 19.6–20.0 s, against 19.9–20.3 s on its own. So a leaf’s blast radius is every job that touches it, and only those jobs. That makes job placement a network decision too.</p><p><strong>Partial loss was the hardest to read.</strong> 1 % loss on one uplink set off no BGP or BFD event at all. In the first round it cost +85 % in one run and almost nothing in the other two. A rerun showed the difference came from which uplink was lossy, not from chance. A fault that routing can’t see, and that hurts on one link but not another, is the worst kind to operate. Section 5 covers how hard it was to find.</p><p>The spine-loss row hides the twist that gives this article its title. Some of its loss came <em>after</em> the spine was restored, and none at the moment it failed. That’s the next section.</p><h3>4. Reachable but empty</h3><p>In all three runs, the repair was the outage. When I took a spine out, the probes saw no loss at all. When I put it back, rail B lost 1.3–1.6 s of traffic in every run (1.3–2.3 s in a second round of three), and tenant traffic took hits too.</p><p><strong>What I expected.</strong> My first theory was a classic one. The restored spine advertises routes before it can forward, so the leaves send it traffic too early. The textbook fix is FRR’s bgp update-delay, which holds a router&#39;s advertisements back after startup. I nearly added it. Instead, I timed every step of the restore first.</p><p><strong>What the timeline showed.</strong> I timestamped each step on one host clock. Link and kernel route changes came from ip monitor on the leaves, BGP state and route installs from FRR’s logs and the spine’s kernel table, and loss from a probe stream across rail B. Across three runs, the restore always went in this order:</p><ol><li><strong>+0.2 s:</strong> spine 1’s links come up. At the same moment, the leaves’ kernels put spine 1 back into their ECMP group. BGP to spine 1 is still Idle.</li><li><strong>+1.4 to 2.0 s:</strong> spine 1’s IPv6 link-local addresses finish duplicate-address detection and become usable. With this lab’s Linux settings, that’s one probe and a 1 s timer, after a random delay of up to 1 s.</li><li><strong>+1.6 to 2.9 s:</strong> the leaves resolve spine 1 with neighbour discovery. Packets hashed to spine 1 can now actually leave the leaf. <strong>Loss starts at the same moment, to the 0.1 s resolution of the probes.</strong></li><li><strong>About the same time:</strong> BGP sessions to spine 1 reach Established. Unnumbered BGP needs the same neighbour entry, so it can’t come up sooner.</li><li><strong>+2.8 to 4.1 s:</strong> spine 1 receives the fabric’s routes and installs them. <strong>Loss ends when spine 1 installs the routes the traffic needed, again to the probes’ 0.1 s resolution.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*8dp-1-NWcwXSvJnK4CF4ag.png" /><figcaption>spine restore timeline</figcaption></figure><p>So my theory was wrong. The leaves didn’t wait for spine 1 to advertise anything. They put it back into ECMP from link state alone, 2–3 s before spine 1 knew where to send the traffic. Spine 1 was reachable but empty, and traffic hashed to it was most likely dropped there until its forwarding table filled. Where the packets died is inferred from the timing; I had no capture on the spine to prove it.</p><p><strong>Why I didn’t ship the knob.</strong> bgp update-delay only applies when bgpd starts or all its sessions are cleared (FRR 10.2 documentation), and in this drill bgpd kept running. Even if it had applied, it delays the spine&#39;s advertisements, and the leaves weren&#39;t waiting for those. It would have been a fix at the wrong layer, with no effect, sitting in the config and looking like a solution. Measuring the timeline before touching the config is what kept it out.</p><p><strong>What a second round showed.</strong> The timeline pointed to a sharper hypothesis: FRR’s zebra keeps the leaves’ ECMP next-hop group when a link fails, and reinstalls it the moment the link comes back, whatever BGP is doing. A follow-up run confirmed it from zebra’s debug log. At link-down, zebra reuses the old group with spine 1 marked inactive. At link-up (+0.19 s), it marks spine 1 valid again and reinstalls the group, and bgpd sends nothing. In FRR 10.2, that reinstall runs unconditionally when an interface comes up. Section 6 shows the fix.</p><p>Two other loose ends closed too. The roughly 100 s stall fits BGP’s connect-retry timer (120 s), and it hit 4 of 15 spine restores across both rounds. And turning off the spine’s duplicate-address detection, which makes the link usable sooner, made things worse: loss started about 1.2 s earlier and lasted about 0.6 s longer. A faster link gave the leaves more time to send traffic to an empty spine. Lowering the spine’s BGP update timer didn’t move the end of the loss at all.</p><p>One question is still open. Packets hashed to spine 1 before the leaves resolved its address weren’t lost, and I had no capture to show where they waited.</p><h3>5. Catch it before the job does</h3><p>Routing never noticed two faults in this lab. One was 1 % packet loss, and I could only half find it after the fact. The other was a config mistake, which I could catch in seconds before deploy. The third fault was in my own test suite.</p><p><strong>Partial loss: easy to inject, hard to find.</strong> I dropped 1 % of packets on one uplink with no carrier change. BGP and BFD saw nothing, because the link was up and keepalives mostly got through. At first the job saw it inconsistently: +85 % in one run, about +4 % or too small to measure in the other two. Each run had put the loss on a randomly chosen uplink. My guess was that the cost depended on how many flows ECMP hashed onto the lossy uplink. A rerun disproved it. With the loss on one uplink, the step cost +41–46 % in three of three runs; on another, almost nothing in three of three. The same 14 flows produced both results. The cost follows the uplink, and I don’t yet know why.</p><p>Then I tried to find the bad link from telemetry alone, without being told which one it was:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ptzp9JLIaagpbK0wqhW7qQ.png" /><figcaption>Fabric Results</figcaption></figure><p>SignalPicked the right uplinkDrops per MB, per uplink2 of 3 runs (run 2 by only 1.8×)Share of traffic per uplink1 of 3 runs</p><p>That isn’t detection. The reason is the lab itself. Shaping the links to 500 Mbit/s means they drop packets under normal congestion, at about the same rate as the 1 % I injected, so the fault blended into the noise. A real AI fabric is configured differently. In the design this lab targets, RoCE runs in a lossless class (PFC, with ECN acting first); some fabrics instead run it lossy, with ECN only. In a lossless class, drops should be rare and are worth an alarm, although lossless is a design goal, not a guarantee. Real ports also expose PFC pause, ECN/CNP, CRC and FEC counters, which my virtual links don’t have. On real hardware, I’d watch those counters per link and compare each link with its siblings, not with the fabric average. This result shows my lab’s detection limits, not how detectable the fault is on a real fabric. I can’t claim I found this fault from telemetry, and the article doesn’t.</p><p><strong>Config drift: caught in 9 s instead of 120 s.</strong> In an earlier drill, I changed one leaf’s BGP AS number in that leaf’s config only, the way a hand edit drifts from the source of truth. Deployed, the sessions went down, and recovery waited on FRR’s 120 s connect-retry timer. By section 3’s logic, that is up to two minutes of a stalled job. The same broken configs, checked offline with Batfish, showed four half-open BGP sessions in 9 s, before any switch was touched.</p><p>That check catches drift, not bad design. If the wrong AS number goes into the intent file instead, the renderer applies it consistently on both ends, and my intent validator rejects it. So the two checks catch different failure classes, and a fabric pipeline needs both. One honesty note: the Batfish release I pinned (2026.08.27) doesn’t model BGP unnumbered on NX-OS. For that vendor, I validated a numbered variant rendered from the same intent. Separately, Batfish parsed the lab’s own unnumbered FRR configs and reported all 16 sessions as established. That shows Batfish accepts those configs, not that it models every unnumbered behaviour.</p><p><strong>The test that lied.</strong> My tenant-isolation tests check that tenant A can’t reach tenant B. They passed with the lab switched off. The helper turned “command failed” into “unreachable”, which is exactly the answer an isolation test is looking for. I fixed it to fail loudly when it can’t run, and split the suite: 54 tests run without the lab, 11 need it. The lesson carries straight to operations. A check that something is blocked must first prove the thing exists, the same way a dashboard with no alerts looks identical when its collector is dead.</p><p>All three point the same way. The cheapest second of GPU time to save is the one you save before the fault reaches the job: catch drift before deploy, and test your tests and monitors. Section 6 turns to faults you can’t prevent, and what to change so the GPUs keep working through them.</p><h3>6. What kept the job running</h3><p>Four changes held up under measurement in this lab, and two plausible ones didn’t. The biggest win was one line of config that made the leaves follow BGP instead of link state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5l912Whu5SVvG9O49FiibQ.png" /><figcaption>Test Results</figcaption></figure><p>ChangeFault it targetsResult in this labLabelLeaves follow BGP, not link state (no zebra nexthop kernel enable)Spine restoreRestore loss 1.3–2.3 s (same-day baseline) → <strong>0 in 3 of 3 runs</strong>; no loss at failureEMULATEDBFD on every fabric link (100 ms × 3)Silent link failureDetected in 0.54–0.57 s, against 7–9 s without itEMULATEDConfig validation before deployConfig driftCaught in 9 s offline, against a 120 s stall after deployOFFLINE-VALIDATEDKeep a job off failure domains it doesn&#39;t needLeaf lossA job on rail B finished on time while leaf 1 was downEMULATEDFlap hold-down (2nd flap in 10 s → hold until 5 s quiet)Link flap<strong>No gain</strong>: +1.1 sEMULATED-POLICYDuplicate-address detection off on the spineSlow restore<strong>Worse</strong>: loss started earlier and lasted 0.6 s longerEMULATED</p><p><strong>The fix for the repair.</strong> By default, FRR’s zebra installs ECMP routes as shared kernel next-hop groups, and those groups come back at link-up on their own. With no zebra nexthop kernel enable on the leaves, zebra installs each route with its next hops inline instead. Nothing changes at link-up, and spine 1 rejoins only when BGP adds it, at +2.9 to 3.8 s, once it has routes. No restore loss was observed in 3 of 3 runs, with no loss at the failure and no slower bring-up. In one of those runs, a BGP session hung for 105 s on connect-retry, and still no traffic was lost: that leaf simply didn&#39;t use spine 1 until BGP did. That&#39;s the property you want. Forwarding should follow the control plane, not run ahead of it.</p><p>The caveats are real. The knob isn’t in the FRR 10.2 user guide, I tested it only on 10.2.1 with 11 routes, and inline routes cost zebra more kernel work per change, which I didn’t measure at scale. The repo renders it from intent behind a flag (zebra.leaf_kernel_nexthop_groups: false in the fabric intent), the default is unchanged, and the E8 experiment doc has the tested behaviour and zebra’s debug logs. On real switches, the question to put to your vendor, or your own lab, is the same: does the NOS put a returning link back into ECMP before routing says it’s ready?</p><p><strong>For flapping: take the link out, and keep it out.</strong> A returning link needs about 3 s to carry traffic, so a link that flaps faster than that is a dead link to the job, while it moves 15–19 flows between spines on every flap. I tested an emulated hold-down. It didn’t help (+1.1 s), because this flap stopped on its own before the hold mattered. A hold-down pays off only when the fault outlasts it, and I didn’t test that. The practical rule: shut a flapping link and keep it down until someone repairs it. Many NOSes can do this with a link-flap error-disable. For the job, that costs the same as a dead link, and it stops the churn.</p><p><strong>Watch the timers you don’t think about.</strong> BGP’s 120 s connect-retry timer stalled 4 of 15 spine restores. With the zebra fix that stall was harmless to traffic, but the fabric still ran on one spine for two minutes. A shorter connect timer is the obvious next test; I haven’t run it.</p><p><strong>On the job’s side</strong> (standard practice, not tested here). Checkpoint often enough that restarting beats waiting. Set collective timeouts, so a job stuck on a dead path fails fast and restarts instead of hanging. Fence failing nodes and links before the scheduler places work on them, and use topology-aware placement, so a job spans as few leaves as it needs. Article 3 covers both on the scheduling side.</p><p><strong>Would RoCE have helped?</strong> No. RoCE is a transport, not a source of redundancy, and every fault here lives in routing and forwarding underneath it. Several would get worse. RoCE resends everything after a lost packet, so partial loss and flapping hurt more. A long enough outage errors out the connection instead of slowing it, so the job restarts from its checkpoint. Lossless PFC prevents congestion drops, not failure drops.</p><p><strong>What would help on a RoCE fabric</strong> (not tested here):</p><ul><li><strong>Restore black hole:</strong> the same fix as in this lab. Forwarding should follow the control plane, so a returning switch takes traffic only once it has routes.</li><li><strong>Leaf loss:</strong> dual-home each NIC to two leaves, or place jobs so they span as few leaves as possible. On the job side, use short collective timeouts and frequent checkpoints, so a dead path fails fast and restarts instead of hanging.</li><li><strong>Flaps and partial loss:</strong> take the bad link out fast, with flap error-disable and per-link error-counter alarms. Then spread each connection over many paths: adaptive routing or packet spraying with a transport that tolerates reordering, as newer AI Ethernet fabrics such as Spectrum-X and Ultra Ethernet do. One bad link then costs a share of bandwidth, not a whole flow.</li><li><strong>Congestion around a failure:</strong> let ECN-based congestion control (DCQCN) act before PFC, and run a PFC watchdog so a stuck queue can’t spread pauses across the fabric.</li></ul><p>Testing these on real RDMA is the next step.</p><p><strong>What this doesn’t show.</strong> Everything ran on one machine: emulated switches, software forwarding, four hosts, TCP rather than NCCL over RDMA, no PFC or ECN, three runs per condition. Three results are still unexplained: why the first BGP connect fails in the connect-retry stalls, why 15 streams sent nothing for 32 s in one flap run, and why 1 % loss hurt one uplink and not another.</p><p><strong>What changes at thousands of GPUs.</strong> Faults stop being events and become background: with enough links, something is always flapping, restoring or degrading. The two habits that matter most scale directly. Judge every fault by job time, not reconvergence time. Treat every repair as a change, with a timeline you can check, rather than as good news.</p><h3>Run It Yourself</h3><p>Everything above lives in one public repository: <a href="https://github.com/veldanda3415/goodput-stack">github.com/veldanda3415/goodput-stack</a>. Each result traces back to a script, its raw output and a write-up with the prediction written before the run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rV2yObiGKBbqcGmikbSzZg.png" /><figcaption>Details of Repo</figcaption></figure><p><strong>To run the lab</strong> you need a Linux machine (WSL2 works) with containerlab and Podman. Exact versions are pinned in the repo, and fabric/README.md covers setup.</p><pre>git clone https://github.com/veldanda3415/goodput-stack &amp;&amp; cd goodput-stack<br>make fabric-up &amp;&amp; make fabric-shape-on &amp;&amp; make fabric-test   # leaf-spine, shaped links, checks<br>make fabric-e6                                               # the six failure drills under load<br>python -m fabric.experiments.e8 restore --label baseline     # spine restore timeline<br>python -m fabric.experiments.e8 restore --label fix --knob no-kernel-nhg   # leaves follow BGP<br>python -m fabric.experiments.e8 flap --label baseline-flap   # flap, measured to completion<br>python -m fabric.experiments.e8 jobs                         # a second job during leaf loss<br>python -m fabric.experiments.e8 degrade --where leaf1:eth1   # 1 % loss on one uplink<br>make fabric-batfish                                          # config drift caught before deploy<br>make fabric-down</pre><p><strong>If you have real hardware, this is where you can help.</strong> Every gap here is hardware I don’t have. Results from any of these would be welcome as an issue or pull request:</p><ol><li><strong>A spine restore on real switches under RoCE traffic.</strong> Does the NOS put a returning link back into ECMP before routing is ready, and does the job see loss after the repair?</li><li><strong>A leaf or link failure under NCCL over RDMA.</strong> How long until the collective errors out, and with which NCCL timeout and retry settings?</li><li><strong>Link-flap error-disable on a real NOS</strong>, against the same 2-second flap.</li><li><strong>The leaf zebra setting at real route scale</strong>, with its control-plane cost.</li></ol><p>Please include the hardware, software versions, exact commands and raw logs, and label each result the way this article does: real, emulated or design only.</p><h3>Sources</h3><ul><li><a href="https://docs.nvidia.com/networking/display/onyxv3104302/roce+commands">NVIDIA Onyx: RoCE Commands</a> — lossless (PFC) vs ECN-only RoCE modes and RoCE interface counters</li><li><a href="https://docs.frrouting.org/en/latest/bgp.html">FRR 10.2 documentation</a>: BGP (bgp update-delay) and zebra (zebra nexthop kernel enable)</li><li>Linux kernel ip-sysctl documentation — dad_transmits, accept_dad</li></ul><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=823f387ad66b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Metrics Can’t Keep a GPU Busy]]></title>
            <link>https://medium.com/@ravikiran.veldanda/web-metrics-cant-keep-a-gpu-busy-4fd2cb3083bc?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fd2cb3083bc</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 14:36:11 GMT</pubDate>
            <atom:updated>2026-10-24T14:36:11.398Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Request counts and queue depth were built for web servers. LLM routing needs to understand the work ahead.</em></p><p>Oct 24, 2026 · @Ravi Kiran Veldanda</p><h3>The Two-Second Pause</h3><p>Ask a chatbot a one-line question and the first word usually appears almost immediately. Sometimes it doesn’t: you wait a second or two, then the answer streams in at normal speed. Often nothing is wrong with the model. Your request was simply sent to the wrong copy of it.</p><p>Any LLM service with real traffic runs several copies of the model, called replicas, behind one API. A router in front decides which replica gets each request. Web load balancers decide by counting: round robin, fewest connections, shortest queue. Counting works when requests cost about the same. LLM requests don’t. A one-line question and a 3,000-token document are each one request, but they cost the GPU very different amounts of work.</p><p>I measured what that costs on real GPUs. On a free Kaggle machine with two NVIDIA T4s, I ran two identical replicas of one model (Qwen2.5–3B on vLLM), one per GPU. I kept replica L busy with two long prompts and replica S busy with three short ones. By request count, L looks less busy. Then I sent the same short question to each replica, 12 times apiece.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*ge5m-Y_zTg4hkoZV1ZUP-w.png" /><figcaption>Replicas details</figcaption></figure><p>Landing on L cost about 2.2 seconds before the first word: an observed 16× in this setup, not a general multiplier. Twelve probes per replica is a small sample, so read the gap, not the decimals: the 95 % confidence interval runs from 0.4 to 4.1 s. That is a bootstrap interval for the difference in medians. The probes went out in random order into a continuously loaded system, and nine of twelve L probes landed mid-prefill, about the share of time L spent prefilling. So they sample the load cycle fairly, but they are not fully independent. On L the probe either slipped in between long prefills (0.2 s) or waited behind one (3–5 s), which is why the range is wide. For a 128-token answer, the whole response finished 9.5 s later on L.</p><p>Would a modern, LLM-aware router have avoided L? I use llm-d’s endpoint picker, which scores replicas on engine state: queue length, KV-cache usage and prefix-cache hits. The picker can’t run on Kaggle, so for the T4s I applied its own scoring formulas offline to the metrics both engines reported just before each probe.</p><ul><li><strong>With vLLM’s default settings,</strong> nothing queued. The picker chose S all 24 times, but only because S’s KV-cache usage was about 3 points lower. The margin was under 1 % of the score range. Nothing in its inputs showed the long prompts on L.</li><li><strong>With each replica limited to two requests at a time,</strong> a queue formed on S. The picker then sent the probe to L 21 times out of 24.</li></ul><p>Then I ran the whole path for real, on my laptop: the real gateway and picker in front of two llama.cpp replicas in Kubernetes, each pinned to its own four CPU cores. Same shape: two long prompts on L, three short ones on S, then a short probe through the gateway. The stock picker sent 8 of 12 probes to L. A probe sent to L waited 19.80 s for its first token, against 3.94 s on S. Whenever the picker saw a request queued on S, it chose L, five times out of five. The rest of the time every score tied and a coin toss decided.</p><p>My first Kubernetes test, with simulated engines, had shown the same blind spot: all 16 probes went to the long-prompt pod. A token-aware scorer fixed it there. It did not hold up on real engines with my test prompts.</p><p>Every number in this article comes from my own runs, and each carries a label:</p><ul><li><strong>Real, GPU:</strong> the T4 measurements (Kaggle 2×T4, vLLM 0.31, Qwen2.5–3B, one machine, no router in the path).</li><li><strong>Real, routed (CPU):</strong> the llama.cpp runs (Qwen2.5–0.5B, four pinned cores per replica, real gateway and picker in the path). Pinning did not stop the two replicas slowing each other: each probe was 44–49 % slower when the other replica was busy. I report that beside every CPU number.</li><li><strong>Computed offline:</strong> the picker’s choices on the T4s, calculated from the engines’ real metrics with the picker’s own scoring rules.</li><li><strong>Simulated:</strong> the first Kubernetes routing tests (real gateway and picker; the engines are llm-d’s inference simulator, with timings I set).</li></ul><p>This series is about goodput: the useful work a GPU delivers within the latency users will accept. The 2.2s gap wasn’t simply a slow-GPU problem. The T4 measurements show how much replica selection can matter, while the offline picker analysis shows why an engine-aware router can still make the wrong choice. I reproduced the routing failure end to end on CPU replicas; the GPU routing result remains to be tested in the live request path. The rest of the article covers why request size matters to a GPU, and how an LLM-aware router decides. Then it shows where that router goes blind, and why the obvious fix worked in the lab but failed on real engines with my test prompts. It closes with what the evidence does and doesn’t show, and what changes at scale. The code and raw results are in the <a href="https://github.com/veldanda3415/goodput-stack">goodput-stack repo</a>.</p><h3>Not All Requests Weigh the Same</h3><p>The unit of work for an LLM is the token, not the request. A request’s cost depends on how many tokens it brings in, how many it generates, and where it sits inside the engine when the next request arrives.</p><p>Every request runs in two phases.</p><ul><li><strong>Prefill</strong> reads the whole prompt in one pass. Its cost grows with prompt length, and it is limited by compute. The first output token can’t appear until prefill finishes.</li><li><strong>Decode</strong> then generates the answer one token at a time. Each step re-reads the model weights, so it is limited by memory bandwidth, not compute.</li></ul><p>The two phases run at very different speeds. On my laptop CPU, with llama.cpp and four cores:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KzNWvYdYT46PLBjQO_GqjA.png" /><figcaption>Prefill and decode run</figcaption></figure><p>A replica holding two long prompts is therefore busy for tens of seconds, even though it holds fewer requests than its neighbour. A router counting requests sees the opposite of the truth.</p><h3>Waiting is where the time goes</h3><p>An engine runs a fixed number of requests at once, called slots or sequences. A request that finds every slot full waits in a queue, and that wait lands on its time to first token. On the laptop, with two slots and a small model, four streams instead of two barely moved throughput (67.6 to 68.9 tokens/s). Median time to first token went from 192 ms to 1,902 ms. The GPU, or here the CPU, looked equally busy either way; the users did not see the same service.</p><p>A free slot is not always enough either. The engine’s scheduler decides how a new prompt shares compute with the prompts already running. vLLM caps the prompt tokens it processes per step (chunked prefill), so a long prefill is split up and a new request’s prefill can run between the pieces. That is the likely reason the T4 gap was about 2 s, against tens of seconds on llama.cpp, which the Blind to Size section returns to. The engine’s scheduler sets how much a wrong pick costs.</p><h3>Memory: the KV cache</h3><p>While a request is in flight, the engine keeps the attention keys and values for every token it has seen, the KV cache. For Qwen2.5–3B that is 36,864 bytes per token, so one 3,000-token prompt holds about 110 MB of GPU memory until it finishes. On a T4 at 90 % memory use, vLLM had room for 175,008 tokens of KV cache in total. Long prompts use that space up fastest, and when it runs out the engine stops admitting work.</p><p>KV-cache usage is the one signal that does grow with prompt size, which is why routers read it. But it is an indirect signal. It reports memory held now, not the prefill work still ahead. On the T4s it differed between the two replicas by about 3 points while one of them had seconds of prefill queued.</p><p>The last factor is reuse. If a replica has already processed the start of a prompt, such as a shared system prompt, it can keep that prefix in cache and skip its prefill. That is why LLM routers also score prefix-cache hits. I turned prefix caching off in these tests, so every prompt paid full price.</p><h3>Counting flows, not bytes</h3><p>This is the same mistake the <a href="https://medium.com/@ravikiran.veldanda/equal-cost-is-a-lie-the-strange-physics-of-gpu-traffic-b7ae2cc18ce5">first two articles in this series</a> found in the network. ECMP hashing balances flows, not bytes, so a few large flows can pile onto one link while others sit idle. A request-counting router balances requests, not tokens, so a few long prompts can pile onto one replica. In both cases the fix starts with measuring the unit that actually costs something.</p><h3>A Router That Reads the Engine</h3><p>The open-source answer to LLM routing is to stop counting requests and ask the engines instead. In Kubernetes this is the Gateway API Inference Extension: a standard gateway handles the HTTP side and hands the replica choice to an endpoint picker that reads engine metrics. I used agentgateway as the gateway and llm-d’s endpoint picker, the same open stack an inference team would deploy. I didn’t build a router of my own.</p><p>A request takes this path:</p><ol><li>The client sends an OpenAI-style request to the gateway.</li><li>The gateway pauses the request and asks the endpoint picker which replica should serve it, over Envoy’s external-processing protocol (ext_proc).</li><li>The picker scores every replica in the pool, an InferencePool, and returns the winner.</li><li>The gateway forwards the request to that replica and streams the answer back.</li><li>If the picker is down, the gateway can “fail open”: it skips the question and falls back to its own load balancing.</li></ol><p>The picker refreshes each replica’s metrics every 50 ms and scores replicas with three scorers. Each returns a value from 0 to 1, multiplied by a weight:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6lgX5ID2sBxhenFxh15hoA.png" /><figcaption>EPP Scores</figcaption></figure><p>The replica with the highest total, out of 7, wins. Equal totals are settled by a random shuffle.</p><h3>What it gets right</h3><p>I tested the basics first, on simulated engines, so the timings were mine to set:</p><ul><li><strong>It sees a queue.</strong> I saturated one replica directly (2 running, 6 waiting) and sent 20 requests through the gateway. All 20 went to the idle replica. With both idle, they split 9 and 11.</li><li><strong>It fails safely.</strong> I sent three rounds of 50 requests: with the picker up, with it scaled to zero, and after restoring it. All 150 got answers. The 50 sent while the picker was down were spread by the gateway’s own load balancing. An alert flagged the outage, and the picker was routing again 2.0 s after I scaled it back up.</li><li><strong>It is quick.</strong> The picker’s own scoring took 0.032 ms per request on average.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwmsZVS_scxnVWzZIg5iHA.png" /><figcaption>Token Aware Routing</figcaption></figure><h3>Where its view goes stale</h3><p>The picker scores from a snapshot, refreshed every 50 ms. A burst that arrives inside one refresh window is scored against the same snapshot, so every request sees the same scores. I sent 8 requests within 8 ms, 13 times. The splits ranged from 3/5 to 7/1, never 8/0. The same 8 requests spaced 0.25 s apart split 4/4 every time. The picker’s debug log showed why: all 24 requests in three bursts got identical queue scores, and the random tie-break chose.</p><p>A metric scraped from the engine always lags the load the router itself has just sent. That matters for the next finding.</p><h3>Blind to Size</h3><p>None of the picker’s three inputs measures the prefill work still ahead of a replica. Queue length counts requests. KV-cache usage counts memory already held. Prefix hits count reuse. So I built one test to see what happens when request size is the only thing that differs between replicas, and wrote the prediction down before each run.</p><p>The size test uses two replicas. Replica L carries two long prompts (about 3,000 tokens each), replica S carries three short ones (about 230 tokens), and both are kept loaded. Then a short probe arrives. Counted by requests, L looks lighter. Counted by work, L is far heavier.</p><h3>Three runs, one pattern</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GhGg5Ivhc0sloqCFka883g.png" /><figcaption>Results from experiments</figcaption></figure><p>On simulated engines with two slots each, S’s third short request had to wait, so S showed a queue and L didn’t. The queue scorer sent every probe to L. I had predicted about 7.7 s on L against well under 2 s on S, and that held.</p><p>On the T4s with vLLM’s defaults, nothing queued: vLLM allows far more than five requests at once. The picker chose S every time, but not because it saw the long prompts. S’s KV-cache usage was about 3 points lower, worth 0.06 of the 7 available points. That is the right answer by a margin too thin to rely on. When I restarted both T4 replicas with two slots each, S queued in 21 of 24 snapshots and the picker would have sent the probe to L 21 times out of 24. The first-token gap in that condition was not resolved with 12 probes, because S’s queue slowed S as well. The full 128-token answer finished 6.6 s later on L.</p><p>On the laptop, the picker really ran in the request path, in front of real llama.cpp. With two slots per replica it sent 8 of 12 probes to L. Its log showed the mechanism. Five times it saw a request queued on S, and five times it chose L. The other seven times S’s queue had just drained, because short requests finish fast and re-send, so all scores tied and a coin toss decided: 3 to L, 4 to S. I had predicted at least 11 of 12 to L. I was wrong about how often the queue would be visible, but not about where it pointed.</p><p>With four slots per replica, nothing queued at all. Every score tied on all 12 probes, and chance sent 9 of them to L. A free slot on L did not save them: 8 of the 9 waited 15 to 36 s for a first token.</p><p>A free slot is not free compute. llama.cpp runs all busy slots together, sharing a fixed budget of prompt tokens per step among them. With two slots, the probe waited for a long prompt to finish, then had the four cores mostly to itself. With four slots, it started at once but shared every step with the long prompts’ remaining prefill. The closed-loop load also kept sending new long prompts into the spare slots. More work running at once on the same four cores means each request moves more slowly, which is why L got slower, not faster. S went the other way: with four slots, its third short request no longer had to wait. This is my reading of the results, not yet confirmed in llama.cpp’s batching code; sampling its /slots endpoint during a probe would show it.</p><h3>Why the signal points the wrong way</h3><p>In this traffic shape the picker isn’t only blind to size, it is pulled toward the wrong replica. Short requests arrive and finish often, so the replica serving them is the one that shows a waiting request. Long prompts sit in their slots for many seconds without anything visibly waiting behind them. A scorer that reads queue length then reads “S is busy, L is free”, the opposite of the work each replica has ahead.</p><p>That is a property of this shape, not of every workload. With mixed traffic on every replica, the queue scorer is often right, as the first tests in this article showed. The point is narrower and more useful: queue length and KV-cache usage are not measures of pending work. When requests vary in size, a router that reads only those signals is right by luck, and the luck runs out when slots fill.</p><h3>The Fix Was Already Upstream, and Then It Wasn’t</h3><p>The fix I first trusted came from llm-d itself, worked on simulated engines, and failed on real engines with my test prompts. Both halves taught me something.</p><h3>The plugin I didn’t write</h3><p>My plan was to write a token-aware scorer in Go and plug it into the picker. Before writing it, I read the picker’s source (llm-d router v0.9.0). It already shipped one: an in-flight load producer that counts the prompt tokens the picker has dispatched to each replica and not yet seen prefilled, and a token-load scorer that reads that counter. It was off in practice. Its default threshold is 4,194,304 tokens, so at lab scale every replica scored the same and the scorer changed nothing.</p><p>I set the threshold to 8,192 tokens and the weight to 4. A weight of 4 lets the token score swing the total by up to 4 points, more than the queue scorer’s maximum of 2, so request size can outvote a short queue. On simulated engines the result was clean:</p><ul><li><strong>Size test:</strong> 0 of 8 probes to L, 0.56 s to first token, down from 8 of 8 and 7.75 s.</li><li><strong>Saturation test still passed:</strong> all 20 requests went to the idle replica.</li><li><strong>Bursts improved:</strong> 4 of 5 bursts split 4/4. The counter moves at dispatch time, inside the burst, while scraped metrics stay frozen until the next refresh.</li></ul><p>No custom code: one values file. A plugin that duplicated upstream would have been harder to defend than a configuration change.</p><h3>What the extra hop costs</h3><p>I measured the gateway against sending requests straight to the replicas, on simulated engines on a quiet host. At 16 concurrent requests, going through the gateway cost 2.7 to 4.7 % of throughput and 4 to 11 ms of median latency. The token-load scorer made no difference beyond run-to-run spread. The picker’s own scoring took 0.032 ms per request.</p><p>Above 16 concurrent requests both paths bent the same way, and I first read that as the gateway’s limit. It was my load generator: a single Python process pinned at one full core. So the gateway’s real ceiling is still unmeasured. My first run of this test also shared the machine with a fabric experiment, and I threw it out.</p><h3>And then it wasn’t</h3><p>On real engines the same configuration did much less.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCZ3d7MpE_8jCuZ3qHgYMg.png" /><figcaption>Simulation vs Real Engines</figcaption></figure><p>On the laptop, the scorer broke all seven ties toward S, which helped. But in all five cases where the picker saw a request queued on S, the queue scorer still won and the probe went to L.</p><p>The reason is the estimate. The picker doesn’t tokenize prompts; it estimates their size. Its log on the laptop against the token counts llama.cpp reported:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWcfCYIyhnTId-6jYBm5Pg.png" /><figcaption>Estimate vs Engine’s Count</figcaption></figure><p>The long prompts were counted at about a third of their size, so the load they put on L looked small, and the token score could no longer outvote a queue. With real counts, the scorer would have sent the probe to S every time. That is computed from the logged scores, assuming the scorer behaves the same with correct inputs. I haven’t verified it end to end.</p><p>The cause is in the code. By default the picker doesn’t tokenize. It counts the prompt’s bytes and assumes four per token. My test text, numbered words like “w0 w1 w2”, splits into many small tokens, about 1.25 bytes each. So the estimate came in at a third of the real count. (The CPU figures are rounded up to whole 64-token blocks.) In the simulator the same text was about 3,000 words, four times the bytes, so the estimate was large enough to work. Ordinary prose sits nearer four bytes per token, where the estimate would be closer; I didn’t test that.</p><p>Real token counts are the first fix: a better input, not a better weight. But a token count is still not pending work. A queued prompt token, a token already in the KV cache and a token waiting to be decoded don’t cost the same, and chunked prefill, batching and prefix hits change the price. Engine-reported pending work and calibrated latency prediction are the stronger signals.</p><h3>The Ledger, and What It Still Can’t See</h3><p>The claims this article makes, how strong the evidence is for each, and where they stop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQ4rf-xyY2s4dHgDpW3UWQ.png" /><figcaption>Ledger for Reference</figcaption></figure><h3>What I got wrong</h3><ul><li><strong>I planned a plugin that already existed.</strong> Reading upstream first saved the code, and turned the finding into a configuration change anyone can reproduce.</li><li><strong>I trusted a fix tuned on simulated prompts.</strong> The token-load setting that worked on simulated engines lost to the queue scorer on real engines. My synthetic prompt, numbered words, was unusually token-dense, which made the picker’s byte estimate fail. A test prompt is part of the experiment.</li><li><strong>I mistook my load generator for the gateway’s limit.</strong> The bend above 16 concurrent requests was one Python process at full core. I also discarded an earlier run made on a shared machine.</li><li><strong>I expected CPU pinning to stop the two replicas slowing each other.</strong> It removed none of the 44–49 % slowdown. Shared memory bandwidth, cache or clock speed are the suspects, not yet separated.</li><li><strong>I predicted at least 11 of 12 wrong picks on the CPU.</strong> It was 8, because the short-prompt replica’s queue keeps draining and refilling.</li><li><strong>I predicted a 3–5 s first-token time on the T4 with two slots.</strong> It was 2.38 s, and the gap to the other replica was not significant at 12 probes.</li><li><strong>I expected a free slot to protect the probe.</strong> With four slots, the probe still waited 15 to 36 s behind the long prompts’ prefill.</li></ul><h3>What it still can’t see</h3><ul><li><strong>Load it didn’t send.</strong> The token counter only knows what this picker dispatched. Requests sent straight to a pod, or through another picker replica, are invisible to it. With two picker replicas, each sees half the traffic.</li><li><strong>Clients that hang up.</strong> When a client disconnected through the gateway, llama.cpp kept the slot busy for at least 15 s. Sent directly, a streaming request freed its slot in about 1.5 s. The gateway doesn’t pass the disconnect on.</li><li><strong>Slow cold starts.</strong> The gateway cancels its call to the picker after 10 s. If the picker is holding a request while a replica scales up from zero, any request still held at 10 s fails with HTTP 500.</li><li><strong>Some of its own vital signs.</strong> The gateway reports no time-to-first-token of its own, and llama.cpp exports no latency histograms or KV-cache usage.</li></ul><h3>What this doesn’t show</h3><p>Two replicas on one machine, small models (Qwen2.5–0.5B on CPU, Qwen2.5–3B on a T4), 12 probes per condition, one synthetic traffic shape, prefix caching off, no real tokenizer in the picker, and no production traffic. The direction of every result held across three very different setups. The sizes of the gaps are specific to each one.</p><h3>The Road Ahead</h3><p>The router needs to measure the work ahead of each replica, not the requests in it. Real token counts are a better input; engine-reported pending work and calibrated latency prediction are stronger routing signals. Here is what I would change next, cheapest first.</p><ol><li><strong>Count real tokens.</strong> Switch the picker from its byte estimate to its vLLM tokenizer backend, and rerun the routed CPU test with prose-like prompts as well as the numbered ones. This tests whether the token-load scorer works once its input is right.</li><li><strong>Have the engine report pending work.</strong> Prompt tokens still waiting for prefill is the number a router needs, and the engine knows it exactly. A scraped gauge of it would also cover load the picker didn’t send.</li><li><strong>Share state between picker replicas.</strong> Running two pickers for availability splits their counters. A shared counter, or routing each client to one picker, fixes that.</li><li><strong>Predict latency, not load.</strong> Score each replica by its predicted time to first token for this request, given its queue, its pending prefill and the prompt’s size. Then compare that against the latency target.</li><li><strong>Separate prefill from decode.</strong> Disaggregated serving runs prefill and decode on different replicas, so a long prefill can’t stall a short request’s first token at all. It moves the problem into the network: the KV cache has to travel from the prefill replica to the decode replica, which is where this series’ fabric articles pick up.</li></ol><h3>What changes at 1,000s of replicas</h3><ul><li><strong>Scraping gets expensive and stale.</strong> A 50 ms refresh across thousands of replicas is a lot of traffic, and bursts inside one window still herd. Dispatch-time counters and engine-pushed state matter more, not less.</li><li><strong>One picker can’t hold everything.</strong> Routing becomes hierarchical: pick a pool or zone first, then a replica. Each layer needs its own notion of pending work.</li><li><strong>Prefix reuse becomes the biggest lever.</strong> With many replicas, sending a request where its prefix is already cached saves more prefill than any balancing. That makes the cost of a wrong pick even larger.</li><li><strong>Mixed engines need engine-aware scoring.</strong> The same wrong pick cost about 2 s on vLLM and tens of seconds on llama.cpp. A router serving several engine types has to know which scheduler sits behind each replica.</li></ul><h3>Run it yourself</h3><p>Everything here is in the <a href="https://github.com/veldanda3415/goodput-stack">goodput-stack repo</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X9blZykL-JdjvTOsa_0bhg.png" /><figcaption>How to run</figcaption></figure><ul><li>make epp-plugin-on / make epp-plugin-off switch the token-load scorer; its settings are in deploy/gateway/epp-sim-token-load.values.yaml.</li><li>deploy/gateway/GAPS.md lists every gap found, with the test that shows it.</li><li>Raw results are under benchmarks/results/probes/ and benchmarks/results/t4/.</li></ul><p>If you have real GPUs and a production traffic mix, I would like to know whether the direction holds. Issues and pull requests are welcome.</p><h3>References</h3><ul><li>llm-d, <a href="https://llm-d.ai/blog/sticky-until-saturated-token-aware-routing">Sticky until saturated: token-aware routing</a>: the token-load scorer and its threshold.</li><li>llm-d router, <a href="https://github.com/llm-d/llm-d-router/issues/3567">issue #3567</a>: how the estimate backend counts request bytes.</li><li><a href="https://gateway-api-inference-extension.sigs.k8s.io/">Gateway API Inference Extension</a>, <a href="https://agentgateway.dev/">agentgateway</a>, <a href="https://llm-d.ai/">llm-d</a>, <a href="https://docs.vllm.ai/">vLLM</a>, <a href="https://github.com/ggml-org/llama.cpp">llama.cpp</a>: the open components used.</li></ul><p><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fd2cb3083bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your GPUs Are Waiting on One Cable]]></title>
            <link>https://medium.com/@ravikiran.veldanda/your-gpus-are-waiting-on-one-cable-79f12fd02741?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f12fd02741</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 03:02:24 GMT</pubDate>
            <atom:updated>2026-10-22T03:02:47.524Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why AI clusters can’t trust equal-cost paths, and what it takes to build a network GPUs can rely on.</em></p><p>Oct 21, 2026 · @Ravi Kiran Veldanda</p><h3>Four Links Bundled, One in Use</h3><p>In an AI cluster, one busy cable can hold up every GPU in a job. A model I built of a 256-GPU cluster puts a number on it: if one link runs at half speed, the GPUs’ data exchange takes 55 % longer and each training step up to 8.3 % longer. Those two numbers are calculated, not measured; the lab sections below measure the mechanism behind them.</p><p><strong>Every network engineer has had this ticket.</strong> You bundle four 100G links between two switches into a <em>port-channel</em> (LACP link aggregation), so they act as one 400G pipe. Then the nightly backup runs at 100G while three of the links sit idle. The answer is always the same: a port-channel doesn’t split traffic packet by packet. It hashes each <em>flow</em> (one conversation between two endpoints) onto a single member link, so packets of that flow stay in order. One big flow can never use more than one link, and two big flows can land on the same one.</p><p><strong>Most days nobody notices.</strong> Thousands of small user flows spread evenly over the members, and the average works out. Network engineers call these flows <em>mice</em>. The trouble starts when a few <em>elephants</em>, large long-lived flows, carry most of the bytes.</p><p>Some <strong>GPU collective traffic</strong> behaves like a synchronized set of elephant flows<strong>, every few milliseconds, on every link at once.</strong> A large model is split across many GPUs, and they share results constantly. A training step ends with every GPU exchanging what it computed, so all of them hold the same answer before the next step starts. A model split across GPUs for inference does a smaller exchange for every token it writes. These exchanges are called <em>collectives</em>. The most common one, <em>all-reduce</em>, adds up every GPU’s numbers and hands the total back to all of them.</p><p>A collective is a handful of elephants. The network between GPU servers spreads them the same way a port-channel does, just across switches instead of cables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkKPSw2q0HSFt70dLDan1A.png" /><figcaption>AI Cluster comparision</figcaption></figure><p><strong>The last row is what makes it worse.</strong> The backup is one job running late. A collective’s flows start together, and no GPU can move on until the last one finishes. Networks have seen this waiting before too: a web search fans a query out to hundreds of servers and answers only when the slowest one replies. GPU traffic has both problems at once, the hashing and the waiting, on every step.</p><p><strong>Waiting is expensive.</strong> A GPU waiting on the network does no useful work, and GPUs are the most expensive part of the cluster. I modelled a 256-GPU cluster training an 8-billion-parameter model, with one network link running at half speed (calculated, not measured):</p><ul><li>The collective took <strong>55 % longer</strong>.</li><li>The whole step, which also includes computing time, took <strong>8.3 % longer</strong>. Only the exchange stretched, but every GPU paid for it. This is an upper bound: it assumes computing and communication don’t overlap. The lab measures the mechanism behind it in the sections below.</li></ul><p>In Equal Cost Is a Lie I said the paths cost the same, but the load on them doesn’t. This article goes down to show why, one layer at a time:</p><ol><li>What a collective actually moves, measured on two real GPUs.</li><li>Why ECMP goes wrong for GPU traffic, with packets captured on the wire, and why the data-centre fixes for elephants don’t carry over.</li><li>How AI clusters redesign the network around the GPUs (rail-optimized topology).</li><li>Why AI networks must not drop a single packet, and how they avoid it.</li></ol><p>Every number carries a label saying how real it is: real GPU, emulated network, or design only. The full list is in The Ledger.</p><h3>Inside One Box</h3><p>Before any network is involved, two real GPUs in one server already show how a collective behaves. On a pair of NVIDIA T4s, all-reduce reached <strong>3.89 GB/s</strong>, and the library chose to send the data through the CPU’s memory instead of straight from GPU to GPU. <em>(Real GPUs, one server, PCIe. Not the cluster network.)</em></p><p><strong>The library that does the exchange.</strong> When PyTorch asks for an all-reduce, it hands the job to NCCL (the NVIDIA Collective Communications Library, pronounced “nickel”). NCCL looks at how the GPUs are wired, then picks three things on its own:</p><ul><li><strong>Transport:</strong> how bytes travel. Inside a server: directly between GPUs (P2P), over NVLink where the server has it or over PCIe where it doesn’t, or through a shared buffer in CPU memory (SHM). Between servers: through a NIC with RDMA (InfiniBand or RoCE), or over plain TCP sockets as a fallback.</li><li><strong>Algorithm:</strong> the pattern of who sends what to whom. Ring or Tree.</li><li><strong>Channels:</strong> how many parallel lanes to split the work across. Hold on to this one: across a network, channels become separate flows, and flows are what ECMP hashes.</li></ul><p><strong>The setup.</strong> Kaggle’s free “GPU T4 ×2” machine: two T4s on PCIe Gen3 x16. They have no NVLink (NVIDIA’s direct GPU-to-GPU link), so they talk across the CPU’s PCIe host bridge. I ran NVIDIA’s own benchmark, nccl-tests, with NCCL’s debug log switched on so it prints every choice it makes:</p><pre>NCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=INIT,GRAPH,TUNING \<br>  all_reduce_perf -g 2 -b 8 -e 1G -f 2 -n 50 -w 10 -c 1</pre><p>That sweeps message sizes from 8 bytes to 1 GiB, doubling each time, with 50 timed runs per size after 10 warm-ups, and checks every result for correctness.</p><p><strong>What a ring all-reduce actually moves.</strong> Each GPU’s data is cut into N chunks. In the first half, chunks travel round the ring and get added up along the way (reduce-scatter), so each GPU ends up owning one fully summed chunk. In the second half, those finished chunks travel round again so every GPU gets all of them (all-gather). Each half takes N−1 steps, and each step moves one chunk. So every GPU sends this much, no matter how many GPUs there are:</p><pre>bytes sent per GPU = 2 × (N - 1) / N × S</pre><p>where S is the message size. That’s why nccl-tests reports two numbers. <em>Algorithm bandwidth</em> is simply S divided by time. <em>Bus bandwidth</em> (busbw) scales that by the traffic the algorithm really put on the links, so it can be compared with a link’s speed:</p><p>busbw = algbw × 2(N — 1) / N</p><p>The factor depends on the collective, because each one puts a different amount of traffic on the links. All-reduce runs two phases (reduce-scatter, then all-gather), so it moves nearly twice the message. All-gather and reduce-scatter are one phase each, so they move nearly the message once:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sy7NFR0Pg2O81EJk9q04Cw.png" /></figure><p>So on two GPUs, all-reduce’s busbw equals its algbw, and all-gather’s busbw is half its algbw.</p><p><strong>What I measured</strong> (1 GiB messages unless noted):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23ZQxVtElLZKIVpiQj5etw.png" /></figure><p><strong>What NCCL chose, and why.</strong> The log shows NCCL picked shared memory (SHM) with 2 channels. Small messages used Ring with a low-latency protocol on one channel, and from 128 KiB up it switched to Ring with its bulk protocol. It did <strong>not</strong> use direct GPU-to-GPU copies, even though the log confirms both GPUs supported them. On this setup, NCCL selected shared-memory transport rather than direct P2P. The topology and NCCL’s transport-selection rules influenced that choice: in the version I ran (2.28.9), P2P is used by default only up to a certain PCIe distance, and these two GPUs sit one step beyond it, across the CPU’s host bridge. Other NCCL versions, CPUs or servers may choose differently. Forcing P2P gained 8 %, and forcing Tree gained 15 %.</p><p>Two lessons carry into the rest of this article:</p><ol><li><strong>The defaults aren’t always best.</strong> On this machine, NCCL’s automatic choices left 8–15 % unused. That number is specific to this hardware and version; the habit that carries over is reading its log and testing the alternatives.</li><li><strong>Topology shapes the transport.</strong> The same two GPUs could move data three different ways, and which one NCCL used depended on how its rules judged the path between them.</li></ol><p><strong>A simple model, and how wrong it was at first.</strong> Collective time is usually modelled as a fixed start-up cost plus size divided by bandwidth:</p><pre>T(S) = \alpha + \frac{S}{\beta}</pre><p>Fitted to my runs, the floor came out at 17.3 µs and the bandwidth at 3.89 GB/s. With those numbers, the model’s median error across 28 message sizes was 3 %. Before fitting, I had plugged in datasheet values: 80 % of PCIe Gen3 x16 (15.754 GB/s) and a 1 µs start-up. That version predicted collectives <strong>69–89 % faster</strong> than they ran. The maths was fine; the path was wrong. The datasheet assumes a direct GPU-to-GPU link, and NCCL took the longer road through CPU memory. Measure the path before you trust the model.</p><p><strong>Why this matters for the network.</strong> In most large training servers the GPUs talk over NVLink, which is far faster than a single network port. Once a collective spans servers, each GPU’s share goes out through its NIC, and the network becomes the slowest part of the path. NCCL’s channels turn into separate network flows, and those flows are exactly what ECMP has to place. That’s where the next section picks up.</p><p><em>What this doesn’t show:</em> more than two GPUs, NVLink, NICs or RDMA, or any switch. Two T4s on PCIe are a baseline, not a cluster.</p><h3>Hashed to the Same Uplink</h3><p>When the switches hashed on IP addresses only, every flow between two GPU servers took the same uplink, whether there was 1 flow, 4 or 32. And across 36 timed runs, job time tracked the bytes on the busiest link almost perfectly (correlation r = 0.998). <em>(Emulated network: containerlab, FRR, Linux kernel forwarding.)</em></p><p><strong>Why switches hash per flow at all.</strong> A switch with eight equal paths could spray packets round-robin and get a perfect split. It doesn’t, because no two paths have exactly the same delay, so spraying delivers packets out of order. TCP can mistake reordering for loss, retransmit, and slow down. RoCE is usually stricter: in its reliable mode, most NICs expect every packet in sequence, and a gap makes the sender go back and resend from the missing packet onward. So ECMP, like a port-channel, pins each flow to one path and trades balance for order. RoCE fabrics are often engineered to minimize packet loss because loss and retransmission can severely affect performance</p><p><strong>How a path gets picked.</strong> Most switches run a pipeline like this:</p><ol><li>Take some header fields. <em>L3 hashing</em> uses source and destination IP. <em>L4 hashing</em> adds the protocol and the source and destination ports: the five-tuple.</li><li>Run them through a hash function, mixed with a per-switch seed.</li><li>Map the result to a bucket, and the bucket to a next hop.</li></ol><p>In Linux this is one setting, net.ipv4.fib_multipath_hash_policy: 0 for L3, 1 for L4. Data-centre switches offer similar choices, with vendor-specific fields and hash functions.</p><p><strong>Where RoCE v2 gets its entropy.</strong> RoCE v2 carries InfiniBand’s transport inside UDP, and the destination port is always 4791. Between two servers, the IPs never change either. That leaves one field that varies: the <strong>UDP source port</strong>, which most NICs derive from the <em>queue pair</em> (QP), RDMA’s equivalent of a connection. So between two servers, the number of paths a job can use is capped by its number of queue pairs, not its bytes. In NCCL, that number depends on settings such as the channel count and NCCL_IB_QPS_PER_CONNECTION. More queue pairs means more entropy, at the cost of more connection state on the NIC.</p><p><strong>The odds are worse than they look.</strong> Treat ECMP as throwing k equal flows at n links at random. A collective finishes when its busiest link finishes, so the slowdown is the busiest link’s load divided by a perfect share. <em>(Calculated: exact maths, checked by simulation.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*65LmEWLajTO4AEzRg6_tBA.png" /><figcaption>ECMP Calculations.</figcaption></figure><p>Eight flows on eight uplinks split perfectly about once in 400 tries. On average the job runs 2.6 times slower than the network allows. It’s the birthday paradox with link-sized consequences. Adding flows helps, but slowly: 64 flows on 8 links still lose about 1.5×. Typical web traffic rarely feels this, because with thousands of small flows the average dominates.</p><p><strong>What the lab showed.</strong> The lab is a leaf-spine built in containerlab: 2 spines, 4 leaves and 4 servers with two NICs each, running BGP (FRR) between every switch. Two virtual machines run Soft-RoCE, a software RDMA NIC that puts real RoCE v2 packets on the wire.</p><ul><li><strong>L3 hashing ignores flow count.</strong> With the hash on IP addresses only, 100 % of traffic between two servers went up one uplink at 1, 4 and 32 flows. Switching to L4 hashing spread the same flows across both.</li><li><strong>Queue pairs show up as source ports.</strong> I captured RDMA writes with 1, 4 and 16 queue pairs. The capture showed 1, 4 and 16 distinct UDP source ports, and under L3 hashing every one of them still landed on the same spine.</li><li><strong>The busiest link sets the clock.</strong> On links shaped to 500 Mbit/s, a ring collective with L3 hashing took 6.17 s against 3.30 s for a perfect split: about 1.9×, the two-flows-collide case from the table. Over 36 runs, job time followed the busiest link’s bytes with r = 0.998.</li><li><strong>One result needs a rerun.</strong> L4 hashing with 16 flows per server pair came within 0.03 s of a perfect split. But my load generator shared one byte budget across its streams, so streams on the quieter link quietly carried more. A real collective can’t rebalance like that. The maths predicts about 1.1–1.4× instead, and a rerun with fixed bytes per flow will tell.</li></ul><p><strong>Didn’t data centres already solve this?</strong> Elephants and mice are an old problem, and there are well-known fixes. Each relies on something GPU traffic doesn’t have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUqclx5Ke4-j0JUNT0_BWw.png" /><figcaption>The DC Methods of fixes for elephant flows</figcaption></figure><p>Those fixes improve the average. They assume flows are independent, that mice fill the gaps, and that TCP forgives the odd reordering. Collective traffic often has none of that: the flows are large, they start together, and RoCE’s usual transport handles reordering and loss poorly.</p><p><strong>The industry’s answer</strong> takes the same ideas one step further: spray packets across all paths and let the receiving NIC put them back in order. Per-packet adaptive routing is a flowlet with a gap of zero, made safe because the NIC now handles reordering. AWS’s SRD transport, NVIDIA’s Spectrum-X and the Ultra Ethernet Consortium’s transport each take a version of this approach. Until that hardware is everywhere, the cheaper levers are L4 hashing with more queue pairs, and a topology that avoids the hash in the first place. That’s the next section.</p><h3>One Hop, No Hash</h3><p>If ECMP’s hashing is the problem, the simplest fix is to wire the network so most GPU traffic never needs a hashing decision. A <em>rail-optimized</em> network wires GPU number <em>i</em> of every server to the same leaf switch, so the busiest traffic crosses one switch and no hashing decision at all. <em>(Design and sizing: calculated. Failure behaviour: emulated.)</em></p><p><strong>How a GPU server is wired.</strong> A typical training server holds 8 GPUs joined by NVLink, and gives each GPU its own NIC: NVIDIA’s DGX H100, for example, has eight 400G NICs. So the network sees 8 separate endpoints per server, not one.</p><p><strong>The traditional design: a leaf per rack.</strong> In a normal data centre, every port of a server goes to the top-of-rack leaf. Applied to GPU servers, all 8 NICs plug into the same leaf. GPU traffic between two racks always climbs to the spine, and every flow meets ECMP on the way up.</p><p><strong>The AI design: a leaf per rail.</strong> Look at who actually talks to whom. Many large jobs split each layer across the 8 GPUs inside a server (tensor parallel, over NVLink), and split the data or the model’s stages across servers. With that layout, across servers GPU 3 mostly talks to GPU 3, GPU 5 to GPU 5. So the rail-optimized design runs NIC 0 of every server to leaf 0, NIC 1 to leaf 1, and so on: 8 <em>rails</em>. Traffic between same-index GPUs now goes NIC → rail leaf → NIC: one hop, no spine, no hash.</p><p><strong>What about GPU 3 talking to GPU 5?</strong> That crosses rails, and in the network it would have to go through a spine and meet ECMP again. NCCL can avoid it with a feature called PXN, where the hardware and settings allow: it first moves the data over NVLink inside the server to GPU 5, whose NIC sits on the right rail, then sends it one hop. The fast link inside the box does the routing, and the network only ever sees same-rail traffic.</p><p>Taken to its limit, that gives <em>rail-only</em>: drop the spines entirely and let NVLink handle every cross-rail move. A study by <a href="https://arxiv.org/abs/2307.12169">Wang et al.</a> (MIT and Meta; arXiv 2023, HOTI 2024) estimated this cuts network cost by 38–77 % and network power by 37–75 % compared with a conventional GPU cluster network [1], at the price of relying fully on NVLink and on jobs that fit the pattern.</p><p><strong>What it costs, sized.</strong> I sized all three designs for non-blocking clusters built from 128-port 400G switches <em>(calculated)</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sS7sGg-ddZHGKutB1q4V1w.png" /><figcaption>Sizing the Rack/Switches</figcaption></figure><p>Two things stand out:</p><ul><li><strong>Rails trade copper for optics.</strong> The number of cables barely changes: every NIC still gets one. What changes is their length. A rack’s leaf sits a metre away, so short copper cables work. A server’s 8 NICs now go to 8 different rail leaves spread across the row, so every server link needs optics, which cost more and draw more power.</li><li><strong>Rail-only stops saving once a rail outgrows one switch.</strong> With 128 ports, that happens above 128 servers (1,024 GPUs). Beyond that, each rail needs its own leaf-spine.</li></ul><p><strong>How big two tiers can go.</strong> A non-blocking leaf-spine built from k-port switches tops out at k²/2 endpoints. With 128 ports of 400G, that’s 8,192 GPUs. Move to 800G NICs on the same 51.2 Tb/s switch and each switch has only 64 ports, so the ceiling falls to 2,048. Past that you add a third tier, and section 3’s problems return: more hashing stages, and hash <em>polarization</em>, where every tier sorts flows the same way unless each switch uses a different seed.</p><p><strong>Rails also shape failures.</strong> My lab is a small version of this: 4 servers with 2 NICs each, on 2 rails (A and B), 4 leaves and 2 spines, running BGP with BFD <em>(emulated)</em>. When I took an uplink down, the flows on that link ran at half rate, while rail B and traffic between servers on the same leaf were untouched. But when I took a whole leaf down, the ring collective stalled almost completely: it dropped to about 2 % of its rate. Rails contain the network damage, yet a collective still waits for its slowest member, so in my lab the blast radius of one leaf was the whole job.</p><p><strong>What rails don’t fix.</strong> Traffic that genuinely crosses rails still meets ECMP. The worst case is mixture-of-experts models, whose all-to-all exchange sends every GPU’s tokens to every other GPU. And once a rail spans more servers than one leaf can hold, rail traffic climbs to the spines and hashes again. Rails remove most of the problem, not all of it, which is why the transport underneath still has to cope when things go wrong. That’s the next section.</p><h3>Pause, Don’t Drop</h3><p>GPU traffic rides RDMA, a transport built for a network that never loses a packet, so AI Ethernet has to behave like one. In my lab, the switch marked over 11,000 RDMA packets as congested, and the sender never slowed down: the reaction (DCQCN) is normally implemented in RDMA NIC hardware, and the software NIC I used doesn’t implement it. <em>(Packets: Soft-RoCE over an emulated network. Switch design: rendered, never run on hardware.)</em></p><p><strong>Why GPUs use RDMA.</strong> With RDMA (remote direct memory access), the NIC copies data straight from one machine’s memory into another’s. The CPU and the kernel’s network stack stay out of the path, and with GPUDirect RDMA the NIC reads and writes GPU memory directly. That removes copies and microseconds from every exchange. <em>RoCE v2</em> (RDMA over Converged Ethernet) carries InfiniBand’s transport inside ordinary UDP/IP packets, so it can be routed over a normal leaf-spine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DKU_sFjkn6ROhfFHStR03g.png" /><figcaption>Why your GPUs are waiting</figcaption></figure><p><strong>One RoCE v2 packet, as captured.</strong> I ran RDMA writes between two VMs across the lab fabric and decoded the packets layer by layer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9m8pUuWGPAQmLkZMkJ85ig.png" /><figcaption>RoCE packet header</figcaption></figure><p>The sequence number is the key field. In RoCE’s reliable mode, the receiver expects PSNs in order and acknowledges them, often several at a time. On a real RDMA NIC all of this runs in hardware; in Soft-RoCE it runs in the kernel.</p><p><strong>Why one lost packet hurts so much.</strong> When a PSN goes missing, the receiver sends a NAK naming the gap. Most RoCE NICs then <em>go back N</em>: they resend every packet from the missing one onward, including all the ones that arrived fine. TCP, by contrast, uses selective acknowledgements and resends only what was lost. So a loss rate TCP handles well can sharply reduce RDMA throughput. Newer NICs add selective retransmission, but many deployed fabrics are still designed with go-back-N in mind.</p><p><strong>Prediction, before I measure it.</strong> I will inject 0.01 %, 0.1 % and 1 % loss on one link and compare RDMA writes with TCP. I expect RDMA throughput to fall much faster than TCP’s as loss rises, and the capture to show a NAK followed by a burst of resent packets. The result goes in The Ledger, whichever way it comes out.</p><p><strong>Ethernet has done lossless before.</strong> Storage networks never dropped frames: Fibre Channel only sends when the next hop has advertised buffer space. When storage moved onto Ethernet (FCoE), Ethernet gained a set of extensions called Data Center Bridging to match. RoCE reuses them, plus one congestion-control loop of its own,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQ7TN7wms-mtPvX-6zDhww.png" /><figcaption>RoCE</figcaption></figure><p><strong>The order matters: ECN first, PFC last.</strong> PFC is blunt. A pause stops a whole class on a link, the upstream switch then fills and pauses its own neighbours, and congestion can spread across the fabric. In the worst case pauses loop into a deadlock, or a faulty NIC pauses the network endlessly (a pause storm), which is why switches run a PFC watchdog. So the ECN threshold sits well below the PFC threshold: senders slow down before anyone has to pause.</p><p><strong>Lossless needs buffer held in reserve.</strong> After a switch sends PAUSE, bytes already in flight on the cable still arrive and need somewhere to land. That reserve, called <em>headroom</em>, grows with link speed and cable length. My calculator reproduces a published vendor example (27,592 bytes for 100G over 100 m) and gives about 22 KB per port and class for 400G over 10 m <em>(calculated)</em>. On a 128 MB switch with 64 ports of 800G and 100 m cables, headroom takes 5.8 % of the buffer for one lossless class, and 46 % for eight. That’s one reason many fabrics run one or two lossless classes rather than eight.</p><p><strong>My design</strong> puts this into the fabric’s intent, rendered to SONiC switch configuration <em>(design only, never run on a switch)</em>:</p><ul><li>RoCE traffic (DSCP 26) in its own lossless class, with PFC on that priority only.</li><li>CNPs (DSCP 48) in a strict-priority class, so the brake signal is never stuck behind the traffic it’s meant to slow.</li><li>Everything else in a normal lossy class.</li><li>ECN marking on the lossless queue, with thresholds below the PFC pause point, plus a PFC watchdog.</li></ul><p>On the lab hosts, the same classification ran for real: DSCP 26 traffic landed in the RoCE class and DSCP 48 in the CNP class, packet for packet <em>(emulated)</em>.</p><p><strong>What the lab showed about ECN.</strong> I squeezed a link to 500 Mbit/s with ECN marking on <em>(emulated)</em>:</p><ul><li><strong>TCP reacted.</strong> The switch marked packets, the receiver echoed the marks, and the sender backed off. Worst-case latency stayed low, but throughput fell about 10 % (0.40 vs 0.44 Gbit/s), because my thresholds were set at about one packet. Mark too early and you waste the link.</li><li><strong>RDMA didn’t.</strong> The switch marked 11,615 Soft-RoCE packets during a 3-second run, and the capture held <strong>zero CNPs</strong>. Soft-RoCE doesn’t implement DCQCN, so the marks reached a receiver that had no way to answer. In real deployments that loop runs in the RDMA NIC.</li></ul><p><strong>What this lab can’t show.</strong> The virtual links in containerlab have no PFC, so there are no pause frames, no congestion spreading and no pause storms. There is no DCQCN reaction and no NIC-speed behaviour. Those need real switches and RDMA NICs; here they stay a design, labelled as one.</p><p><strong>Where the industry is heading.</strong> Lossless Ethernet works, but it’s fragile to run at scale. The newer transports from section 3 (AWS’s SRD, the Ultra Ethernet Consortium’s transport) take a different path: spray packets, tolerate reordering, and retransmit selectively, so the occasional drop stops being a disaster. The network GPUs can rely on may end up being one that’s allowed to drop a packet, as long as the NIC is smart enough not to care.</p><h3>The Ledger</h3><p>Every claim in this article, with how real it is. Most of the network results are emulated or calculated, and the only real GPUs are two T4s in one server. That’s enough to show the mechanisms, not to claim production performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uenOV_LxQOUn0NRHXe8FZw.png" /><figcaption>Result details</figcaption></figure><p><strong>What I got wrong along the way:</strong></p><ol><li><strong>I timed the launcher, not the network.</strong> My first collective job times were over 98 % container start-up delay. The network part was milliseconds. I threw those numbers out and redesigned the test with shaped links and a synchronized start. Lesson: check what your stopwatch actually measures.</li><li><strong>My load generator cheated in ECMP’s favour.</strong> iperf3’s byte limit is shared across all its parallel streams, so streams that hashed onto the quieter link carried more bytes. A real collective gives every flow a fixed share and waits for all of them. The rerun with fixed bytes per flow is the one open result above.</li><li><strong>I called a calculated number measured.</strong> The slow-link figure that opens this article came from my sizing model, and an early draft said it was a lab run. I caught it while checking sources for this article.</li><li><strong>I assumed RDMA would run in containers.</strong> It didn’t. The kernel’s software RoCE sends only from the host’s own network namespace, so devices inside containers were created but never sent a packet. I moved the RDMA endpoints into two small VMs, each with its own kernel.</li><li><strong>I trusted the datasheet for the GPU path.</strong> My first collective model assumed a direct GPU-to-GPU link and came out 69–89 % too optimistic. NCCL had taken the long way through CPU memory.</li><li><strong>I set the ECN thresholds too low.</strong> Marking at about one packet made TCP back off before the link was full. Correct, but wasteful.</li></ol><p><strong>What none of this shows:</strong> real RDMA NICs, switch ASIC hashing at line rate, PFC pause frames, DCQCN reacting to congestion, NVLink, or NCCL running across servers. Those need real hardware, and until I’ve run on it, they stay design.</p><h3>Run It Yourself</h3><p>Everything above lives in one public repository: <a href="https://github.com/veldanda3415/goodput-stack">github.com/veldanda3415/goodput-stack</a>. Each result in The Ledger traces back to a script, its raw output and a write-up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uvlmvL1PVU8I3WwRsaJ4rA.png" /><figcaption>github folder and result details</figcaption></figure><p><strong>To run the lab</strong> you need a Linux machine (WSL2 works) with KVM, containerlab and Podman, and the rdma_rxe kernel module for Soft-RoCE. Exact versions are pinned in the repo.</p><pre>git clone https://github.com/veldanda3415/goodput-stack &amp;&amp; cd goodput-stack<br>make fabric-up &amp;&amp; make fabric-test   # build the leaf-spine, check BGP, BFD and reachability<br>make fabric-e1                       # ECMP: L3 vs L4 hashing<br>make fabric-e4                       # ECN marking, TCP and Soft-RoCE<br>make fabric-e5                       # collective traffic patterns vs ECMP<br>python -m fabric.tools.ecmp_collision    # the odds table in section 3<br>make fabric-down</pre><p>The NCCL runs need nothing but a free Kaggle account: pick the “GPU T4 ×2” accelerator and run benchmarks/nccl/t4_handson.sh in a notebook.</p><p><strong>If you have real hardware, this is where you can help.</strong> The gaps in The Ledger are all hardware I don’t have. Results from any of these would be welcome as an issue or pull request:</p><ol><li><strong>NCCL across two or more servers over RoCE</strong>, with 1, 4 and 8 queue pairs per connection, under L3 and L4 hashing. Does job time follow the busiest link, as it did here?</li><li><strong>Loss against go-back-N on a real RDMA NIC</strong>, at 0.01 %, 0.1 % and 1 % loss, ideally on NICs with and without selective retransmission.</li><li><strong>The lossless QoS design on a real switch:</strong> PFC pause counts and ECN marks under incast, with the thresholds from fabric/qos/.</li><li><strong>The T4 script on an NVLink server</strong>, to see which transport NCCL picks when the GPUs share NVLink.</li></ol><p>Please include the hardware, software versions, exact commands and raw logs, and label each result the way this article does: real, emulated, calculated or design only.</p><h3>The Road Ahead</h3><p>Everything in this article gets harder at 10,000 GPUs, and the same rule decides each problem: the job runs at the speed of its slowest link.</p><ul><li><strong>A third tier brings polarization.</strong> Past the two-tier ceiling, flows pass through more hashing stages. If every tier hashes the same fields the same way, a spine only ever sees flows its leaf already sorted onto one uplink, and it sends them all down the same subset of paths. Each tier needs a different seed or different fields.</li><li><strong>Failures reshuffle healthy flows.</strong> With simple modulo hashing, losing one link can remap many flows that were on healthy links, so collectives that were fine get moved mid-step. <em>Resilient hashing</em> keeps a fixed bucket table and moves only the dead link’s flows.</li><li><strong>How a link fails matters more than whether it fails.</strong> In my emulated drills, a link flapping every few seconds cost a step more than 30 seconds, while a link that simply died cost about 8. In that lab, damping flaps would have bought more than faster failover.</li><li><strong>Averages hide the problem.</strong> A dashboard of average link use looks healthy while one uplink is full and a whole job waits on it. The metric to watch is the busiest link, with per-queue ECN marks and PFC pauses beside it.</li><li><strong>The transport is changing underneath.</strong> Packet spraying with NICs that reorder, and selective retransmission instead of go-back-N, attack the root cause: the reason ECMP hashes per flow in the first place.</li></ul><p><strong>The takeaway.</strong> AI cluster performance isn’t a property of any one layer. It comes from four things acting together: where traffic is placed (hashing and entropy), how tightly the collective synchronizes the GPUs, the topology underneath (rails and tiers), and how the transport behaves under loss, reordering and congestion. Tune any one of them alone, and the slowest link still sets the pace.</p><p><strong>Next in the series:</strong> the other end of the stack. The gateway that picks which GPU server answers a prompt has the same blind spot as ECMP: it counts requests, not their size. I’ll show what that cost and the one setting that fixed it. After that, operating the fabric: failure drills, and why recovering from a failure hurt more than the failure itself.</p><h3>References</h3><ol><li>W. Wang, M. Ghobadi, K. Shakeri, Y. Zhang, N. Hasani. <a href="https://arxiv.org/abs/2307.12169">Rail-only: A Low-Cost High-Performance Network for Training LLMs with Trillion Parameters</a>. arXiv 2307.12169 (2023); IEEE HOTI 2024. Source of the 38–77 % network cost and 37–75 % power estimates in section 4.</li><li>A. Gangidi et al. (Meta). <a href="https://engineering.fb.com/wp-content/uploads/2024/08/sigcomm24-final246.pdf">RDMA over Ethernet for Distributed AI Training at Meta Scale</a>. ACM SIGCOMM 2024. Low entropy and ECMP in a production RoCE training fabric.</li><li>Y. Zhu et al. <a href="https://www.microsoft.com/en-us/research/publication/congestion-control-for-large-scale-rdma-deployments/">Congestion Control for Large-Scale RDMA Deployments</a>. ACM SIGCOMM 2015. The original DCQCN paper, section 5.</li><li>L. Shalev et al. (AWS). <a href="https://www.amazon.science/publications/a-cloud-optimized-transport-protocol-for-elastic-and-scalable-hpc">A Cloud-Optimized Transport Protocol for Elastic and Scalable HPC</a>. IEEE Micro 2020. SRD’s packet spraying, sections 3 and 5.</li></ol><p>All other numbers come from my own runs and calculations; see The Ledger and the repository.</p><p><em>I used Claude as a pair-programmer and writing partner for this series. The design decisions, architecture and experiments are my own, and every result comes from my own runs or calculations, labelled as such.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f12fd02741" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Equal Cost Is a Lie: The Strange Physics of GPU Traffic]]></title>
            <link>https://medium.com/@ravikiran.veldanda/equal-cost-is-a-lie-the-strange-physics-of-gpu-traffic-b7ae2cc18ce5?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7ae2cc18ce5</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sun, 18 Oct 2026 21:49:55 GMT</pubDate>
            <atom:updated>2026-10-18T21:49:55.070Z</atom:updated>
            <content:encoded><![CDATA[<p>Oct 18, 2026 · @Ravi Kiran Veldanda</p><p><em>From the moment you press Enter to the links between GPUs: what I learned routing, scaling and networking open-source LLMs.</em></p><h3>The Pause Before the First Word</h3><p>Type a question into ChatGPT and press Enter. There’s a short pause, then the answer appears a few words at a time, as if someone were typing it. Behind it is a large language model (LLM), and that rhythm holds the whole story of this article, so it’s worth slowing down on.</p><p><strong>The pause is the model reading.</strong> Before it can write anything, it has to process your entire prompt: the question, every earlier message in the chat, any document you pasted in. Engineers call this step <em>prefill</em>. The wait it causes is the <strong>time to first token (TTFT)</strong>. A token is a chunk of text, roughly three-quarters of a word. The longer the prompt, the longer the reading, and the longer you stare at an empty reply.</p><p><strong>Then the model writes, one token at a time.</strong> Each new token depends on all the ones before it, so it can’t skip ahead or write in parallel. This step is <em>decode</em>, and the gap between tokens is the <strong>inter-token latency (ITL)</strong>. It’s what makes a reply feel smooth or halting.</p><p><strong>While it works, the model keeps notes.</strong> Rather than re-reading the whole conversation for every new word, it keeps what it has already worked out in the memory of the GPU (graphics processing unit), the chip that runs the model. That store is the <strong>KV cache</strong> (short for key-value cache, after the two kinds of notes it keeps). It grows with every token, and it stays occupied until the reply is finished. GPU memory is fixed, so the KV cache sets how many conversations one GPU can serve at the same time.</p><p><strong>And the model itself is big.</strong> A model’s size is counted in <em>parameters</em>, the numbers it learned in training. At standard 16-bit precision each parameter takes 2 bytes, so an 8-billion-parameter model needs about 16 GB just to load. That fills a 16 GB NVIDIA T4, the free GPU I used, before a single conversation starts. A 70-billion-parameter model needs about 140 GB, far more than an 80 GB NVIDIA H100, a common data-center GPU, can hold, and that’s before any room for the KV cache. So it’s split across several GPUs, each holding a slice, and to produce every token those GPUs exchange their partial results, over and over. Inside one server that traffic crosses fast internal links; across servers, it crosses the network. Storing the numbers in fewer bits (<em>quantization</em>, for example 4-bit instead of 16-bit) shrinks the model to fit, at some cost in accuracy.</p><p><strong>Picture a row of water dispensers.</strong> Each dispenser is a GPU running the model, and it has a few taps: the memory that lets it serve several people at once. Everyone in line carries a bottle. Some carry a small cup, some a five-gallon jug. A jug holds its tap far longer than a cup, so a few jugs can tie up a dispenser while the cups behind them wait. Now add an attendant who sends each newcomer to the line with the fewest people. A line of two people carrying jugs looks shorter than a line of five with cups, and it’s the slower one.</p><p><strong>None of this would matter without a promise.</strong> Serious services are judged against one. A <em>service-level objective (SLO)</em> is the target a team sets itself, for example “the first word within one second for 99 of every 100 requests, then smooth typing after that”. A <em>service-level agreement (SLA)</em> is the same promise written into a contract, with penalties when it’s missed. Without a promise, slow is just slow. With one, every jug sent to the wrong line is a broken promise, and the usual cure, buying more GPUs, is the most expensive one there is.</p><p>When you use ChatGPT, the provider keeps that promise for you. Many organizations can’t hand their data over that way: governments, banks, hospitals, sites with no internet connection at all. They run open-weight models such as Llama or Qwen on their own hardware, and the reading, the typing, the memory, the dispensers and the promise all become theirs to engineer.</p><p>The attendant in that picture is a load balancer, and counting heads is how most load balancers work. The next section is about why that habit, learned from web traffic, breaks here.</p><h3>Mice and Elephants</h3><p>Network engineers learned this lesson long before LLMs. Most traffic on a network is <em>mice</em>: short, small flows, like loading a web page. A few flows are <em>elephants</em>: long, heavy transfers, like a backup or a video stream. Tools built for mice spread traffic by counting or by chance, and they work beautifully until a handful of elephants land in the same place. Then one link or one server drowns while its neighbors sit idle.</p><p>Web services are built for mice. A page request is small, every request costs about the same, it finishes in milliseconds, and any server can answer it. So the load balancer in front can be simple. Send requests in turn (<em>round-robin</em>), or to the server with the fewest open connections, and the numbers even out on their own.</p><p>Every LLM request is a potential elephant, and the load balancer can’t tell which:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2Zuo8e8Z7h3Sfip8pQgwQ.png" /><figcaption>WebRequest Vs LLM Request</figcaption></figure><p><strong>First, “busy”.</strong> A GPU doesn’t serve one request at a time. It serves many at once, folding new requests into the running batch as old ones finish (<em>continuous batching</em>). So a GPU is never simply busy or free. Each request it takes on makes it a little slower for everyone, until its memory is full and newcomers have to wait in line. Through all of this, the health check still passes, the CPU still looks idle, and every web-era signal says the server is fine.</p><p><strong>Second, “where it should go”.</strong> Many requests begin the same way: the same system instructions, the same shared document. A replica that has already read that opening can keep its notes and skip reading it again, a trick called <em>prefix caching</em>. So sending a request to a replica that has seen its first half saves real work. It’s a little like session stickiness in web load balancing, except what you’re preserving is computation, not a login.</p><p>Put together, the right question isn’t “which server has the fewest requests?” It’s “which replica can start this request soonest and finish it within the promise?” Answering that takes the engine’s own view: how many requests are waiting, how much memory is free, which prompts it already holds, and how much reading is already queued. A load balancer that asks the engine instead of counting heads is called <em>inference-aware</em>.</p><p><strong>Goodput is how you keep score.</strong> Throughput counts every token produced. <em>Goodput</em> counts only the useful ones: tokens delivered within the SLO, per GPU. A server can post impressive throughput while half its users wait past the promised first word, and then its goodput is half of what the throughput suggests. Every layer in this article is judged by goodput, because it’s the number that connects the promise to the bill. More goodput per GPU means keeping the same promise with fewer GPUs.</p><p><strong>Then the elephants come back, between the GPUs.</strong> Earlier, we saw that a large model is split across GPUs that swap partial results for every token, and training jobs do the same on a far bigger scale. That traffic is the purest elephant there is: a few huge flows, all starting at the same moment, with every GPU waiting for the slowest one to finish. Data-center networks usually spread flows over several equal paths by hashing each flow onto one of them, a technique called <em>ECMP</em> (equal-cost multipath). With thousands of mice, the hashing evens out. With a few elephants, two can land on the same link while the others sit empty, and the whole job runs at the speed of that one crowded link. The paths cost the same; the load on them doesn’t. Equal cost is a lie.</p><p>None of this is news to the people who build inference platforms. The next section looks at what they’ve built, and the question it still leaves open.</p><h3>Smarter Gateways, Same Blind Spots</h3><p>The industry saw the elephants coming. Over the last two years the open-source world has built load balancers that ask the engine instead of counting heads, and serving platforms around them. Self-hosting an LLM no longer means writing your own router.</p><p><strong>First, there are two kinds of “AI gateway”.</strong> The name covers two different jobs, and they’re easy to confuse:</p><p>• <strong>Cross-provider gateway</strong> (for example LiteLLM or Envoy AI Gateway). Decides <em>which model or provider</em> gets a request. It manages API keys, tracks spending, and fails over to another provider when one goes down. In the dispenser picture, it chooses which building you walk into.</p><p>• <strong>Inference gateway.</strong> Decides <em>which copy of the same model</em> gets the request, using each engine’s live state: how many requests are waiting, how much memory is free, which prompts it already holds. It chooses the dispenser inside the building.</p><p>Self-hosting needs the second kind, and that’s the kind this article is about.</p><p><strong>The building blocks for that second kind now exist:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xS7yrI5viMfDsX99aUQ1zA.png" /><figcaption>goodput-stack building blocks</figcaption></figure><p><strong>So where are the blind spots?</strong> Every one of these projects documents what it does. None of them can tell you where it fails on <em>your</em> workload, because that depends on things only you know: how long your prompts are, how bursty your traffic is, how big your model is, what your network looks like. The losses that matter rarely show up as errors. They show up as a slow first word while every dashboard stays green. Five blind spots sit underneath that, and none of them can be fixed by tuning alone:</p><p>• <strong>Every layer reports its own health; none reports the user’s.</strong> The engine reports tokens per second. The GPU reports utilization. The gateway reports requests and errors. The network reports links up. The promise itself (first word on time, smooth typing after) isn’t any layer’s metric, so everything can look healthy while users wait. For example, most routing scores count requests, not tokens, and a request still waiting in line hasn’t taken any GPU memory yet. So three long documents queued on one replica can look lighter than five short questions queued on another, and no dashboard flags the difference.</p><p>o <strong>What the lab does:</strong> measures goodput where the user sits, at the client, end to end, then compares what the user saw with what each layer reported at the same moment.</p><p>• <strong>Hundreds of knobs, and no way to tell which one matters.</strong> Thresholds, refresh intervals, batch limits and timeouts are all configurable; that’s the point. The tools ship the knobs, but not which ones matter for your traffic, what values to use, or what each change costs elsewhere. Reading engine state more often, for instance, routes on fresher data but puts more load on the engines. Without a way to reproduce the failure, tuning is guessing.</p><p>o <strong>What the lab does:</strong> single-question probes that reproduce one failure on demand. Write down a prediction, measure, turn one knob, measure again.</p><p>• <strong>Each layer is right on its own; goodput is lost in the seams.</strong> Every component can be configured correctly and the failure still happens between them. What should happen if the routing component crashes: stop all traffic, or keep serving without its advice? When a user closes the browser tab, does the engine stop writing, or keep spending the GPU on an answer nobody will read? An autoscaler can start a fresh replica when demand rises, but if the gateway in front gives up waiting first, the user gets an error anyway. No single project owns these seams, so no single project’s documentation covers them.</p><p>o <strong>What the lab does:</strong> tests the integrated stack rather than components one at a time, including deliberate failure drills.</p><p>• <strong>Published benchmarks answer a different question.</strong> They usually report one engine on one GPU, with a fixed prompt mix, at peak throughput. The question a team actually has is different: with <em>my</em> prompts and <em>my</em> SLO, how many GPUs do I need, and what does each token cost? Throughput isn’t goodput, and their hardware isn’t yours.</p><p>o <strong>What the lab does:</strong> engine sweeps on real GPUs across load levels, batch limits and quantization; GPU memory capacity predicted from the model’s size, then checked against the real thing; cost per million tokens.</p><p>• <strong>Capacity is planned in two languages.</strong> Serving teams think in tokens, users and GPU memory. Network teams think in links, gigabits and paths. A model split across GPUs turns tokens into network traffic, and almost nobody translates between the two. The result is a fabric sized for the wrong traffic, or a model placed across a link that’s already crowded.</p><p>o <strong>What the lab does:</strong> follows one request from tokens, to GPU memory, to the traffic between GPUs, to the links that carry it. A model of that traffic is checked against real GPUs, and a fabric is designed and sized from it.</p><p>None of these is a bug in a single project. They live in defaults and in the seams between projects, which is exactly why no single project’s documentation can show them to you.</p><p><strong>That’s what goodput-stack is for.</strong> It isn’t another platform to adopt. It’s an evaluation lab for the open inference stack, built to give an AI infrastructure engineer one holistic view: how well the GPUs are actually used, with the network behind them in mind, so the GPUs and the fabric that connects them can be planned together instead of separately. The goal is simple to state: serve open-weight models within the promise on the fewest GPUs, and know which layer to blame when that fails. I integrated the components a production team would actually choose, then measured where each blind spot costs goodput. Two rules run through all of it:</p><p>• <strong>A label on every number.</strong> Real GPU, simulated, emulated or design-only, stated before the number, so a laptop result is never mistaken for a cluster one.</p><p>• <strong>The smallest fix first.</strong> Tune what’s already there before writing new code, and write up what’s still missing for the upstream projects.</p><p>That makes it useful to three kinds of reader. Teams choosing an inference gateway get a list of what to test before trusting the defaults. Network engineers asked to build an AI fabric see what this traffic does to their design. And engineers learning the stack can run all of it on a laptop and a free GPU.</p><p>The next section follows one request through all of it.</p><h3>Down the Stack</h3><p>Here is the path one request takes, from the moment you press Enter to the wires between GPUs. Each layer makes its own decision about where the request goes or what it gets, and each decision is a place where goodput can be won or lost.</p><p>One request through goodput-stack, from Enter to the fabric:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YuhS2vA0yXa__azl4OByTg.png" /><figcaption>goodput-stack block diagram</figcaption></figure><p>The request runs down the left column. The endpoint picker advises the gateway, the autoscaler and scheduler act on the engines from the side, and observability sits under everything.</p><h3>The front door: the gateway</h3><p>The request arrives in the same format ChatGPT-style apps already use (the OpenAI API), and the reply streams back token by token. The gateway, <a href="https://agentgateway.dev/">agentgateway</a> in my lab, accepts it, checks it and holds the connection open for the whole reply. Before forwarding anything, it stops to ask one question: <em>which replica should take this?</em> It doesn’t answer that itself. Through the <a href="https://gateway-api-inference-extension.sigs.k8s.io/">Gateway API Inference Extension</a>, a Kubernetes standard, it hands the question to a separate component.</p><h3>The attendant: the endpoint picker</h3><p>That component is the <em>endpoint picker</em>, here the one from llm-d. It’s the attendant from the water dispensers, except it doesn’t count heads. It reads each replica’s live state and scores it: how many requests are waiting, how much memory is free, whether the replica already holds this prompt’s opening text, and (once tuned) how much reading is queued in tokens. The highest score wins, and the gateway forwards the request there. If the picker itself goes down, the pool can be set to keep serving without its advice, routing blind instead of refusing traffic.</p><p>My first version of this layer was a router I wrote myself, to learn the mechanics. I threw it away and replaced it with what a production team would actually deploy. The scoring logic is llm-d’s work, not mine. My part is the integration, the probes that test what it claims, and closing the gaps they found with the smallest change that worked. Testing real components taught me more than building a toy one would have.</p><h3>The dispensers: the engines and their memory</h3><p>The chosen replica runs an <em>inference engine</em>: the software that actually runs the model. <a href="https://github.com/vllm-project/vllm">vLLM</a> is the common choice on GPUs, and <a href="https://github.com/ggml-org/llama.cpp">llama.cpp</a> runs models on ordinary CPUs. This is where the mechanics from the start of this article happen: reading the prompt, writing token by token, batching many requests together, and keeping the KV cache in memory. It’s also where the big trade-offs live: how many requests to batch at once, and how many bits to store the model in.</p><p>In my lab, the replicas behind the gateway are llama.cpp on a CPU and a simulator that behaves like vLLM, because I have no local GPU. Real vLLM runs separately on a free Kaggle T4 GPU, where I measured memory, speed and cost directly.</p><h3>More dispensers when the line grows: the autoscaler</h3><p>When requests start waiting, the autoscaler adds replicas, and it removes them when the line clears, all the way down to zero. Web autoscalers usually watch CPU. That’s the wrong signal here, because an engine can be overwhelmed while its CPU sits nearly idle. <a href="https://keda.sh/">KEDA</a> (Kubernetes Event-driven Autoscaling) in my lab scales on the number of requests waiting for a slot instead. Starting a replica takes time, so the gateway in front has to hold the request long enough for the new replica to come up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7qpWhBU_sBr3A0-D5KFpg.jpeg" /><figcaption>idea of dispensers</figcaption></figure><h3>Where the dispensers stand: the GPU scheduler</h3><p>Something has to decide which machine each replica, or each training job, runs on. Kubernetes hands out GPUs whole: a pod gets one GPU, or two, never half. On top of that, <a href="https://kueue.sigs.k8s.io/">Kueue</a> manages queues of GPU work for teams. It gives each team a quota, lets a team borrow GPUs another team isn’t using, takes them back when the owner needs them, admits a multi-GPU job only when <em>all</em> its GPUs are free, and keeps a job’s GPUs close together in the network. A health check fences off a GPU machine that fails, so new work stops landing on it. I tested all of this on simulated GPUs, since real ones can’t be faked on a laptop.</p><h3>The wires between GPUs: the fabric</h3><p>When a model or a job spans GPUs in different servers, every token depends on the network. AI clusters are usually wired as a <em>leaf-spine</em>: each server connects to a leaf switch, and every leaf connects to every spine, so any two servers are two hops apart over many equal paths. Large clusters add a twist called <em>rail-optimized</em> design. GPU number one in every server connects to the same leaf, GPU number two to the next, and so on, so the GPUs that talk most share a switch.</p><p>The traffic itself rides <em>RoCE v2</em> (RDMA over Converged Ethernet, where RDMA means remote direct memory access), which lets one GPU’s memory write directly into another’s over Ethernet without the CPU in the middle. That speed comes with a demand: RoCE expects a network that doesn’t drop packets. So switches signal congestion early with <em>ECN</em> (Explicit Congestion Notification) marks, slow senders down with a control loop called <em>DCQCN</em> (Data Center Quantized Congestion Notification), and as a last resort pause a link briefly with <em>PFC</em> (Priority Flow Control). Routing between switches runs on BGP (Border Gateway Protocol), and BFD (Bidirectional Forwarding Detection) detects a dead link in a fraction of a second rather than waiting for slower protocol timers.</p><p><strong>How networks tame elephants.</strong> This is where the elephants from earlier do the most damage, and networks have four broad answers:</p><p>• <strong>More entropy.</strong> Split one big transfer into many smaller flows, so the hashing has more to spread. NCCL (NVIDIA Collective Communications Library), the library GPUs use to exchange data, can open several connections per pair for exactly this reason.</p><p>• <strong>Smarter path choice.</strong> Move a flow during a natural pause in it (<em>flowlet switching</em>), or let switches pick the least-loaded path as traffic arrives (<em>adaptive routing</em>).</p><p>• <strong>Packet spraying.</strong> Send each packet down a different path and let the receiver put them back in order, the direction newer AI networking efforts are taking.</p><p>• <strong>Engineered placement.</strong> Pin known elephants to chosen paths, or design the topology and the job placement so elephants rarely share a link at all.</p><p>My fabric lab is an emulated leaf-spine built in containerlab, rendered from a single description of the intended design, with real RDMA traffic between two virtual machines on the same PC, using a software version of RoCE (Soft-RoCE), and collective-style load. It tested the first answer, more entropy, directly. Adaptive routing and packet spraying need real switch hardware, so they appear in the design but not in the measurements, and so does PFC. I also measured real GPU-to-GPU traffic with NCCL on two T4s in one machine, to check the model of that traffic against something real.</p><h3>Watching all of it: observability</h3><p>Underneath every layer, Prometheus collects the numbers and Grafana shows them: time to first token, inter-token latency, tokens per second, requests waiting, memory in use. These dashboards are only useful if they measure what the user feels, which is why the lab measures at the client as well as inside each layer.</p><p>Most of the boxes in that picture are other people’s software. What’s mine is how they’re put together, the tests that hold each one to its claims, the tuning, the fabric design, and a label on every result. The next section is the ledger: what broke, what fixed it, and how real each number is.</p><h3>The Ledger</h3><p>Here’s what the blind spots cost when I measured them, layer by layer, in the same top-to-bottom order. Every number comes from a recorded run in the repo’s <a href="https://github.com/veldanda3415/goodput-stack/blob/main/RESULTS.md">RESULTS.md</a>, and every row carries a label saying how real it is. Read the label before the number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slrMMmBXF8edtyXz0kP-gg.png" /><figcaption>Results from goodput-stack</figcaption></figure><p>Read down the third column and a pattern shows. <strong>Most of the fixes were not new code.</strong> They were a setting that already existed, a better signal, or a design choice, made once a measurement showed where the loss was. My own plan was wrong once along the way: I set out to write a custom routing plugin, then found that llm-d already had one, switched off by its defaults. Two items are still open, and they stay in the ledger as open.</p><h3>How to read the labels</h3><p>I had no GPU cluster, no RDMA network cards and no switch that does PFC. Instead of hiding that, every result says where it came from:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yr7Np_MWkXJMCukZb-YRVQ.png" /><figcaption>How to read Evidence labels</figcaption></figure><p><strong>What this doesn’t show:</strong> behavior at production scale, real lossless Ethernet under heavy many-to-one traffic, real GPUs behind the gateway, and gateway capacity above 16 concurrent clients. These are open items in the repo’s <a href="https://github.com/veldanda3415/goodput-stack/blob/main/docs/gaps.md">gap log</a>, next to the questions I couldn’t close.</p><h3>The Road Ahead</h3><p>The build phase is complete: every layer in scope is in the repo with recorded evidence. It’s a lab you can reproduce, not a platform to put production traffic on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ib99Ycvvq4j-E6_bHEOOtw.png" /><figcaption>goodput-stack readiness as of 10/18/2026</figcaption></figure><p>Before anyone should call it production-ready, three things are missing: a highly available gateway (today it runs on one node), real GPUs behind the gateway instead of beside it, and client disconnects that free the engine’s slot.</p><h3>How to use it</h3><p>There are three ways in, depending on what you run. Everything is open source under Apache-2.0.</p><p>1. <strong>You’re choosing an inference gateway.</strong> Read <a href="https://github.com/veldanda3415/goodput-stack/blob/main/deploy/gateway/GAPS.md">GAPS.md</a> for what the stock stack does and doesn’t do, then run the probes against your own setup. Today they’re written against this lab’s pools; packaging them to run against any OpenAI-compatible gateway is the next step.</p><p>2. <strong>You’re designing an AI fabric.</strong> Start from <a href="https://github.com/veldanda3415/goodput-stack/blob/main/fabric/DESIGN.md">DESIGN.md</a>. Edit the single intent file, render router and switch configs from it, validate them offline with Batfish, then bring up the lab and run the failure drills.</p><p>3. <strong>You want to learn the stack hands-on.</strong> All of it runs on a CPU-only workstation and a free Kaggle T4.</p><p>Prerequisites: k3s, Helm 4, kubectl and Python 3, with the Gateway API and Inference Extension resources and the agentgateway controller already installed. The fabric needs containerlab on rootful Podman, and the GPU runs need a Kaggle account.</p><pre>git clone https://github.com/veldanda3415/goodput-stack &amp;&amp; cd goodput-stack<br> make check-env &amp;&amp; make venv<br> make deploy ENV=k3s # engines + gateway<br> make epp-deploy # one endpoint picker per InferencePool<br> .venv/bin/python scripts/smoke_test.py - runs 10<br> make obs-up &amp;&amp; make keda-up # dashboards, queue-depth autoscaling<br> make probe-p8 # the request-size routing probe<br> make t4-run STAGE=baseline # vLLM on a Kaggle T4<br> make fabric-up &amp;&amp; make fabric-test</pre><p>make help lists every target, and the <a href="https://github.com/veldanda3415/goodput-stack#quick-start-k3s-lab">README</a> has the full steps.</p><h3>What changes at thousands of GPUs</h3><p>The mechanisms stay the same at scale; the cost of getting them wrong grows. A size-blind router across four replicas costs a few seconds of waiting. Across a fleet, it’s GPUs bought to absorb a queue that better routing would have spread out. A hash collision in a lab slows one job. On a training fabric, it slows every job sharing that link. A slow recovery in an emulated lab loses a few seconds of traffic. On a rail-optimized cluster, it stalls the whole collective. That’s why the network half of this project exists at all: it’s where tokens turn into GPU memory, and GPU memory turns into traffic on the links.</p><h3>The series</h3><p>Each of the next articles takes one layer of this stack and goes deep: the assumption that breaks, my prediction, the measurement, what I got wrong, the smallest fix, and what it doesn’t show.</p><p>1. <strong>AI fabric design:</strong> leaf-spine and rail-optimized topologies, ECMP entropy, RoCE v2 and lossless Ethernet, and NCCL on two T4s.</p><p>2. <strong>Inference routing:</strong> how the endpoint picker decides, the probes that tested it, and tuning an upstream scorer.</p><p>3. <strong>Operating an AI fabric under failure:</strong> BFD, flapping links, link recovery, Batfish validation and runbooks.</p><p>4. <strong>GPU memory and cost:</strong> KV-cache math, batching, quantization and cost per million tokens on a real T4.</p><p>5. <strong>Autoscaling and GPU scheduling:</strong> KEDA on queue depth, scale-from-zero, Kueue and node-health fencing.</p><blockquote>The code, configurations, probes and raw results are all at <a href="https://github.com/veldanda3415/goodput-stack">github.com/veldanda3415/goodput-stack</a>.</blockquote><p>If you run inference or AI fabrics in production, I’d like to hear where your defaults lost goodput, and which blind spot I missed.</p><blockquote><em>A note on how this was made: I used Claude, Anthropic’s AI assistant, as a pair programmer and writing partner for both the code and this article. The architecture, design decisions, experiments and conclusions are my own, and every number here comes from a recorded run in the repo.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7ae2cc18ce5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How an Agentic System Actually Works — Traced Through One BGP Flap]]></title>
            <link>https://medium.com/@ravikiran.veldanda/how-an-agentic-system-actually-works-traced-through-one-bgp-flap-200f3fac6ded?source=rss-9647b1a10db1------2</link>
            <guid isPermaLink="false">https://medium.com/p/200f3fac6ded</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[ravikiran veldanda]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 20:51:06 GMT</pubDate>
            <atom:updated>2026-09-12T20:51:06.638Z</atom:updated>
            <content:encoded><![CDATA[<p>Every “agentic AI” conversation eventually collapses into the same five nouns: an LLM, an orchestrator (ADK, LangGraph, the Claude or OpenAI Agent SDK — pick your framework), MCP servers, a RAG store, and a knowledge graph. Not every system uses all five — plenty of agents are just an LLM plus MCP tools, no graph, no vector store — but the moment a system reaches for more than tool-calling, it’s reaching for one of these four, so treat the shape below as the ceiling, not a checklist. Framework docs explain each one in isolation. What’s harder to find is the thing that actually matters when you’re designing one of these systems: the <em>order</em> they fire in, and which one owns which kind of question.</p><p>So instead of another architecture diagram with five boxes and no timeline, here’s one incident, traced hop by hop, with a rule at the end you can reuse for the next design question without redrawing any of this.</p><h3>The incident</h3><p><strong>03:14 UTC</strong> — the BGP session between edge routers <strong>R1</strong> (Ashburn) and <strong>R2</strong> (Denver) flaps three times in 90 seconds. Monitoring opens <strong>ticket #4471</strong>, severity SEV3, and hands it to the ops agent.</p><p>Nothing below is specific to networking. Swap the router for a database and the runbook for a policy doc, and the shape doesn’t change.</p><h3>The trace</h3><p>Time runs top to bottom. In this plan-then-synthesize design, the two <strong>LLM</strong> hops are the only moments anything is actually “thinking” — everything else is deterministic plumbing the orchestrator drives. (Other agent patterns, like a ReAct-style loop, call the LLM once per tool step instead of twice total — same five layers, just more thinking hops.)</p><figure><img alt="The Agentic System Flow" src="https://cdn-images-1.medium.com/max/976/1*KUd3DP1T0afWZHumcHUT3A.png" /></figure><h3>Walking the trace</h3><p><strong>1 — Alert becomes a task.</strong> <em>Orchestrator.</em> Monitoring’s webhook lands on the orchestrator, not on the LLM. It opens a run: a shared state object holding the raw alert, the ticket ID, and an empty evidence list. Nothing intelligent has happened yet — this is intake.</p><p><strong>2 — First LLM call: triage and plan.</strong> <em>LLM.</em> The orchestrator sends the alert to the LLM along with a description of the tools available. Its only job here is judgment: how severe is this, and what evidence would a network engineer ask for first? It returns a plan, not an answer — {&quot;need&quot;: [&quot;topology&quot;, &quot;live_bgp_state&quot;, &quot;past_incidents&quot;]}.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gtQUiizHEfrZhy1OMK_reA.png" /><figcaption>Agentic Anatomy</figcaption></figure><p><strong>4a — Knowledge graph: what’s connected.</strong> <em>Knowledge Graph.</em> “Need topology” becomes a graph query — query_topology(link=R1↔R2, depth=2) — against a graph built from CMDB/topology feeds: routers, links, and services as nodes; connects_to, depends_on, owned_by as edges. This is exact multi-hop traversal, not a similarity search — the same query returns the same subgraph every time, which is why it&#39;s the layer to trust for &quot;what else does this touch.&quot;</p><p><strong>4b — MCP: what’s true right now.</strong> <em>MCP.</em> In parallel, the orchestrator’s MCP client calls a network-ops MCP server exposing get_bgp_session_state(), get_interface_counters(), and get_recent_config_diffs(). That server is the only thing that actually talks to the routers, over SNMP, gNMI, or a vendor API. The LLM never touches a device — it only ever sees the JSON this server hands back.</p><p><strong>4c — RAG: has this happened before.</strong> <em>RAG.</em> Also in parallel, the orchestrator embeds a query and searches a vector store built, well before this incident, from runbooks, vendor knowledge bases, and past postmortems. It returns the top-k chunks with their source citations — fuzzy and semantic, useful for “how was this fixed last time,” not for hard facts.</p><p><strong>5 — Evidence lands in shared state.</strong> <em>Orchestrator.</em> The subgraph, the live device data, and the retrieved chunks all write into the same state object opened in step 1. This is the only place they ever meet — no layer below the orchestrator knows the other two exist.</p><p><strong>6–7 — Second LLM call: synthesize.</strong> <em>LLM.</em> Only now does the LLM see everything at once, formatted into its context window. Its job is judgment again, not retrieval: weigh the evidence and produce a structured diagnosis — root-cause hypothesis, a confidence score, a proposed fix. E.g., <em>“MTU mismatch introduced by the 02:14 UTC config push; confidence 0.82; recommend reverting MTU on R1 Gi0/1.”</em></p><p><strong>8 — Human approval gate.</strong> <em>Orchestrator.</em> Anything with a side effect pauses here — a workflow rule the orchestrator enforces, not something the LLM decides on its own. A human (or an auto-approve policy for low-risk, read-only fixes) confirms before restart_bgp_session() is allowed to run.</p><p><strong>9 — Execute the fix.</strong> <em>MCP.</em> Once approved, the orchestrator issues the write-capable MCP call — same protocol as step 4b, different tool. The read/write distinction, and which tools need approval, lives in the orchestrator’s tool registry, not in the model.</p><p><strong>10 — Close the loop.</strong> <em>Orchestrator.</em> The orchestrator renders the LLM’s structured output — hypothesis, action taken, RAG citations, graph evidence — back into the ticket. Everything a human reviews afterward traces to a specific tool call or retrieval, never to an unexplained model opinion.</p><h3>The five layers, plain</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*QSzH22_R5ajHJsGmO5Vk3A.png" /><figcaption>Five layers Table 1</figcaption></figure><h3>Where it breaks</h3><p>The same five layers, but the failure modes that actually show up on-call — grounded in the incident above, not hypothetical.</p><p><strong>Orchestrator — state-machine failures</strong></p><ul><li><em>Loop without progress</em> — the LLM re-requests a tool it already has the answer for. Cap retries per step and fail into “needs human,” don’t let it spin.</li><li><em>Silent partial fan-out</em> — one of the three parallel calls (say RAG) times out. If the gap isn’t marked explicitly in state, the LLM never learns a source was missing and reasons as if it had full evidence.</li><li><em>Approval-gate bypass</em> — a tool-registry tagging bug marks a write tool as read-only, and restart_bgp_session() runs without a human ever seeing it. Config error, not model error — exactly what an audit should look for.</li></ul><p><strong>LLM — reasoning failures</strong></p><ul><li><em>Malformed call</em> — get_bgp_state(rotuer=&quot;R1&quot;), a typo&#39;d arg. Schema validation should bounce this back for a retry; without it, it fails silently downstream.</li><li><em>Wrong tool for the question</em> — asking search_runbooks() when the case needed query_topology(). This doesn&#39;t error, it just returns confidently irrelevant evidence.</li><li><em>Confabulated root cause</em> — asserting “MTU mismatch” when nothing retrieved actually says that. The most dangerous failure here: it looks identical to a correct diagnosis until someone checks each citation against its source.</li><li><em>Miscalibrated confidence</em> — 0.82 attached to what’s actually a coin flip; the number means nothing until it’s checked against real outcomes.</li></ul><p><strong>Knowledge Graph — structural failures</strong></p><ul><li><em>Topology drift</em> — the graph reflects last week’s CMDB export; a router was re-peered since, so query_topology() returns a blast radius that no longer matches reality.</li><li><em>Missing edges</em> — the data model never captured depends_on between a link and the service riding it, so a genuinely affected service never surfaces.</li><li><em>Runaway traversal</em> — depth=2 was fine at design time; a year of topology growth later, the same query returns hundreds of nodes and buries the one that matters.</li></ul><p><strong>MCP — live-system failures</strong></p><ul><li><em>Tool timeout</em> — get_bgp_session_state() times out because the device is genuinely unreachable, which on a bad night might be the incident itself. Treat &quot;tool failed&quot; as evidence, not just a reason to retry.</li><li><em>Non-idempotent retry</em> — restart_bgp_session() fires twice because a retry assumed the first call had failed when it had actually just succeeded slowly. Write tools need idempotency keys, not just retries.</li><li><em>Stale cache</em> — an MCP server fronting a slow API serves five-minute-old state as “live,” and the LLM reasons from data that’s already wrong.</li></ul><p><strong>RAG — retrieval failures</strong></p><ul><li><em>Retrieval miss</em> — the relevant runbook exists but embeds far from the query wording and never makes top-k; the LLM reasons as if no prior incident exists.</li><li><em>Groundedness gap</em> — the retrieved chunk is topically related but doesn’t actually support the specific claim attached to it. Right neighborhood, wrong house.</li><li><em>Stale corpus</em> — the runbook was updated last month; the embedding wasn’t re-indexed, so the citation points to a now-wrong procedure.</li></ul><h3>Evaluating it</h3><p>Two different questions: is each component doing its job, and does the whole pipeline get incidents right.</p><p><strong>Per-component, offline</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*ABfhryRifGQGoV1lfG8u8g.png" /></figure><p><strong>End-to-end</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*yHUKAPrgL415W_onCI8dVQ.png" /></figure><h3>Watching it run</h3><p>One incident, one trace — the same ten hops become the same ten spans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*cscSwFbCxdDwwK9esc0kyg.png" /></figure><p>Four numbers earn a dashboard and an alert on their own: <strong>fan-out completion rate</strong> (did all three parallel branches actually return), <strong>empty-retrieval rate</strong> (RAG or KG coming back with nothing — an early sign of a stale corpus or a stale graph), <strong>rejection rate by incident category</strong> (a live proxy for the model getting worse, before anyone reruns an eval), and <strong>p95 latency and cost per run</strong>. The one rule underneath all of it: every claim in the final hypothesis should click through to the exact span that produced it — that’s what turns “trust the model” into “check the model,” which is the only version of this an on-call engineer should accept.</p><h3>The decision rule</h3><p>This is the part worth keeping past this one incident — apply it to the next design question without redrawing the trace above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*1VMPxlyBTYTdM8sPeFfkmQ.png" /></figure><h3>Naming differences, same shape</h3><p><strong>Google ADK</strong> calls the orchestrator an Agent and a lookup a Tool. <strong>LangGraph</strong> calls it a Node operating on shared State, wired into a graph of edges. The <strong>OpenAI</strong> and <strong>Claude Agent SDKs</strong> call it an agent loop doing function calling. Under every one of those names, it&#39;s the same thing: something that calls the LLM, executes what the LLM asked for, and feeds the result back in.</p><p>MCP is the outlier — it isn’t a framework concept at all, it’s a transport. It’s the one piece in this stack meant to stay the <em>same</em> regardless of which orchestrator sits on top of it: a standard way to say “here are my tools” and “here’s the result,” so a tool built once plugs into an ADK agent, a LangGraph node, or a Claude agent without being rewritten for each.</p><h3>Deliberately out of frame</h3><p>LLM gateway routing, per-provider rate limits, and horizontally scaling any of these five layers are infrastructure concerns you add on top once the shape above works for one request. They change how much traffic this survives, not how the reasoning happens — which is what this piece is about.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=200f3fac6ded" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>