Neural Playground

Lesson 4 of 7 · 18 min

How Networks Learn: Five Training Paradigms

Training is a search for good weights. Tour the five big families — supervised, unsupervised, reinforcement, neuroevolution and self-supervised — with real numbers and one shared target.

Training = searching for good weights

A brand-new network starts with random weights, so every answer is a guess.

Training is the search for weights that make those guesses better.

To search, we need a number that scores how wrong the network is — that number is the loss.

Five ways to search

Not every network learns the same way. This lesson tours five families of training:

1. Supervised — learn from an answer key.

2. Unsupervised — find structure with no labels.

3. Reinforcement — learn from rewards by trial and error.

4. Neuroevolution — breed a population and let the fittest survive.

5. Self-supervised — let the data label itself.

They chase different signals, but they share one goal: make the loss (or the score) better.

1 · Supervised learning — the answer key

Supervised learning is school with an answer key. Every training example carries a label: the correct answer.

The network guesses, the teacher checks, and the error is sent back so the weights can improve.

Examples: a spam filter trained on emails marked *spam* or *not spam*; a cat/dog classifier like our Class A / Class B sandbox.

Worked example. One training point has the correct label 1.0 (definitely a cat). The network guesses 0.7.

Its error is 0.7 − 1.0 = −0.3, and the squared loss is (−0.3)² = 0.09.

The training step nudges the weights so the next guess creeps toward 1.0.

Supervised loss for one point

Loss = (guess − correct)² = (0.7 − 1.0)² = 0.09

Labels tell the network what the answer should have been. Humans (or sensors) supply them, which is powerful but expensive.

2 · Unsupervised learning — no answer key

Unsupervised learning gets no labels at all. The network sees raw data and looks for hidden structure — groups, patterns, or a simpler way to describe it.

Clustering example. A shop records customer spending: 1.0, 1.2, 5.0, 5.3 (hundreds of dollars). Nobody labels 'budget' or 'big spender'.

An unsupervised algorithm notices the numbers fall into two clumps: one centred near (1.0 + 1.2) / 2 = 1.1, the other near (5.0 + 5.3) / 2 = 5.15.

It can now describe every customer by which clump they belong to — with no labels ever supplied.

The same trick powers recommendations, anomaly detection and compressing data.

3 · Reinforcement learning — learn by doing

Reinforcement learning (RL) is learning by doing. An agent lives in an environment, takes actions, and receives rewards. Nobody says which move is 'right' — the agent discovers which moves pay off.

Game analogy. Think of a video-game score: dodge an attack and the score goes up; run into a wall and it goes down. The agent repeats actions that earned reward and avoids actions that lost it.

Exploration vs exploitation. The agent must balance *exploration* (try something new — controlled by ε) with *exploitation* (use what already works). Too little exploration and it never finds the best move; too much and it never settles down.

Worked ping. Bump a wall and receive −1. Reach the goal and receive +1. Over many tries the value of 'move toward goal' grows while 'bump wall' shrinks — no labels, just rewards.

4 · Neuroevolution — survival of the fittest

Neuroevolution copies nature. Instead of computing a gradient, it keeps a population of networks (say 8), scores each one, lets the best survive, and builds the next generation by copying and mutating the survivors.

Breeding analogy. A mutation is a small random tweak to a weight. Most tweaks do nothing helpful, but every so often one improves the score — and that child becomes a parent next round.

Worked generation. Generation 1 has 8 random lines; the best scores 0.52 (a fitness like 1 / (1 + loss)). Keep the top 4 and make 8 mutated children. Generation 2's best scores 0.68. By generation 7 the best score can reach 0.82 and the line fits the points.

When each shines. Gradient descent is precise and fast when the problem is smooth; neuroevolution needs only a score, so it works on messy problems (or when gradients are unreliable) — but it is usually slower.

5 · Self-supervised learning — the data labels itself

Self-supervised learning sits between supervised and unsupervised. The data supplies its own labels, so no human is needed.

Predict the next word. Take a sentence and hide the next word: The cat sat on the ___. The correct label is the real next word, mat.

Train a giant network to predict it across billions of sentences and it learns grammar, facts and reasoning along the way. This is how modern large language models are trained.

Semi-supervised learning is the middle ground: a small labelled set plus a large unlabelled set.

Try it: same target, three paradigms

Switch between Supervised, Reinforcement and Evolution. In Supervised the error shrinks every step; in Reinforcement the agent chases reward pings; in Evolution the population breeds toward a better line.

Training Paradigms Lab

One target, three ways to learn it. Fit a line to five labelled points with supervised gradient steps, a reward-hungry agent, or a breeding population.

supervised · reinforcement · evolution

The orange dots are the training data. The network wants a line that passes through them. Switch between Supervised (learn from labels), Reinforcement (learn from reward) and Evolution (breed the fittest) — each uses a different knob, but they all chase the same shrinking error.

Runs for up to 100 steps, then stops.
warming up…labelled points, gradient steps shrink the error

Control knobs

Check yourself

How Networks Learn

Question 1 of 8

A spam filter is trained on 10,000 emails, each hand-marked spam or not spam. Which paradigm is this?