All posts
For ParentsAI

How Does ChatGPT Actually Work? A Plain Explanation for Parents and Teens

Farhan — Founder, DotCode Campus 7 min read
A child's hand meeting a robot's hand, fingers interlocked

Most explanations of ChatGPT go one of two ways. Either it's "a robot brain that thinks like a human", which is wrong and slightly alarming, or it's a wall of jargon about transformers and attention heads, which is technically closer but useless to anyone who isn't already a machine learning engineer.

There's a version in between that's accurate, takes about five minutes, and genuinely changes how a teenager uses the thing. This is that version.

Quick Answer: ChatGPT is a next-word prediction machine. It has read an enormous amount of text and learned, statistically, which words tend to follow which. When you give it a prompt, it predicts one likely next word, adds it to the sentence, and predicts again — hundreds of times over. It isn't looking anything up, and there's no step where it checks whether what it just said is true. That single fact explains most of its behaviour, including why it invents sources with total confidence.

It Predicts the Next Word. That's the Whole Trick.

Start with a sentence fragment: "The capital of France is".

You already know what comes next, and you know it without consciously reasoning about geography — the pattern is just overwhelmingly familiar. A language model works the same way, except it has seen that pattern, and billions of others, across more text than any person could read in a thousand lifetimes.

Given that fragment, it assigns a probability to every word it knows. "Paris" scores very high. "Lyon" scores low but not zero. "Banana" scores close to nothing. It picks one, sticks it on the end, and then runs the whole thing again with the new, slightly longer sentence. Word by word, that's how a paragraph gets written.

Nothing in that loop involves looking up a fact, consulting a database, or verifying an answer. The model isn't retrieving that Paris is the capital of France. It's producing the word that best fits the pattern — and for well-worn facts, the pattern and the truth happen to agree.

Why the Same Question Gives Different Answers

Ask ChatGPT the same thing twice and you'll often get two different replies. Parents sometimes read this as the model being unreliable, or "changing its mind". It's neither.

If the model always picked the single highest-probability word, its writing would be flat and repetitive — it would fall into loops, saying the same safe phrase over and over. So instead it samples: it picks randomly, weighted by those probabilities. High-scoring words usually win, but not always.

There's a dial on this, usually called temperature. Turn it down and the output gets predictable and dull. Turn it up and it gets surprising, then creative, then incoherent. What we call an AI's "creativity" is, mechanically, a decision about how often to pick something other than the obvious word.

This is one of my favourite things to show a class, because students can build it themselves in about twenty lines of Python and then sit there moving the dial, watching the text go from robotic to unhinged.

It Doesn't See Words. It Sees Tokens.

Here's the part that explains a lot of the stranger failures.

Before any of this happens, text gets chopped into tokens — chunks that are often a whole word, but frequently a fragment. "Unhelpfulness" might become "un", "help", "ful", "ness". The model never sees the letters of a word the way you do; it sees a sequence of chunk IDs.

This is why AI models have been so unreliable at questions like "how many r's are in strawberry". It isn't a reasoning failure. The model is being asked about letters in a thing it has never seen as letters. Once a student understands tokenisation, that whole category of bug stops being mysterious and starts being obvious.

Where Hallucination Actually Comes From

"Hallucination" is the polite word for the model stating something false with complete confidence — an invented citation, a fabricated statistic, a Singapore school policy that doesn't exist.

It's tempting to treat this as a bug that will eventually be patched out. It's more useful to see it as a direct consequence of the design. The model's job is to produce text that fits the pattern of a correct answer. A made-up journal reference, with plausible authors and a plausible year, fits that pattern perfectly. There's no separate step where the model asks itself "do I actually know this?" — that step isn't in the architecture.

Confidence, similarly, isn't a signal of anything. The model writes in a confident register because the text it learned from was written confidently. A hedge like "I think" is just another token whose probability happens to be low in that context.

Once a teenager gets this, their behaviour changes in a specific, practical way: they stop treating fluency as evidence. That's the single most valuable thing a young person can take away from all of this.

Where Does the "Learning" Happen?

Two stages, roughly.

First, pre-training: the model reads a vast amount of text and adjusts billions of internal numbers until it gets good at predicting what comes next. Nobody labels anything. The text is its own answer key — hide the next word, guess it, check, adjust, repeat, at a scale that's hard to picture.

Second, fine-tuning with human feedback: people rate the model's responses, and it's nudged toward the answers those raters preferred. This is why ChatGPT is helpful and polite rather than merely plausible. It's also why models pick up the preferences — and the blind spots — of the people doing the rating.

Everything the model knows was fixed during training. Unless it's explicitly given a search tool or a document to read, it has no access to today's news, your child's homework brief, or anything that happened after its training cut-off.

Why Building One Beats Being Told About It

You can read all of the above and follow it. A teenager can too. But there's a difference between following an explanation and having watched it happen in code you wrote yourself.

In our AI & Python course for ages 13–17, students build a working text generator from scratch over 12 lessons. Lesson one produces nonsense. Then they teach it to count which words follow which in a real book, and it starts producing broken English. They add weighted random choice and a temperature dial, and it develops a voice. They widen the context window and it sharpens — then starts copying its source material word for word, which is its own lesson about memorisation. They rebuild it on letters instead of words and finally see, first-hand, why "strawberry" is hard.

None of it requires prior coding experience, and none of it involves prompting somebody else's chatbot. The engine is the reason to learn Python — not a reward for already knowing it.

By the end, a student can explain why ChatGPT sounds so certain while being wrong, because they built the small version and watched it happen on their own screen. That's a different kind of understanding from having been told.

The Five-Minute Version, For Dinner Tonight

If you want to hand your child the short form:

  • It guesses the next word, over and over, based on patterns in the text it read.
  • It isn't looking anything up. There's no fact database behind it.
  • It answers differently each time because it picks randomly among likely words.
  • It reads in chunks, not letters — hence the odd spelling and counting failures.
  • Confident doesn't mean correct. Confidence is a writing style it learned, not a measure of certainty.

That's genuinely most of it. For a version pitched at younger children, our guide to AI for kids takes the same ideas down to primary-school level, and AI and coding by age covers what's worth learning at 7–9, 10–12, and 13–17.

If your teen wants to go past the explanation and build the thing, classes run in person at our Jurong East studio, a short walk from the MRT, or live online from anywhere in Singapore, in groups of up to 12. Every course starts with a free 45-minute trial lesson. Book a free trial class and see how they take to it.

Ready to Start Building?

Book a free 45-minute trial class. No commitment, no credit card — just great learning.