← All lessons / Foundations / Lesson 01 of 12

Interactive lesson

AI made simple: what it is, and what it isn't.

Before the jargon: what does “AI” actually mean, how does a system learn from examples, and when should a charity or research team use it? When would another approach work better?

You’ll learn to
  • Distinguish learned patterns from explicit rules.
  • Test a tiny model on new messages and inspect its mistakes.

So what is AI?

Artificial intelligence (AI) is the broad field of getting computers to do tasks that usually need human judgement, such as recognising images, understanding language or making predictions.

Most of the AI you meet today is machine learning: instead of a person writing every rule, a system is shown many examples and learns patterns from them. Show it thousands of emails marked “spam” or “not spam” and it learns which clues, such as particular words, tend to signal spam. These clues are called features. The result of all this learning is called a model: the part that has learned the patterns and makes the predictions.

Generative AI, including tools like ChatGPT, Claude or Gemini, uses the same idea at a huge scale. It learned patterns from vast amounts of text, and uses them to predict what words are likely to come next. That is why it can write fluently, and also why it can sound confident while being wrong.

Traditional software

A person writes the rules.
“If the email contains prize, mark it spam.”

Machine learning

The system learns the rules from examples.
“Here are 10,000 labelled emails. Find the pattern.”

Generative AI

A model learns patterns from huge collections of text or images, then produces new content. Text models predict the next word; image models use different techniques.

What AI isn't. It isn't thinking or understanding in the way people do. It isn't a database of checked facts. And it isn't automatically up to date: it only knows what was in its training data, plus anything you give it.

Interactive

Teach a tiny model to triage an inbox

A charity receives these eight messages. Each one is labelled Urgent or Can wait. Press Train the model, and a small but real model learns which words point to urgency. Then see how it handles four messages it has never seen. These are its test data: the only fair way to judge a model is on examples it didn't learn from.

Try this: switch a few labels to the “wrong” answer and train again. What happens to the predictions?

Not trained yet.

This is real, but tiny. The model counts which words appear in urgent and non-urgent messages (a method called naive Bayes). Real systems learn from thousands or millions of examples, but the principle is the same: the model can only be as good as the examples it learns from.

Interactive

Can AI help with this?

For each task, decide whether AI is a good fit. Then compare your answer with ours. You may disagree; what matters is how you reached your decision.

Key ideas to take away

  • AI learns patterns from examples. Biased, outdated or mislabelled examples produce a biased, outdated or wrong model.
  • Generative AI predicts plausible content. Plausible is not the same as true, so facts, figures and references always need checking.
  • AI is strongest at drafting, summarising, sorting and searching. It is weakest where accuracy is critical, the stakes for a person are high, or accountability matters.
  • Keep a human in charge. Use AI to support people's judgement, especially in health, safeguarding and decisions about individuals. People should remain responsible for these decisions.

Check your understanding

4 quick questions. Try as often as you like. Your progress stays on this device; answers clear when you reload.

Want to go deeper?Equations, code and research for technical learners. Optional.

The model in the lab: naive Bayes

For each word w, the model estimates how much more often it appears in urgent messages than in non-urgent ones, with +1 smoothing so unseen words do not produce zeros:

score(w) = log( (count_urgent(w) + 1) / (N_urgent + V) )
         − log( (count_wait(w) + 1)   / (N_wait + V) )

A message's score is the sum of its words' scores plus the log of the prior ratio. Positive means “urgent”. N is the number of words in each class and V the vocabulary size. Words the model has never seen contribute nothing, which is why it struggles with new vocabulary.

The same idea in Python

from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB

messages = ["Volunteer fell at the event", "Thanks for the newsletter"]
labels   = ["urgent", "can wait"]

vectoriser = CountVectorizer(stop_words="english")
X = vectoriser.fit_transform(messages)
model = MultinomialNB().fit(X, labels)

print(model.predict(vectoriser.transform(["Venue flooded before the event"])))

Words worth knowing

Training data
The labelled examples a model learns from.
Generalisation
How well a model handles examples it has not seen. Always test on held-out data.
Overfitting
Memorising the training examples instead of learning the underlying pattern.
Foundation model
A large model trained on broad data that can be adapted to many tasks. These models underpin today's generative AI.

Continue exploring

We've picked resources that explain these ideas from different angles. They are independent of Code With Impact.

Sources for this lesson

The explanations, examples, triage model and task cards in this lesson are original Code With Impact material. The lesson introduces one idea at a time, followed by hands-on practice. This structure is inspired by the visual teaching approach of the resources below.

How we reference: we link and credit, we never copy other educators' text, diagrams or code. See our full Sources & credits register.