Chapters: 0:00 The One Job 0:21 What IS This Thing? 0:53 Autocomplete on Steroids 2:51 Inside the Machine 5:48 The Great Split 7:27 Three Axes of Scale 9:32 The Staircase 11:38 The Real Landscape 13:42 One Job, Infinite Outputs
In this video, we visually explore the core structure behind large language models (LLMs) and how a few key components combine to create powerful AI systems.
You will learn: • The core architecture behind modern LLMs • How transformers process language • The role of attention and embeddings • Why scaling changes model behavior • How these systems generate text and understanding
This video connects together many of the ideas behind modern AI into one unified picture.
This video is part of the Attention Visualized series, where we explain modern AI concepts through visual intuition.
Topics on this channel include: Transformers, attention mechanisms, embeddings, decoding strategies, large language models (LLMs), and AI agents.
These are the most powerful AI systems ever built.
They write poetry, solve math problems, and generate working code.
But here's what might surprise you.
Every single one of them does exactly one thing.
Predict the next word.
You use ChatGPT every day.
You type a message, it responds.
But that chat interface, that is just the surface.
Underneath there's a machine, a specific architecture with specific components.
So what is a large language model?
Not a big AI, what is it, structurally?
And why does making it larger suddenly unlock abilities that smaller models cannot do?
Those are the questions we are going to answer.
Let's start with something you already know.
Your phone keyboard.
You type good morning, how, and it suggests three words, are, is, have.
Three choices based on a few words of context.
An LLM does the exact same thing, but at a completely different scale.
Instead of three choices, it picks from over 50,000 possible tokens.
Instead of three words of context, it reads thousands.
Now here's where it gets interesting.
Here is a partial sentence.
The cat sat on the...
The model looks at every word that came before and produces a probability for every possible next token.
Watch as the bars appear.
Mat gets 18 percent.
Floor gets 12 percent.
Table, 9 percent.
Ground, 8 percent.
Couch, 6 percent.
The model picks the most likely one, mat, and adds it to the sentence.
Now the sentence is, the cat sat on the mat.
And here's the key.
The model does not stop.
It feeds that new sentence right back in and predicts the next word.
Then the next.
One word at a time, over and over, until the response is complete.
This is why ChatGPT streams word by word.
It is literally computing one token at a time.
That might seem complicated, but think about what is actually happening.
The model is not thinking about cats or mats.
It is not understanding anything.
It is computing the most probable continuation based on patterns it learned from trillions of
words of text.
It is really just autocomplete scaled to the size of the internet.
Every capability you have seen from poetry to code to conversation comes from this one
operation.
Predict the next word.
But this raises an obvious question.
We know what it does.
What is the machine that computes this prediction?
Let's open it up.
We will trace one prediction through an actual model, GPT-2, small.
Our input is the same sentence.
The cat sat on the.
First, the model splits this into tokens, word pieces from its vocabulary.
We get five tokens, each one an integer.
464 for the.
3797 for cat.
3332 for sat.
319 for on.
262 for the.
Next, each token looks up its own row in a massive table called the embedding matrix.
This table has 50,257 rows, one for every token in the vocabulary, and each row is a
vector with 768 numbers.
Watch as each token finds its match and pulls out a vector.
So our five tokens become a matrix of shape 5 by 768.
Then the model adds position embeddings.
A separate vector for each position added to the token embeddings.
Now the model knows not just what each word is, but where it sits in the sentence.
Now here's where the real processing begins.
This data enters the first of 12 identical blocks.
Each block does two things.
First, multi-head attention, where each token decides how much to attend to every other
token, but with a critical rule, each token can only see tokens before it.
This is called causal masking.
Then a feedforward network processes each token independently, expanding from 768 to
3072 dimensions and back.
A residual connection adds the result back to the input.
That is one block.
And here's the elegant part.
The model repeats this exact structure 11 more times.
Same design, different learned weights.
What do you think comes out at the very top after 12 blocks process our five tokens?
At the very last position, the model takes that final 768 dimensional vector and projects
it to 50,257 values, one for every token in the vocabulary.
Softmax converts these to probabilities.
And there they are.
Mat at 18%.
Floor at 12%.
Table at 9%.
The same probability bars, but now we know exactly where they come from.
Take a moment to appreciate what we just traced.
There is something genuinely elegant about this.
The entire architecture is one block, repeated 12 times.
Tokens enter at the bottom.
Probabilities emerge at the top.
That is all there is.
GPT-2, GPT-3, GPT-4, GPT-5, they all use this exact same blueprint.
But this decoder is only one half of the original story.
The transformer that started it all in 2017 had two halves.
And understanding why one half took over is the next piece of the puzzle.
The original transformer published in 2017 had two halves, an encoder and a decoder.
And from that single design, three families emerged.
First, encoder-only models.
BERT, released in 2018.
In BERT, every token can see every other token.
Bidirectional attention.
See how the entire grid is lit up?
Every word attends to every other word, including words that come after it.
This makes BERT excellent at understanding tasks like classification and search,
but it cannot generate text.
It has already seen the answer.
Then came decoder-only models.
GPT, also 2018.
Now watch what happens when we add the mask.
Every cell above the diagonal goes dark.
Each token can only see tokens to its left.
This is causal masking, and it changes everything.
You cannot predict the next word if you have already seen it.
The third family, encoder-decoder models like T5, uses both halves.
But today, almost no new LLM uses this design.
So decoder-only one, and not just because of momentum.
Causal masking makes inference efficient,
because old key and value matrices get reused for each new token.
Prompting maps naturally to the left-to-right setup.
And at sufficient scale, the bidirectional advantage nearly disappears.
So the architecture is simple.
Then the obvious question becomes, why does making it larger matter so much?
Here's what most people assume.
Large means lots of parameters.
More parameters, better model.
Right?
Not exactly.
That is only one-third of the story.
An LLM's power depends on three things scaling together.
Parameters, the number of learnable values inside the model.
Training data, the amount of text it learns from.
And compute the total processing power used during training.
All three.
Not just one.
Here's the story that changed everything.
In 2021, DeepMind built Gopher.
280 billion parameters, trained on 300 billion tokens.
It was the biggest model at the time.
Then in 2022, the same lab built Chinchilla.
Only 70 billion parameters, four times smaller.
But trained on 1.4 trillion tokens, 4.7 times more data.
The result?
Chinchilla won on every single benchmark.
Four times smaller, but trained on far more data.
The lesson was clear.
You cannot just make the model bigger.
Data must scale proportionally.
And here's what makes this even more remarkable.
These relationships follow precise mathematical laws.
Performance improves as a power law of parameters, data, and compute.
And these laws hold across seven orders of magnitude.
They are so reliable that OpenAI fits scaling curves on models
using a thousand times less compute than GPT-4,
and accurately predicted GPT-4's performance before training it.
The ratio that emerged?
Roughly 20 training tokens for every parameter.
Go below that, and your model is undertrained,
no matter how many parameters it has.
Now, we know the architecture is simple,
and we know that scale follows precise laws.
But does scaling up just make models better at the same things?
Or does something fundamentally different happen at extreme scale?
The answer is, something genuinely new happens.
At small scale, millions of parameters, a model learns basic grammar.
Increased by 10 times, and it produces coherent paragraphs.
Another 10 times, it handles translation.
These feel like gradual improvements,
the model getting better at things it could already sort of do.
But somewhere around 100 billion parameters, something changes.
Capabilities appear that did not exist at all in smaller models.
In context learning, the ability to learn from examples in the prompt without any retraining.
Instruction following.
Multi-step reasoning.
These are not improvements.
They are entirely new abilities that emerge at a specific scale threshold,
like water suddenly freezing at zero degrees.
Scientists call these emergent capabilities.
And here's the most striking example.
Take the question, what is 47 times 83?
Give it to GPT-2, a 1.5 billion parameter model.
It produces garbled nonsense.
Same architecture we just traced.
Same training objective.
Same kind of data.
Now give the exact same question to GPT-3, 175 billion parameters.
100 times larger.
What do you think it answers?
3901.
Correct.
Same architecture, same training.
100 times more parameters, and arithmetic turns on.
This to me is the most remarkable thing about modern AI.
Scale does not just improve existing capabilities, it creates new ones.
The same transformer block from 2017, repeated more times with more data,
develops abilities that were never programmed and could never have been predicted from smaller models.
That is the surprise at the heart of modern AI.
But where do the real systems, the models you actually use every day, fit into this picture?
Let's put real names to what we have learned.
GPT-1 released in 2018, 117 million parameters.
It could complete sentences.
GPT-2, one year later, 1.5 billion, roughly 10 times larger.
It generated coherent paragraphs.
GPT-3, 2020, 175 billion parameters.
That is where in-context learning emerged.
And GPT-4, 2023, roughly 1.76 trillion parameters, a mixture of experts' architecture.
Each generation about 10 times bigger.
Then GPT-5, August 2025.
OpenAI stopped disclosing parameter counts, but the leap was unmistakable,
a unified system where a real-time router chooses between fast responses and deep reasoning.
To put that in physical terms, GPT-3's 175 billion parameters at 16-bit precision
take up 350 gigabytes.
A single GPU has 80.
You need at least five GPUs just to hold the model.
Now zoom out.
The original 2017 transformer branched into three families.
The encoder branch, BERT, and its descendants still matters for search and classification.
The encoder-decoder branch is small and shrinking.
But the decoder branch, that is where GPT-5, Claude, Lama, and Gemini all live.
The exact architecture we traced in this video.
And one more thing, something that surprises a lot of people.
The chatbot you talk to every day?
That is not what the model was trained to be.
Pre-training teaches Next Token Prediction on raw internet text, books, Wikipedia, code.
A second, much smaller phase called instruction tuning
turns the raw predictor into a helpful assistant.
The chat interface is a thin behavioral layer on top of a massive text prediction engine.
And that brings us full circle.
Let's come back to where we started.
Every LLM does one thing, predict the next word.
But now you know what that means.
You have seen the architecture, a stack of identical transformer blocks, unchanged since 2017.
You have seen the mechanism, tokens flow in at the bottom, probabilities flow out at the top.
You have traced the three axes of scale, parameters, data, and compute, all growing together.
And you have seen what happens at the top of the staircase,
where scale creates capabilities that were never programmed.
One objective.
One architecture.
Scaled up.
And something new emerges.
That is what a large language model is.