# AI 101

Lets' unbox AI. What Is Actually Happening When You Ask AI a Question, Bro? I asked ChatGPT what the capital of India was, got the answer in like two seconds, and then spent way too long overthinking what actually happens in that gap. Like, not in some deep philosophical "is AI alive" way. I mean mechanically. What is literally happening to my sentence between me hitting Enter and the text printing on the screen?

Turns out, the funda is wilder than just "the AI knows things." The easiest way to explain this without putting anyone to sleep is to think of it like a massive film production like a full-blown Game of Thrones set. A raw script goes in, and a finished scene comes out with a whole crew sweating in the background to make it happen. Say less, let us break it down.

What Is an LLM, Actually? An LLM (Large Language Model) is basically just an oversized, over-caffeinated pattern predictor. You feed it text, and it guesses what is statistically most likely to come next. It does this over and over, one piece at a time.

That is literally it.

It is like that one friend who has binge-watched every movie ever made and can now just spit out perfect dialogue on the fly because they have seen the pattern a million times. You already know the heavyweights: ChatGPT, Claude, Gemini. Different studios, different actors, but they are all running on the exact same core engine. Bet.

The "T" in GPT Now, if you are in the tech scene, the first name you think of is ChatGPT. You have heard the term GPT. It stands for Generative Pre-trained Transformer.

Generative: It generates text.

Pre-trained: It already crammed the whole internet before you even opened the tab.

Transformer: Bro, this is where the madness happens.

You might think OpenAI invented this, but here comes Google. Way before ChatGPT blew up, Google researchers dropped a paper that basically gave birth to all this smart Architecture.

The paper's name? "Attention Is All You Need." Absolute flex of a title, honestly.

![](https://cdn.hashnode.com/uploads/covers/6950d1ca85602739c40abd67/0d7a86df-cc30-4d30-bd41-e8a403902d8a.png align="center")

Decoding above Diagram. Take a look at the architecture from that paper. I know, it looks like a nightmare engineering schematic from college, but let us just look at the left side how it processes what you type in easy terms.

1.  Inputs (The Raw Script) This is exactly what you type. You ask, "Who is the true heir to the Iron Throne?" To the computer, this is just raw, meaningless garbage text. But before it can do anything, the model has to chop your sentence into tiny pieces called **Tokens**. Think of tokens as the model's custom vocabulary. Every model (ChatGPT, Claude, Gemini) has its own dictionary and cuts words differently some might see "Throne" as one token, while others split it up. It is like breaking a script down into syllables that the actors can actually pronounce.
    
2.  Input Embedding (Translating to Math) Computers do not speak English or Hindi, bro, they only speak math. Input Embedding takes your words and converts them into dense lists of numbers (vectors). It is like translating your prompt into High Valyrian, creating a secret mathematical code where similar words hang out together.
    
3.  Positional Encoding (The Scene Sequence) Bro, order matters. "Jon killed the King" vs "The King killed Jon." Same exact words, completely different vibe. Positional Encoding slaps a tiny mathematical tag on each word so the model knows exactly who is standing where in the sentence.
    
4.  Multi-Head Attention (The Main Directors) This is the absolute MVP of the paper. When you say "Winter", are you talking about the cold season or the Stark family? The Attention mechanism looks at all the surrounding words to nail the exact context. "Multi-Head" just means there are like five different directors screaming at once—one checking the grammar, one checking the tone, and one making sure the lore makes sense.
    
5.  Feed Forward & Add/Norm (The Editing Room) Once the directors figure out the context, the data goes through Feed Forward networks and normalization. This is the post-production crew doing the heavy editing polishing the math so the final output does not break.
    

All of this insane calculation happens in a fraction of a second just to predict the very next word. Then it takes that new word, adds it to your prompt, and runs the entire production all over again for the next one. Crazy, right?

## Training vs. Inference: The "Scripting" vs. "Performance" Phase

Bro, now that you know how the engine works, you have to realize that this model is pulling a double shift. It goes through two completely different phases to get you that answer: Training and Inference. Think of it like a movie: one is the months of filming, and the other is the actual premiere.

1.  The Training Phase (The Long Rehearsal) Before you ever get to chat with it, the model spends months, sometimes years in Training. This is the part where it reads the entire internet, bro. We are talking petabytes of books, code, articles, and scripts.
    

2.  The Inference Phase (The Live Performance) This is exactly what happens when you type your prompt and hit Enter. The Training is over; the actor is now on stage.
    

The model isn't learning anything new here, bro; it is just using that massive map it built to predict your answer in real-time.

It takes your input, converts it to tokens, runs it through the layers of the Transformer (that attention mechanism we talked about), and spits out the most probable next word.

It does this over and over, feeding its own output back into itself until the sentence is finished. It is like the actor reciting lines on live TV they aren't practicing anymore, they are just delivering the performance based on everything they learned during the rehearsal.

Now you know How Things Work BTS. Let's revise it in brief.

###   
What Happens When You Send a Message to ChatGPT?

Here's the sequence, without the marketing gloss:

1.  **You type a prompt.** A question, an instruction, whatever.
    
2.  **The message gets processed.** Your text is converted into a format the model can actually work with (more on this in a second).
    
3.  **The model generates a response.** Not all at once — token by token, each one predicted based on everything before it, including your original prompt.
    
4.  **The response streams back to you**, which is why you see ChatGPT "typing" instead of a reply just appearing instantly.
    

![](https://cdn.hashnode.com/uploads/covers/6950d1ca85602739c40abd67/1200f331-f168-4dad-8ca8-ae9f41fdb133.png align="center")

## Tokenization

A **token** is a chunk of text sometimes a full word, sometimes part of a word, sometimes just punctuation. Tokenization is the process of breaking your sentence into these chunks and converting each one into a number the model can process.

Why not just use whole words? A few reasons: word-level vocabularies get enormous once you account for every tense, plural, typo, and language. Breaking words into smaller reusable pieces lets the model represent basically anything including words it's never technically "seen" before — using a much smaller, more manageable set of building blocks.

**Simple example.** The sentence:

> "How's the weather?"

might get broken down into something like: `How`, `'s`, `the`, `weath`, `er`, `?` — six tokens for four words. Common words are usually a single token; longer or less common words often get split into pieces.

Every model has a **context window** a limit on how many tokens it can "hold in mind" at once during a conversation. As a conversation gets longer, older tokens eventually get pushed out to make room for new ones, which is why a very long chat can start losing track of something you mentioned way back at the beginning.

One more thing worth knowing the model doesn't always pick the single most likely next word. A setting called **temperature** controls how much it's allowed to gamble on less-probable options. Low temperature gives you safe, consistent, almost deterministic output the director's approved cut. High temperature gives you something more varied and unexpected closer to an improvised, unscripted take. Same script, same actor, very different performance depending on how much freedom they're given.

If you read article till here, drop a like and comment what you thing on it.
