← Hobby builds

Hobby build — 2026

A fly’s brain when it tastes sugar?

2026Personal projectBrain simulationPython · Numba · three.js

Scientists have mapped every neuron and connection in a fruit-fly brain, and a published computer model turns that map into a brain that can be switched on. I ran it: feed it sugar, watch the spikes, then silence two neurons and see what changes.

Neurons in the model
127,400
Connections
14.7 M
Sugar-taste neurons switched on
21
Motor neuron read out
MN9
MN9 after silencing 2 neurons
−62%

01 — The story

A brain you can switch on

In my talk The Whole Fly, Wired I reviewed three papers on the fruit-fly connectome. One of them, by Philip Shiu and colleagues (Nature, 2024), turns the wiring map of a whole fly brain into a computer model that can be switched on. This hobby project runs that published model on a laptop and asks it one question: what happens inside the brain when the fly tastes sugar?

The page follows the experiment in four steps. First the map, then the simple rule every neuron follows. Then the main test: switch on the 21 sugar-taste neurons the paper used and follow the spikes to MN9, a motor neuron that lifts the proboscis, the fly’s feeding tube. Then silence two neurons out of 127,400, run the exact same experiment again, and plug the brain into a simple walking fly to see what that difference could look like.

Nothing here was recorded from a living fly. Every spike is computed by the model and replayed from runs I made on 23 October 2026.

Where it started: my review of the three papers →

Credit where it’s due

I did not build the brain model or the wiring map. The model is the work of Philip Shiu, Gabriella Sterne, Nico Spiller and colleagues in Kristin Scott’s lab, shared openly under the MIT licence. The map is the FlyWire connectome. My part is running the model, checking it against the original, and showing what it does.

Meet the people behind the model ↓

How to read this page

Every figure and number carries one of three tags, so you always know where it comes from.

  • DATAMeasured: the wiring and where each neuron sits.
  • MODELSimulated activity, under the model’s assumptions.
  • APPMy display choices: animation, mappings, the walking fly.

Credits — the people behind the model

From the Scott Lab at UC Berkeley

This project only exists because Philip Shiu, Gabriella Sterne, Nico Spiller and their colleagues, in work led by Kristin Scott, built the model and shared their code openly for anyone to run. Thank you.

Scott Lab at UC Berkeley banner: a dashed fly flight path above five pictures, from fluorescent taste neurons and brain imaging to a close-up of a fly’s mouthparts and a fruit fly on a leaf
Portrait of Philip Shiu

Philip K. Shiu

First author of the paper; co-author of the model code

LinkedIn ↗
Portrait of Gabriella Sterne

Gabriella R. Sterne

Co-author of the paper

LinkedIn ↗
Portrait of Nico Spiller

Nico Spiller

Co-author of the paper; co-author of the model code

LinkedIn ↗

Paper: Shiu, P.K., Sterne, G.R., Spiller, N. et al. Nature 634, 210–219 (2024). Photos and lab banner shared for credit.

02 — The map DATA

Every neuron, in its place

The FlyWire project reconstructed the whole brain of one adult female fruit fly from electron-microscope images: every neuron, and every synapse between them. The release used here (v630) has 127,400 neurons joined by about 14.7 million connections, made of 52.8 million synapses.

Each dot below is one of those neurons, placed where it sits in the real brain (positions from Schlegel et al. 2024, matched by neuron ID; 127,320 of the 127,400 have one). More than half of them are in the two optic lobes, the wide wings on either side, which handle vision. Taste and feeding live in the lower middle, in the subesophageal zone.

Neurons
127,400
Connections
14.7 M
Synapses
52.8 M
Brain width
≈ 0.8 mm
Figure A — Turn it: the whole brain, neuron by neuron DATA

All 127,320 neurons with a known position

FlyWire v630 · DATA Loading 127,400 neurons…

Seen from the front, with the fly’s right on your left. Drag sideways, or focus the picture and use the arrow keys, to turn it.

Optic lobes · 73,618 Central brain · 32,415 Sensory · 9,145 Visual projection · 7,851 Ascending & descending · 3,618 Motor · 100

03 — Turning the map into a brain MODEL

Every neuron is a leaky bucket

Shiu and colleagues gave all 127,400 neurons the same simple rule, called leaky integrate-and-fire. Think of a bucket with a small hole. Incoming spikes pour charge in, the charge slowly leaks out, and if the level rises past a line the neuron fires a spike of its own and the bucket empties.

How hard one neuron pushes another depends only on how many synapses connect them, and on whether its chemical messenger excites or inhibits (GABA and glutamate count as inhibitory). Each synapse is worth 0.275 mV, the model’s one tuned number. There is no learning, no hormones and no spontaneous firing. That is the whole model.

The rule, as the model writes it

dv/dt = (v₀ − v + g) / τ_m
dg/dt = −g / τ_s
v > v_th  →  spike, v = v₀, g = 0
input spike  →  g += synapses × 0.275 mV
Resting level v₀−52 mV
Firing line v_th−45 mV
Leak time τ_m20 ms
Input decay τ_s5 ms
Rest after a spike2.2 ms
Travel delay1.8 ms
Time step0.1 ms
Figure B — Try it: one neuron MODEL

Pour spikes in and watch it fire

INPUT SPIKES FIRE LEAK SPIKE! INPUTS FIRING LINE −45 mV REST −52 mV 0 ms 400 ms (simulated)
Input spikes so far0
Output spikes so far0
Bucket level−52.0 mV

Same equations and parameters as the full model. Too few inputs and the leak wins, so it never fires. In the real network each neuron’s inputs come from the neurons wired to it in FlyWire.

400 ms of simulated time, played 20× slower. Input spikes arrive at random (a fixed seed, so the same settings always give the same picture).

04 — Sugar in, spikes out MODEL

Follow one second of sugar through the brain

This is the paper’s own test. The 21 sugar-taste neurons (gustatory receptor neurons) get random spikes at 100 per second each for one simulated second, a stand-in for the fly touching sugar, and every spike anywhere in the brain is recorded.

The readout is MN9. Its firing drives the proboscis drawing beside the brain; how far a real proboscis moves for a given MN9 rate is not known, so that mapping is my choice and tagged APP. Switch to the second run to see the same input with two neurons silenced.

In the picture

A neuron firing a simulated spike

The 21 sugar-taste neurons (input)

MN9, the two motor neurons (output)

The two Roundup neurons, when silenced

Figure C — Watch it: inside the head MODEL

Run 1: sugar neurons on

SIMULATION REPLAY · not recorded data Loading the replay…
Simulated time0 msshown 20× slower
MN9 now0 spikes/s
Spikes in the last 10 ms0all neurons, this trial
Proboscis APP0% 0% below 5 spikes/s, 100% at 100

Each flash is one simulated spike. Activity starts at the sugar-taste neurons in the lower brain.

MN9 SPIKES PER SECOND (10-TRIAL AVERAGE, SMOOTHED) 0 25 50 75 100 PROBOSCIS FULLY OUT (APP) 0 ms1000 ms
Sugar only · 65.5 spikes/s averageRoundup silenced · 24.7 spikes/s

The flashes show every spike of trial 1 (10,097 with sugar only; 7,647 with Roundup silenced). The MN9 line is the average of all 10 trials. Brain positions: FlyWire v630 (DATA); spikes: the model (MODEL); colours, glow and the proboscis: this page (APP).

05 — Silence two neurons MODEL

Two neurons out of 127,400

The model can switch any neuron off. Silencing, exactly as in the original code, removes everything a neuron sends: it can still fire, but nothing downstream hears it. I silenced Roundup, a cell type the paper places just before the motor neurons in the sugar-to-feeding pathway (two neurons, one per side), and repeated the same 10 trials.

The comparison is paired. Trial 3 of the silenced run received exactly the same random sugar input as trial 3 of the normal run, so each pair of bars differs only by the silencing.

Result, within this model

MN9: 65.5 → 24.7 spikes/s

A drop of 62%, lower in all 10 of 10 paired trials. The other MN9 fell harder, from 49.8 to 5.4 (−89%).

Does it match the paper?

Yes in direction. The paper calls Roundup “the pre-MN with the strongest predicted silencing phenotype”. This is a result inside the model, not a tested prediction about a living fly.

Figure D — Ten paired trials MODEL

MN9 firing in every trial, before and after silencing Roundup

MN9 SPIKES PER SECOND, EACH TRIAL020406080672417129264223673047229563226611776231863199652410TRIAL (SAME RANDOM INPUT IN EACH PAIR)
Sugar onlySame input, Roundup silencedSpikes counted over the whole simulated second of each trial.

06 — From brain to behaviour HYBRID DEMO

Give the brain a body (a pretend one)

The brain model only produces spikes. To see what they could mean for a fly, I connected it to a simple, hand-written walking controller in a small arena with two sugar patches. The fly wanders at random. When it stands on sugar, the 21 sugar neurons switch on. If MN9 then fires fast enough, the controller stops the fly to feed.

The walking and turning are mine, not the model’s: the wiring map has no nerve cord, so the brain cannot move legs. Only the decision to stop and feed comes from the simulated brain. Nothing learns, and a fly that finds sugar found it by chance.

  1. ArenaSugar under the fly? (0–1)APP
  2. Sensory inputThe 21 published sugar neurons, up to 100 spikes/sDATA
  3. Brain modelAll 127,400 neurons, 0.1 ms stepsMODEL
  4. MN9 decoderSmoothed rate → feed signalAPP
  5. Walking controllerRandom walk, stops to feedAPP
  6. Back to the arena, every 50 ms
Figure E — Watch it: two flies, same luck HYBRID DEMO

Both flies wander

Intact brainwalking
SUGAR 1.0SUGAR 0.5START

MN9 0 spikes/s · fed 0.0 s

Roundup silencedwalking
SUGAR 1.0SUGAR 0.5START

MN9 0 spikes/s · fed 0.0 s

MN9 SPIKES PER SECOND (SMOOTHED), BOTH ARENA RUNS0255075100FEEDING GATE ≈ 29 (APP)0 s15 s

Same seed, same random walk: until they reach sugar, both flies take exactly the same path. Off the sugar, the sugar neurons are silent and MN9 stays at 0.

Intact brainRoundup silenced15 simulated seconds, shown at simulated speed. Computing each run took 2.2–3.1 s per simulated second on a laptop, so it is played back afterwards. The fly is drawn larger than scale.
Time feeding, intact
10.7 s
Time feeding, Roundup silenced
0.9 s
Distance walked
50 vs 166 mm

07 — Under the hood

How the project works

Python for the brain, TypeScript for the pictures

The project, which I call FlyBrain Arcade, is a small pipeline. It fetches the original model and its data, runs the whole brain fast enough to experiment with, measures the results honestly, and turns them into the pictures on this page. Pick a stage to see what it does and which files do it.

Stage 01 DATA

Fetch the original, untouched

Downloads the published model at a pinned version (commit 91bdd1e) together with its FlyWire v630 files, about 200 MB, and checks each file’s SHA-256 fingerprint. The model’s parameters are read straight from the original code rather than typed in again, and a test checks them.

scripts/fetch_upstream.pyflybrain/upstream.py

Checked spike for spike against the original

Test runOriginalMineDifferent
200 ms, 100 Hz1,8741,8740
1 s, 100 Hz9,2429,2420
1 s, 200 Hz, Roundup silenced13,68913,6890
500 ms, 50 Hz, one Rattle silenced1,5971,5970

Total spikes across all 127,400 neurons. My first version was not identical: the original quietly ignores input that arrives while a neuron is resting after a spike. Copying that rule made them match exactly.

How fast, on a laptop

JobTimeMemory
1 trial × 1 s, Numba2.3 s0.5 GB
10 trials × 1 s, Numba4.5 s0.5 GB
30 trials × 1 s, Numba9.1 s0.6 GB
1 trial × 1 s, original Brian220.8 s3.1 GB

Intel Core Ultra 7 laptop, 8 cores. For comparison, the paper reports about 5 minutes per one-second trial per CPU thread on its 2023 setup. Not real time: results are computed first, then replayed.

08 — Honest limits

What this does and doesn’t show

  • Everything moving here is computed by a model. None of it is a recording from a living fly.
  • The model leaves a lot out: hormones and other neuromodulators, electrical synapses, neuron shapes, the body and learning. Its neurons never fire on their own.
  • Absolute firing rates are uncertain. The paper tested the model mainly on whether switching neurons on or off changes the output in the right direction.
  • How strongly MN9 moves the proboscis is not known. The extension shown is my display choice: 0% below 5 spikes per second, 100% at 100.
  • The 3D fly in the top frame is a stylised house fly made with an AI 3D tool, not an anatomical model. The brain inside it is a fruit-fly brain.
  • In the arena, walking is a hand-written random walk. The brain map has no nerve cord, so the model cannot move legs.
  • Nothing here learns. The arena fly does not know where the food is; it only stops when the model’s feeding output is high.

Sources and credits

  • Model: Shiu, P.K., Sterne, G.R., Spiller, N. et al. A Drosophila computational brain model reveals sensorimotor processing. Nature 634, 210–219 (2024). doi.org/10.1038/s41586-024-07763-9. Code: philshiu/Drosophila_brain_model (MIT), commit 91bdd1e.
  • Connectome: FlyWire public release v630 (Dorkenwald et al. 2024; Schlegel et al. 2024, Nature 634).
  • Lab: the Scott Lab at UC Berkeley, where the work was led by Kristin Scott (see the credits above).
  • Neuron positions: flyconnectome/flywire_annotations v1.1.0 (Schlegel et al. 2024).
  • Simulation: my Numba re-implementation of the published model, checked spike for spike against the original Brian2 code. Runs computed on 23 October 2026.
  • 3D fly in the top frame: a house-fly model generated with Tripo AI, simplified for the web.
My review of the papers →

Discussion

Comments

No comments yet

Register with your email to join the discussion

Your email is never shown publicly.

No comments yet. Be the first to share your thoughts.