<?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"><channel><title><![CDATA[Shambhavi]]></title><description><![CDATA[Shambhavi]]></description><link>https://shambhavik.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Shambhavi</title><link>https://shambhavik.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 22:32:56 GMT</lastBuildDate><atom:link href="https://shambhavik.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[What Actually Happens When You Ask ChatGPT a Question?]]></title><description><![CDATA[It starts with your phone keyboard
You open WhatsApp and type: "Happy birthday to..."
Before you even finish, your keyboard suggests one word: "you".
You never taught your phone that. It just knows, b]]></description><link>https://shambhavik.hashnode.dev/what-actually-happens-when-you-ask-chatgpt-a-question</link><guid isPermaLink="true">https://shambhavik.hashnode.dev/what-actually-happens-when-you-ask-chatgpt-a-question</guid><category><![CDATA[AI]]></category><category><![CDATA[llm]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[chatgpt]]></category><category><![CDATA[Computer Science]]></category><dc:creator><![CDATA[Shambhavi Krishnan]]></dc:creator><pubDate>Sun, 11 Oct 2026 11:58:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/abdf5b92-5373-42c9-a992-fb12cde2406f.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>It starts with your phone keyboard</h2>
<p>You open WhatsApp and type: <strong>"Happy birthday to..."</strong></p>
<p>Before you even finish, your keyboard suggests one word: <strong>"you"</strong>.</p>
<p>You never taught your phone that. It just <em>knows</em>, because millions of people have typed that sentence before and "you" is the most likely next word.</p>
<p>Hold on to that little moment. It is the seed of everything in this blog.</p>
<h2>Now, let's ask ChatGPT something</h2>
<p>Say you type: <em>"Why is the sky blue?"</em></p>
<p>You hit enter and two seconds later a clean, friendly answer appears, word by word. It feels like a tiny person on the other side is thinking, typing and explaining.</p>
<p>There is no tiny person. And here is the surprising part: <strong>what's happening is a much, much bigger version of your keyboard's guessing game.</strong></p>
<p>Let's slow things down and follow your question on its journey.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/70c529ee-34d4-4995-ae17-9d7fc0303f2d.png" alt="" style="display:block;margin:0 auto" />

<h2>Step 1: Your sentence gets chopped up</h2>
<p>Computers don't read words the way we do. So the first thing that happens is that your question gets chopped into small pieces called <strong>tokens</strong>.</p>
<p>"Why is the sky blue?" becomes something like:</p>
<p><code>Why</code> | <code>is</code> | <code>the</code> | <code>sky</code> | <code>blue</code> | <code>?</code></p>
<p>A token is not always a full word. Long or unusual words get split into smaller chunks and a rough rule of thumb is that 1 token is about 3 to 4 English characters. This is also why you will hear people say "the model has a limit of X tokens". That is just the size of its working memory.</p>
<h2>Step 2: Words become numbers</h2>
<p>Here is the thing about computers: they only understand numbers. So every token gets converted into a long list of numbers called an <strong>embedding</strong>.</p>
<p>Think of it like giving every word a <strong>GPS coordinate on a giant map of meaning</strong>.</p>
<ul>
<li><p>"King" and "Queen" sit close together.</p>
</li>
<li><p>"Dog" and "Puppy" are neighbours.</p>
</li>
<li><p>"Dog" and "Tax return" live in different cities.</p>
</li>
</ul>
<p>The model never sees the word "sky". It sees where "sky" lives on that map and what sits around it: clouds, blue, sun, air.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/d7526498-adea-4b78-92ed-3e9b6b42b164.png" alt="" style="display:block;margin:0 auto" />

<h2>Step 3: The brain does its thing</h2>
<p>Now comes the heart of ChatGPT, a design called the <strong>Transformer</strong>. Don't let the name scare you. The one idea you need is <strong>attention</strong>.</p>
<p>Imagine reading this sentence:</p>
<blockquote>
<p>"The trophy didn't fit in the suitcase because <strong>it</strong> was too big."</p>
</blockquote>
<p>What does "it" mean? The trophy or the suitcase? You instantly know it is the trophy, because you pay attention to the right words in the sentence.</p>
<p>The model does the same. For every token, it asks: <strong>"Which other words in this conversation matter most to understanding this one?"</strong> It does this over and over, across many layers (dozens, in big models) and each layer understands your question a little better.</p>
<p>That is the famous idea behind the 2017 research paper titled <em>"Attention Is All You Need"</em> and it is why modern AI suddenly got so good.</p>
<h2>Step 4: The guessing game, just like your keyboard</h2>
<p>After all that processing, the model does exactly what your phone keyboard does. It asks:</p>
<p><strong>"Given everything so far, what is the most likely next token?"</strong></p>
<p>It produces a list of candidates, each with a probability:</p>
<table>
<thead>
<tr>
<th>Next token</th>
<th>Chance</th>
</tr>
</thead>
<tbody><tr>
<td>"The"</td>
<td>38%</td>
</tr>
<tr>
<td>"Sunlight"</td>
<td>21%</td>
</tr>
<tr>
<td>"Great"</td>
<td>9%</td>
</tr>
<tr>
<td>...and thousands more</td>
<td></td>
</tr>
</tbody></table>
<p>It picks one (with a little randomness, more on that below), adds it to the text and then <strong>does the whole thing again</strong> for the next token. And again. And again.</p>
<p>That's how the answer appears word by word on your screen. It is not a typing animation. The model is generating it live, one token at a time.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/35ee4f8f-a6c7-4e7e-80ce-6ff55fa5bdef.gif" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/e7b3b389-8ea2-4b58-92d2-022b9b56f106.gif" alt="" style="display:block;margin:0 auto" />

<h3>About that "little randomness"</h3>
<p>There's a setting called <strong>temperature</strong>. A low temperature means the model plays it safe and always picks the top guess. A higher one means it sometimes picks a less obvious word, which feels more creative. That is why asking the same question twice can give slightly different answers.</p>
<h2>But wait, how did it get so smart?</h2>
<p>A fair question. Your keyboard only knows "Happy birthday to <em>you</em>". ChatGPT can explain physics and write poems. What's the difference?</p>
<p><strong>Training.</strong> And a lot of it, in two main stages:</p>
<p><strong>Stage 1: Pre-training (reading the internet).</strong> The model is shown a huge amount of text, such as books, articles, websites and code. Its only task is: <em>hide the next word and guess it.</em> It guesses wrong, gets corrected, adjusts its internal numbers a tiny bit and repeats this billions and billions of times. Those internal numbers are called <strong>parameters</strong> (or weights). Big models have hundreds of billions of them. Think of them as tiny dials, tuned until the guessing gets really good.</p>
<p><strong>Stage 2: Fine-tuning with human feedback (learning manners).</strong> A model that only predicts text might ramble or say weird things. So humans rate its answers ("this one is helpful, this one is bad") and the model is nudged toward the helpful ones. This is often called <strong>RLHF</strong> (Reinforcement Learning from Human Feedback). It is the step that turns a text-guesser into something that feels like an assistant.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a881f8e6282a743dd5e2398/4a0cf368-e37d-41fe-ba51-d38df135f559.png" alt="" style="display:block;margin:0 auto" />

<p>So... does it actually understand?</p>
<p>This is where it gets interesting and honestly debated, even among experts. What we know for sure:</p>
<p>• It doesn't look up answers in a database. The knowledge is baked into those billions of numbers.</p>
<p>• It doesn't "know" things the way you do. It predicts what a good answer would look like.</p>
<p>• That's why it can sometimes sound confident and be completely wrong. This is called a hallucination. The model isn't lying. It is producing the most plausible-sounding text and plausible is not always true.</p>
<p>So the practical lesson: use it like a brilliant, fast-reading friend. Great for explaining, drafting and brainstorming. But double-check the important facts.</p>
<p>Let's rewind the whole story You typed "Why is the sky blue?" and here is what happened in those two seconds:</p>
<ol>
<li><p>Tokenization: your sentence was chopped into pieces.</p>
</li>
<li><p>Embeddings: each piece became a point on a map of meaning.</p>
</li>
<li><p>Transformer + attention: the model worked out which words matter to which.</p>
</li>
<li><p>Next-token prediction: it picked the most likely next piece, then repeated, one token at a time.</p>
</li>
<li><p>All of this was possible because of training: reading a huge amount of text, then learning manners from humans.</p>
</li>
</ol>
<p>And it all started with the same idea as your phone suggesting <strong>"you"</strong> after "Happy birthday to".</p>
<p>The next time ChatGPT surprises you, remember: it's not magic and it's not a tiny person. It is the world's most well-read autocomplete and that is still pretty amazing.</p>
<p><em>Enjoyed this? I'm just getting started with this blog. Next up: what happens when an AI "remembers" your conversation. Follow along!</em></p>
]]></content:encoded></item></channel></rss>