Area 00 // FoundationsLesson 01 / 14012 min read
What AI, ML, deep learning and generative AI are
AI is the big goal of making computers do things that seem smart; machine learning is the main way we get there today, by learning from examples instead of following hand-written rules; deep learning and generative AI are smaller circles inside it.
Think of it like this
Analogy
Think about how a child learns what a dog is. Nobody hands them a rulebook ("four legs, fur, a tail, barks"). Their parents point at lots of dogs and say "dog", and at cats and say "cat". After enough examples, the child can recognise a dog they have never seen before, even a strange-looking one.
Machine learning teaches computers the same way: show it many examples with the right answer, and it works out the pattern by itself.
The problem it solves
Some tasks are easy to describe as rules: "if the basket total is over £50, delivery is free." A programmer writes that once and it is always right.
Other tasks are impossible to write down. Try writing the rules for "is this photo a cat?" or "is this review angry?" or "write a polite reply to this email". There are millions of edge cases. Every rule you add breaks something else.
That is the gap AI fills: getting computers to do tasks we can do but cannot explain step by step.
How it works, step by step
The words get used loosely, so here they are as circles inside each other, from biggest to smallest.
- Artificial intelligence (AI) is the goal, not a technique: computers doing things that seem to need intelligence. A chess program from 1997 that follows hand-written search rules counts as AI.
- Machine learning (ML) is the main way we build AI today. Instead of writing rules, you give the computer examples (emails marked "spam" or "not spam") and it finds the pattern. What it learns is called a model.
- Deep learning is machine learning with neural networks: big stacks of simple maths units (you'll build one in lesson 3). It shines on messy data like images, sound and language.
- Generative AI is deep learning that creates things (text, pictures, music, code) instead of only choosing a label. A large language model (LLM) such as GPT, Claude, Gemini or Llama is a generative model for text: it writes one small piece of text at a time, each time picking a likely next piece.
- An AI engineer (that's you, by the end of this course) mostly uses these models: calls them through an API, gives them the right information, connects them to tools, tests them, secures them and ships them. You rarely train a big model from scratch.
Rules vs learning, side by side
| Classic programming (rules) | Machine learning | |
|---|---|---|
| You provide | The rules | Examples with answers |
| The computer produces | Answers | The rules (a model) |
| Good for | Clear, stable logic (tax, sorting) | Fuzzy patterns (photos, language) |
| When it's wrong | Fix the rule | Add better examples, retrain |
See it in code
- Needs
- Nothing: plain Python 3, no installs.
Here is the difference in a few lines. First a hand-written rule, then a tiny "learner" that works out which words signal spam by counting them in labelled examples.
# 1) Classic programming: a person writes the rule.
def is_spam_rule(text):
return "lottery" in text.lower()
# 2) Machine learning (a tiny version): learn from labelled examples.
examples = [
("win the lottery now", "spam"),
("claim your free prize", "spam"),
("free prize inside, click now", "spam"),
("lunch at noon?", "ham"), # "ham" = a normal email
("here are the meeting notes", "ham"),
("can you send the notes now", "ham"),
]
# Count how often each word appears in spam and in normal mail.
counts = {"spam": {}, "ham": {}}
for text, label in examples:
for word in text.split():
counts[label][word] = counts[label].get(word, 0) + 1
def is_spam_learned(text):
# Each word votes: +1 for every time it was seen in spam, -1 for normal mail.
score = 0
for word in text.lower().split():
score += counts["spam"].get(word, 0) - counts["ham"].get(word, 0)
return score > 0
new_email = "free prize waiting"
print("rule says spam: ", is_spam_rule(new_email))
print("learned says spam:", is_spam_learned(new_email))rule says spam: False
learned says spam: TrueThe rule missed it because nobody wrote a rule for "prize". The learner caught it because "free" and "prize" appeared in spam examples. Nobody told it those words matter; it found that out from the data. Real models learn millions of patterns like this, with much better maths.
A real example
Example
One email app, three kinds of AI
A modern email app uses all three circles at once:
- Rules: "Emails from your contacts never go to spam." A product manager decided that; it's an
ifstatement. - Machine learning: the spam filter. It was trained on billions of emails people marked as spam, and it keeps learning from your "Report spam" clicks.
- Generative AI: the "Help me write" button that drafts a reply. An LLM reads the email thread and generates new text.
As an AI engineer you would mostly build the third part, but you need to know when the first or second is the better, cheaper choice.
The easy way
Start here
You don't need maths or a GPU to start. The quickest way to feel the difference between these ideas:
- Open a chatbot (ChatGPT, Claude or Gemini) and ask it to explain something. That's generative AI.
- Run the snippet above. That's (tiny) machine learning.
- Then follow this course in order: Foundations gives you just enough of how learning works, and from the LLM area on you'll build real apps.
When you grow: the production setup
In real companies these pieces are combined deliberately: rules for things that must always be exactly right (prices, permissions), classic ML for cheap high-volume decisions (fraud scores, ranking), and LLMs for language-heavy tasks (support replies, summaries, coding help), with tests (evals) checking each part.
Trade-offs
What you gain
- Machine learning solves problems nobody can write rules for: vision, speech, language.
- A model improves when you give it more and better examples, without rewriting code.
- Generative AI can handle open-ended requests a fixed program never could.
What it costs you
- Learned models are only as good as their examples, and can be confidently wrong.
- It's hard to explain exactly why a model gave an answer.
- Big models cost money for every request and need careful testing.
When not to use it
- The logic is simple, fixed and must be exactly right (tax rates, access rules): write normal code.
- You have no examples and no way to check answers: you can't tell if the model is any good.
Common mistakes
- Using "AI" and "LLM" as if they mean the same thing. LLMs are one small (very popular) corner of AI.
- Reaching for an LLM when an
ifstatement would do. It's slower, costs money and can be wrong. - Thinking an AI engineer must train models from scratch. Most of the job is building reliable apps around existing models.
- Believing a model "understands" like a person. It has learned patterns from data, which is powerful but different.
Interview questions
Try answering out loud first, then open the model answer.
What is the difference between AI, machine learning and deep learning?
Model answer
AI is the broad goal of making machines perform tasks that seem to need intelligence; it includes hand-written rule systems. Machine learning is a subset where the system learns patterns from data instead of being explicitly programmed. Deep learning is a subset of ML that uses multi-layer neural networks, which work especially well on unstructured data like images, audio and text. Generative AI and LLMs sit inside deep learning.
When would you not use machine learning?
Model answer
When the logic can be written as clear, stable rules and must be exactly correct (billing, permissions, validation), when there's no data to learn from or no way to measure correctness, or when the cost and latency of a model aren't justified. A rule is cheaper, faster, deterministic and easier to test.
What does an AI engineer do, compared to an ML researcher?
Model answer
An ML researcher designs and trains new models and techniques. An AI engineer builds products on top of existing models: choosing a model, prompting it, retrieving the right data (RAG), connecting tools (agents), evaluating quality, controlling cost and latency, securing the system and deploying it. The AI engineer is closer to a software engineer who deeply understands how models behave.
Quiz
Pick an answer to see whether it’s right and why.
0 of 6 answered
Key terms
- Artificial intelligence (AI)
- The broad goal of making computers do tasks that seem to need intelligence, such as understanding language or recognising images. Includes both hand-written rules and learned models.
- Machine learning (ML)
- Getting a computer to find patterns in examples, instead of a person writing the rules, so it can make predictions on new inputs.
- Deep learning
- Machine learning with neural networks that have many layers. Works especially well on messy data like images, sound and text.
- Generative AI
- Models that create new content (text, images, audio, code) instead of only choosing from fixed labels.
- Model
- The thing you keep after training. A function, stored as numbers, that turns an input (an email, a prompt) into an output (a label, a reply).
- Large language model (LLM)
- A very large neural network trained on huge amounts of text to predict the next token. That one skill lets it answer questions, write, summarise and follow instructions.
Before and after
Read first
Nothing. You can start here.
Progress is saved in this browser only.