How LLMs Actually Work — Explained by Building a Tiny One
You use a language model every day. Odds are, your mental model of it is one of two wrong pictures: a search engine that looks things up, or a mind that understands you. It's neither — and the real answer is both simpler and stranger.
The best way to get it isn't an article (ironically). It's watching a tiny model get built. That's why we made Micro LLM, a free tool that trains a real, miniature language model in your browser while you watch. But here's the walkthrough of what you'll see.
Step 1: It Starts by Counting
Feed a model text and, at the most basic level, it counts: after the word "good", how often does "morning" come next? How often "luck", "grief", "idea"? Do this across enough text and you get a giant table of "what tends to follow what".
A model this simple already writes! Badly — it wanders and contradicts itself — but recognisably. In Micro LLM you can watch exactly this stage: the model learns word proximities from the text you give it, and its guesses start echoing your text's style. There's no lookup and no understanding. Just counting, turned into probability.
Step 2: One Word at a Time, Every Time
Here's the core loop, and it never changes no matter how big the model: given everything so far, guess the next word. Then do it again.
The model doesn't plan the paragraph, know how the sentence will end, or "have" an answer that it's transcribing. Each word is a fresh probability draw over the whole vocabulary. When ChatGPT writes you an essay, it's this loop running thousands of times, fast.
Once you've watched a micro model do it — probabilities visibly shifting with each word added — a lot of big-model behaviour suddenly makes sense.
Step 3: Scale Does Something Weird
So how does "guess the next word" become "write working code and pass exams"? Scale. To get really good at next-word prediction across all human text, a model is forced to internalise grammar, facts, styles and reasoning patterns — because those are what make the next word predictable. Nobody programs the skills in; they precipitate out of the prediction task at scale. That leap still surprises the researchers who build these things.
The big models add another trick — attention, which lets the model weigh which earlier words matter for this guess ("it" refers to the contract, not the coffee) — but the engine remains the loop you watched in step 2.
Why This Explains the Weirdness You've Seen
- Hallucinations: the model always produces a plausible next word — "plausible" is the whole job. When it doesn't know, plausible and true part ways, fluently. It isn't lying; it's completing.
- Confidence with no self-awareness: there's no internal fact-checker to feel doubt. Probability has no conscience.
- Why context improves everything: more relevant context reshapes every probability in the loop. That's the entire mechanism behind good prompting — see The Anatomy of a Perfect Prompt.
- Why AI text has an accent: always choosing likely words produces smooth, snag-free prose — the very tell we describe in Is This Written by AI?
Go Watch One Learn
Reading about next-word prediction is one thing. Typing text into Micro LLM, pressing train, and watching probability turn into language in front of you is another — it's the difference between reading about gravity and dropping the ball. Free, in your browser, no signup, about ten minutes.
Afterwards, the jargon version of all this will read easily — start with AI Jargon in Plain English, and for why this understanding is worth career money, Why Understanding AI Is the Real Career Edge.
Cocoon builds free AI tools and runs practical AI training for professionals and teams across Sri Lanka and Southeast Asia. Try the free tool from this article or talk to us about training.