Levels
Pick a level to play. A check means you have solved it with every row correct.
How weightspace works
1. What you're doing
Each level gives you a tiny neural network and a rule, like "output 1 only when both inputs are 1." You set the network's numbers by hand until its answers match the rule for every possible input.
The truth table lists every input and the answer you want. Press
Start to reveal the network and start the clock. Your score
is rows correct × 1000 + margin bonus + seconds left.
Getting rows right always matters most. Once every row is right, you unlock the margin bonus, worth up to 250 points per row. It looks at the row whose output sits closest to 0 (the "worst" row) and asks how far it is on the right side, compared with the best possible for that level. A network that clears 0 by a wide margin is a cleaner circuit than one that barely scrapes by, so a well-separated solution beats a fast, sloppy one. Seconds left only break ties after that. A few levels have no margin bonus, because their best possible margin isn't known for sure; the score box says so.
2. How one neuron computes
A neuron takes its inputs, multiplies each one by a weight, adds them up, and adds its own bias. Call the result z:
z = (x1 × w1) + (x2 × w2) + … + b
The output neuron's answer is 1 if z is above 0, otherwise 0.
For example, with weights 0.8 and −0.3, a bias of −0.5, and the input x1 = 1, x2 = 0:
z = (1 × 0.8) + (0 × −0.3) − 0.5 = 0.3 → above 0, so the answer is 1
A positive weight pushes z up when its input is on. A negative weight pushes it down. A weight of 0 means the neuron ignores that input. The bias sets where z starts before any input is on, so it decides the answer for an all-zero input.
Show spoiler: a full worked example (solves level 3, AND)
Weights 0.5 and 0.5, bias −0.75:
| x1 | x2 | z | answer |
|---|---|---|---|
| 0 | 0 | −0.75 | 0 |
| 0 | 1 | −0.25 | 0 |
| 1 | 0 | −0.25 | 0 |
| 1 | 1 | +0.25 | 1 |
One input alone isn't enough to get past the bias, but both together are.
3. Reading the screen
- Lines are weights. Thicker means bigger. Teal is positive, rust is negative, and a thin dashed line is exactly 0. The number above each line is its weight.
-
Nodes hold biases. The
bunder each node is its bias. - Drag to change a value. Drag a line or a node up or down, like a knob. Values snap to 0.05 and stay between −1 and 1. You can also Tab to one and use the arrow keys.
- Hover a truth-table row to trace that input through the network. Each node shows its value, and the small italic number near the end of each line is what that line carries: its weight × the value coming into it. Lines carrying 0 fade out. Click a row to pin it.
-
Hidden neurons show
z → h: the sum before ReLU and the value after (see section 5). The small curve inside each hidden node is ReLU, and the dot marks where the hovered row's z lands on it. - The decision boundary plot shows what the network answers for every input, including the in-between values the truth table doesn't list. Teal means it answers 1 and rust means 0. With 3 inputs, it's a cube you can drag to rotate, with the answer-1 region shaded inside. The ? next to the plot explains the markings.
4. Why one neuron isn't always enough
A single neuron can only split its inputs with one straight line: everything on one side answers 1, everything on the other answers 0. That works for AND. It can't work for XOR, where the two 1s sit on opposite corners.
Each corner is one input: x1 runs left to right, x2 bottom to top. Filled dots want 1, hollow dots want 0.
5. Hidden layers and ReLU
The fix is to add hidden neurons between the inputs and the output. Each hidden neuron computes its own z, then passes it through ReLU:
ReLU(z) = z if z is above 0, otherwise 0
Negative sums are cut to 0; positive sums pass through
unchanged. So a hidden neuron is a detector: it stays
silent until its inputs push z above 0, then reports how far
above. In the table and on the network,
−0.40 → 0.00 means ReLU cut a negative sum to 0.
The output neuron then works like the single neuron in section 2, except its inputs are the hidden neurons' values. Each hidden neuron can draw its own line, and the output combines them, which is how the network handles XOR.
A dead neuron is a hidden neuron whose z is 0 or below for every input, so it outputs 0 every time and contributes nothing. If you see the "dead" label, raise its bias or its weights.
Show spoiler: a full worked example (solves level 26, XOR)
h1 counts how many inputs are on (weights 1 and 1, bias 0). h2 fires only when both are on (weights 1 and 1, bias −1). The output takes 0.5 × h1 − 1 × h2 − 0.25:
| x1 | x2 | h1: z → h | h2: z → h | output z | answer |
|---|---|---|---|---|---|
| 0 | 0 | 0 → 0 | −1 → 0 | −0.25 | 0 |
| 0 | 1 | 1 → 1 | 0 → 0 | +0.25 | 1 |
| 1 | 0 | 1 → 1 | 0 → 0 | +0.25 | 1 |
| 1 | 1 | 2 → 2 | 1 → 1 | −0.25 | 0 |
On (1, 1), h2 wakes up and cancels h1's count, which pulls the answer back to 0.
6. Tips
- Set the bias first: it decides the answer when every input is 0.
- Use a weight of 0 to make a neuron ignore an input.
- When inputs form a number, like x1 x2 x3 in "5 or more," give higher bits bigger weights.
- For hidden levels, decide what each hidden neuron should detect before touching any numbers.
- Hover rows constantly. The row that's wrong usually tells you which number to move.
Leaderboard
Best run per player on each level. Sign in with GitHub to submit your scores.
| # | player | score | accuracy | margin | time left | timestamp |
|---|