The previous lesson covered machine learning at a high level: data in, patterns found, predictions out. This lesson goes one level deeper into the specific technology behind tools like ChatGPT, Gemini, and Claude — Large Language Models (LLMs) — and explains exactly how they "learn" to write.
LLMs are trained on enormous text datasets — a huge volume of text pulled from the internet, books, Wikipedia, code repositories, and academic papers. Text is broken into tokens, roughly ¾ of a word each ("Hello" is one token, "ChatGPT" is about two) — the largest models are trained on datasets measured in the trillions of tokens.
Training works by hiding the last word of a sentence and asking the model to guess it:
Input: "The capital of France is ___"
Model predicts: "Paris" → correct, reinforced
"Berlin" → wrong, corrected
"Rome" → wrong, correctedThis happens billions of times across trillions of examples. Each time the model is wrong, it slightly adjusts its internal settings — called parameters — to make a better guess next time. After enough repetitions, the model has effectively compressed the patterns of human language into those parameters.
Raw training alone produces a model that completes text — not necessarily one that's helpful, polite, or safe to talk to. That extra layer comes from Reinforcement Learning from Human Feedback (RLHF): human reviewers rate the model's responses ("helpful and safe" vs. "harmful or wrong"), and the model is trained further to produce the kind of response people actually preferred. This step, not the raw internet text, is what makes ChatGPT feel conversational and well-mannered rather than just predicting whatever text is statistically likely.
When you type a message, the model generates its reply one token at a time — each one chosen probabilistically, as the statistically most likely next token given everything before it, not looked up as a "correct" answer. This explains two things you may have noticed:
The Mental Model That Actually Matters
An LLM is not a database that looks facts up. It's an extremely sophisticated pattern-completion engine — the same way you could complete "Mary had a little ___" without consulting a database, just from having seen the pattern before. This is exactly why LLMs are so good at writing and so unreliable at precise arithmetic or obscure facts.
| Term | What it means |
|---|---|
| Token | The smallest chunk of text a model processes — roughly ¾ of a word. |
| Context window | How much text a model can "see" at once. Beyond this limit, it effectively forgets earlier parts of the conversation. |
| Parameters | The internal numbers adjusted during training — often numbering in the billions for large models. Roughly, more parameters means more capacity to learn patterns. |
| Temperature | A setting controlling randomness. Low temperature picks the most likely word every time (repetitive, predictable); higher temperature allows more variety and creativity. |
| Fine-tuning | Taking an already-trained model and training it further on a narrow, specific dataset — like a general doctor taking extra training to specialise in one field. |
| Hallucination | When a model states something factually wrong with total confidence — a direct result of predicting likely text rather than verifying facts. |
Understanding this — that an LLM predicts rather than knows — is the single most useful mental model for using AI tools well. The next lesson puts it to practical use: comparing the major AI models available today and knowing which one actually fits a given task.