license: cc-by-4.0
language:
- en
tags:
- webgpu
- connectome
- drosophila
- tic-tac-toe
- experimental
Fly XOX
Weights for a tic-tac-toe player that runs on the MaleCNS fruit fly connectome. The whole wiring diagram stays in (166,700 neurons, 25.6M connections), and the only trained part is three values per neuron. The browser game loads the webgpu/ folder.
Files
webgpu/ is the browser model: seven arrays split into 16 MiB chunks, 224,749,428 bytes in total. manifest.json lists each chunk with its SHA256, and the app checks every chunk before copying it to the GPU. Trained gains are already multiplied into weight and encoder. golden.json holds 12 test boards along with their PyTorch logits, and webgpu-verification.json has the result of running the shaders on them. brainmap.json and brainmap.bin hold a 2D position and an annotation group for every neuron, used by the game's activity panel.
training/ has the checkpoints. best.pt is the one the export came from (step 1,100, chosen on validation, optimizer state included). last.pt is step 1,200, and untrained.pt is the starting point used for the baseline numbers. results.json has every score below, history.json has the validation curve, and before.json is the validation score before training.
graph/ is the filtered connectome as a scipy sparse matrix (connectome.npz), plus MaleCNS body IDs (ids.npy), the sensory neurons (sensory.npy), the fixed board input projection (encoder.npy), and manifest.json with the source URLs and SHA256 hashes of the original downloads.
controls/ has results for two more runs on the real wiring and three on a shuffled graph, plus how the shuffle was done.
analysis/ has compare.json (real vs. shuffled) and regions.json (response per annotation group and step, readout neurons per group and cell type, parameter changes).
How it works
- The board becomes 27 one-hot values (empty, mine or theirs for each square).
- A fixed random projection feeds them into the 17,937 sensory neurons.
- Four softsign rate updates run across the full graph, starting from zero each move.
- A fixed random readout from 2,048 non-sensory neurons gives 9 move scores. Taken squares are masked.
Edge weights are synapse counts normalized per receiving neuron. GABA and glutamate neurons count as inhibitory and everything else as excitatory. Each neuron gets a trained input gain, offset and leak, 500,100 parameters in total. The two projections stay fixed.
Neurons are kept if they have a superclass in the annotations and aren't glia. Every connection between kept neurons is included, with no synapse threshold.
Results
1,200 steps, about 43 seconds of training on an RTX 3090. Rotations and mirror images of a board always fall in the same split. Any move minimax rates as best counts as correct.
| Positions | Best move picked | |
|---|---|---|
| Train | 3,560 | 98.2% |
| Validation | 492 | 90.0% |
| Test | 468 | 91.7% |
| Test, before training | 468 | 62.8% |
| Test, random legal move | 468 | 56.9% |
500 games per row:
| Opponent | Fly plays | Won | Drew | Lost |
|---|---|---|---|---|
| Random | first | 474 | 26 | 0 |
| Random | second | 425 | 70 | 5 |
| Minimax | first | 0 | 500 | 0 |
| Minimax | second | 0 | 480 | 20 |
Full games also visit training positions, so the test split is the real generalization number.
Real vs. shuffled wiring
The shuffled graph keeps every neuron's in-degree, out-degree, transmitter sign and normalized input weights, and randomizes which neuron each connection comes from. Three runs per graph with different batch orders, same test positions:
| Graph | Test runs | Mean |
|---|---|---|
| Real wiring | 91.2%, 91.7%, 94.0% | 92.3% |
| Shuffled | 82.7%, 83.5%, 87.8% | 84.7% |
Where the signal goes
Averaged over all boards, the biggest response outside the sensory neurons is in antennal lobe projection neurons (0.080 at the last step), and it drops off quickly after that. The mushroom body and central complex barely respond. 1,755 of the 2,048 readout neurons are in the optic lobe, 1,261 of them lamina cells L1 to L3 right behind the photoreceptors. That comes from where the input lands, not from any kind of vision: the input projection treats photoreceptors like every other sensory neuron. Full numbers are in analysis/regions.json.
Limitations
- One shuffle and three runs per graph. There's no plain MLP baseline.
- It's a rate model with rough transmitter signs. Nothing spikes, there's no real timing, and backprop is nothing like how flies learn.
- The shaders were checked against PyTorch with wgpu-native on a CPU Vulkan driver: same moves, logits within 5e-6.
- Running it needs WebGPU, a 225 MB download, and storage buffers of at least ~102 MB.
License
Derived from MaleCNS v1.0 by HHMI Janelia/FlyEM, the University of Cambridge, MRC LMB, Google Research and collaborators (https://male-cns.janelia.org/), which is CC BY 4.0. These files use the same license. The training and game code is MIT.