Settings

Theme
Lite Mode (saves mobile data)

In Lite Mode, animations and videos don't play until you tap them, and their size is shown first. Interactive widgets still work.

Text size

Back up or move your progress →

Part 0: Start Here

What are AI, ML and Deep Learning?

P0.120 min●○○ BeginnerReviewed Nov 30, 2026

Why this matters for machine learning

Every other lesson in this course is about one of the circles in this picture. Knowing what each word means, and what it does not mean, stops you from being confused by headlines, and tells you which tool to reach for.

  • The data, model, training, parameters and prediction vocabulary you meet here is used in every lesson. P0.2 turns it into a learning loop you can run. (P0.2: How a machine "learns")
  • A single artificial neuron, the building block of deep learning, is the next step after this lesson. (P4.1: From neurons to the perceptron, coming soon)
  • Large language models, the systems behind chatbots, are deep-learning models. P10.A1 explains how they work. (P10.A1: What is a Large Language Model?, coming soon)

After this lesson you can

  • Explain AI, machine learning and deep learning in plain words, and say how they nest
  • Tell a rule-based program from a program that learns from data, using the spam-filter example
  • Use the words data, model, training, parameters and prediction (inference) correctly
  • Say where generative AI and large language models sit, and what "narrow" and "general" AI mean
  • Place the main milestones from 1950 to 2022 on a timeline and explain the two AI winters

You hear “AI”, “machine learning”, “deep learning” and “ChatGPT” in the same sentence, as if they all meant the same thing. They do not. Each is a smaller idea inside the one before it. By the end of this lesson you will know which is which, and why a program that learns is a different kind of thing from a program that follows rules.

Two ways to build a clever program

Imagine you must build a spam filter: a program that reads an email and decides “spam” or “not spam”. (Not-spam is often called ham.)

Way 1: write the rules. You think about what spam looks like and type it in. The simplest rule you can write:

If the email contains the word “free”, it is spam.

Way 2: learn from examples. You collect emails that people have already labelled as spam or ham, and let the computer work out for itself which words point towards spam.

Here are eight labelled emails (the numbers are tiny so you can follow every step) and what the one-line rule says about each:

#EmailTruthRule saysRight?
1win free prize nowspamspamyes
2free money nowspamspamyes
3claim your free prizespamspamyes
4win cash prize nowspamhamno (missed spam)
5meeting at noonhamhamyes
6lunch now with teamhamhamyes
7are you free for lunchhamspamno (a real email blocked)
8project meeting noteshamhamyes

The rule is right on 6 of 8. You could fix it: add “prize”, “cash”, then add an exception for “lunch”… Every fix needs a person to notice the mistake and write a new rule, and the rules start to fight each other.

Now the learning way. For each word, count how many spam emails contain it, and subtract how many ham emails contain it. That number is the word’s score: positive means “points to spam”, negative means “points to ham”.

WordScoreWordScore
prize+3meeting−2
win+2lunch−2
free+2at, noon, with, team−1 each
now+2are, you, for−1 each
money, claim, your, cash+1 eachproject, notes−1 each

(For example, “prize” is in 3 spam emails and 0 ham emails, so its score is 3 − 0 = +3. “free” is in 3 spam and 1 ham email: 3 − 1 = +2.)

To judge an email, add up the scores of its words. A total above 0 means spam, otherwise ham. Email 4, “win cash prize now”: 2 + 1 + 3 + 2 = 8, spam. Email 7, “are you free for lunch”: −1 − 1 + 2 − 1 − 2 = −3, ham. Nobody wrote a rule about “lunch”. The data did.

This learned filter is right on all 8 training emails. It also handles three emails it has never seen: “win cash now” (total 5, spam), “are you free for the meeting” (total −3, ham) and “claim your prize now” (total 7, spam). The one-line rule gets all three wrong.

A fair warning. This is a toy. With only 8 emails, getting them all right proves very little: a program can fit a small training set perfectly and still fail on new emails. Real filters learn from huge numbers of emails and are judged on emails they have not seen (P3.A4). Real systems also often mix rules and learning. The point here is only the difference in approach.

Intuition

Think of teaching a child to recognise dogs. You could hand over a rulebook (“four legs, fur, barks…”) and quickly find exceptions: a dog with three legs, a hairless dog, a fox. Or you could just point at many dogs and non-dogs and say “dog” or “not dog”. People are good at the second way, and so, it turns out, can computers be.

Where the comparison breaks: a child brings years of experience of the world. A learning program starts from nothing but its examples, so it can only be as good as those examples, and it can pick up quirks of them. In our toy data, “now” gets a +2 spam score only because it happened to be in 3 spam emails and 1 ham email.

Code

Run this to see the same two filters in code. It uses only the standard library. Edit the emails and run it again.

Try it: a rule versus learned word scores

Runs real Python in your browser. First run downloads about 6 MB (once; your browser keeps it).

The first line of output is number of learned parameters: 19: the table above has 19 word scores. Those are the numbers training produced.

The vocabulary of learning

The spam example already contains the five words you will see in every lesson.

WordPlain meaningIn the spam filter
DataThe examples a system learns from. Examples that come with the right answer attached are labelled; the answer is the label.The 8 emails, each labelled spam or ham
ModelThe recipe that turns an input into an output.“Add up the word scores. Above 0 means spam.”
ParametersThe numbers inside the model that are set by learning.The 19 word scores
TrainingUsing data to find good values for the parameters.Counting words in spam and ham emails to get the scores
Prediction (or inference)Using the trained model on a new input to get an output.Scoring “win cash now” and answering “spam”

Two more words. A feature is a measurable property of an input that the model uses; here, which words appear in the email. In classic machine learning a person usually chooses the features (we chose “words”). In deep learning, the model learns its own features from raw input, which is a big part of why it is so powerful. You will see this in P0.2 and in Part 4.

Notice the order: training happens first, once (or from time to time). Prediction happens afterwards, every time someone uses the model. Training is usually the expensive step; a single prediction is usually cheap.

Three circles: AI, ML and DL

Now the main picture. Use the buttons to zoom in, one circle at a time.

Zoom in: each circle sits inside the one before

Artificial intelligenceMachine learningDeep learning

You are inside: AI

Artificial intelligence (AI). The broad goal: computer systems that do things we would call intelligent when a person does them, such as playing chess, recognizing speech or writing text. It includes systems built entirely from hand-written rules.

Nested circles. Zoom in from AI, to machine learning, to deep learning, to large language models. Everything inside a circle is also part of every bigger circle around it. Keyboard: Tab to the buttons and press Enter or Space.

In words:

  • Artificial intelligence (AI) is the broad goal: computer systems that do things we would call intelligent if a person did them, such as playing chess, understanding speech, or writing text. It says nothing about how you build the system.
  • Machine learning (ML) is one way of reaching that goal: the system learns patterns from data instead of following rules a person wrote. Our learned spam filter is machine learning.
  • Deep learning (DL) is machine learning with neural networks that have many layers. A neural network is a model made of many small units (artificial neurons) joined in layers; you meet it in P4.1. “Deep” refers to the number of layers. The layers learn their own features: given pictures of faces, early layers tend to pick up simple things such as edges, and later layers combine them into parts and then faces.

Where does the circle stop being “deep”? There is no sharp line. A network with one layer of neurons is usually not called deep; networks with many layers clearly are. Do not worry about the exact boundary.

Where do generative AI and LLMs sit?

Generative AI means systems that create new content: text, images, audio, code. A large language model (LLM) is a very large deep-learning model trained on huge amounts of text to predict what comes next, and then usually tuned further to follow instructions; chatbots such as ChatGPT are built on LLMs. So LLMs sit inside deep learning, as the last zoom level shows (P10.A1 explains how they work).

Generative AI is a bit different. It describes what a system does, not how it is built, so it is not another circle in the picture. Today’s well-known generative systems are deep-learning models, but “generative” and “deep” are separate ideas. And much of AI is not generative at all: a spam filter, a face recognizer and a chess program create nothing.

Try it: sort the systems

Pick a system, then tap the circle (or the button) where it belongs. You get feedback each time, and a wrong answer comes with a hint.

Where does each system belong?

No system selected yet.

Pick a system from the list, then tap where it belongs: in the picture or on a button.

Placed 0 of 9
Nine example systems to place: not AI, AI but not ML, ML but not deep learning, or deep learning. Works by tap, and by keyboard using the buttons below the picture.

Rules or learning: when to use which

Learning is not always better. Each approach has a place.

Hand-written rulesLearning from data
NeedsSomeone who knows the rules and can write them downMany examples (usually labelled)
Good whenThe rules are few and clear (calculate tax, route a call), or you need to explain every decisionThe rules are too many or too fuzzy to write: recognising faces, speech, spam
Weak whenThe world is messy and there are endless exceptionsThere is little data, or the data is biased or unrepresentative
When things changeA person edits the rulesYou can often retrain on new examples (you still must collect and check them)
Explaining a decisionUsually easy: point at the ruleOften hard, especially for deep networks

Real products often combine both: learned models for the fuzzy part, plain rules for the parts that must be exact or auditable.

Narrow AI and general AI

Every AI system in use today is narrow AI: built or trained for particular tasks, such as recognising speech, translating, recommending videos or playing a game. A chess program cannot drive a car, and a face recognizer cannot write an essay.

Artificial general intelligence (AGI) is the idea of a system that can learn and do any intellectual task a person can. It is a goal people discuss, not something that exists today, and there is no agreed definition or test for it. Experts disagree about how far away it is, or whether the idea is even the right way to think about progress. Nothing in this course depends on the answer.

Large language models blur the picture a little, because one model can write, translate, summarise and answer questions. They are still trained for a particular kind of job (predicting text), and they have clear limits. Stated carefully, today’s systems:

  • can do impressive things on specific tasks, sometimes better than people on that task: recognising objects in photos, translating, summarising, writing code, playing board games;
  • can fail in surprising ways: for instance an LLM can state something false in a confident tone (P10.G2), and a vision system can be fooled by changes a person would not notice (P5.17);
  • depend on their training data, and may do worse on inputs unlike anything they saw in training;
  • do not have a general understanding of the world in the way a person does. Exactly how to describe what they do or do not understand is a topic researchers argue about, so be wary of anyone who is certain either way.

Why did deep learning take off when it did?

Neural networks are an old idea (the perceptron is from 1958). They became the dominant approach to many problems only in the 2010s. Researchers commonly point to three things coming together:

IngredientWhat changed
DataLarge labelled datasets and huge amounts of text and images online. For example, ImageNet (presented in 2009) has grown to over 14 million labelled images; the 1,000-class subset used in its yearly contest has about 1.28 million training images in 1,000 classes.
ComputeGPUs (graphics processors) turned out to be very good at the huge numbers of multiplications that neural networks need (P1.B6). AlexNet in 2012 was trained on GPUs.
AlgorithmsBetter ways of building and training networks: for example the ReLU activation and dropout (both used in AlexNet), and later the Transformer (2017).

No single one of these is “the” reason, and historians and researchers weigh them differently. The pattern to remember: a many-layered network needs lots of data to learn from, lots of computing to train it, and good methods to make training work. Around 2012 all three were available at once.

A short history

Here is the story as a timeline. Scroll through it and tap events for more detail. Notice the two shaded AI winters.

AI from 1950 to today (scroll down; tap an event for more)

Blue-edged cards are ideas, green are milestones, orange are ingredients (data, methods) that later systems relied on. Shaded cards with a snowflake are the "AI winters": periods when interest and funding fell. Each label is also written in words, so colour is not needed.

A vertical timeline of AI from 1950 to 2022. Cards are labelled Idea, Milestone or Ingredient. Two shaded cards mark the AI winters. Tap any card to open more detail.

Three things the timeline shows.

  1. AI began as a goal, not a method. In 1956 nobody had today’s learning methods. Early AI included both rules and learning. Some of the first learning programs, such as Samuel’s checkers player (1959), are from the same decade.
  2. AI winters are what happens when promises outrun results. Funding and interest fell sharply twice. They did not end the field: machine learning and neural-network research carried on, and LeNet (1989 to 1998) was working deep learning years before the boom.
  3. Progress comes in waves, driven by ingredients as much as by ideas. Backpropagation was known by 1986, but the big gains of 2012 needed big data and GPUs too.

Misconceptions

Go deeper Is there one official definition of AI?

No. Textbooks such as Russell and Norvig’s Artificial Intelligence: A Modern Approach describe four ways people have defined it: systems that think like humans, act like humans (the idea behind Turing’s test), think rationally (follow correct logic) and act rationally (do the best thing available to reach a goal). Different definitions put the edge of “AI” in different places. This is also why a very simple device such as a fixed-rule thermostat is a borderline case that people can disagree about. This course uses the common working definition from the circles picture and keeps examples to clear cases.

Go deeper The famous "without being explicitly programmed" quote

You will often see machine learning defined as “the field of study that gives computers the ability to learn without being explicitly programmed”, credited to Arthur Samuel. That exact wording is not found in his 1959 paper, “Some Studies in Machine Learning Using the Game of Checkers”. It is a common paraphrase. What the paper does say, in its abstract, is that a computer can be programmed so that it will learn to play a better game of checkers than the person who wrote the program. The paraphrase captures the idea well; just do not quote it as his exact words.

Go deeper Where does 'learning' end and 'programming' begin?

Our spam filter has a human-written part (count words, subtract, add up, compare with 0) and a learned part (the 19 scores). That is true of all machine learning: a person always decides the model’s shape, the data and how success is measured. What is learned is the parameters. In deep learning the model is far bigger and also learns its own features, but a person still chooses the architecture, the data and the training method. Part 4 and P0.2 make this precise.

Check yourself

Check your understanding

  1. Which statement about AI and machine learning is correct?

  2. In the spam filter, what are the 19 word scores (such as prize = +3)?

  3. Which of these is an example of deep learning?

  4. What does "narrow AI" mean?

  5. Which combination do researchers commonly point to when explaining why deep learning took off in the 2010s?

Exercises

  1. Put each in the right place: AI but not ML, ML but not deep learning, or deep learning. (a) A translation program built from hand-written grammar rules and a dictionary. (b) A program that classifies flowers by comparing their measurements with labelled examples. (c) A neural network with many layers that transcribes speech.
    Show answer(a) AI but not ML: people wrote the rules. (b) ML but not deep learning: it learns from labelled examples, but there is no deep neural network. (c) Deep learning.
  2. Using the word scores in the lesson, what total does “free prize now meeting” get, and is it classified as spam?
    Show answerfree +2, prize +3, now +2, meeting −2 makes 5. Above 0, so spam.
  3. Add a ninth training email, “free cash for lunch”, labelled ham. Which scores change, and to what?
    Show answerfree goes from +2 to +1 (3 spam, 2 ham); cash from +1 to 0 (1 spam, 1 ham); for from −1 to −2; lunch from −2 to −3. All other scores stay the same. Now “free prize now meeting” totals 1 + 3 + 2 − 2 = 4, still spam.
  4. Name the data, the model, the parameters, the training and the inference in the spam example.
    Show answerdata: the labelled emails. Model: add up word scores and compare with 0. Parameters: the word scores. Training: counting words to get the scores. Inference: scoring a new email.
  5. Put these in order, oldest first: AlexNet wins ImageNet, the Dartmouth workshop, the Transformer paper, the backpropagation paper in Nature.
    Show answerDartmouth workshop (1956), backpropagation paper (1986), AlexNet (2012), Transformer (2017).
  6. Pick a task: deciding whether a photo contains a cat. Why is writing rules for it hard, and what would you need to build a learned version instead?
    Show answercats vary in colour, pose, size, lighting and background, and so many exceptions appear that the rules never end. A learned version needs many photos labelled “cat” or “no cat”, a model, and training. Check it on photos it has never seen.
  7. Someone says “deep learning is just a copy of the human brain”. Give two reasons why that is misleading.
    Show answeran artificial neuron is a simple calculation, far simpler than a biological neuron; and networks are judged by how well they do a task on a computer, not by how closely they copy a brain. The brain inspired the idea, but it is not a description.

Further reading

Key takeaways

  • Artificial intelligence (AI) is the broad goal of making computers do things that seem intelligent. Machine learning (ML) is one way to build AI: learn patterns from data instead of writing the rules by hand. Deep learning (DL) is ML with many-layered neural networks that learn their own features.
  • The circles nest: deep learning is inside machine learning, which is inside AI. Not all AI is machine learning (hand-written rule systems are AI), and not all machine learning is deep learning.
  • Rules need a person who knows them all and keeps them up to date. Learning needs examples (data). In our toy spam filter, the learned version beat the one-rule version on 8 of 8 training emails and 3 of 3 new emails, but with this little data that proves nothing.
  • Data is what you learn from, the model is the recipe that makes predictions, its parameters are the numbers inside it, training sets the parameters from data, and inference (prediction) uses the trained model on new inputs.
  • Today's AI systems are usually described as narrow: built or trained for particular tasks, and they can fail in surprising ways. 'General' AI is a hypothetical goal with no agreed definition.
  • Deep learning took off around 2012 when three things came together: large datasets, GPU computing, and better training methods. The ideas themselves were older.
  • AI's history includes two 'winters' of falling funding after over-promising. Machine learning research continued through both.
Found a mistake? Tell us