How AI Learns: Machine Learning Basics
Understand the core ideas behind today's AI — machine learning, training data, models, and next-word prediction — explained without math or code.
Rules vs. Learning
For most of computing history, software followed rules a programmer wrote: if the order total is over $50, then shipping is free. That works when the rules are simple and known.
But try writing rules for “is this email spam?” or “is there a cat in this photo?” There are too many cases, and the rules change constantly. Machine learning (ML) takes a different approach: instead of writing the rules, you show the computer lots of examples and let it learn the pattern.
| Traditional software | Machine learning |
|---|---|
| Humans write the rules | The system learns patterns from examples |
| Input + rules → answer | Examples → learned patterns → answers on new inputs |
| Predictable, but brittle for messy problems | Flexible, but can be wrong in surprising ways |
The Key Vocabulary
Training data — the examples the system learns from. For a spam filter: thousands of emails labeled “spam” or “not spam.” For a language model: a vast amount of text from books, websites, and other sources.
Model — the result of training: a mathematical structure that captures the patterns found in the data. When people say “the AI,” they usually mean the model.
Training — the process of adjusting the model, over and over, until its predictions match the examples well.
Inference — using the trained model on something new. Every time you send a prompt, the model is doing inference.
A useful analogy: training is like years of reading and practice; inference is answering a question on the spot using what that practice taught you.
The Nesting Dolls of AI
These terms nest inside each other:
- Artificial intelligence — the broad goal of machines doing “thinking” tasks.
- Machine learning — a way to achieve AI by learning from data.
- Deep learning — machine learning with large, layered neural networks, loosely inspired by the brain. It powers modern image, speech, and language AI.
- Generative AI — deep learning models that create new content: text, images, audio, video.
How a Language Model Writes
Large language models are trained on one deceptively simple task: predict the next word. (Technically, the next token — a word or piece of a word — but “word” is close enough.)
Given “The capital of France is”, the most likely next word is “Paris.” Given “Thanks so much for your”, likely next words include “help,” “time,” and “patience.” Repeat that prediction billions of times across an enormous amount of text, and the model absorbs grammar, facts, writing styles, reasoning patterns, and a sense of how conversations flow.
When you send a prompt, the model writes its response one word at a time, each time choosing a likely next word given everything before it — your prompt plus what it has written so far. After training, assistants go through additional steps that teach them to follow instructions, hold a conversation, and decline harmful requests.
Three consequences follow directly from this, and they’ll matter for the rest of the course:
- Your prompt shapes everything. The model continues from what you give it. More relevant context produces more relevant continuations.
- Fluency isn’t accuracy. The model is optimized to produce plausible text. Plausible and true usually overlap — but not always.
- Responses vary. There’s some deliberate randomness in which likely word gets chosen, so the same prompt can produce different answers.
- In a new chat, send:
Write a one-sentence slogan for a neighborhood coffee shop. - Use your assistant’s regenerate or retry button (often a circular-arrow icon) two or three times, or open new chats and send the exact same prompt.
- Compare the results. How different are they?
- Now send a more specific version:
Write a one-sentence slogan for a neighborhood coffee shop that's known for its quiet study space and opens at 5 a.m.Regenerate a few times again.
Notice that the specific prompt produces answers that vary less and fit better. More context narrows the range of plausible continuations — that’s the whole idea behind the prompting framework in Module 4.
Common mistake: assuming the model has a stored, checked fact for everything it tells you.
The model learned patterns, not a verified fact table. For well-known facts, the patterns are strong and the answer is usually right. For obscure details — a specific statistic, a small company’s policy, a quote, a citation — the model may generate something that fits the shape of a correct answer without being correct. The next lesson covers this in depth.
1. What is the core task a large language model is trained on?
Next-word prediction, repeated at enormous scale, is what gives language models their fluency and broad knowledge — and also why they can produce confident, plausible text that isn't true.
2. Which is the correct nesting, from broadest to narrowest?
AI is the broad goal; machine learning is one approach; deep learning is ML with neural networks; generative AI is deep learning that creates new content.
3. You send the same prompt twice and get two different answers. What's the most likely explanation?
Variation is built in. It's why regenerating can be useful for brainstorming — and why you shouldn't treat any single response as the definitive answer.
Up Next
Knowing how AI generates text makes its weaknesses predictable. The next lesson covers AI’s main limitations — and the workplace tasks where it genuinely shines.