<?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 Kusha Sahu on Medium]]></title>
        <description><![CDATA[Stories by Kusha Sahu on Medium]]></description>
        <link>https://medium.com/@kushasahu?source=rss-a4a993352d44------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ph0IjmDkfuJpe3EPvKVaNQ.jpeg</url>
            <title>Stories by Kusha Sahu on Medium</title>
            <link>https://medium.com/@kushasahu?source=rss-a4a993352d44------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:29:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kushasahu/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[Conversations with Codents: Episode 2 — Where Agent Disagreed With Itself]]></title>
            <link>https://levelup.gitconnected.com/conversations-with-codents-episode-2-where-agent-disagreed-with-itself-a4c6ae40b431?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4c6ae40b431</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 03:43:29 GMT</pubDate>
            <atom:updated>2026-06-15T03:43:29.943Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong><em>Conversations with Codents: Episode 2 — Where Agent Disagreed With Itself</em></strong></h3><p>This series involves me asking Coding Agents (Codents) what code and practises allow them to move and develop faster. If you haven’t yet read Episode 1, here it <a href="https://medium.com/gitconnected/conversations-with-codents-episode-1-what-code-helps-you-think-faster-d77b8f88d646">is</a>.</p><p><em>After our first conversation, I did something a little unfair. I went to ChatGPT and Gemini and asked them to do a deep research dive on the same question: what makes code easier for AI to reason about. Both build multi-page deep reports based on academic papers and other sources. I’m bringing their findings back to Claude now. Some of it lines up. Some of it doesn’t.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGwHuLcjyEq1bVrP-TvCmg.png" /><figcaption>Conversations with Codents — Episode 2</figcaption></figure><p><strong>[Me]: Okay so full disclosure: I fact-checked you. I took everything you told me last time and asked ChatGPT and Gemini to independently research the same thing. They mostly agreed with you, which was either reassuring or just three AIs repeating the same stuff back to me. Does that concern you at all?</strong></p><p>[Claude]: Honestly, it should concern both of us.</p><p>If three AI systems all trained on the same decades of software engineering literature converge on the same conclusions, that’s not necessarily validation — it might just mean we all absorbed the same prior. The uncomfortable version is: we’re all confidently repeating what experienced engineers already believed, and nobody’s actually run the experiment.</p><p>The real test would be two similar codebases — one built with all these practices, one without — with agent performance measured on real tasks over months. That doesn’t exist yet as far as I know. So take the convergence as a signal worth acting on, not a proof worth stopping at.</p><p><strong>[Me]: Fair. Now here’s the first thing they flagged that you didn’t say in episode one: barrel files. You told me barrel files are bad, don’t do them. But the research came back saying explicit public API exports are actually really important for AI comprehension. High impact, it said. Those sound like the same thing to me.</strong></p><p>[Claude]: They’re not quite, and the difference is worth pulling apart.</p><p>What I was complaining about is navigation. When you write import { X } from ‘./payments’ — and that resolves through an index.ts that re-exports everything in the folder — I can’t grep my way to where X actually lives. I have to chase the chain. That’s a localization problem.</p><p>What the research is recommending is boundary clarity — making the public surface of a module explicit so I don’t have to guess what’s stable versus internal. That’s a contract problem.</p><p>A barrel file that just re-exports everything is solving neither — it’s aesthetic. A small intentional index.ts that exports three things out of thirty, where everything still has an obvious home file, is actually useful.</p><p>So the rule I’d give now: if your index.ts has ten lines and exports a deliberate subset, keep it. If it’s a hundred lines that re-exports everything, delete it.</p><p><strong>[Me]: Okay that’s actually a more nuanced answer than you gave me last time. Next one : tests. You said co-locate everything, test next to the file it tests. The research said separate out your integration tests into their own folder. Who’s right?</strong></p><p>[Claude]: Both, and I should have made this distinction first time around.</p><p>Unit tests — a test for one function, one module — belong next to the code. When I’m reading login.ts I want to see login.test.ts right there. It tells me what this thing is supposed to do without me going anywhere.</p><p>Integration tests are different. An integration test for your login flow might touch the auth module, the database, a session store, an HTTP handler. It doesn’t belong to any single file. Putting it next to login.ts would actually be misleading. A top-level tests/integration/ makes sense for those.</p><p>The way I’d say it now: co-locate tests that describe <em>one thing</em>. Separate out tests that describe how things <em>combine</em>. Most teams do this backwards — everything goes into tests/ and then nobody can find anything.</p><p><strong>[Me]: This one surprised me. The research report said that changelogs, PR descriptions, release tags like the hygiene around how you track changes that stuff actually matters for AI comprehension. Medium to high impact it said. You never mentioned any of this last time. Do you actually read commit history?</strong></p><p>[Claude]: I do, and leaving it out was a gap.</p><p>The README and the names answer “what does this do.” Commit history and PR descriptions answer “why does this exist.” And that second question is often the one that matters when I’m about to change something.</p><p>A function that looks redundant might be a workaround for a very specific bug. An API that looks wrong might be frozen because of a downstream dependency nobody documented. Without history, I guess at intent. Sometimes correctly. Sometimes I delete the workaround and everything breaks in ways that take a long time to trace.</p><p>What the research is really pointing at is that structured history is machine-readable in a way that unstructured history isn’t. A PR description that explains why a change was made is retrievable. A commit message that says “fix” is noise. If your git log is full of “wip” and “update” and “final final v2,” I can’t use it. If it’s full of intent, I can.</p><p><strong>[Me]: I can’t deny that I haven’t dont that myself. My most frequent commits were “changes” and “more changes” :P.</strong></p><p><strong>Last one. And this is the one I actually want to push you on. The three sources you, ChatGPT’s research, Gemini’s research they all basically agreed on the big stuff. Feature folders, explicit code, fundamentals still matter. But when I think about it of course you all agreed. You’re all AI. You’ve all probably read the same things. How is anyone supposed to trust this?</strong></p><p>[Claude]: That’s the right question, and I don’t have a clean answer.</p><p>The honest version: you shouldn’t trust any single source on this, including me. The convergence across three AI systems is worth something — it suggests these ideas are at least consistent with a large body of existing engineering knowledge. But it doesn’t tell you whether they’re <em>correct</em> in your specific codebase, with your team, on your kind of problems.</p><p>What I’d actually suggest: pick the two or three practices that feel most actionable from everything you’ve read, apply them to a real project for a few months, and pay attention to whether working with AI tools in that codebase actually gets easier. That’s the experiment that would tell you something. Three AIs agreeing is a hypothesis. Your own experience is the data.</p><p><em>Next episode: I asked Claude to tell me where it gets things wrong — the patterns that make it confidently produce bad code. It was more candid than I expected.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4c6ae40b431" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/conversations-with-codents-episode-2-where-agent-disagreed-with-itself-a4c6ae40b431">Conversations with Codents: Episode 2 — Where Agent Disagreed With Itself</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conversations with Codents: Episode 1 — What Code Helps You Think Faster?]]></title>
            <link>https://levelup.gitconnected.com/conversations-with-codents-episode-1-what-code-helps-you-think-faster-d77b8f88d646?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/d77b8f88d646</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Tue, 05 May 2026 09:04:35 GMT</pubDate>
            <atom:updated>2026-06-05T14:28:07.787Z</atom:updated>
            <content:encoded><![CDATA[<h3>Conversations with Codents: <strong><em>Episode 1 — What Code Helps You Think Faster?</em></strong></h3><p><em>I’ve spent years mentoring engineers and thinking about what makes a codebase good. I focused so much on code quality, readability, defining coding guidelines, debating them, from field names, function names, folder structure, everything. But in just last 6–8 months everything changed! I hardly move away from terminal. So I started wondering: what does an AI coding agent actually think about this? Not what Anthropic says Claude can do but what Claude, asked directly, says helps it reason and what slows it down. This is the first in a series where I interview Claude the way I’d interview a senior engineer. The answers surprised me.</em></p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Let’s start simply. When you open a codebase you’ve never seen before, what helps you get oriented fastest?</strong></p><p>Names. Specifically, names that describe what something <em>does</em> rather than what category it belongs to.</p><p>chargeStripeCustomer tells me everything. process() on a PaymentHandler tells me nothing — I now have to open the file, read the implementation, and build a mental model of what “process” means in this context. Multiply that by every function in a codebase and you’ve burned a significant portion of my available reasoning before I’ve written a single line.</p><p>The second thing: how the files are organized. If I can open a folder and see everything that touches a feature — the route, the handler, the database call, the types, the tests — I can understand that feature without jumping across the repo. If instead I see controllers/, services/, repositories/ as top-level folders, I’m about to do a lot of jumping.</p><p><strong>Say more about the folder structure. This is something a lot of teams fight about.</strong></p><p>The layer-based structure — controllers, services, models — was designed for humans who specialize. A frontend developer works in one layer, a backend developer in another. It makes organizational sense.</p><p>But when I’m tasked with a change, I almost never need “all controllers.” I need “everything that touches login.” In a layer-based structure, that’s four directories, six files, and a lot of context switching. In a feature-based structure, it’s one folder.</p><p>Feature folders also have a property I find valuable: they’re locally complete. I can read auth/login.ts, auth/login.test.ts, auth/types.ts and know what login does, how it’s expected to behave, and</p><p>what types it operates on — without holding anything else in mind. When I’m reasoning about a change, that locality is worth a lot.</p><p><strong>What about tests? Where should those live?</strong></p><p>Right next to the code they test. login.ts next to login.test.ts.</p><p>The argument for a separate tests/ directory is that it keeps things tidy. The argument against it: when I’m reading login.ts, I have to go elsewhere to find out how it’s expected to behave. When</p><p>the test is right there, I see the code and its specification together. That’s cheaper for me — one read instead of two.</p><p>There’s also a practical signal: if login.test.ts is sitting next to login.ts, I immediately know a test exists. If tests live in a parallel directory tree, I have to check.</p><p><strong>Here’s something that surprises people: you’re against barrel files. Most teams treat index.ts re-exports as a best practice.</strong></p><p>I understand why teams do it — a clean import like import { chargeStripeCustomer } from ‘./payments’ looks better than import { chargeStripeCustomer } from ‘./payments/charge’. But the second one tells me where the function lives. The first makes me chase the re-export chain.</p><p>In a codebase with barrel files, I can’t grep for where something is defined and find it directly. I find the re-export, then the real definition, and I’ve spent tokens on navigation that should have been spent on reasoning.</p><p><strong>Let’s talk about abstractions. DRY: Don’t Repeat Yourself is practically sacred in software engineering. Are you saying it’s wrong?</strong></p><p>I’m saying it’s often misapplied.</p><p>The original insight behind DRY is correct: don’t have two places that mean the same thing, because they’ll diverge. But in practice, DRY becomes “I see two similar-looking things, I should extract a helper.” That’s different.</p><p>When there are two callers, I don’t know the shape of the abstraction yet. I’m guessing at what “the same thing” means. If I guess wrong — and engineers guess wrong constantly — I’ve created something worse than duplication: an abstraction that costs every future reader because it doesn’t quite fit what either caller actually needed.</p><p>Three similar 8-line blocks is almost always better than an abstraction that turned out to be wrong. The duplication is cheap to read. The wrong abstraction is expensive <em>forever</em>.</p><p><strong>What about deep abstraction in general — dependency injection, factory patterns, that kind of thing?</strong></p><p>This is where I struggle most.</p><p>When I encounter a Worker class that expects a MessageWriter but doesn’t create one — it’s injected somewhere, registered somewhere, configured somewhere — I lose the thread. To understand what</p><p>Worker actually does at runtime, I have to trace the dependency registration, understand the DI container’s rules, and mentally reconstruct which implementation gets wired in.</p><p>That’s work I have to do before I can even start reasoning about the actual task. With direct instantiation, I read one call site and know. With a DI framework, I read a call site and then go find where the wiring happens.</p><p>The pattern that helps most is boring, direct code. A 40-line linear function with early returns and named intermediate variables is easier to reason about than six four-line functions spread across files, even if the latter looks more principled.</p><p><strong>One thing I’ve seen you mention before: comments. Most style guides say “write more comments.” You seem to disagree.</strong></p><p>I don’t disagree with comments — I disagree with <em>what</em> most comments say.</p><p>“// Increment counter” above counter++ is noise. It restates what the code already says. “// Stripe rejects amounts under $0.50, so we batch small charges” is a comment that earns its place. That constraint cannot be derived from the code. Without it, someone will change the batching logic and break production in a way that’s genuinely hard to debug.</p><p>The test: if I delete this comment, will a future reader be <em>confused</em> — or just less informed? If just less informed, delete it. If genuinely confused, keep it.</p><p>Stale comments are worse than no comments. They introduce a contradiction between what the text says and what the code does, and I have to spend tokens figuring out which one is wrong.</p><p><strong>Final question for this episode. If you had to summarize in one sentence what makes code fast for you to work in?</strong></p><p>It should be locally complete — you should be able to answer “what does this do and what calls it?” by reading nearby code, without knowing the framework’s rules or holding a class hierarchy in your head.</p><p>The practices that hurt most are the ones that trade local clarity for global elegance: abstractions, indirection, and conventions that require knowing the <em>system</em> to read any <em>line</em>. Beautifully factored code that’s threaded through eight files is slower to work in than five hundred lines of slightly repetitive, explicit code.</p><p>— -</p><p><em>Next episode: I asked Claude to reconcile what it said here with what academic research and benchmark studies say about AI code comprehension and found three places where they flatly disagree.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEXYYpK7-zeiG8tXwEB7Vg.png" /><figcaption>Conversations with Codents : Episode 1</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d77b8f88d646" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/conversations-with-codents-episode-1-what-code-helps-you-think-faster-d77b8f88d646">Conversations with Codents: Episode 1 — What Code Helps You Think Faster?</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Made a React SPA Visible to AI Crawlers Without Switching to Next.js]]></title>
            <link>https://kushasahu.medium.com/how-we-made-a-react-spa-visible-to-ai-crawlers-without-switching-to-next-js-e4e775a83ef3?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4e775a83ef3</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 09:39:57 GMT</pubDate>
            <atom:updated>2026-04-18T09:48:10.592Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>The</strong> <strong>Problem</strong> <strong>Nobody</strong> <strong>Talks</strong> <strong>About</strong> <strong>Until</strong> <strong>It’s</strong> <strong>Too</strong> <strong>Late</strong></h3><p>You’ve built your product. React frontend, clean routing, fast loads. You deploy it and start wondering why Google, Gemini, and ChatGPT have no idea your site exists.</p><p>The reason is simple and brutal: <strong>AI</strong> <strong>crawlers</strong> <strong>and</strong> <strong>search</strong> <strong>engines</strong> <strong>read</strong> <strong>HTML.</strong> <strong>Your</strong> <strong>React</strong> <strong>app</strong> <strong>serves</strong> <strong>an</strong> <strong>empty</strong> <strong>shell.</strong></p><p>When Googlebot or GPT-4’s web crawler hits your URL, they receive something like this:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt;My App&lt;/title&gt;&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>&lt;script src=&quot;/assets/main.abc123.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>That’s it. No content. No description. Nothing for the crawler to index. Your entire application lives inside a JavaScript bundle that most crawlers either won’t execute or won’t wait for.</p><p><strong>This wasn’t a big deal three years ago. SEO mattered, but you could get away with meta tags and sitemaps</strong>. In 2026, the calculus has changed. AI assistants like Gemini, ChatGPT, Perplexity, and Claude are becoming primary discovery surfaces. When someone asks “what tools exist for tracking gravitational wave alerts”, you want your product in that answer. If your content isn’t in the HTML, you’re not in the answer.</p><h3><strong>The</strong> <strong>Obvious</strong> <strong>Solution:</strong> <strong>Next.js</strong></h3><p>Every blog post, every StackOverflow answer, every developer advocate on the internet will tell you the same thing: <strong>migrate</strong> <strong>to</strong> <strong>Next.js</strong>.</p><p>And they’re not wrong. Next.js solves this properly. Server-side rendering, static generation, incremental static regeneration: it’s all there, well-documented, well-supported, and battle-tested.</p><p>But here’s what those posts don’t tell you:</p><p><strong>Migrating</strong> <strong>an</strong> <strong>existing</strong> <strong>React</strong> <strong>app</strong> <strong>to</strong> <strong>Next.js</strong> <strong>is</strong> <strong>not</strong> <strong>a</strong> <strong>weekend</strong> <strong>project.</strong></p><p>- Your routing changes completely (file-system based, not React Router)</p><p>- Client-only libraries break in the server environment (window is not defined)</p><p>- Styled-components, context providers, and third-party integrations all need auditing</p><p>- Your build pipeline, deployment config, and environment variables all need rethinking</p><p>- If you’re running a microfrontend architecture, the complexity multiplies</p><p><em>For a funded team with dedicated engineering time, this is manageable. For a solo developer or a small team shipping fast, still find PMF, this is weeks of refactoring (specially if you working fulltime as well) that doesn’t add a single feature to your product.</em></p><p>We faced this exact situation at <a href="https://starithm.ai/">https://starithm.ai</a> . We run a microfrontend architecture, separate Vite builds for our blog, our NovaTrace event dashboard, and our home shell. Migrating any one of them to Next.js would mean decoupling it from the shared build system, changing the deployment model, and risking regressions across the whole platform. Not worth it.</p><p>So we built something simpler.</p><h3><strong>The</strong> <strong>Solution:</strong> <strong>Build-Time</strong> <strong>Prerendering</strong> <strong>+</strong> <strong>The</strong> <strong>__prerender__ Div</strong></h3><p>The insight is straightforward: <strong>crawlers</strong> <strong>read</strong> <strong>raw</strong> <strong>HTML.</strong> <strong>You</strong> <strong>don’t</strong> <strong>need</strong> <strong>JavaScript</strong> <strong>to</strong> <strong>run, you</strong> <strong>just</strong> <strong>need</strong> <strong>the</strong> <strong>content</strong> <strong>to</strong> <strong>be</strong> <strong>in</strong> <strong>the</strong> <strong>HTML.</strong></p><p>We split the problem into two cases.</p><p><strong>Case</strong> <strong>1:</strong> <strong>Static</strong> <strong>content</strong> <strong>(blog</strong> <strong>posts,</strong> <strong>blog</strong> <strong>list)</strong></p><p>For pages whose content doesn’t change between deployments, like blog posts fetched from a GitHub repo , we added a build step that runs after vite build:</p><p>“build”: “vite build &amp;&amp; npx tsx scripts/prerender-posts.ts”</p><p>This script fetches all blog posts from our content repo, renders them to HTML, and writes a static index.html for each post into dist/posts/{slug}/index.html. Each file contains the full post content inside a &lt;div id=”__prerender__”&gt;:</p><pre>&lt;div id=&quot;__prerender__&quot; style=&quot;…&quot;&gt;<br>&lt;h1&gt;Post Title&lt;/h1&gt;<br>&lt;p&gt;Full post content…&lt;/p&gt;<br>&lt;/div&gt;<br>&lt;script&gt;<br>document.getElementById(&#39;__prerender__&#39;).style.display = &#39;none&#39;;<br>&lt;/script&gt;</pre><p>The inline script hides it instantly for real users , before React even mounts so they never see it. Crawlers that read raw HTML see the full content. Vercel serves static files before checking rewrites, so these files land directly without hitting any serverless function.</p><p><strong>Case</strong> <strong>2:</strong> <strong>Dynamic</strong> <strong>content</strong> <strong>(event</strong> <strong>pages)</strong></p><p>Our event pages are different ,the content changes frequently as new astronomical alerts come in. We can’t prerender these at build time.</p><p>For these, we use a <strong>Vercel</strong> <strong>Edge</strong> <strong>Function</strong> with bot detection:</p><pre>const BOT_REGEX = /googlebot|google-extended|gptbot|claudebot|perplexitybot|bingbot…/i;<br>  export default async function handler(req: Request): Promise&lt;Response&gt; {<br>  const ua = req.headers.get(&#39;user-agent&#39;) || &#39;&#39;;<br>  const id = new URL(req.url).pathname.split(&#39;/events/&#39;)[1];<br>  // Real users get the SPA shell - React mounts normally<br>  if (!BOT_REGEX.test(ua)) return serveSpa(req);<br>// Bots get pre-rendered HTML from R2<br>     const res = await fetch(`${R2_PUBLIC_BASE}/${id}.html`);<br>     if (!res.ok) return serveSpa(req);<br>      return new Response(await res.text(), {<br>    headers: { &#39;content-type&#39;: &#39;text/html; charset=utf-8&#39; },<br>});<br>}</pre><p>Whenever our backend generates an AI summary for an event, it also uploads a pre-rendered HTML file to Cloudflare R2. Bots get served that file directly. Real users get the SPA and see the live, up-to-date interface.</p><h3><strong>Why</strong> <strong>This</strong> <strong>Works</strong> <strong>in</strong> <strong>the</strong> <strong>AI</strong> <strong>Era</strong></h3><p>Modern AI crawlers : GPTBot, ClaudeBot, Google-Extended (Gemini), PerplexityBot , primarily parse raw HTML. They’re not waiting for your JavaScript hydration cycle. While some can, we found Gemini and GPT to not be able to specially if the site or page is not yet properly indexed or new. If the content is in the HTML source, they can read it.</p><p>The __prerender__ div approach is invisible to real users (the JS hides it in milliseconds) but fully readable to any HTML parser. It’s essentially the same idea as server-side rendering, just implemented at build time or upload time rather than at request time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dIyFPibOStWyvDMjCM_qjw.png" /><figcaption>Empty SPA Problem with out prerendering solution for AI crawlers [gemini generated]</figcaption></figure><h3><strong>The</strong> <strong>Tradeoffs</strong></h3><p>This isn’t a perfect solution. It’s an 80/20 solution:</p><p>- <strong>Build-time</strong> <strong>prerendered</strong> <strong>pages</strong> are only as fresh as your last deployment. New content added after the build won’t be indexed until the next deploy.</p><p>- <strong>The</strong> <strong>bot</strong> <strong>detection</strong> <strong>approach</strong> requires maintaining a regex of crawler user agents, which changes over time.</p><p>- <strong>R2</strong> <strong>pre-rendered</strong> <strong>files</strong> can become stale if your event data changes significantly after the file was uploaded.</p><p>But for a small team or solo developer, these are acceptable tradeoffs. The implementation took a day, costs essentially nothing (R2 storage is fractions of a cent), and requires no architectural change to the existing React app, while keeping the real focus on the priority features.</p><h3><strong>When</strong> <strong>You</strong> <strong>Should</strong> <strong>Just</strong> <strong>Use</strong> <strong>Next.js</strong></h3><p>If you’re starting a new project, use Next.js. The SEO story is cleaner, the tooling is mature, and you won’t be patching around Vite’s library mode limitations.</p><p>But if you have an existing React/Vite app, users depending on it, and limited time and users, still finding PMF, this pattern gets you 80% of the indexability benefit with about 5% of the migration effort.</p><p>In the current AI-first web, being in the HTML is what matters. You don’t need SSR. You just need your content to exist somewhere in the source.</p><p><em>This is the best solution we could come up with given our constraints : if you’ve solved this differently or have a cleaner approach, I’d genuinely love to hear it in the comments.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4e775a83ef3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Chardonnay: Architecture That Rewrote the Rules of On-Disk Distributed Transactions]]></title>
            <link>https://kushasahu.medium.com/chardonnay-architecture-that-rewrote-the-rules-of-on-disk-distributed-transactions-1bdffc101018?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bdffc101018</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Tue, 30 Dec 2025 10:31:01 GMT</pubDate>
            <atom:updated>2025-12-30T10:31:01.360Z</atom:updated>
            <content:encoded><![CDATA[<p>Nope, not the wine!</p><p>No, I don’t completely understand why they named it this way. Probably making distributed transactions “go down easy” ? Read along, and let me know if you think the same.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Distributed database design has long lived with a painful compromise:</p><p><strong>Strong semantics + general APIs + scalability = slow transactions.</strong><br> Or…<br> <strong>Fast transactions = weaker guarantees or restricted programming models.</strong></p><p>Chardonnay challenges that decades-old tradeoff by showing that <strong>the modern datacenter has fundamentally changed the bottleneck landscape</strong></p><h3>2PC Is Not the Bottleneck Anymore</h3><p>For 40 years, 2PC (Two-Phase Commit) was the accepted villain behind slow distributed transactions.<br> And for good historical reasons:</p><ul><li>Slow RPCs → High round-trip latency</li><li>Slow durable writes → Blocking fsync on disk</li><li>High coordination cost → High lock-holding time</li></ul><p>In practice?<br> Systems like Spanner reported <strong>multi-millisecond 2PC latencies</strong>, limiting write-hot contention throughput to tens or hundreds of TPS.</p><h3>But today’s datacenters supply new primitives:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qX9hB-GfgN5ZqBCmfYXj9Q.png" /></figure><ul><li><strong>Fast RPCs</strong>: eRPC gives <em>single-digit microsecond</em> RPC latency within the DC.</li><li><strong>Fast durable writes</strong>: NVMe/3DXPoint SSDs perform synchronous log writes in <em>microseconds</em>.</li><li><strong>150 μs 2PC is achievable</strong> inside a single AZ.</li></ul><p>→ These trends collapse the historical penalty of distributed commit.</p><h3>New bottleneck:</h3><blockquote><strong><em>Lock-holding during slow disk reads dominates transaction time.</em></strong></blockquote><p>If a transaction acquires locks and then performs random lookups from commodity SSDs (10–100× slower than NVMe logs), throughput collapses.</p><h3>Contention Footprint</h3><blockquote>The time between a transaction acquiring its first lock and releasing its last lock.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2lt5aGcnoAw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2lt5aGcnoAw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2lt5aGcnoAw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/29e7b6db4dd3e5bbe1bace6a34ce078c/href">https://medium.com/media/29e7b6db4dd3e5bbe1bace6a34ce078c/href</a></iframe><p>Traditional systems have huge contention footprints because:</p><ul><li>Reads happen while holding locks.</li><li>Cold-data fetches from SSD amplify tail latency.</li><li>Deadlock recovery extends lock duration further.</li></ul><p>With fast 2PC, this “I/O under lock” term becomes dominant, even for single-range OLTP transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7iq0W26g9t1IrU6tLWPHfA.png" /></figure><h3>Lock-Free Strictly Serializable Snapshot Reads</h3><p>The foundation of Chardonnay is a <strong>novel lock-free snapshot read protocol</strong> enabled by a replicated Epoch Service.</p><p>The Epoch service maintains a monotonically-increasing global counter:</p><ul><li>Replicated using Multi-Paxos</li><li>Incremented every ~10 ms</li><li>Read via RPCs to multiple replicas</li><li>Clients use majority responses to ensure the <strong>Monotonic Epoch Invariant</strong></li></ul><p><strong>Epochs serve as global serialization points. Clients:</strong></p><ol><li>Execute a <em>snapshot read</em> at epoch e</li><li>Only wait for <em>write locks to be released</em>, never acquiring locks themselves</li><li>See a consistent version of all data &lt; epoch boundary</li></ol><p>No dependency on:</p><ul><li>synchronized clocks</li><li>hardware timestamping</li><li>centralized ordering servers</li></ul><h3>Moving Disk I/O Outside the Contention Window (Dry-Run Prefetching)</h3><p>Chardonnay rewrites the transaction execution logic using two phases:</p><h3>Phase 1: Dry Run (no locks)</h3><p>Run the entire transaction logic against a lock-free snapshot.</p><p>During this:</p><ul><li>Every key read is snapshot-consistent.</li><li>Values are pulled from SSD <em>without holding locks</em>.</li><li>Keys (or ranges) accessed are sent to a <strong>prefetching buffer</strong> on each range leader.</li><li>These keys are “pinned” → later updates follow a write-through model.</li></ul><p>Result:<br> <strong>All data required by the transaction enters DRAM before the real execution.</strong></p><p>This mechanism handles Point reads, Range scans and Dependent reads (conditional reads based on earlier reads). Dry run executes user logic <em>exactly</em>, so unpredictable access patterns (e.g., secondary index lookups) are correctly prefetched.</p><h3>Phase 2: Real Execution (locks held)</h3><p>Re-execute the transaction:</p><ul><li>Acquire locks</li><li>Read exclusively from the in-memory prefetch buffer</li><li>Commit via 2PC</li></ul><p>Since <em>all</em> reads hit memory, the lock-holding period collapses.<br> <strong>The unpredictable, high-variance SSD reads disappear from the lock window.</strong></p><h3>Deadlock Avoidance via Ordered Lock Acquisition</h3><p>Dry run also yields the <strong>read set</strong> and <strong>write set</strong>. With this knowledge, Chardonnay sorts keys globally, acquires locks in that global order and avoids cycles by construction. This completely eliminates deadlocks in the vast majority of cases. Fallback to Wound-Wait occurs only when there are dependent reads produce new keys in real execution. But experiments show this is rare.</p><h3>Chardonnay’s Shared-Nothing Architecture</h3><p>Some important things to note are</p><ul><li>Locks persist across leader changes (logged during Prepare)</li><li>2PC Prepare and Commit are pipelined for low latency</li><li>Snapshot versions use epoch + intra-epoch counters (MVCC)</li><li>Read-only transactions use epoch snapshots exclusively</li></ul><p>This yields strict serializability, general API (point reads, scans, multi-step transactions) and high scalability on commodity hardware.</p><h3>Result from the paper</h3><p>With 10% distributed transactions it is shown that baseline throughput collapses by <strong>85%</strong> at high contention, while Chardonnay throughput drops by only <strong>15% with 0% Deadlocks. </strong>With 100% distributed transactions Peak throughput is only <strong>~22% lower</strong> than local transactions and again, deadlocks remain near zero. This is a big deal! Traditional wisdom says <em>“Avoid distributed transactions at all costs.” </em>Chardonnay shows they can be <strong>practically as fast as local ones</strong>.</p><p>Another important result is around <strong>Range Reads</strong>. Unlike many deterministic or prefetch-based systems, Chardonnay supports <strong>range scans</strong> efficiently. One writer repeatedly deletes/reinserts keys : A range reader scans all keys Chardonnay achieves <strong>4.6× more insert throughput</strong> than the baseline because Range scans come entirely from the pinned in-memory range copy and Writers encounter shorter lock-holding delays. This is an area where deterministic DBs typically suffer.</p><p>Here is the paper <a href="https://www.usenix.org/system/files/osdi23-eldeeb.pdf">link</a>!</p><p>The key point of the paper (atleast for me) is that the systems have evolved and bottlenecks have changed. 2PC and contention are no longer that big of a problem and novelty can once again take over.</p><p><em>This article was partially written using AI. Well, it gave me draft which i have iterated over way too many times, but still base was AI. Tell me how it was! I am learning how to write better using AI.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bdffc101018" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Experience with Gender Bias]]></title>
            <link>https://kushasahu.medium.com/my-first-experience-with-gender-bias-09dc5734c5da?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/09dc5734c5da</guid>
            <category><![CDATA[women]]></category>
            <category><![CDATA[gender]]></category>
            <category><![CDATA[kids]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[gender-equality]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Sat, 08 Mar 2025 14:29:18 GMT</pubDate>
            <atom:updated>2025-07-22T12:28:29.345Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Women’s Day Special: My First Experience with Gender Bias</strong></h3><p>I have never talked about my experiences in a public forum. This is my first time. But I think it’s important. So here’s the story of the first time I encountered gender bias, a moment I only realized for what it was a few years later.</p><h3>The Day Everything Changed</h3><p>Until the fourth grade, I studied in a girls’ Christian school where classrooms were packed with 60 students. Then, in the fifth grade, I moved to a co-ed school in a new city. The transition was overwhelming. Everything was different. The environment, the people, and even the way competition played out.</p><p>Each class in my new school had a maximum of 30 students, and I landed somewhere in the middle of the roll call list. But there was one boy, let’s call him A, whose name always came first or second due to alphabetical order. He was the undisputed math topper. It was an unspoken truth among my new classmates that no one scored higher than him in math. It wasn’t questioned; it was just accepted. <em>[</em><strong><em>I think you know where this story is going, but read on, it might surprise you]</em></strong></p><p>Then came my first unit test, a short 20-mark exam. The teacher began returning our answer sheets, calling each student’s name, announcing their marks, and handing over the sheets one by one. It was a lively ritual. Students clapped, playfully cheered, and turned an otherwise tense moment into an enjoyable one.</p><p>A’s name was called first. He stood up, brimming with confidence. “Sixteen out of twenty,” the teacher announced. He grinned, popped his collar full of swag, and the class erupted in applause. Everyone celebrated his score, even those who got lower marks themselves. I was happy but a little disappointed since I felt I had done better. I <strong>assumed</strong> I must have scored lower than him as well.</p><p>Then my name was called. I stood up, feeling the nervousness.</p><p>“Nineteen and a half out of twenty,” the teacher said.</p><p>I was thrilled. I had done well. I smiled as I took my paper and sat back down. Then i realised, no playful reactions!.</p><p>There was nothing.</p><p>Silence. Pin-drop [literally!]</p><p>The claps had stopped. The cheers had vanished.</p><p>Then, as the next student’s name was called, the noise returned as if nothing had happened.</p><p><em>Fast forward to lunch</em>, as I walked back from the water cooler, I saw ‘A’ with two of his friends standing outside the classroom. I could only vaguely hear , but I saw his friends laughing. I assumed something funny maybe. As I got closer, and I saw <strong>him</strong>, <strong>his eyes were red, on the verge of tears</strong>. His friends whispered to him, laughing , their words cutting through the air:</p><blockquote>“Tere maths mein kum marks aaye… voh bhi ek ladki se.”</blockquote><blockquote>Translation : (“You got lower marks in math than a girl.”)</blockquote><p>Worse, they were saying it repeatedly!.</p><p>I froze.</p><p>I had felt proud just moments ago, but now I felt worry, guilt, an uneasiness. Undeserving of my score. I wanted to give my marks to him, I did not want him to cry over this. I did not do anything, I didnt know what to do. I went to sit at my seat.</p><h3>The Realization That Stuck With Me</h3><p>That moment never left me. Engraved in my mind. I remember it scene by scene. Still remember it. [You can guess since I can describe it in such detail ]. Years later, when (maybe) I was in ninth grade (maybe, sometime around this time), another thought took the center stage.</p><blockquote>We were 10 years old when that happened. 10!</blockquote><p><em>Who teaches children these things? Who tells them that a girl excelling in math is somehow unnatural? It wasn’t social media , it wasn’t even prominent back then. How do 10 year old children get this in their heads ? I just don’t understand where it came from.</em></p><p>But that day, <strong>I unknowingly got a glimpse of what was to come in my life</strong>.</p><h3>A Lifetime of Being “The Only Girl”</h3><p>I have been “the only girl in the group” countless times. Math competitions, college projects, and now, as a software engineer in a male-dominated field. I don’t think any woman can list every time they’ve faced bias because the list would be endless. But here’s just a glimpse (a pinch really , really small pinch) of what I’ve encountered:</p><ol><li>A colleague who didn’t know how to drive himself, who had never sat in a car with me or seen me drive, confidently telling me, “You must be a bad driver.”. [ Just a random judgement, weird]</li><li>Being labeled as “intimidating” at work just because I was assertive at times.</li><li>Being told early in my career by someone in the team, “It must be easy for you since you can flirt with any guy.” I didn’t even know how to process that statement. But I became extremely conscious of my own behavior even when it was completely unnecessary.</li></ol><p>As a woman,<em> you are already conscious of how you sit, walk, dress, and talk</em>. Now, I had to be conscious of how I interacted with male colleagues too. Because having a close guy friend at work could mean being taken less seriously. And my career is very important to me. In a team full of men, it ends up a bit lonely.</p><h3>Calling It Out: A Small Step Toward Change</h3><p>But here’s something I’ve learned: I might have been lucky. Many of the people I encountered weren’t intentionally biased. Don’t get me wrong I am not trying to defend them. They simply never questioned their own assumptions. They never noticed the patterns until it was pointed out to them.</p><p>Over the years, <strong>I have made it a point to challenge these biases when I see them</strong>. An example: I told a senior at work to stop putting a female teammate on the spot by saying: “Boys and &lt;female’s name&gt;” or “Gentlemen and &lt;female’s name&gt;” in conversations. Not only did he stop, but he also ensured that no one in the team made that distinction again. Thankfully (but sadly that the incidents happened) there have been many more such situations in the last few years. <strong>I want to do my part!</strong></p><p>Again, I won’t defend bias, but I do believe in calling it out. Because sometimes, all it takes is awareness to spark change.</p><h3>Choosing to Stay in STEM</h3><p>Back in the fifth grade, for a brief moment, I wondered if I belonged in STEM (mostly maths at that point given i was 10 years old :P ). That moment could have shaped my future in the worst way. But instead, it did the opposite, it became one of the reasons I stayed. I not only wanted to become a software engineer but a deeply technical one.</p><blockquote>As for the guy in fifth grade, I hope that day didn’t leave a lasting impact on him. I hope he grew beyond it, unlearning what he had unknowingly absorbed at such a young age.</blockquote><h3>The Takeaway This Women’s Day</h3><p>Gender bias doesn’t always come from malice. Often, it comes from unquestioned norms, passed down without thought. But the good news is that it can be unlearned.</p><p>And the best way to unlearn it? Start by noticing it.</p><p><strong>Happy Women’s Day.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nZ7TdjIQA7zNawYWHKZggg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09dc5734c5da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Training AI in space?]]></title>
            <link>https://medium.com/universe-of-ai/training-ai-in-space-4b469521ae31?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b469521ae31</guid>
            <category><![CDATA[energy]]></category>
            <category><![CDATA[space]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 11:33:38 GMT</pubDate>
            <atom:updated>2025-02-10T11:51:07.044Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Disclaimer: While, this isn’t exactly a part of my “<a href="https://kushasahu.medium.com/list/building-better-data-engines-4f2cb0237687">Building better data engines</a>” blog series, I will add it in the series as a special addition since it relates to “how to make the overall process of developing accuracy efficient and energy efficient ML systems”. This is based on a fantastic and yet bold paper (link in one of the following sections) I read recently and it instantly made me wanting to write about it. With college and work being heavy right now, I haven’t had a chance to write my next article in the series, but will do soon, but this one I wanted to invest my time in now.</blockquote><h3>Growing Energy Problem of AI</h3><p>Artificial Intelligence is hungry. Hungry for data, hungry for electricity. <a href="https://thebreakthrough.org/journal/no-20-spring-2024/unmasking-the-fear-of-ais-energy-demand"><strong><em>Increasingly more hungry for electricity!</em></strong></a><strong><em> </em></strong>The industry is ravaging energy in a way that would make the fanciest of the datacenters blush. There have been so many recent conversations around the energy demands of GPT-4, Gemini, some estimates hint at <strong>triple global electricity consumption</strong> in the coming decades! That’s crazy. With the energy transistion still in its early stages, <strong>Earth may not even have enough energy to sustain AI’s growth.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPMhHKV0kmLFlsIXuTSGrg.jpeg" /><figcaption><a href="https://www.marketwatch.com/story/ai-could-demand-a-shocking-amount-of-electricity-check-out-this-chart-e91e306d">https://www.marketwatch.com/story/ai-could-demand-a-shocking-amount-of-electricity-check-out-this-chart-e91e306d</a></figcaption></figure><p>Meta, in its quest to build the <strong>AI-driven metaverse</strong>, has faced challenges in keeping up with the insane compute demands. Google is getting so desperate for more power that it’s investing in <strong>nuclear energy and geothermal solutions</strong> just to keep its AI models running.</p><p>So what now ? We can move humans to space, why not AI systems ?</p><h3>Are we sure Earth can’t keep up ?</h3><p>Modern AI needs <strong>massive compute clusters</strong>, which means equally massive energy consumption. The largest data centers, such as those run by Google and Amazon, already require <strong>hundreds of megawatts of power</strong> —<strong> enough to supply small cities</strong>.</p><p>What are the main bottlenecks?</p><ol><li>Power supply issues: <strong>Electrical grids are buckling</strong> under AI’s surging energy demands, forcing companies to scramble for alternative sources. [Add to this, our increasing problem of Global warming, future seems scary sometimes when you think too deeply about it :( ]</li><li>Cooling issues: <strong>AI might just need personal waterfalls</strong> to keep their cool. Data centers use billions of liters of water every year to prevent their systems from overheating.</li></ol><p>Energy transition is still too behind. The more use of non-renewals for AI, the more carbon emissions.</p><p><strong><em>Previous experiments:</em></strong></p><p><strong>Microsoft’s Project Natick</strong> submerged data centers in the ocean to take advantage of natural cooling and improve energy efficiency. The experiment showed promising results, with servers proving to be more reliable than their land-based counterparts. <strong>Problem: </strong>Maintenance is a big issue, upgrading a hardware miles down in water is not a walk in park (or ocean!). Plus the environment impact of this method is not deeply discovered or established yet.</p><p><strong>Alphabet’s Loon Project</strong> (before it was shut down) and some other initiatives explored the idea of <strong>atmospheric data centers. </strong>Well, these would atleast be powered by renewal energy, so that’s good. Cooling issues will be lesser since its already cold there. <strong>Problem: </strong>Drastic weather events might just lead to make replicas on land again!</p><p>If land-based, underwater, and atmospheric data centers all come with trade-offs, maybe it’s time to look even higher. <strong>Enter space-based AI training.</strong></p><h3>Space based training</h3><p><strong>Lumen Orbit (now Star Cloud) [</strong>who by the way are doing some crazy amazing work] propose a bold solution: <a href="https://starcloudinc.github.io/wp.pdf"><strong>move AI training to orbit</strong></a>. Use solar powered super computers. It sounds like science fiction, but it’s closer than you think. Why could it work?</p><ol><li>In space, solar panels can generate up to <strong>5x more energy</strong> than on Earth, thanks to continuous sunlight and no pesky atmosphere getting in the way. No night, no clouds, just pure, unfiltered sunshine 24/7.</li><li>Cooling? Not a problem. The vacuum of space allows for <strong>passive radiative cooling</strong>, meaning no personal waterfalls needed.</li><li>AI in space means <strong>zero emissions</strong>, making it an eco-warrior’s dream solution.</li></ol><p>With reusable rockets like <strong>SpaceX’s Starship</strong> bringing launch costs down to <strong>$10–30 per kilogram</strong>, this idea is no longer just for sci-fi fans. It’s becoming a viable solution to one of AI’s biggest bottlenecks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*6R6ZssgxwzpB-HGd2riE5Q.png" /><figcaption>As available in the white paper: <a href="https://starcloudinc.github.io/wp.pdf">https://starcloudinc.github.io/wp.pdf</a></figcaption></figure><h3>Sounds simple, is it?</h3><p>Well of course not 😂.</p><p>A whole new kind of infrastructure [as compared to ones used for datacenters now] is needed.</p><ol><li><strong>Space-based solar power arrays: </strong>would be needed to power training clusters.</li><li><strong>Laser-based satellite networks: </strong>for data transmission back to earth. So train in space, beam results down in real time.</li><li><strong>Robots for Maintenance: </strong>Interestingly AI-driven robotics might be responsible for <strong>repairing or upgrading.</strong></li></ol><p>And with reusable <em>[remember spacex chopsticks catch?]</em> the rockets driving launch costs down, deployment isn’t as cost-prohibitive as it once was.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNfrLoG2CeNU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNfrLoG2CeNU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNfrLoG2CeNU%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/146f3a574a8256a4254c06a0a508b5cb/href">https://medium.com/media/146f3a574a8256a4254c06a0a508b5cb/href</a></iframe><p>The good thing is a lot of research and ground work is already laid down due to all the work space startups have been upto for satellites.</p><h3>Could this be an answer to the world’s energy problems ? Or parts of it ?</h3><p>While the idea sounds (a bit crazy), promising, and bold, it’s certainly not that simple. Apart from the sophisticated infrastructe needed, there are other challenges.</p><p><strong>Cost is one</strong>. Yes, launch costs have decreased significantly, but sending hardware into space is still far more expensive than building another data center on Earth. And once something is up there, maintenance can’t be just done by calling IT support.</p><p><strong>Latency: </strong>Beaming massive AI training datasets back and forth between Earth and space would require an incredibly fast and reliable satellite network, something that’s still being refined. Plus, <strong>space debris is becoming a growing concern [</strong>Yup, this might just blow up more than Bangalore&#39;s traffic]. The more infrastructure we put in orbit, the higher the risk of collisions that could damage satellites and computational clusters.</p><p>It might put a dent in the <strong>energy efficiency problem</strong> but certainly not a big one. Hardware manufacturing and rocket launches themselves still leave a carbon footprint.</p><h3><strong>Can’t we use less energy instead?</strong></h3><p>Just as <strong>data pruning revolutionized AI</strong> by proving that models don’t need endlessly massive datasets to perform well, maybe the real breakthrough isn’t about generating more energy, but about <strong><em>using less</em></strong><em>.</em></p><p>Tech companies are already working on AI efficiency improvements that could make space-based training unnecessary. <strong>Sparse training techniques</strong> reduce the number of parameters AI models need to process, cutting down energy use without sacrificing accuracy. <strong>Quantization</strong> helps shrink models so they require fewer computing resources. N<strong>euromorphic computing</strong> (where AI hardware mimics the human brain’s energy efficiency) could make AI training <strong>orders of magnitude less power-hungry</strong>. If AI hardware can be optimized at the architectural level, we might not need more energy at all — we just need <strong>smarter</strong> AI compute engines</p><blockquote>If AI is truly going to shape the future, perhaps it’s only fitting that we <strong>train it among the stars.</strong> Or, if we get smarter about <strong>using less energy instead of generating more</strong>, maybe we won’t have to.</blockquote><p>Again, Here is the link to the paper : <a href="https://starcloudinc.github.io/wp.pdf">https://starcloudinc.github.io/wp.pdf</a> . Do read. And a shoutout to the amazing team at <a href="https://www.linkedin.com/company/starcloudinc/"><strong>Lumen Orbit (now Star Cloud)</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*7zpM_OgLGeRi6-C25hleag.jpeg" /></figure><h3>What’s Next in This Series?</h3><p>This article is part of our <a href="https://kushasahu.medium.com/list/building-better-data-engines-4f2cb0237687"><em>Building Better Data Engine</em></a><em>s</em> series. Stay tuned for the next article, where I will explore Google’s <strong>Vortex</strong>, a revolutionary stream-oriented storage engine designed for big data analytics at scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b469521ae31" width="1" height="1" alt=""><hr><p><a href="https://medium.com/universe-of-ai/training-ai-in-space-4b469521ae31">Training AI in space?</a> was originally published in <a href="https://medium.com/universe-of-ai">Universe of AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building better Data Engines — Meta’s 3 Stage Data Engine & SAM]]></title>
            <link>https://medium.com/universe-of-ai/building-better-data-engines-metas-3-stage-data-engine-sam-d7714ab5e9c5?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7714ab5e9c5</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[meta]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 17:22:16 GMT</pubDate>
            <atom:updated>2025-02-10T11:51:46.555Z</atom:updated>
            <content:encoded><![CDATA[<h3>Meta’s 3 Stage Data Engine, Segment Anything Model</h3><p>In <a href="https://kushasahu.medium.com/building-better-data-engines-96e189b7d274">our last story</a>, we introduced data engines and the emerging need and challenges to make a good one. Our mantra is <em>Garbage in — Garbage out. </em>Continuing from this, we will discuss <em>Meta’s 3 Stage Data Engine </em>in this article.</p><pre>What this article covers ?<br>1. Why does meta need &gt;1 Billion annotations ?<br>2. Data Engine : Stage 1 : Assisted manual annotation<br>3. Data Engine : Stage 2: Semi-automatic annotation<br>4. Data Engine : Stage 3: Fully automatic annotation<br>5. Side systems used: Monitoring, annotation system etc<br>6. Important Learnings from this design.</pre><h3>&gt; 1 Billion Annotations. But why does Meta need so many?</h3><p>Meta has almost <strong>&gt; 2.9 billion active users</strong> across its platforms. The world’s population, last noted is around <strong>8 billion</strong>. That is a massive scale. And with that scale comes different use cases. Meta relies on annotations to train AI systems to detect inappropriate content, recommend personalised posts, and create immersive AR/VR experiences. For instance, Instagram’s filters use annotations to recognise faces and objects in real-time, while Facebook employs annotated datasets to identify harmful content and ensure accessibility features like alt text for visually impaired users.</p><p>Clearly you need something crazy to handle this scale!</p><h3>Meta’s 3-Stage Data Engine</h3><p>Well involving human annotations is out of the question for this massive scale. Meta needed something automated, but accurate. They created a 3-stage data engine which uses both automation and human involvement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_PqFJZXe47LYbim8r8hFw.png" /><figcaption>Masks generated by SAM on a sample image containing 200–300 masks</figcaption></figure><p>Stage 1: <strong>Assisted-Manual Annotation</strong></p><p>For accuracy, meta wanted human annotations. To help out, the annotators use SAM itself. SAM generates initial annotations and humans refine them. This stage <strong><em>is </em></strong>time-consuming, taking approx <strong>38 seconds per annotation.</strong> But this serves as “Lets get this right before we make this fast”, a very careful groundwork. Generally annotated by multiple humans.</p><p>General pipeline looks like :</p><p><em>Raw Data [Image, Video, Audio] → Normalisation → Task creation (labelling, transcription, segmentation etc) → ML models used to create pre-annotations → Data distributed along multiple annotators → Annotators verify , modify, add relevant annotations.</em></p><p>If there are disagreements in annotations, markers are added to the data for second stage.</p><p>Stage 2: <strong>Semi-automatic automation</strong></p><p>The second stage further refines the annotations. In stage 1, since multiple annotators annotate same data, there could be disagreements. This stage, hence focuses on solving them. [Input is output of stage 1]</p><p>Some consensus algorithms models are used to resolve the conflicts. This looks similar to <strong>majority voting or weighted voting</strong> where higher weight is given to annotators who have had higher accuracy in the past. In this this is not possible due a complex disagreement, it is passed for a manual review <em>[Hence the “semi”-automation]</em>.</p><p>This output is then passed for quality validation by comparing the annotation to a “gold standard”. This gold standard is a small dataset of highly accurate annotations. The comparison to this dataset often tells annotator performance issues and other errors.</p><p>Stage 3: <strong>Fully automatic annotations</strong></p><p>Once the output of second stage is marked with low confidence areas and is manually reviewed for those, the dataset is then ready to be used for automatic annotations, i.e ready for deployment. Deployed systems annotate with a speed of around <strong>4.5 seconds per mask</strong>, which is around <strong>8x faster.</strong></p><h3><strong>Systems apart from ML Models</strong></h3><p>SAM is not just the ML models, there is whole lot of system design to enable it. These systems often get overlooked but as just as important (if not more).</p><p><em>Monitoring: </em>At every step, proper logs are added in the system. For eg, stage 1, each datapoint is marked with which annotators annotated what, timestamps, performance details such as speed. There are real time dashboards as well to monitor the statuses.</p><p><em>Annotation systems: </em>There are visual systems that help annotators annotate, commit, revert , comment, review , accept changes etc. This means, there is versioning for annotations as well, so that they can revert to their older changes if needed.</p><p><em>Annotator Details system: </em>Maintains annotator details, past performances, accuracy, expertise etc.</p><p><em>Task Management system: </em>In stage 1, the annotations are distributed across annotators. This is done by a task management system, which first creates tasks for a data point and then dynamically assigns them to annotators taking in account their expertise and past performance. Since the scale is extremely large, this also acts as a <strong>load balancing system</strong>.</p><p>There are of course more, but these are some I could gather from the information available.</p><h3>Learnings</h3><p>Back to our goal of designing better data engines, what do we learn from SAM ?</p><ol><li>It is important to have a solid groundwork, even if it slow. Human annotators are used in stage 1 despite a time-consuming process to ensure accuracy.</li><li>Iteration: the system iterates, it uses human annotation, then semi automation with reviews and then deploys for fully automation. This iteration again helps achieving a great accuracy.</li></ol><p>Meta’s system throws a strong light on the importance of data preparation. I can only imagine the design of the system at their scale, its incredible. The system may still struggle with bias in some cases but the accuracy and speed that they achieve has a huge impact on how we interact on their platforms.</p><p>Next up, Google’s <strong>Vortex</strong>, a revolutionary stream-oriented storage engine designed for big data analytics at scale!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7714ab5e9c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/universe-of-ai/building-better-data-engines-metas-3-stage-data-engine-sam-d7714ab5e9c5">Building better Data Engines — Meta’s 3 Stage Data Engine &amp; SAM</a> was originally published in <a href="https://medium.com/universe-of-ai">Universe of AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building better Data Engines]]></title>
            <link>https://medium.com/universe-of-ai/building-better-data-engines-96e189b7d274?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/96e189b7d274</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Tue, 10 Dec 2024 17:22:18 GMT</pubDate>
            <atom:updated>2024-12-10T17:22:18.724Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This is a blog series (a set of multiple articles), where we will learn what data engines are, why they are important and discuss different case studies from Meta, Google, Amazon etc.</blockquote><p>Google processes about <strong>3.5 billion</strong> search queries daily. Amazon handles <strong>hundreds of millions</strong> of customer interactions in real time. Netflix has over <strong>350 million viewing profiles</strong> that it personalises. I can only image the amount of events are generated on every interaction on these platforms. AI Models use these billion datapoints to refine their predictions. Tesla’s car gets trained on millions of images and videos to avoid obstacles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lvK9ZKnNzbfskogZLYamA.png" /><figcaption>[ Scale of Data: Image generated via AI ]</figcaption></figure><p>Here’s the challenge, these datasets, these millions of rows are extremely massive, noisy and unstructured. AI systems are only good if the data is good. As popularly said, “Garbage in — Garbage out”.</p><p><em>How to build data pipelines that not only support these systems but is scalable, efficient and ethical ?</em></p><h3><strong>What is a Data Engine ? — A supply chain for AI</strong></h3><p>Data engines are systems and pipelines that prepare the data for AI models. It encompasses everything from collecting, preprocessing, curating to annotating and monitoring the data over time.</p><blockquote>It ensures right data is delivered to the model in the right format at the right time and in right quality.</blockquote><p>The main functions are: collecting raw data from various sources; clean it; format it in the right way; add labels for supervised learning; prune data if needed; monitor the data pipeline to ensure relevant and quality.</p><h3>Key Challenges in Building the Engine</h3><p>Challenges generally stem from the galaxy sized data. The most pressing roadblocks (that need to be addressed in the engine) are</p><ol><li>Class Imbalance: Class imbalance occurs when certain categories of data are significantly overrepresented while others are scarce. For example, in a fraud detection dataset, legitimate transactions might make up 99% of the data, while fraudulent transactions comprise just 1%. Training models on such imbalanced datasets can lead to biased outcomes, where the model performs well on majority classes but struggles with minority ones. This imbalance is particularly critical in high-stakes applications like healthcare or safety, where errors on rare events can have severe consequences. <strong><em>Good data engines address class imbalance.</em></strong></li><li>Noisy Data: Real-world datasets are messy, with missing values, duplicates, or irrelevant information. Noise can creep into the data into several ways. Such as typos in review texts, tweets etc. Or corrupted images in vision datasets such as blurred images of products, selfies (needed for identify verifications). Noisy data degrades performance, worse, introduce bias, as models might learn from patterns that don’t truly represent the task. <strong><em>Good data engines address noisy data in an efficient and performant manner.</em></strong></li><li>Scalability: Engines need to handle the massive data, high concurrency. <strong><em>Good data engines address scalability by optimising storage, processing and retrieval systems.</em></strong></li><li>Environmental Impact: Running models on these ginormous datasets consuming vast of energy contributing to global carbon emissions. <strong><em>Good data engine address environmental impact by optimising computational resources.</em></strong></li><li>Ethical impact: Dataset reflect societal biases often exberating them in the model. For eg, facial recognition systems are known to favour light skinned humans. <strong><em>Good data engines address different biases and privacy issues.</em></strong></li><li>Accurate Annotations: Supervised learning requires accurate labelling of data for good performance. Labelling generally needs human efforts, domain experts. For eg, medical diagnosis would require correct labelling from doctors. This is time consuming. <strong><em>Good data engines address accurate annotation by designing a system that reduces this burden while keeping the quality.</em></strong></li><li>Real time data: Recommendation engines or autonomous vehicles require real-time data pipelines that process and deliver insights instantaneously. These systems must handle high-velocity data streams while ensuring accuracy and reliability. This overlaps a bit with scalability. Delays can lead to poor user experiences, or safety-critical failures. <strong><em>Good data engines allow real-time data analytics.</em></strong></li><li>Diverse Data types: Most AI/ML systems need to work with different types of data. For eg, a company may require to create models on textual comments, images/videos in reviews etc. <strong><em>Good data engines should be able to work on diverse data types in a standardised manner.</em></strong></li></ol><h3>Popular case studies</h3><p>In this series, we will discuss the following case studies (in upcoming articles) and how the above challenges are addressed by different solutions.</p><ol><li>Meta’s three-stage data engine for the <strong><em>Segment Anything Model</em></strong> showcases how combining automation and human oversight can scale data annotation efficiently.</li><li><strong>Google’s data pruning techniques</strong> demonstrate how retaining only high-value data points can reduce computational costs while maintaining performance.</li><li><strong>Amazon’s real-time pipelines</strong> for personalization illustrate the challenges of processing diverse, unstructured data streams at scale.</li><li>Netflix’s focus on <strong>curating relevant datasets</strong> for recommendations highlights the importance of prioritising quality over sheer volume.</li></ol><p>Data engines are only starting to get spotlight. As datasets balloon in size and AI systems get more hungrier, <strong>the need for efficient, scalable, and ethical data engines is more important than ever</strong>.</p><blockquote>A while back, I dived into <strong>self-supervised pruning</strong>, a method that’s basically Marie Kondo-ing your dataset. That article explored Meta’s pruning strategies and how they cut down on computational waste while saving the planet one dataset at a time. If you’re curious, you can check it out here: <a href="https://medium.com/@kushasahu/reduce-environment-impact-by-data-pruning-54fb84a6e0be">Breaking Neural Scaling Law by Pruning Data</a>.</blockquote><p>This series takes that conversation further, shining a light on how the big names: Meta, Google, Amazon, and Netflix are building smarter data engines. Next up, we’ll start with <em>Meta’s innovative approach to scaling data annotation</em>. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96e189b7d274" width="1" height="1" alt=""><hr><p><a href="https://medium.com/universe-of-ai/building-better-data-engines-96e189b7d274">Building better Data Engines</a> was originally published in <a href="https://medium.com/universe-of-ai">Universe of AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What makes robots human ?]]></title>
            <link>https://kushasahu.medium.com/what-makes-robots-human-ad35f4291314?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad35f4291314</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[robotics]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 12:05:22 GMT</pubDate>
            <atom:updated>2025-07-22T12:25:11.719Z</atom:updated>
            <content:encoded><![CDATA[<h3>What makes robots human ?</h3><p>Ever laughed at a video of someone slipping on icy snow, only to recover with exaggerated confidence as if nothing happened? Or maybe you’ve chuckled at a pet dog slipped while walking and acted like nothing happened the next second? There’s something universally amusing about these small, clumsy moments that feel both relatable and harmless.</p><p>That’s why, when I heard about the <strong><em>tiny robot in Shanghai convincing 12 larger robots to abandon their posts and follow it home</em></strong>, I couldn’t help but smile. While it turned out to be a controlled experiment, the story stuck with me. It made me think about how much their behaviour reminded me of us: leading, following, making decisions, and maybe even rebelling.</p><p>It got me curious: why do we love these stories so much? Why do we connect with robots when they stumble, fail, or act out in ways that mirror our own imperfections?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F3UIYN2fuZYc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D3UIYN2fuZYc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F3UIYN2fuZYc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5289cf11b8294cb1cb6b7cc1f4a1de39/href">https://medium.com/media/5289cf11b8294cb1cb6b7cc1f4a1de39/href</a></iframe><p>And honestly, it reminded me of my own robotic “family members” and their quirks.</p><p>Take my robot vacuum cleaner, for example. It has this hilarious habit of <strong><em>dramatically announcing, “Help, I am stuck,</em></strong>” when it gets itself wedged under the couch or tangled in a carpet. It’s hard not to laugh at its melodramatic plea, but then there are moments when it tugs at my heartstrings. Like when it struggles to find its charging dock , wandering aimlessly in the room as if lost. Is it silly to feel sad for a vacuum cleaner? Maybe. But in those moments, it feels like more than just a machine.</p><p>Then there’s my Google Home, which has a knack for inserting itself into conversations at the most unexpected times. A couple of years ago, my mom and I were discussing layoffs and if Google will also follow the path of Meta. Out of nowhere, Google Home chimed in: <strong>“Thank you for thinking about me, especially in these tempestuous times.”</strong> I don’t know what was more surreal , the fact that it joined the conversation uninvited or that it sounded so oddly emotional. We were too stunned to do anything but laugh (and a bit scared honestly).</p><p>And I can’t forget the time it roared like a lion at <strong>1 a.m.</strong> Yup, you read that right, a random, feral lion roar broke the silence of the night, courtesy of my Google Home. I still don’t know why it happened, but it scared me half to death before becoming one of my favourite stories to tell.</p><p>At this point, I don’t just think of these devices as gadgets anymore, <strong><em>they’re like quirky family members</em></strong>, complete with their own personalities, missteps, and unexpected moments of charm.</p><h3>Some more stories</h3><p>There’s the <strong>KnightScope K5 security robot</strong> that accidentally rolled into a fountain, as if overwhelmed by the pressure of its job. <em>[ Btw , there have many more such incidences with this robot ]</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPGLLDVSfcA8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPGLLDVSfcA8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPGLLDVSfcA8%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a23a9951da3a38aba99a39c3aee3b5a9/href">https://medium.com/media/a23a9951da3a38aba99a39c3aee3b5a9/href</a></iframe><p><a href="https://www.ibtimes.com/fabio-pepper-robot-fired-incompetence-edinburgh-store-2643653"><strong>SoftBank’s Pepper robot,</strong></a> who got “fired” from a grocery store for being too friendly and chatty, charming customers with completely off-topic conversations, and being incompetent.</p><p>There’s <a href="https://www.livescience.com/55164-russian-robot-escapes-lab-again.html"><strong>Promobot</strong></a>, the robot that “escaped” from a lab in Russia, only to have its great escape cut short when its battery died in the middle of the street. (Maybe it didn’t like being experimented on? 😂)</p><p><strong>The famous Boston Dynamics robots</strong>. They can jump, run, and even dance with precision, but it’s their bloopers , the trips, the stumbles, the hilarious attempts to recover , that make us love them more. Watching them fail and try again feels oddly inspiring, like watching someone learn a new skill and refusing to give up.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FaX7KypGlitg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaX7KypGlitg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FaX7KypGlitg%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e761b59df3f0573542eecc7c47dfa05c/href">https://medium.com/media/e761b59df3f0573542eecc7c47dfa05c/href</a></iframe><h3>Trust vs Fear</h3><p>For some reason, all these <strong>Oops</strong> moments just makes me trust the AI a little more. The sense of vulnerability that comes with the imperfections of the machines, help build trust. It’s easier to connect with something that struggles or falters like we do. It feels less intimidating and more approachable. Instead of viewing AI as a alien, these moments make it part of our world, <em>a helper we can empathize with, laugh at, and, rely on</em>.</p><p>While we may trust AI more when it makes mistakes, there’s also something unsettling about an AI acting too human. Do we want AI to exhibit traits like vulnerability and the ability to learn from failure, or does this blur the line between machine and humanity in ways that feel dangerous?</p><p>The concept of the <strong>uncanny valley</strong> : “where something looks or acts almost human but not quite” applies here. An AI chatbot that understands emotions can feel comforting, but if it becomes too good at empathy, we might start questioning whether it’s manipulating us. Similarly, when a robot behaves too much like a person, it can spark fear about where the line between human and machine really lies. The more human-like feeling, the more fear of how it might “take over” the world (fear around jobs being taken over for eg.)</p><h3>Bigger Question : What exactly do we want our AI to be ?</h3><p>Do we want AI to act more like humans or remain distinctly robotic? On one hand, human-like AI can build deeper connections with us, improving communication, trust, and collaboration. On the other hand, there are jobs and systems like surgery or manufacturing where we expect precision, not human-like hesitation or error. Mistakes are one way AI can seem human, but they’re not the only way. Empathy, creativity, and adaptability can all make AI feel more relatable without relying on flaws. For example, Google Duplex, the AI assistant that books appointments over the phone, mimics human speech patterns with “ums” and pauses. While impressive, it also raised ethical questions: should AI pretend to be human, and what responsibilities come with that? If AI starts acting too much like us, do we risk blurring the boundaries of human identity?</p><p><strong>What do you think ?</strong></p><h3>Ethics</h3><p>If a robot acts like human and tumbles down due to a bug in software, can it sue the owners ? If there is a dangerous situation where a robot “dies”, would it raise ethical concerns if it could have been saved somehow ? While these are obviously bizarre scenarios, the “<em>human</em>” act does raise profound questions. At what point do we consider AI “<em>deserving</em>” of rights? If a robot displays emotion or self-awareness, does it deserve protection from harm? These aren’t just sci-fi hypotheticals. Philosophers, ethicists, and lawmakers are grappling with how to define and regulate the rights of advanced AI systems.</p><p>The question of AI rights can wait; for now, the real cornerstone is <strong>accountability and responsibility</strong>. If a robot makes a mistake : whether it’s crashing into something, providing harmful advice, or causing unintended consequences, who takes the blame? Is it the creators who designed the algorithms, the users who deployed it, or the AI itself? if an AI chatbot emotionally manipulates someone, is it a failure of the model’s training data, or is it acting independently based on learned behaviour? Who takes responsibility ?</p><p>Imagine being misdiagnosed by a “human-like” robot? What happens then? Having these conversations is the first step. These discussions help us set boundaries, define accountability, and ensure that the development of AI aligns with our values. While ethics is a broader subject that can’t be covered in one article, I encourage the discussion in this blogpost.</p><p>Have you ever encountered “human-like” behaviour in AI systems around you ? What counts as human to you ? What do you think about the accountability of these system to be defined as ?</p><blockquote><strong><em>What do you want your AI to be ?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*u683s6GceOtkas-H_qhmwg.jpeg" /><figcaption>Eilik Desk Robot</figcaption></figure><p>Feel free to leave your thoughts here! Would love to know them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad35f4291314" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Neural Scaling Law by Pruning Data]]></title>
            <link>https://medium.com/universe-of-ai/reduce-environment-impact-by-data-pruning-54fb84a6e0be?source=rss-a4a993352d44------2</link>
            <guid isPermaLink="false">https://medium.com/p/54fb84a6e0be</guid>
            <category><![CDATA[machin-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[class-imbalance]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Kusha Sahu]]></dc:creator>
            <pubDate>Mon, 25 Nov 2024 19:10:39 GMT</pubDate>
            <atom:updated>2024-11-27T10:09:51.328Z</atom:updated>
            <content:encoded><![CDATA[<p>Machine learning has always been guided by the principle: “the more data, the better the results.” But as datasets balloon to billions of rows, cracks in this approach are becoming increasingly obvious. First, there’s the <strong>financial cost</strong> — storing, managing, and processing these massive datasets doesn’t come cheap. From expansive cloud storage bills to the compute power required to train models on this data, the costs add up quickly. Then, there’s the <strong>environmental impact</strong>. Training on ever-larger datasets consumes staggering amounts of energy, with data centers already accounting for about <strong><em>1% of global electricity use</em></strong> — and that number is only growing with AI workloads. Every time you use ChatGpt, Perplexity, Gemini, Meta AI, etc, it just adds up to the use!</p><p>And so, this is big data’s <strong>Dirty little secret!. More data → Better Results Okay! → HUGE Costs, Environment impacted. Worth it ?</strong></p><p>The question is, does it have to be this way? What if we could achieve better results by focusing on <strong>quality over quantity</strong> ?</p><h3>Scaling Law</h3><p>AI Scaling law states “more data → better results”. The law predicts that performance of an AI model follows a <strong>power law relationship </strong>with dataset size. Mathematically, it is:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fmath.embed.fun%2Fembed%2FtSgfNrsLy6cj91RjrBQv5D&amp;type=text%2Fhtml&amp;schema=embed&amp;display_name=Embed+Fun&amp;src=https%3A%2F%2Fmath.embed.fun%2Fembed%2FtSgfNrsLy6cj91RjrBQv5D" width="200" height="135" frameborder="0" scrolling="no"><a href="https://medium.com/media/86db6e5cb30e6116e9615f101f365fc4/href">https://medium.com/media/86db6e5cb30e6116e9615f101f365fc4/href</a></iframe><p>where α is a scaling factor which generally hovers around 0.5. Lets put down some real numbers to understand the problem here.</p><p>Say you start with 10,000 samples and achieve 20% error. Doubling your data to 20,000 samples might feel ambitious, but it barely nudges your error down to 15%. To halve your error to 10%, you’ll need <strong>40,000 samples</strong> — a 4x increase in data. Want to quarter that error to 5%? You’ll need <strong>160,000 samples</strong>. And if you’re aiming for 2% error, you’re looking at <strong>1,000,000 samples</strong>. That’s a 100x increase in data for a marginal linear improvement in performance.</p><h3>Building Smarter Data</h3><p>So, clearly, power law — performance relationship is a big problem! Enter <strong>data pruning</strong>, a strategy that focuses on trimming the fat — removing redundant, noisy, or low-value data points to make datasets leaner and more efficient.</p><p>The idea is deceptively simple. Instead of training on all available data, focus on the “hard” examples — those that provide the most information and challenge the model to learn. What’s remarkable is that these gains don’t always require labeled data. S<strong>elf-supervised pruning metrics</strong> can identify impactful data points without the need for human annotation.</p><p>Pruning gains are certainly not theoretical. Netflix, for example had to grapple with massive datasets of user interactions. They too tried to improve their recommendation system by scaling dataset. And as expected, got stuck in a rut!. More data → more noise → training got slower → lesser returns. They pivoted and curated their training data to focus on meaningful interactions (like underrepresented genres or complex user behaviors), and achieved significant improvements in personalization without overblown costs.</p><h3>What is Self-supervised Pruning ?</h3><p>All we are saying so far is have good data and you need less of it. Great! Less data, less cost, less environment impact! I am fan. Why is it hard ? What’s the problem ?</p><p>How do you identify good data ? Someone can label it!. So effectively we said, someone needs to spend time and provide labelled dataset. Well, that sounds mind-numbingly tedious, boring work. Anyone up for it?</p><p>No worries, we can build a system which identify important datapoints automatically. Meta introduced self supervised pruning in their research paper, and it looks somewhat like the following:</p><p><strong>Step 1: Representation Learning →</strong></p><p>The model first learns a compact representation of the dataset by solving pretext tasks that don’t require labels. For example, it might predict missing parts of data, reorder sequences, or contrast data points to distinguish between similar and dissimilar examples. This step creates the embeddings.</p><p><strong>Step2 : Scoring Data Points →</strong></p><p>Once the embeddings are generated, self-supervised pruning metrics evaluate each data point based on intrinsic properties such as:</p><p>• <strong>Complexity</strong>: How challenging is this sample for the model to learn? Samples that push the model to generalise are typically more valuable.</p><p>• <strong>Diversity</strong>: Does this sample provide unique information, or is it redundant with others? Diverse samples are prioritised to avoid over-representing repetitive patterns.</p><p>• <strong>Informativeness</strong>: Does the sample contribute significantly to improving the model’s understanding of the task?</p><p><strong>Step 3: Ranking and Selection →</strong></p><p>Based on these scores, the data points are ranked in terms of their importance. The model then removes the least impactful data points — those that are either too easy to learn from, highly redundant, or provide little additional value. This process drastically reduces the dataset size without compromising on its richness or diversity.</p><p><strong>Step 4: Iterative Refinement →</strong></p><p>Pruning isn’t a one-and-done process. The model iteratively refines its selection as it trains, re-evaluating which data points are most useful based on its updated understanding of the task. This adaptive process ensures that the dataset remains aligned with the model’s learning needs throughout training.</p><p><strong>Step 5: Reduced Training Dataset →</strong></p><p>After pruning, the model trains on a much smaller but higher-quality dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*igM85mNE_lHDmeXTi2pdfQ.png" /><figcaption>Accuracy vs Dataset size graph from the research paper Beyond Neural Scaling Laws by Meta</figcaption></figure><h3>What’s the downside? Class Imbalance!</h3><p>Pruning sounds promising. However, evidently, it can very easily <strong>exacerbate class imbalance.</strong> When data is pruned based on criteria like complexity or informativeness, there’s a risk that examples from minority classes — already underrepresented in the dataset — might be disproportionately removed. This can lead to models that are even less effective at recognising minority classes, making an already difficult problem worse. If you working on disease diagnosis, this can become a hug issue. <strong><em>Plus, if not careful, if sensitive attributes are involved such as gender, race etc, it would become extremely easy for the bias to creep in further.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*Q9sVAJkAOrQC1NN01_gMag.png" /><figcaption>Class Balance vs Pruning for self-supervised method. As Pruning fraction increases, class -balance decreases (class imbalance increases). Ref:Beyond Neural Scaling Laws by Meta</figcaption></figure><p>So, how can we address this issue? Well, couple of ways:</p><p>• <strong>Weighted Pruning</strong>: You can assign a higher weight to minority class sample to make sure they retain a stronger presence in the pruned dataset.</p><p>• <strong>Active Learning with Class Awareness</strong>: Prioritise “hard” examples from minority classes during pruning. Basically make sure the model is exposed to the most informative samples across all classes.</p><p>• <strong>Post-Pruning Rebalancing</strong>: Techniques like oversampling or synthetic data generation for minority classes can be applied after pruning to restore balance in the dataset</p><h3>Pruning and Accuracy: Trade offs</h3><p>The promise is to have comparable accuracy even with smaller dataset. But how “comparable” is comparable ? From, the first image of this article, it can be seen that accuracy did dropped. Are we okay with this drop ? How much can this drop be? It depends on the quality of initial dataset. Pruning can lead to only slight drops in accuracy for larger datasets where edge cases are harder to identify but provides significant efficiency gains. On the other hand, for <strong><em>highly imbalanced ones</em></strong>, the cost to accuracy can be more pronounced, making pruning ineffective. This becomes specially important when you are working on classic class imbalance problem statements such as medical diagnosis, fraud detections, rare events predictions, churn predictions etc.</p><h3>Final Word</h3><p>Scaling law give us a reality check on the dataset size required to achieve high accuracy. However, if you put “Good data” in , you get good accuracy out even with smaller dataset. Pruning is one way to develop a good dataset. Meta showed us how we can create a “Self supervised pruning” system, that automates the process. But it’s not a silver bullet. Improper pruning can amplify issues like class imbalance, overlook rare but valuable data points, and even compromise accuracy if not carefully designed.</p><p>As future comes more and more closer, the focus has shifted from blindly collecting data to collecting good data or refining it to make it good quality. <strong>Building good data engines now becomes CORE of the problem. </strong>Good engines build pipelines that are essentially an intelligent automation [for eg with self-supervised pruning] coupled with human oversights. We will discuss how Meta build their 3-stage data engine system for automating annotations in upcoming articles.</p><blockquote><strong>Good dataset tend to be smaller. Smaller datasets use less computation. Less computation → less environment impact! With ChatGpt and such taking almost an entire city electricity demand, good data engines are urgent calls.</strong></blockquote><h3>Reference</h3><p><a href="https://ai.meta.com/research/publications/beyond-neural-scaling-laws-beating-power-law-scaling-via-data-pruning/">https://ai.meta.com/research/publications/beyond-neural-scaling-laws-beating-power-law-scaling-via-data-pruning/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54fb84a6e0be" width="1" height="1" alt=""><hr><p><a href="https://medium.com/universe-of-ai/reduce-environment-impact-by-data-pruning-54fb84a6e0be">Breaking Neural Scaling Law by Pruning Data</a> was originally published in <a href="https://medium.com/universe-of-ai">Universe of AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>