Tiny Learning Lab

Five small problems, each solved three ways, side by side, with the same rows in every lane so the comparison lines up. Everything here is a real toy model that trains or runs in your browser when you tap the buttons. Nothing leaves the page.

Problem one

XOR: the four-row exam

Exclusive or (XOR) answers 1 when the two bits differ and 0 when they match. Four rows total. It is the smallest problem in machine learning that a straight line cannot solve, which makes it a perfect three-way race: a perceptron, a recurrent neural network (RNN), and a tiny transformer, all training live.

Perceptron

What it uses
One straight line: a weighted sum of the two bits, nothing else.
Its answers right now
Correct
2 / 4
Epochs trained
0
Status
Not trained yet.

Recurrent neural network (RNN)

What it uses
A notebook instead of width. It reads the two bits one at a time, carrying a state of 3 numbers from the first bit to the second, and answers from the final state.
Its answers right now
Correct
0 / 4
Epochs trained
0
Status
Not trained yet.

Tiny transformer

What it uses
One attention head reads both bit tokens, plus a small feed-forward head. The head also sees the average of the two token vectors, a residual shortcut like real transformer blocks use.
Its answers right now
Correct
0 / 4
Epochs trained
0
Status
Not trained yet.
Attention on input 0, 1
To first bit 50%
To second bit 50%

What to watch: the perceptron trains forever and never passes 3 of 4, because the two correct-answer corners cannot be split from the wrong ones by one straight line. The other two bend, and both finish the exam. Same data, same rows, different wiring. Tap See everything on any lane to watch every weight while it trains, and use Train 1 to walk a single epoch at a time.

Why the perceptron can never converge: its training rule only moves the weights when a row is wrong, so it can only come to rest when every row is right, and that resting place does not exist. The two rows that must score positive (0, 1 and 1, 0) and the two that must score zero or below (0, 0 and 1, 1) share the same midpoint, and a flat weighted sum always scores a midpoint as the average of the corners around it, so the midpoint would have to be positive and not positive at the same time. With nowhere to rest, the weights loop: at weights minus 1 and 0 with bias 1, one full epoch of fixes returns to exactly those weights, forever. The score plateaus; the weights never rest. Rosenblatt's convergence theorem says the same thing from the other side: if a solution existed, this rule would find it in finitely many mistakes, so endless mistakes are the proof that none does.

Problem two

Rock paper scissors: three opponents, one you

Tap your throw. All three opponents play against you at the same time, and each one has to commit to its throw using only your past throws, never the current one. Same rounds, same rows, three different ideas about what you will do next.

No rounds yet. Your throw pattern so far: nothing to learn from, so everyone is guessing.

Random

What it uses
Nothing. It ignores your history completely.
Its throw this round
Waiting for round 1.
Record against you
0 W · 0 L · 0 T
Status
It will win about a third of rounds forever.

Frequency counter

What it uses
Your most common throw so far, and plays the throw that beats it.
Its throw this round
Waiting for round 1.
Record against you
0 W · 0 L · 0 T
Status
It punishes habits, but it is always one step behind a change.

Pattern predictor

What it uses
What you usually throw right after your last throw, and plays the throw that beats that.
Its throw this round
Waiting for round 1.
Record against you
0 W · 0 L · 0 T
Status
It learns sequences, not just totals. Rotate in a pattern and it will find the pattern.

What to watch: play with a habit, like always following rock with paper, and watch which lane starts beating you first. Then break the habit on purpose and see who adapts slowest.

Problem four

Monty Hall: three ways to answer the host

A car hides behind one of three doors. You pick a door, the host opens a different door with a goat behind it, and asks if you want to switch. Three strategies play the exact same rounds, so the only difference is the answer each one gives.

Door 1Closed
Door 2Closed
Door 3Closed

No rounds yet. Play one round to see the doors, or play a thousand to see the law.

Stay

What it uses
Your first pick only. It ignores the host completely.
Win rate
0%
Record
0 wins in 0 rounds
Theory says
About 33%. Your first pick was right one time in three, and nothing changes that.

Switch

What it uses
The host's reveal. The opened door is information: the host never opens the car.
Win rate
0%
Record
0 wins in 0 rounds
Theory says
About 67%. Your first pick was wrong two times in three, and the host points at the other candidate.

Coin flip

What it uses
A coin. Heads it stays, tails it switches, no thinking at all.
Win rate
0%
Record
0 wins in 0 rounds
Theory says
About 50%. Half stay at 33% and half switch at 67% averages out.

What to watch: one round proves nothing and the doors feel rigged either way. A thousand rounds is the argument ender: the three bars settle at three different heights, and the only difference between the lanes is how they treat the host's information.

Problem five

Maze dot: wander, learn, or plan

One maze, one dot, one goal in the bottom right. Three ways to get there: wander at random, learn from rewards, or plan with the whole map. Same maze in every lane, same rows: how many steps the route takes, and what happened.

Random walk

What it uses
Nothing. Every step is a coin flip among the open directions.
Route steps
Not run yet
Result
It has no memory, so every walk starts from zero knowledge.

Q-learning

What it uses
A table of scores, one per cell and direction, updated by reward: minus 1 per step, plus 20 at the goal. It only knows where it has been.
Route steps
Not trained yet
Result
Episodes trained: 0. Train it, then ask for its learned route.

Shortest path planner

What it uses
The whole map, all at once. Breadth-first search spreads out from the start and guarantees the shortest route. It does not learn anything.
Route steps
Not planned yet
Result
Perfect information, perfect answer, zero learning.

What to watch: the planner is the ceiling, 13 steps, and it never improves because it was never bad. The learner starts knowing nothing and earns its way to the same 13 steps. The random walker shows what the maze does to something that refuses to remember anything.