Swap the brain

Think of a game console: the console never changes, you swap the cartridge.

Small numbers: how much the strategy liked each square.
Your moveYour turnThe model winsYou winDraw
The cartridge: its numbers, one square each (orange positive, blue negative). Swap cartridges and watch them change.
…and the rest of them.
How it works (for the curious)

The models

Model
Trainedthe tic-tac-toe demo's network, trained on every position
Hand-written48 hand-set hidden units: win if you can, else block, else centre, corner, edge
Randomuntrained: random int8 weights

Each one is an 18 → 64 → 9 network with int8 weights. The page keeps them as three CSS rules of 1,801 numbers each and nothing else. Change the numbers and the same interpreter plays something else.

The hard part: multiplying

To use the cartridge, the console has to multiply its numbers, but a network can't multiply two of its inputs, only add them up. So it splits each number into pieces, like 5 = 4 + 1, and turns 5 × 7 into 4 × 7 + 1 × 7: just adding.

A ReLU network can only add up its inputs with fixed weights, and here the model's weights are inputs too. So every weight × activation is built from ReLUs. The weights come in as unsigned bytes u = w + 128.

StepAs ReLU
layer 1: x is 0 or 1x · u = relu(u − 256·(1 − x)), then subtract 128·Σx
a byte's bits, all at onceq_j = ⌊u / 2^j⌋ = round(relu(2u + 1 − 2^j) / 2^(j+1)), bit_j = q_j − 2·q_(j+1)
bit × activation, 0 ≤ h ≤ 3,310relu(h − 3,310·(1 − bit))
w × h−128·(sign·h) + Σ_j<7 2^j·(bit_j·h), two's complement
thenstep 1's rules: the best free square, if you moved and the game is on
layer 1
1,937
layer 2
5,105
layer 3
5,041
layer 4
433
layer 5
595
layer 6
307
layer 7
100
layer 8
90
output
36
learnedhand-writtencarry (passes a value down a layer)
Checked in numpy: for all three models, on every position and every X move (25,893 cases), the interpreter's logits and move equal the model's own forward pass. It is also exact on 300 random models with weights at the edges of the int8 range; those can push sums past 2²⁴, so the page only loads models that are checked to stay under it. The browser test plays each model's games in Chromium, Firefox and WebKit.