Level 2 · BeginnerLesson 2.1 28 min read 10 question quiz 13 marks of written practice

What AI Is, and What It Is Not

Defining artificial intelligence

There is no single agreed definition, which is part of why arguments about AI get heated. Three useful ones:

SourceDefinition
John McCarthy, who coined the term"The science and engineering of making intelligent machines, especially intelligent computer programs"
A practical definitionComputer systems that do tasks which would need intelligence if a person did them: seeing, understanding language, reasoning, learning and deciding
The EU AI Act (2024)In summary, a machine-based system that works with some level of autonomy and infers from the input it receives how to produce outputs such as predictions, content, recommendations or decisions

The key word in the legal definition is infers. A calculator follows a fixed formula. An AI system works out how to turn its input into an output, usually because it learned how from examples.

Narrow, general and super

KindMeaningExists?
Narrow AIVery good at one task or a family of tasks: recognising faces, translating, playing GoYes, everywhere
General AI (AGI)As capable as a person across almost any intellectual task, able to learn new onesNot yet, and experts disagree on when or whether
SuperintelligenceFar beyond the best humans at nearly everythingHypothetical

Today's large language models are a puzzle for this table. They are far more general than earlier narrow AI, writing code, poems and maths, yet still fail at some things a child can do. Most researchers describe them as broad but not yet general.

The working definition for this course

AI is building systems that turn inputs into useful outputs by recognising patterns, mostly patterns they learned from data. That is less mysterious than the films, and far more useful.

The AI family: AI, machine learning, deep learning, generative AI

The four terms you hear most fit inside each other like nesting bowls.

The AI family: AI, machine learning, deep learning, generative AIFour solid discs stacked like a tiered cake, each smaller than the one below. The largest, at the bottom, is artificial intelligence: any way to make machines act intelligently, including search, rules and learning. On it sits machine learning, which learns its behaviour from data instead of following written rules. On that sits deep learning, machine learning with many-layered neural networks. On top is generative AI, deep learning that creates text, images, audio, video and code.Each field sits inside the one below itARTIFICIAL INTELLIGENCEArtificial intelligenceany way to make machines actintelligently: search, rules, learningMACHINE LEARNINGMachine learninglearns its behaviour from datainstead of following written rulesDEEP LEARNINGDeep learningmachine learning with many-layered neural networksGENERATIVE AIGenerative AIdeep learning that creates text,images, audio, video and code
All generative AI is deep learning, all deep learning is machine learning, and all machine learning is AI. Not the other way round.
TermWhat it isExample
Artificial intelligenceThe whole field: any technique that makes a machine act intelligently, including hand-written rules and searchA chess program searching moves, a route planner
Machine learning (ML)AI that learns its behaviour from data instead of being given rulesA spam filter that learns from emails people have marked
Deep learningMachine learning with neural networks of many layersFace unlock, speech recognition
Generative AIDeep learning models that create new content: text, images, audio, video, codeA chatbot, an image generator

Fields named after tasks

AI is also divided by the task, and each task can be tackled with any method:

  • Computer vision: understanding images and video
  • Natural language processing (NLP): understanding and producing human language
  • Speech: turning sound into words and back
  • Robotics: sensing and moving in the physical world
  • Planning and search: finding a sequence of actions that reaches a goal
  • Recommendation: predicting what a person will want next

Since about 2012, deep learning has become the best method for almost all of them, which is why the words are often used as if they meant the same thing. They do not.

Traditional programming versus machine learning

This is the most important idea in the whole course.

Traditional programming compared with machine learningTwo rows. Traditional programming: rules and data go into a computer that runs the program, and answers come out. Machine learning: data and answers go into a computer that learns, and rules come out, called a model. A dashed arrow shows the model then being used with new data to make predictions.Turn the arrows around and you have machine learningTraditional programmingRulesDataComputer runsthe programAnswersMachine learningDataAnswersComputerlearnsRules: a modelnew data + model = predictionsthen used ondata it has never seen
In machine learning the rules are the output, not the input.

In traditional programming, a person writes the rules. The computer applies the rules to data and produces answers.

In machine learning, a person supplies data and the answers, and the computer works out the rules. The rules it learns are called a model. The model is then used to produce answers for new data it has never seen.

Why learn the rules?

Try writing rules to recognise a cat in a photo. Pointy ears? Some cats have folded ears, and so do foxes. Whiskers? Hidden in half the photos. Fur colour? Every colour. Every rule has exceptions, and the exceptions have exceptions.

But it is easy to collect a hundred thousand photos labelled "cat" and "not cat". Machine learning turns that pile of examples into a model that recognises cats better than any rule list could.

When rules are still better

If the rules are known, simple and must be exactly right, write them. VAT at 20%, a bank's opening hours or the rules of chess should never be learned. Machine learning is for problems where the rules are too many, too fuzzy or unknown.

Perceive, decide, act: AI as an agent

In the most widely used AI textbook, Artificial Intelligence: A Modern Approach, Stuart Russell and Peter Norvig define AI as the study of agents: things that perceive their environment and act on it to achieve goals.

The agent loopA goal, find and fix the failing test, feeds a loop of three boxes joined by amber arrows: think, where the language model plans the next step; act, which calls a tool; and observe, which reads the result back. The tools, search, run code, edit files and tests, sit inside a red dashed sandbox with limited permissions. A memory of notes, files and retrieval connects to think. An exit arrow leads to done: report the fix, or stop at the step limit.An AI agent: think, act, observe, repeat until the goal is reachedgoal: “find and fix the failing test”thinklanguage model plans the next stepactcall a toolobserveread the resultsandbox, limited permissionssearchrun codeedit filestestsmemory: notes,files, retrievaldone: report the fix,or stop at the step limit
The model decides; the program acts, inside limits a person has set.
AgentSensors (perceive)DecidesActuators (act)
Self-driving carCameras, radar, GPSWhere to steer, when to brakeSteering, brakes, accelerator
Robot vacuumBump sensors, cliff sensors, cameraWhich way to go nextWheels, brushes
Chess programThe board positionWhich move scores bestMaking the move
Video recommenderWhat you watched, skipped and likedWhat to show nextThe thumbnails on your screen
AI assistantYour message, files, search resultsWhat to say or which tool to useText, actions in other apps

From simple to clever

  • A simple reflex agent reacts to what it senses now: a thermostat switches the heating on below 19 °C.
  • A model-based agent keeps track of things it cannot currently see: a robot remembers where the stairs were.
  • A goal-based agent plans actions to reach a goal: a satnav.
  • A utility-based agent weighs how good each outcome is: a satnav that trades speed against tolls.
  • A learning agent improves its own behaviour from experience. Most of this course is about how that learning works.

What today's AI is good and bad at

Good atWeak at
Finding patterns in huge amounts of dataCommon sense that nobody wrote down
Recognising images, speech and handwritingSituations unlike anything in its training data
Producing fluent text, images and codeKnowing when it is wrong: it can state falsehoods confidently, called hallucination
Doing the same task millions of times without tiringExplaining why it made a decision
Games with clear rules and scoresLearning from one or two examples, as a child can
Predicting what usually happens nextTelling cause from coincidence
Fluent is not the same as right

A language model is trained to produce text that is likely, not text that is true. Most of the time likely and true agree. When they do not, the model sounds just as sure of itself. Always check facts that matter.

Moravec's paradox

Reasoning that humans find hard can be easy for computers, while perception and movement that humans find effortless can be very hard. A computer beat the world chess champion in 1997. A robot that can tidy any child's bedroom still does not exist.

Hands-on: a spam filter written two ways

Rules versus learning, in code

Both filters below decide whether a message is spam. The first uses rules a person wrote. The second counts how often each word appeared in eight labelled examples and learns which words point to spam.

Python
def rule_filter(message):
    rules = ["win", "free", "prize", "click"]       # written by a person
    return any(word in message.lower().split() for word in rules)

training = [
    ("win a free prize now", "spam"),
    ("claim your free gift card today", "spam"),
    ("cheap pills click here", "spam"),
    ("you have won cash reply now", "spam"),
    ("are we still meeting for lunch", "ham"),
    ("here are the notes from class", "ham"),
    ("can you send me the homework", "ham"),
    ("happy birthday see you at the party", "ham"),
]

# Learning: count each word's appearances in spam and in normal mail (ham)
counts = {"spam": {}, "ham": {}}
for message, label in training:
    for word in message.split():
        counts[label][word] = counts[label].get(word, 0) + 1

def learned_filter(message):
    score = 0
    for word in message.lower().split():
        score += counts["spam"].get(word, 0) - counts["ham"].get(word, 0)
    return score > 0

tests = ["claim your cash now", "send me the class notes",
         "free pizza at lunch for the team", "you won a gift card"]
for t in tests:
    by_rules = "spam" if rule_filter(t) else "ham"
    by_learning = "spam" if learned_filter(t) else "ham"
    print(f"{t:34} rules: {by_rules:5} learned: {by_learning}")

The rules miss two spam messages because they contain none of the four magic words, and they flag a perfectly normal message about free pizza. The learned filter gets all four right because it weighs every word, using evidence from the examples.

Try this

  1. Add the test "click here for the class notes". Which filter gets it right?
  2. Look at counts["ham"]["the"]. The learned filter has decided "the" is a sign of normal mail, only because it appeared in three normal messages. What does that tell you about learning from only eight examples?
  3. Add four more labelled messages of your own and run it again.

Activity: spot the AI

List ten pieces of technology you used in the last 24 hours. For each, decide whether it uses no AI, rules, or learning from data, and what its sensors, decisions and actions are. Compare your list with a partner's and argue about the borderline cases.

Level check

  • Give two definitions of AI and explain what the word "infers" adds
  • Explain the difference between narrow AI and general AI, with examples
  • Draw the AI family as nested circles and give an example for each ring
  • Explain how machine learning differs from traditional programming
  • Describe an AI system as an agent: its sensors, decisions and actions
  • Give three things today's AI is good at and three it is weak at

Key terms you must be able to define

Artificial intelligence (AI)
Computer systems that do tasks which would need intelligence if a person did them, usually by recognising patterns.
Narrow AI
AI that performs one task or a family of related tasks very well. All AI that exists today is at most broad, not general.
Artificial general intelligence (AGI)
A hypothetical AI as capable as a person across almost any intellectual task.
Machine learning
AI that learns its behaviour from data instead of following rules a person wrote.
Deep learning
Machine learning that uses neural networks with many layers.
Generative AI
Models that create new content, such as text, images, audio, video or code.
Model
The learned rules: a function with adjustable numbers that turns inputs into outputs.
Agent
Something that perceives its environment through sensors and acts on it through actuators to achieve goals.
Hallucination
A confident output from an AI model that is false or made up.
Moravec's paradox
The observation that reasoning is easy for computers while perception and movement, effortless for people, are hard.

Flashcards

DefineArtificial intelligence (AI)
AnswerComputer systems that do tasks which would need intelligence if a person did them, usually by recognising patterns.
DefineNarrow AI
AnswerAI that performs one task or a family of related tasks very well. All AI that exists today is at most broad, not general.
DefineArtificial general intelligence (AGI)
AnswerA hypothetical AI as capable as a person across almost any intellectual task.
DefineMachine learning
AnswerAI that learns its behaviour from data instead of following rules a person wrote.
DefineDeep learning
AnswerMachine learning that uses neural networks with many layers.
DefineGenerative AI
AnswerModels that create new content, such as text, images, audio, video or code.
DefineModel
AnswerThe learned rules: a function with adjustable numbers that turns inputs into outputs.
DefineAgent
AnswerSomething that perceives its environment through sensors and acts on it through actuators to achieve goals.

Go further: notes for future AI engineers

How engineers decide whether a problem needs ML

Before any model is built, a good engineer asks four questions:

  1. Is there a pattern to learn? If the outcome is random, no model can predict it.
  2. Is it hard to write the rules? If a short rule list would work, use it: it is cheaper, faster and easier to test.
  3. Is there data? Usually thousands of examples, with labels if the task is supervised.
  4. Can mistakes be tolerated? A model will be wrong some of the time. A film recommendation can afford that. A dose of medicine needs a human check.

Google's well-known Rules of Machine Learning guide opens with exactly this advice: do not be afraid to launch a product without machine learning.

Misconceptions to avoid

Avoid these
  • Using AI, machine learning and deep learning as if they mean the same thing. Each is a smaller part of the one before.
  • Thinking all AI learns. Route planners, chess searchers and expert systems are AI with no learning at all.
  • Believing that a fluent answer must be a correct one. Language models are trained to be likely, not to be true.
  • Assuming AI understands the way people do. It finds patterns in data, which can look like understanding and sometimes is not.
  • Thinking machine learning should replace all rules. If the rules are known and must be exact, write them.
Fun fact

Hans Moravec noticed in 1988 that the things humans find hard, such as chess and algebra, are easy for computers, while the things a toddler does without thinking, such as walking across a cluttered room or picking up a sock, are fiendishly hard. It is called Moravec's paradox, and robots still feel it.

Knowledge check

0 of 10 answered
1What does the word 'infers' add to the EU AI Act's definition of an AI system?
2Which is an example of narrow AI?
3How do AI, machine learning and deep learning relate?
4In machine learning, what goes in and what comes out of training?
5Which problem is best solved with hand-written rules rather than machine learning?
6In the agent view of AI, what are actuators?
7A thermostat switches the heating on whenever the room is below 19 °C. What kind of agent is it?
8What is a hallucination in AI?
9What does Moravec's paradox say?
10Which task is generative AI?
Score 0 / 10

Check you could explain this

13 marks
1Explain the difference between traditional programming and machine learning.4 marks
Explain

Mark scheme0 / 4
  • LIn traditional programming a person writes the rules
  • LThe computer applies the rules to data to give answers
  • LIn machine learning the computer is given data and answers / examples
  • LIt learns the rules, the model, itself
Model answer

In traditional programming a person writes the rules, and the computer applies those rules to data to produce answers. In machine learning the person supplies data together with the correct answers, as labelled examples, and the computer works out the rules for itself. The learned rules are called a model, which is then used to produce answers for new data it has never seen.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.

Think this answer or mark scheme is wrong? Report it

2A school wants software that recognises which student is in a photo. Discuss whether it should use hand-written rules or machine learning.6 marks
Discuss

Mark scheme0 / 6
  • LRules for faces are very hard to write
  • LFaces vary: lighting, angle, expression, glasses, hair
  • LMachine learning can learn patterns from labelled photos
  • LIt needs enough photos of each student
  • LIt will sometimes be wrong, so mistakes need handling
  • LPrivacy or consent concerns about storing faces
Model answer

Hand-written rules would be almost impossible here, because nobody can describe a particular face precisely enough, and the same face changes with lighting, angle, expression, glasses and hair. Every rule would have exceptions. Machine learning suits the problem, because it can learn the patterns that distinguish each student from labelled photos. However, it needs several photos of every student, it will sometimes misidentify someone, so there must be a way to handle mistakes, and storing biometric data about children raises serious privacy and consent issues under data protection law. Machine learning is the right technique, but only with consent, security and a human fallback.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.

Think this answer or mark scheme is wrong? Report it

3Describe a self-driving car as an AI agent.3 marks
Describe

Mark scheme0 / 3
  • LSensors such as cameras, radar or GPS perceive the environment
  • LIt decides what to do, such as when to brake or where to steer
  • LActuators such as steering, brakes or accelerator act
Model answer

A self-driving car perceives its environment through sensors such as cameras, radar and GPS. Its software decides what to do next, such as when to brake, how fast to go and where to steer, to reach its goal safely. It then acts on the world through actuators: the steering, brakes and accelerator.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.

Think this answer or mark scheme is wrong? Report it

Machine mark 0 / 13