Settings

These settings need JavaScript, which is off in this browser, so choosing one changes nothing.

Changes apply as you choose them.

Theme
Font
Why these fonts?

Choose the font you find easiest to read. Studies have not found that special "dyslexia fonts" help people read faster or more accurately. More space between letters and words does help some readers, so try the spacing setting too.

Text size
Reading layout
Letter and word spacing
Line spacing
More reading controls

Focus mode hides the Map and Help links, the breadcrumb and the footer, so only the page you are reading is left.

Reading voice and speed

Emma is a computer voice, made with the open Kokoro model. Her readings are saved on this site. Where a part has no Emma reading yet, your device's own voice reads it.

Reading speed

The number is how many times faster than normal. 1.5 is one and a half times as fast. The voice keeps its pitch.

Move or delete progress
Move your progress

This device's save code:

Or open this restore link on the other device:

Lesson 1.2

Rules or examples?

After this lesson you can explain the difference between written rules and learning from examples.

About 8 minutes, or 13 with the Deep layers

Reading depth for every section

In short

  • A computer can sort things by rules that people write, or by patterns it learns from examples.
  • To learn from examples, it gets examples with the answer marked. People choose those examples and answers.
  • A rule does exactly what it says. A model learns only from its examples. So both can get things wrong.

Two ways to sort things

In August 2025, US adults surveyed online were asked: “How does AI like chatGPT learn to write?”

About 1 in 3 (33%) of the 2,299 who answered picked “Programmers wrote down rules for how to write”. That is not how a chatbot like ChatGPT learned. It was trained on huge amounts of text.

There are two ways to get a computer to sort things. People can write the rules it follows. Or it can learn patterns from examples.

Some everyday things follow set rules, such as calculators, traffic lights and thermostats. Others were trained on examples, such as apps that translate or recognise pictures.

Spam filters show both. Spam is junk mail, the messages you do not want. A person can write a spam rule by hand. A spam filter can also learn from examples of spam.

The survey ran online from 1 to 6 August 2025, with 2,301 US adults, and was published in December 2025. Its question 90 was “How does AI like chatGPT learn to write?”, with four printed answers. Of the 2,299 adults who answered it, about 4 in 10 (39%) chose “It read huge amounts of text from books, websites, and articles”. About 1 in 3 (33%) chose “Programmers wrote down rules for how to write”. Just under 1 in 4 (23%) chose “People typed in answers to millions of questions”, and 1 in 20 (5%) chose “Scientists wrote down every possible response by hand”.

The same survey asked what a chatbot like ChatGPT is doing when it answers a question. Of the 2,296 who answered, almost half (45%) chose “Looking up the exact answer in a database”, and about 1 in 5 (21%) chose “Following a script of prewritten responses”.

Chatbots like ChatGPT run on large language models, which are trained on massive amounts of text. So rules written for how to write do not describe how such a chatbot learned. Generative models (models that make new text, pictures or sound) first learn by copying the patterns of the data they are trained on. They are sometimes trained further on examples for particular tasks.

The answer about people typing is partly true. When ChatGPT launched in November 2022, OpenAI said it fine-tuned (trained further) an already trained model with conversations written by people, who played both the user and the assistant. That was the 2022 version. That is learning from examples, the subject of this lesson. OpenAI’s page adds that ChatGPT “has evolved substantially since then”.

The limits: this is one online survey, from the US only. It printed four answers and no “not sure” option, and the publisher’s article does not discuss this question. We found nothing like it for Ireland or for neurodivergent learners.

How learning from examples works

To learn from examples, a computer is given examples with the right answer marked. An example is one item, such as one message. The answer marked on it is its label, such as “junk”.

The computer finds links between the examples and their labels. What it builds is called a model. Finding patterns in examples like this is called machine learning.

“Learn” here means finding patterns in data. It is not learning the way a person does.

People make the choices in both ways. A person writes the rule. People also choose the examples and mark their labels.

Learning from labelled examples is called supervised learning. Each example has features and a label. Features are the things a model looks at to make its guess, and the label is the answer. For a message, the features can be the words in it, and the label is “junk” or “not junk”.

The sorter in this lesson does not keep a copy of its messages. It stores word counts. Google’s course describes a model in supervised learning as a collection of numbers that link patterns in the features to the labels. Training is how the model finds those numbers.

The point of training is to work on new cases: examples the model never saw. Using a trained model on new examples with no labels is called inference.

To check a model, people give it examples whose labels it cannot see. Then they compare its guesses with the real labels.

A model can do badly on new cases unlike its examples. Google’s example: 100 years of weather data from July alone would give poor predictions of rain in January.

One classic spam filter is a word-counting model called naive Bayes. It counts how often each word appears in the junk examples and in the not-junk examples. Then it puts a new message in the group whose word counts fit it better. It needs only a small amount of training data. It can also give chance figures, but these are known to be unreliable, so this lesson never shows them.

Try it: Sort the messages

Some messages are junk: adverts, prizes and offers you did not ask for. The rest are not junk.

These messages are made up for this lesson.

Rule: if a message has the word "free" in it, it goes in junk.

Which of these messages will the rule catch? There is no wrong guess here.

Message 1: Claim your free prize now, just click the link
Message 2: Free phone upgrade for students this week only
Message 3: You won a voucher, reply now to collect it
Message 4: Free lunch for the class after the exam on Friday
Message 5: The lab moves to room two on Tuesday

What the rule did

Junk the rule caught

  • Message 1: Claim your free prize now, just click the link
  • Message 2: Free phone upgrade for students this week only

Junk the rule let through

  • Message 3: You won a voucher, reply now to collect it

Not junk, but the rule caught it

  • Message 4: Free lunch for the class after the exam on Friday

Not junk, and the rule let it through

  • Message 5: The lab moves to room two on Tuesday

The rule checks for one word, and nothing else.

What the model did

Now a small model sorts the same five messages. It learned from example messages we wrote and marked junk or not junk. It is a word-counting model, called naive Bayes.

Junk the model caught

  • Message 1: Claim your free prize now, just click the link
  • Message 3: You won a voucher, reply now to collect it

Junk the model let through

  • Message 2: Free phone upgrade for students this week only

Not junk, but the model caught it

None

Not junk, and the model let it through

  • Message 4: Free lunch for the class after the exam on Friday
  • Message 5: The lab moves to room two on Tuesday
  • You have won a cash prize, click the link to claim it (we marked it junk)
  • The lecture on Monday starts at ten in room four (we marked it not junk)
  • Claim your reward today, only a few left (we marked it junk)
  • Free tea and coffee at the study group tonight (we marked it not junk)
  • Win a new phone, reply now to enter (we marked it junk)
  • Can you send me the notes from this week's class (we marked it not junk)
  • Huge sale on shoes, click the link before midnight (we marked it junk)
  • The library is open late this week for students (we marked it not junk)
  • Free gift card waiting for you, claim it now (we marked it junk)
  • Our group meets after the lab to plan the project (we marked it not junk)
  • Congratulations, you are our lucky winner this month (we marked it junk)
  • Free printing for students in the library this week (we marked it not junk)
  • Last chance to get the deal, click to buy now (we marked it junk)
  • Reminder: hand in the essay by Friday (we marked it not junk)
  • Earn cash from home, reply to find out how (we marked it junk)
  • The bus to campus is running late this morning (we marked it not junk)
  • Your prize is ready, follow the link to collect it (we marked it junk)
  • Sports club practice moves to Thursday this week (we marked it not junk)
  • Get two pizzas for the price of one, order now (we marked it junk)
  • Are you coming to the class trip on Saturday (we marked it not junk)

Side by side

  • Message 1: Claim your free prize now, just click the link. We marked it junk. The rule caught it. The model put it in junk.
  • Message 2: Free phone upgrade for students this week only. We marked it junk. The rule caught it. The model did not put it in junk.
  • Message 3: You won a voucher, reply now to collect it. We marked it junk. The rule let it through. The model put it in junk.
  • Message 4: Free lunch for the class after the exam on Friday. We marked it not junk. The rule caught it. The model did not put it in junk.
  • Message 5: The lab moves to room two on Tuesday. We marked it not junk. The rule let it through. The model did not put it in junk.

Both made mistakes: the rule checks only for its one word, and the model learned only from our examples.

We wrote these messages to show where each way goes wrong.

Lesson 1.4 shows how a chatbot writes one likely word at a time.

A rule does exactly what it says

A written rule does exactly what it says, and nothing more.

Say the rule is: if a message has the word “free” in it, it goes in junk. It would catch “Free bike checks at the sports centre”, which is not junk.

It would also let “Win a prize, just click the link” through. That message is junk, but it does not have the word “free”.

A written rule can be read. That is one strength of rules. Anyone can see exactly what the rule shown here checks.

A rule-based system follows logic that people programmed, exactly as written. It catches every match, even one its writers did not mean, and lets through anything that does not match.

AILit, the OECD and European Union’s framework for AI literacy, lists transparency, how easy it is to see how something works, among the things to weigh when choosing between the two ways.

Whether a written rule counts as AI depends on whose definition you use. Ireland’s Higher Education Authority (HEA) names rule-based systems as one of the main families of AI. The definition in the EU AI Act, the EU’s main AI law, leaves out programs that only carry out rules written by people, and names machine learning as one way an AI system can work things out. Lesson 1.1 has more on this.

Each way has its uses

A model can get things wrong too. It learned only from the examples people gave it. A new message unlike them can end up in the wrong group.

So neither way always wins. Learning from examples needs examples. With only a few, a written rule can do better.

But rules have limits too. A few simple rules are quick to write. A big, complicated set of rules gets too hard to keep working.

Machine learning needs data. Google’s guide for engineers says that if machine learning is not absolutely required for your product, do not use it until you have data. With a small set of examples, or one without much variety, you may not gain anything from machine learning.

If a simpler way without machine learning already works, use it. Machine learning can cost much more to build, and it often needs looking after for a long time. The simple way is the one a learning system has to beat.

Learning from examples suits tasks that cannot be done in clear, separate steps, such as working with language or recognising faces. So a task that can be written as clear steps may suit a rule.

Choosing between the two means weighing several things: the setting, how much good data there is, speed and cost, how easy it is to see how it works, what you want, and what could go wrong.

Rules lose too. Google’s guide for engineers says a simple rule of thumb can get a product started, but a complex one cannot be kept working. Once there is data and a basic idea of the goal, it says to move to machine learning.

Check-in

Which of these is an example of technology that follows set rules?

A calculator.

Yes. A calculator follows set rules that people wrote. Traffic lights and thermostats are other examples.

An app that translates what you say.

Not this one. Translation is an example of technology that was trained on examples.

An app that recognises what is in a photo.

Not this one. Image recognition is an example of technology that was trained on examples.

This lesson's spam sorter learned from labelled examples. A new message arrives that it never saw. What does this sorter do?

It looks the message up among its examples.

Not this one. This sorter keeps word counts from its examples, not a copy of each message. So there is nothing to look up.

It uses the patterns it found in its examples to make a guess about the new message.

Yes. The point of learning from examples is to work on new cases the model never saw.

It follows a rule that a person wrote for that exact message.

Not this one. That is the other way, written rules. A filter that learned from examples uses the patterns it found.

Sources (11)

Glossary

rule
An instruction that people write for a computer to follow exactly. One example is "if a message has this word, it goes in junk".
example
One item a computer learns from, such as one message.
label
The answer marked on an example, such as "junk" or "not junk".
feature
A thing a model looks at in an example to make its guess, such as the words in a message.
model
What a computer builds from its examples. It is often a set of numbers, not a copy of the examples.
machine learning
Getting a computer to find patterns in examples, instead of writing every rule by hand.
training data
The examples an AI system learned from.

Where next

I have finished this lesson