Inspiration

In 2024 the FlyWire consortium finished mapping every neuron and every synapse in an adult fruit fly's brain: 134,181 neurons and about 2.7 million connections. It's the first complete wiring diagram of a brain that can walk, fly, smell and choose. We wanted to see what that brain does when you give it a job. Not a fly's job. Ours: answering email, going to the gym, filling in Workday applications, doomscrolling reels.

What it does

Phyllis Inglewood is a fly-sized office at 3:47 am, built in three.js: nine cubicles under flickering fluorescent lights, an LED board scrolling corporate encouragement, a clock stuck on the night shift. Every cubicle belongs to an Inglewood, and each Inglewood is a copy of the real fly connectome making live decisions:

Fly Job
Willoughby Inglewood writes Shakespeare one word at a time, picking from a tray of 8 words
Bobby Inglewood plays chess as White against a random opponent
Gordo Inglewood food critic. You feed it a dish, it gives a verdict from "spit it out" to "chef's kiss"
Marlo Inglewood balances reps, rest and fatigue on the bench and squat rack
Doris Inglewood triages email: archive, reply, flag or unsubscribe
Elton Inglewood fills in Workday-style job applications, field by field
Mona Inglewood paints a 64-cell Mona Lisa from 8 pigments
Ferrari Inglewood likes, opens comments or swipes on reels, and slowly tunes its own feed
The Inglewoods the family band. Upload a song; four flies each hear one part (drums, bass, vocals, keys) and a fifth conducts

Click any fly and a panel drops down showing its brain live: all 134k neurons, the sensory neurons lighting up, and the 16 descending neurons per action whose firing picks the move. Hover a neuron for its FlyWire ID. Hit Lesion connectome and the fly's choices go flat. Press ^ to see "the pods", where all the brains are kept.

The rule that makes it honest

The claim is that the fly's real neurons make every decision you see. Four things keep that true:

  1. The observation enters only through real sensory neurons.
  2. Each action is read from a fixed group of 16 real descending neurons (the brain's wires to the body). There is no learned output layer.
  3. Training changes connection strengths only. Which neuron connects to which, and whether each connection excites or inhibits, stays exactly as FlyWire mapped it.
  4. A lesion test (core.check) zeroes the connectome and checks that the fly stops reacting to its world. Every fly has to pass before it can train on the GPU.

How we built it

  • Brain: FlyBrain (PyTorch) turns the FlyWire v783 tables into a sparse recurrent network: leaky rate neurons, 8 steps per decision, signed weights on a log scale so a trained connection can never flip from excitatory to inhibitory. Standard sparse backprop wanted a 72 GB dense gradient, so the team wrote a custom autograd function that computes the gradient edge by edge in chunks.
  • Tasks: every fly is one FlyTask subclass with 2 to 8 actions, a 4 to 64 float observation and an action mask, so even an untrained fly never does anything impossible. Reward flies (Marlo, Ferrari, Bobby, Mona, Elton) learn with REINFORCE. Teacher flies (Doris, Gordo, Willoughby) imitate a rule or a corpus; Willoughby walks through real Shakespeare and learns to tell the true next word from 7 decoys.
  • Training: a shared Runpod RTX 4090 with a one-job-at-a-time queue. Teammates submit, status, logs and pull from their laptops with one script. Each fly gets about 15 minutes on the full 134,181-neuron brain.
  • World: a Python server runs every trained brain live on CPU and streams decisions to a three.js office (ACES tone mapping, soft shadows, ambient occlusion, bloom and film grain). Each fly's station.js animates its own actions, and the brain view renders all 134k neurons with WebGL.
  • The Inglewoods (the band) run entirely in the browser: a modeled antenna (a damped resonator tuned to measured fly hearing), the five real antennal neuron classes, and a spiking leaky integrate-and-fire model (Shiu et al.) of the 8,161 neurons sound can reach, one fly per Web Worker.

Results (full brain, trained vs. random vs. lesioned)

Fly Trained Random Lesioned
Marlo, gym (reward) 55.5 -15.3 -5.4
Ferrari, reels (reward) 29.8 1.0 0.2
Mona, painting (reward) 6.80 4.20 4.38
Elton, job applications (reward) -25.3 -33.8 -36.7
Doris, inbox (agreement with teacher) 100% 32% chance 22%
Gordo, critic (agreement with teacher) 71% 12.5% chance 11%
Willoughby (picks the real next word) 43.5% 12.5% chance 11.5%

Every trained fly beats random, and every lesioned brain falls back to about random. That last column is the point: the behaviour lives in the wiring.

Challenges

  • Memory. A 134k × 134k connectome doesn't fit as a dense matrix, and PyTorch's sparse backward quietly builds one anyway. The custom chunked gradient got the full brain training on a single 4090.
  • Readout without cheating. With no output layer, the only knobs are the strengths of connections that already exist and how the observation drives the sensory neurons. Some tasks needed real thought about which sensory neurons to drive and how to shape rewards (Marlo's reward only pays for rest after a real set, so "1 rep, nap, 1 rep, nap" can't win).
  • One GPU, many people. A queue, per-person SSH keys and an "only edit your own folder" rule let everyone train in parallel without breaking each other's flies.

What we learned

A brain that evolved to find rotting fruit can, with nothing but its connection strengths retuned, learn to triage email or tell Shakespeare from noise. And the lesion test is a good habit for any "biological" AI claim: if cutting the wiring doesn't break the behaviour, the wiring wasn't doing it.

What's next

Longer training runs, flies that talk to each other (two-brain chess is already wired up), and spiking dynamics for every station, not only the band.

Credits

Connectome: FlyWire v783 (Dorkenwald et al., Nature 2024). Annotations: Schlegel et al., Nature 2024. Neuron model and packaged connectivity: Shiu et al., Nature 2024. Keeping the wiring and signs fixed while learning strengths follows github.com/cesp99/fly-chess.

Built With

Share this project:

Updates

Submission history