Part 1: Start hereChapter 2 of 159
The map: AI, machine learning, deep learning and generative AI
Beginner4 min1 code sample3 review cards
The vocabulary of AI is a pile of overlapping words, and people use them loosely. A single picture sorts it out: each term is a subset of the one before it. Learn the nesting once and every headline becomes easier to read.
What you will learn
- Place AI, machine learning, deep learning, generative AI and large language models on one map
- Tell the eras of AI apart and what changed between them
- Estimate the parameter count of a neural network and a transformer from its shape
Nested circles#
- Artificial intelligence (AI) is the broadest term: any system that does something we would call intelligent. It includes hand-written chess programs and rule-based expert systems that involve no learning at all.
- Machine learning (ML) is the part of AI where the system learns its behaviour from data instead of being given rules (chapter 1).
- Deep learning (DL) is the part of ML that uses neural networks with many layers. It is what made image recognition, speech recognition and translation work well.
- Generative AI is deep learning that creates new content: text, images, audio, video, code. It includes language models and diffusion models.
- Large language models (LLMs) are generative models, usually transformers, trained on enormous amounts of text to predict the next token.
The circles are nested, but the methods differ a lot: a gradient-boosted tree (ML, not deep learning) is still the best tool for many tables of business data, while a transformer (deep learning, generative) powers chat assistants.
A short history, with the turning points#
| Era | Idea | What changed |
|---|---|---|
| 1950s to 1980s | Symbolic AI: hand-written rules and logic | Powerful in narrow domains, brittle, and the rules never covered the real world |
| 1990s to 2000s | Statistical machine learning: learn from data with SVMs, trees, boosting | Data and probability replaced hand-written rules |
| 2012 onward | Deep learning: GPUs plus big datasets plus neural networks | A network won the ImageNet image contest by a large margin and the field turned |
| 2017 onward | Transformers: the attention mechanism | Sequence models that train in parallel and scale, behind modern language models |
| 2020 onward | Foundation models: pretrain once on broad data, adapt to many tasks | One model, many uses; scaling laws guide investment (chapter 94) |
| 2024 onward | Reasoning models and agents: more thinking at answer time, tools, long tasks | Reinforcement learning on checkable rewards (chapter 101) |
Dates are approximate and the boundaries are fuzzy; each wave built on the last rather than replacing it.
How big is a model?#
"Parameters" are the adjustable numbers a model learns. Counting them is just arithmetic. A dense layer with n_in inputs and n_out outputs has n_in × n_out weights plus n_out biases. A transformer block has roughly 12 × d² parameters, where d is the width of the model (chapter 89), and the word embeddings add vocabulary size × d. The script uses those rules on a line, on a small image classifier, and on two famous language-model shapes.
def dense(n_in, n_out):
return n_in * n_out + n_out
line = 2 # y = w x + b
mlp = dense(784, 128) + dense(128, 64) + dense(64, 10) # a small network for 28 x 28 images and 10 classes
def transformer(layers, width, vocab):
blocks = 12 * layers * width ** 2 # attention (4 d^2) + feed-forward (8 d^2) per block
embeddings = vocab * width
return blocks + embeddings
gpt2_small = transformer(layers=12, width=768, vocab=50_257) # the published GPT-2 small shape
gpt3_scale = transformer(layers=96, width=12_288, vocab=50_257) # the published GPT-3 shape
for name, n in (("a straight line", line), ("a small image classifier (MLP)", mlp), ("GPT-2 small shape", gpt2_small), ("GPT-3 shape", gpt3_scale)):
print(f"{name:32s} {n:>18,d} parameters")
print(f"\nGPT-3 is about {gpt3_scale / gpt2_small:,.0f} times bigger than GPT-2 small, and {gpt3_scale / mlp:,.0f} times bigger than the little classifier")Output from a real run
a straight line 2 parameters a small image classifier (MLP) 109,386 parameters GPT-2 small shape 123,532,032 parameters GPT-3 shape 174,563,733,504 parameters GPT-3 is about 1,413 times bigger than GPT-2 small, and 1,595,851 times bigger than the little classifier
The estimates land on the published sizes: about 124 million for GPT-2 small and about 175 billion for the GPT-3 shape. A model of that size needs hundreds of gigabytes just to hold its weights in 16-bit numbers, which is why serving and quantising large models is a field of its own (chapter 99).
Quick check
Which statement about the terms is correct?
Check yourself
Answer in your head first, then open the answer and say how it went. That is what schedules your review.
Is a rule-based chess engine machine learning?
Roughly how many parameters does a transformer have in terms of its depth and width?
Finished this chapter?
Your progress is saved in this browser.
Up next: 3. How models learn: the training loop · 4 min
3 questions from this chapter are in your review queue.Practise your reviews
About this chapter
Builds on1. What is machine learning?
On the learning pathsAI from zeroMachine learning engineer
Checked against python 3.14, numpy 2.5, scipy 1.18, scikit-learn 1.9, pandas 3.1, torch 2.14, gymnasium 1.4 on 2026-10-24. AI moves fast, and library versions, model names and prices change often. Where current documentation disagrees with this page, trust the documentation, and tell us on the corrections page.