SKF × studio91.ai studio91.ai
Scene 1 / 12
How an LLM Actually Works

How does an LLM actually work?

It's not magic. It's two phases — run one after the other, millions of times a day.

Phase 1
Learning
It reads an enormous amount of text and slowly tunes billions of internal dials until it can predict language well. This happens once, ahead of time.
Phase 2
Answering
Every time you type a prompt, the frozen model reads it and predicts — one token at a time — what should come next.
Phase 1 · Learning — Step 1

It starts by reading an enormous amount of text

Web pages. Books. Code. Articles. A vast slice of everything humans have written down.

A calm, continuous intake — not a single document, but a civilisation's worth of writing.
Phase 1 · Learning — Step 2

The model doesn't see words. It sees tokens.

Type a short phrase, or pick one below, and watch it break apart.

Tokens = the Lego bricks of language.
Phase 1 · Learning — Step 3

It plays a simple game, over and over

Guess the next word. Check the real answer. Adjust. Repeat.

The cat sat on the ___
 
Examples seen
0
Phase 1 · Learning — Step 4

Each correction nudges billions of tiny dials

Over billions of rounds, the connection strengths — the “weights” — settle into stable patterns.

Parameters tuned
0
The “knowledge” is just billions of these tuned numbers.
Phase 1 · Learning — Complete

Training ends. The weights freeze.

The model has compressed patterns of language, facts, and reasoning into one fixed set of numbers.

Like a musician who has drilled scales for years — the skill is now baked in and frozen. They don't relearn the scales before every performance. They just play.
This ends Phase 1. What's next happens every single time you send a prompt.
Phase 2 · Answering — Step 1

You type a prompt. It becomes tokens again.

Same Lego bricks as before — now assembled by you, in real time.

Phase 2 · Answering — Step 2

It reads the whole prompt at once

Not left to right, like a person reading. All tokens, all at once, in parallel.

Phase 2 · Answering — Step 3 · The Star Scene

Attention: deciding which words matter to each other

Hover a word to see what it “attends to.” Toggle heads to see different relationships tracked in parallel.

Attention = the model deciding which words matter to each other.
This mechanism comes from “Attention Is All You Need” (Vaswani et al., 2017) — the paper that introduced the Transformer, the architecture behind virtually every modern LLM.
Phase 2 · Answering — Step 4

It doesn't “know” the answer — it ranks the possibilities

Every candidate next-token gets a probability. It samples from this ranked list.

The capital of France is ___
Predictable Creative
It usually samples the top choice — but not always.
Phase 2 · Answering — Step 5

One token at a time, fed back in, again and again

It appends its chosen token, feeds the whole thing back in, and predicts the next one.

It never “writes a paragraph.” It only ever answers: what comes next?
Naming What You Just Saw

Generative Pre-trained Transformer

You've heard the acronym. Now you know exactly what each word means.

G
Generative
It generates — produces new tokens, one at a time.
P
Pre-trained
It learned once, ahead of time, from a huge slice of text — then froze.
T
Transformer
The architecture that makes attention possible — deciding which words matter to each other.
The Transformer was introduced in “Attention Is All You Need” (Vaswani et al., 2017, Google) — one of the most influential papers in modern computing.
One More Layer, Before It Reaches You

Raw prediction isn't enough — it gets a polish pass

Not a third phase. A refinement round on top of Phase 2, using human preferences instead of raw text.

Preferred by reviewers
“Here's a clear, direct answer — with the key risk flagged up front.”
Less preferred
“Well, it's complicated, there are many factors, one might consider…”
Humans rank pairs of candidate answers. A second, smaller training round nudges the model's weights toward the style people actually prefer — more direct, more honest, safer. This is often called RLHF — Reinforcement Learning from Human Feedback.
Same two phases as before — just with a finishing coat before it ever reaches you.
Recap

The black box isn't sealed anymore

Phase 1 — Learning
  • Read a massive amount of text
  • Broke it into tokens
  • Played “guess the next token,” billions of times
  • Weights settled into stable patterns
  • Training ends — the model freezes
Phase 2 — Answering
  • Your prompt becomes tokens
  • The model reads it all at once
  • Attention links related words together
  • It ranks the next-token probabilities
  • One token at a time, looped, until done
This is simplified. Real systems add a human-preference polish pass (which we just covered) plus the ability to call outside tools — both worth their own deeper conversation.
The black box isn't sealed anymore.
Quick Check

Let's see what landed

Presenter note