0.1What are AI, ML, deep learning and LLMs?
Four buzzwords, one family tree. Learn how the fields nest inside each other and the single idea that separates them, rules written by people versus behavior learned from data.
Four words that get mixed up
Open any news site and you will see “AI”, “machine learning”, “deep learning”, “generative AI” and “LLM” used as if they meant the same thing. They don’t, but they are related in a very tidy way: each one is a subset of the one before. Once you see the nesting, most of the confusion goes away, and you will know exactly where ChatGPT, a spam filter, a chess computer and an image generator each belong.
Artificial intelligenceArtificial intelligence (AI)The broad field of building systems that perform tasks we associate with intelligence: perceiving, reasoning, learning, using language. is the oldest and broadest term. It means any technique that makes a computer do something we would call intelligent if a person did it: planning a route, playing chess, understanding speech, answering questions. Crucially, AI says nothing about how. A program full of hand-written rules counts. So does a program that searches millions of possibilities. So does a program that learns.
Machine learningMachine learning (ML)A branch of AI in which behavior is learned from data rather than written out as explicit rules. is the part of AI where the behavior is learned from data instead of written out by a programmer. You choose a flexible modelModelA function with adjustable parameters that maps inputs to outputs. Training sets the parameters so the outputs are useful., a function with adjustable numbers inside it, show it lots of examples, and let an algorithm tune those numbers until the model’s outputs match the examples.
Deep learningDeep learningMachine learning with neural networks that have many layers, learning increasingly abstract features at each layer. is machine learning with neural networksNeural networkA model made of layers of neurons, each layer transforming the previous layer's output. that have many layers. Each layer transforms the output of the previous one, so the network can learn its own intermediate features (edges, then shapes, then objects) rather than relying on features a human designed.
Generative AIGenerative AIModels that create new content such as text, images, audio or video by learning the patterns of their training data and sampling from them. is the branch of (today, almost always deep) learning that produces new content: text, images, music, video, code. And large language modelsLarge language model (LLM)A very large neural network, usually a Transformer, trained to predict the next token of text. Chat assistants are post-trained LLMs. are the generative models for text: enormous neural networks trained to predict the next piece of text, then refined into assistants.
Imagine two kitchens. In the first, a cook follows a thick binder of recipes written by a master chef: “if the sauce is too thin, add a spoonful of flour.” Every situation has to be anticipated in the binder. In the second, an apprentice has tasted thousands of dishes, each one rated by a mentor, and has slowly developed a feel for what works, including for dishes nobody ever wrote down.
The binder is a rule-based system: classic AI. The apprentice is machine learning: the ratings are the labels, the tasting is training, and the apprentice’s feel is the learned model. Deep learning is an apprentice whose palate develops its own vocabulary of flavors. An LLM is an apprentice who has read nearly every recipe ever published and can write new ones in any style.
The map
Here is the family tree drawn as nested rings. Click a ring to see a definition and examples, then use the buttons below the map to place some real systems.
Very large neural networks (usually Transformers) trained to predict the next token of text on a huge corpus. Post-training turns them into assistants that follow instructions.
- ChatGPT, Claude, Gemini
- Open-weight models: Llama, Qwen, DeepSeek, Kimi
- Code assistants
- Vision-language models that also read images
The innermost ring is the topic of most of this guide.
A few things the map makes clear:
- Everything inside a ring is also part of every ring outside it. ChatGPT is an LLM, so it is also generative AI, deep learning, machine learning and AI. A chess engine from 1997 is AI but none of the inner rings.
- Generative is about the output, not the method. A deep network that labels photos is deep learning but not generative. Stable Diffusion is generative but not a language model.
- The rings are about technique, not quality. An outer-ring system is not “less AI”. Route planners in your phone use clever search, not learning, and they work extremely well.
Rules versus learning: the big shift
The most important line on the map is the one between AI in general and machine learning. On one side, a person writes the logic. On the other, the logic is extracted from data.
Consider the classic example: a spam filter. The rule-based approach says: I know what spam looks like, so I’ll write it down. Contains the word “free”? Spam. Has an exclamation mark? Spam. That works for a while. Then legitimate mail like “Free pizza in the kitchen” gets flagged, and spammers simply stop using the word “free”. Every fix needs a human to write a new rule, and rules start contradicting each other.
The machine learning approach says: I don’t know exactly what spam looks like, but I have thousands of emails that people have already marked as spam or not spam. Count how often each word shows up in each pile. Words that appear mostly in spam become evidence for spam; words that appear mostly in normal mail become evidence against. This is supervised learningSupervised learningLearning from examples that come with the correct answer (a label), such as emails marked spam or not spam. The model learns to map inputs to labels.: learning from examples that come with the right answer attached. A classic algorithm that does exactly this counting is naive BayesNaive BayesA simple, classic classifier that scores an input by multiplying how likely each of its features (for example each word) is under each class, assuming the features are independent., which powered many real spam filters in the early 2000s.
| Subject line | AA. Rules | BB. Learned | |
|---|---|---|---|
| You have won a free cruise, claim nowtruth: spam | spam✓ | spam✓ | |
| Meeting moved to Thursdaytruth: ok | ok✓ | ok✓ | |
| Verify your password to keep your accounttruth: spam | ok✗ | spam✓ | |
| Free pizza in the kitchen after the meetingtruth: ok | spam✗ | ok✓ | |
| Make cash from home with this one tricktruth: spam | ok✗ | spam✓ | |
| Trip photos and dinner planstruth: ok | ok✓ | ok✓ | |
| Urgent prize for you: click to claimtruth: spam | ok✗ | spam✓ | |
| Can you send the project notes?truth: ok | ok✓ | ok✓ | |
| Accuracy | 4/8 | 8/8 |
Things to try:
- Turn on every rule. The rules catch more spam, but “Free pizza in the kitchen” becomes a false alarm, and “Make cash from home” still slips through because no rule mentions “cash”.
- Slide the learned filter down to 2 examples, then up to 16. With 2 examples it knows only a dozen words; most test emails score exactly zero (no evidence), and it even flags “Free pizza” because “free” appeared in its one spam example. With 16 it gets every test email right, even though nobody told it that “cash”, “urgent” or “claim” are suspicious. It discovered those words.
- Type “Free lunch with the project team”. The rules shout spam because of “free”. The learned filter weighs “free” (mildly spammy) against “the”, “lunch” and “project”, which it has only seen in normal mail, and lets it through.
- Type something with words it never saw, like “Quarterly synergy webinar”. The learned filter has no evidence either way. A model only knows what its data taught it.
Why deep learning took over
Classic machine learning still needed humans to decide what to count. For spam, words are a natural choice. But what should you count to recognize a cat in a photo? Pixel brightness? Edges? Engineers spent decades hand-designing features like these, with mediocre results.
Deep learning removed that bottleneck. A deep network is fed raw pixels, raw audio or raw text, and its many layers learn their own features. In image networks, early layers end up detecting edges and colors, middle layers detect textures and parts, and late layers respond to whole objects. Nobody programmed those detectors; they emerged from training. The price is that deep networks need lots of data and lots of computation, which is why they only took off around 2012. The next lesson, a short history, tells that story.
Where LLMs fit
An LLM is a deep neural network, almost always a TransformerTransformerThe neural network architecture behind modern LLMs: stacked blocks of self-attention and feed-forward layers with residual connections., trained on a simple task at an enormous scale: given some text, predict the next tokenTokenA chunk of text (a word, part of a word, or a character) that a language model reads and writes as a single unit. (a word or piece of a word). Do that over trillions of tokens with billions of adjustable numbers, and the model has to soak up grammar, facts, styles of reasoning and much more, because all of these help predict what comes next.
A raw LLM trained this way is a document-continuer, not an assistant. A second phase, post-training, teaches it to follow instructions, hold a conversation and decline harmful requests. ChatGPT, Claude, Gemini and open-weight models such as Llama, Qwen and DeepSeek are all LLMs that went through both phases. Part 2 of this guide opens the box, starting with tokenization and next-token prediction.
MATH CORNER · optionalWhat 'learning from data' means, as an equation
Every machine-learning method on the map shares the same skeleton. We have a model , a function whose behavior depends on parameters (theta). We have examples : inputs and the correct outputs. And we have a loss that measures how wrong a prediction is. Learning means solving
In words: find the knob settings that make the average error on the examples as small as possible. A rule-based system skips this entirely: a human picks directly.
Worked example: the spam filter in the demo. The learned filter gives each word a weight equal to the log of how much more often it appears in spam than in normal mail:
With all 16 training emails (8 spam, 8 ok) and add-one smoothing, the word “cash” appears in 2 of 8 spam emails and 0 of 8 normal ones:
| word | spam count | ok count | weight | ||
|---|---|---|---|---|---|
| cash | 2 | 0 | |||
| free | 2 | 1 | |||
| project | 0 | 1 |
The “+1” in each count (smoothing) stops a word that was never seen in one pile from producing . Both classes have 8 examples, so the prior term is . For “Free project ideas”, the only words the filter knows are “free” () and “project” (); “ideas” never appeared, so it contributes nothing. The score is about : below zero, so not spam. A rule that fires on “free” would have flagged it. Here the parameters are simply the word weights, and “training” is counting.
In code
The same contrast in a few lines of Python. The learned version uses scikit-learn, a standard library for classic machine learning:
# Rule-based: a human writes the logic
def is_spam_rules(subject: str) -> bool:
s = subject.lower()
return "free" in s or "winner" in s or "!" in s
# Learned: the logic is extracted from labeled examples
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
subjects = ["WINNER! Claim your free prize now", "Lunch tomorrow at noon?",
"Earn cash fast from home", "Notes from the project meeting"]
labels = [1, 0, 1, 0] # 1 = spam, 0 = ok
vec = CountVectorizer()
X = vec.fit_transform(subjects) # words -> counts
clf = MultinomialNB().fit(X, labels) # "training" = counting + smoothing
print(clf.predict(vec.transform(["Free cash prize"]))) # -> [1]
Notice that the learned version contains no knowledge about spam at all. Swap in movie reviews labeled positive or negative and the same code becomes a sentiment classifier.
- “AI and machine learning are the same thing.” Machine learning is one part of AI. Search algorithms, planners and rule-based expert systems are AI without any learning.
- “Machine learning programs itself, so no human design is involved.” People still choose the model family, the data, the loss and many settings. What is learned is the specific parameter values, which is often millions or billions of numbers nobody could set by hand.
- “ChatGPT looks things up in a database of answers.” A plain LLM generates text from patterns stored in its parameters; it has no table of answers. Some products add web search or document retrieval on top (see RAG), but that is a separate component.
- “Deep learning is a newer, unrelated kind of AI.” It is machine learning with a particular kind of model, many-layered neural networks, whose core ideas date back decades. What changed around 2012 was data and compute.
Check your understanding
Q1.A 1997 chess program wins by searching millions of positions using an evaluation function experts designed by hand. Where does it sit on the map?
Q2.What is the defining difference between a rule-based spam filter and a machine-learning one?
Q3.Stable Diffusion generates images from text prompts using a deep neural network. Which statement is correct?
Q4.What problem did deep learning solve that classic machine learning struggled with?
Q5.In the demo, the learned filter sees a subject made only of words that never appeared in training. What does it do?
Further reading
- courseElements of AI — A free, gentle online course from the University of Helsinki covering exactly these definitions, with no math required.
- blogA Plan for Spam (Paul Graham, 2002) — The essay that popularized statistical, learned spam filtering over hand-written rules.
- courseMachine Learning Crash Course (Google) — A practical, free introduction to supervised learning, with exercises.
- videoIntro to Large Language Models (Andrej Karpathy) — A one-hour talk on what an LLM is, how it is trained, and where it is heading.
- videoNeural networks (3Blue1Brown) — Beautifully animated lessons on what a neural network is and how it learns.