← AI Foundations

Can a neural network learn?

Train a tiny neural network, see its connections change, and test whether it has learned from examples.

Last lesson, you adjusted how strongly colour and shape affected a decision. Could a computer learn how to adjust its connections using examples instead?

In this lesson you will train a real, tiny neural network with two inputs, two hidden neurons and one output. It is intentionally limited to four fruit descriptions, not photographs. You do not need to understand the calculations.

How this lesson works: Engage, Explore, Explain, Elaborate, Evaluate
Extra examplesYour teacher may tell you which.
EngageCommit to a prediction before you test anything. A wrong guess is fine: it shows you what to look for.

Engage: What changes during training?

If you train a neural network with labelled examples, what is changing?

ExploreTry it on the board and compare what happens with your prediction.

Explore: Choose, train, test

  1. Before training, choose a fruit's colour and shape, and press Record this prediction. (The untrained network calls every fruit Apple.)
  2. Press Train one example a few times. Watch the connections. Then use Train 300 examples to allow enough repeated practice to see clearer changes.
  3. Test the same fruit again and press Record this prediction. Did its output change? Try all four combinations: green/round, green/long, yellow/round and yellow/long.

The network really adjusts its internal numbers during training. The connecting lines give you a glimpse of those changes, but you do not need to decode every line.

Important: During testing, the network uses its existing learned connections. Testing a fruit does not change the weights. Training does.

Try it yourselfYour edits are saved in this browser.

Train the network, then record at least one prediction.

Use the board. This ticks when you get there.

ExplainPut a name to what you saw, and why it works.

Explain: What has the network learned?

Identify which part of the model changes when it learns from examples.

Explain why choosing a fruit to test does not itself teach the network.

Explain why a network can improve on its training examples and still struggle with something new.

A programmer designs the network's structure and how training works. Training adjusts its internal connections. Its prediction can change even though nobody rewrites a rule such as “yellow means banana.”

Which action changes the neural network's learned connections?

Suppose you train the network only on yellow bananas, then test a green, round fruit. Why might it get it wrong?

Elaborate Extra · typicalUse the idea in a new situation.

Elaborate: Can you teach it the wrong lesson?

First choose Only yellow bananas, press Reset network, and train. Test a green, round fruit. What has the network not had the chance to learn?

Then select Use all examples, Reset network, train again and compare. You can also investigate the incorrect-label checkbox. Keep the same test fruit when comparing runs.

Wider investigation: Choose Show internal numbers. These values are connection weights (multipliers), not percentages or separate rules. Some may be negative, and none has to correspond to a human-readable feature. Can the same output change when several connections change together?

Try it yourselfYour edits are saved in this browser.

EvaluateLook back at your first ideas and what changed.

Evaluate: Explain the difference

Without using the board, complete these statements:

What is the strongest evidence that this network has learned from training?

EvaluateLook back at your first ideas and what changed.

Learning with AI: outputs do not reveal everything

Modern AI systems can be useful even when we cannot easily explain their learned internal patterns. We might inspect individual numbers without understanding what they collectively represent.

Imagine an AI assistant makes a confident claim in a subject you are learning. What would you verify independently? What work should you practise yourself before asking AI for help?

Takeaway: a neural network's behaviour changes as training adjusts its connections. Its predictions come from those learned numbers, not from a list of rules someone wrote.

Chatbots are neural networks too: very large ones, trained on huge amounts of text to predict the next word. That is the same next-word idea from Unit 1, with far more examples and connections.

Next: your sorter, your neural network and your dice generator are different kinds of AI. The next lesson names four kinds and how each goes wrong.

Now you can
Next lesson8. What kind of AI is it?Sort everyday systems into four kinds (rules written by people, models that predict, models that make new content, and agents that act; one useful way to sort them), then match each kind to the way it usually goes wrong.
For teachers

Train and test a genuine tiny neural network without teaching the mathematics. About 30 minutes.

Open the teacher guide: answers, solutions, slides and a worksheet.

Students will be able to

Before class

The board uses a small genuine 2-2-1 sigmoid neural network with backpropagation. It sees only colour and shape, not photographs. No account or online model is needed. The lesson ends by linking back to Unit 1: chatbots are very large neural networks trained to predict the next word. Optional extension, with school approval: train an image model in the Pattern Trainer (https://tools.learningwaypoints.com/trainer/, photos stay on the computer; Teachable Machine also works) and test photos not used in training. An image model processes much richer information than two hand-chosen clues; neither guarantees correct predictions.

Running the lesson

  1. Have students record a prediction before training.
  2. Reset the network whenever comparing training datasets.
  3. Ask what changed internally and what stayed the same.

The hard part (on purpose)

Students may think testing a new fruit automatically retrains the model.

When students get stuck

Stretch and support

Stretch: Show optional connection numbers; ask why they are not percentages.

Support: Start with all examples and compare one fruit before and after 100 training steps.

Where it leads

The last lesson of Unit 2 names four kinds of AI (rules, predict or sort, make new content, take actions) and how each goes wrong.