What is this?
A tiny generative-agents-style town, except the residents aren't LLMs — each fly is a leaky-integrate-and-fire simulation of a 30,000-neuron, 1.5-million-synapse slice of the real MaleCNS fruit-fly connectome (smell → antennal lobe → lateral horn + mushroom body → descending neurons → leg/wing/proboscis motor neurons).
Odors in the town become currents on the fly's actual olfactory receptor neurons, split by antenna side and by channel: nectar/sugar (glomeruli VA2, DP1m, VM5d, DM3), fermenting fruit (DM1, DM4, DM2), other flies (DA1, VA1v, VL2a, DL3) and water/decay (DA2, DL5, V, DM5). Each fly has its own tastes — Fig lives for fermenting berries, Clementine only cares about sugar — and its own hunger, so the same garden pulls on one fly and leaves another cold. The whole 30k-neuron slice runs at 1 ms resolution, one brain per fly, in its own Web Worker.
Steering direction is read from the left/right spike-rate contrast of those receptor pools, channel by channel, each weighted by how strongly it is firing (no smell → no steering, just wandering). When the total drive is rising the fly runs straighter, faster and turns upwind — the surge/cast behaviour real flies show; when it falls the fly casts. Vigor comes from the leg and wing motor-neuron pools downstream, and the proboscis motor pool decides when a fly on food actually eats. Each fly keeps a memory stream and reflects on its day at dawn.
Does it work? Yes, measurably: with one food source 8 tiles away, a random-walking fly spends 3% of its time on it; the steering fly reaches it every run and spends ~42% of its time there. Pair that smell with punishment first and it drops to 9%; pair it with reward and it rises to 70% (scripts/harness.mjs, numbers in the README).
What the flies can do (all of it driven by the connectome slice)
- Learn. Pick a fly → the Fly tab shows its KC→MBON synapses, how many have been weakened, live dopamine, and its current opinion of the sugary and fermenting smells; on the map a green/red ring flashes while dopamine is teaching. Each brain has 33,000 plastic Kenyon-cell → MBON synapses in its mushroom body. Tasting food drives the PAM reward dopamine neurons; getting soaked or nearly swatted drives the PPL1 punishment neurons. A three-factor rule (recently active Kenyon cell × dopamine) depresses the matching synapses, so the MBON approach/avoid balance for that odor shifts — and that balance scales how hard the fly steers toward whatever it is smelling. Reward makes a smell magnetic; punishment makes the fly "smell food… but remember". The odor specificity comes from the Kenyon-cell population code, which we had to make feedforward-dominated to get (see below).
- Learn from each other. A fly that watches a neighbour eat while smelling that food gets a small reward-dopamine pulse — a Danchin-style social-learning shortcut. Watch for the 👀 tag and "X was right about this place".
- Court. Males smell female cuticular pheromone through their real Or47b/Or88a receptor neurons (VA1v/VA1d). That gates a courtship drive on the P1/pC1 neurons; when P1 recruits the song descending neurons (pIP10, vPR6) the male chases, extends one wing and sings 🎵. Females slow down and listen; whether she stays depends on her.
- Jump. Anything looming — a swat from you (click the grass next to a fly) or another fly diving in — excites the LC4/LPLC2 looming-detector neurons. If the giant fiber (DNp01) fires, the fly bolts 💨, even out of sleep, and the scare is punishing for the smell it was tracking.
- Groom. Meals and river water leave dust on the bristles; bristle input recruits the grooming descending neurons DNg11/DNg12 and the fly stops to clean itself 🧼.
- Sleep like a fly. Sleep is a homeostat, not a schedule: pressure builds while awake and drives the dorsal fan-shaped body sleep neurons, the clock neurons (DN1, LNd, aMe) add a circadian night term, and a fly whose dFB rate crosses threshold settles down — at home if it can, in the grass if it can't. Waking happens when the dFB quiets, or hunger wins.
- Steer upwind by feel. Wind on the antennae drives Johnston's-organ neurons; when an odor gets stronger the fly turns toward the side the wind is pushing on, read from that left/right JO contrast rather than from a wind vector.
Not included: phototaxis and gravitaxis — the 30k-neuron slice has no photoreceptors (looming is injected at the LC4/LPLC2 stage) and no gravity-sensing JO subgroup labelled well enough to use. No language model anywhere: the feed lines are templates filled from what the fly actually did.
What's real and what's not
Real: the wiring. Which neuron connects to which, how many synapses, and whether each connection is excitatory or inhibitory all come straight from the measured fly connectome. Nothing is hand-drawn. Every behaviour above is gated by the spike rate of the real neurons named, driven through the real synapses.
Not real / our choice: how a neuron's voltage is modelled (a simple leaky integrate-and-fire), how strong a synapse is per count, which smells drive which receptor neurons, the learning rule's constants, the internal drives (hunger, sleep pressure, courtship motivation, dust) that we inject as currents, and how motor-neuron spikes get turned into "move forward" or "turn". Real fly neurons are much richer than this. And it's a male connectome for all six flies — the females are males wearing a name tag.
One thing we had to change for learning to be odor-specific: left alone, this LIF network sits in a self-sustained "up-state" where the antennal lobe and Kenyon cells fire the same way whatever the smell (sweet vs. ferment Kenyon-cell codes correlated 0.99). We scaled recurrent excitation onto the projection neurons and Kenyon cells down (×0.3) and their feedforward ORN→PN→KC synapses up, which brings the Kenyon-cell code to 11% active and 0.58 correlated between odors — sparse and distinct enough for punishment paired with one smell to hit that smell about twice as hard as the other (scripts/learn_test.mjs).
One thing we tried that didn't work: we wanted "turn left/right" to come out of the descending neurons (the fly's brain→body command lines), the way it does in a real fly. In this simple model it doesn't — a smell on the left antenna excites both halves of the brain about equally by the time it reaches those neurons, so there was no left/right signal to read. So the turning direction is taken one stage earlier, from the left vs. right smell receptor neurons themselves; everything else (speed, eating, wing buzz, escape, grooming, song, sleep) comes from the named downstream neurons. We'd rather say that than pretend.
Bottom line: a connectome-shaped toy with a town around it, not a validated digital fly.
Credits
Keys: space pause · 1/2/3 speed · O odor · L labels · drag to pan · wheel to zoom · click a fly to follow · click the grass to swat.