Grey Leno has a fly brain β€” 138,639 neurons, 15.1M connections # πŸͺ° Grey Leno Fly Brain **A whole fruit-fly brain runs a late-night talk show in your browser.** 138,639 real *Drosophila* neurons, wired exactly as the FlyWire connectome maps them,
fire spike by spike and puppeteer **Grey Leno** on the TUURD Talk stage. [![Watch the show](https://img.shields.io/badge/β–Ά_WATCH_THE_SHOW-flyleno.viosarcade.xyz-d2332a?style=for-the-badge)](https://flyleno.viosarcade.xyz/) [![Poke a fly brain](https://img.shields.io/badge/🧠_POKE_A_FLY_BRAIN-live_demo-6ff3e2?style=for-the-badge&labelColor=110608)](https://spikecalls.github.io/grey-leno-fly-brain/) ![neurons](https://img.shields.io/badge/neurons-138%2C639-ffc94a?labelColor=110608) ![connections](https://img.shields.io/badge/connections-15%2C091%2C983-ffc94a?labelColor=110608) ![synapses](https://img.shields.io/badge/synapses-54%2C492%2C922-ffc94a?labelColor=110608) ![connectome](https://img.shields.io/badge/connectome-FlyWire_v783-6ff3e2?labelColor=110608) ![model](https://img.shields.io/badge/model-LIF_Β·_Shiu_et_al._2024-6ff3e2?labelColor=110608) ![three.js](https://img.shields.io/badge/three.js-0.170-f4e8dc?labelColor=110608) ![license](https://img.shields.io/badge/code-MIT-f4e8dc?labelColor=110608)
--- ## What is this? **FlyLeno** is a browser toy with a real neuroscience engine inside. - The **brain** is a whole-brain spiking model of the adult fruit fly: every one of its 138,639 neurons and 15.1 million connections from the [FlyWire](https://flywire.ai/) connectome, simulated as leaky integrate-and-fire cells in a Web Worker, in plain JavaScript. - The **body** is Grey Leno, a physics ragdoll on a TUURD-Talk-style stage built in three.js. - The **show** is you. Throw tomatoes, pipes, roses and sugar. Book a goose. Start a tomato storm. Every event stimulates the fly's real sensory neurons, and Leno does whatever its descending neurons tell him to. Nothing at the motor level is scripted. When Leno walks, it is because `P9` neurons fired. When he backs away from a heckler, that is `MDN`, the moonwalker neuron. When he flinches, the giant fiber (`DNp01`) crossed threshold. ## πŸ“Ί Live from the show
Fly-Leno flying over the stage while tomatoes splat; the brain panel shows fear at 95%
Tomato storm. Fly-Leno takes off. Fear 95 %, arousal 74 %.
Wide shot of the TUURD Talk theatre with the audience, Fly-Leno eating on stage
The house. Snack time on stage: dopamine +0.95, mood +0.71.
The stage seen through a hexagonal compound-eye filter
Fly eyes. What the R1-6 photoreceptors see, ommatidium by ommatidium.
Sidebar with voice output, motor output meters and a spike raster
Inside the head. Voice, motor output and the live spike raster.
## 🧠 From tomato to twitch ```mermaid flowchart LR A["πŸ… Stage event
tomato Β· applause Β· goose Β· music"] --> B["πŸ‘… Sensory neurons
Poisson spikes on identified
taste · smell · JO hearing · R1-6 vision"] B --> C["🧠 Connectome
138,639 LIF neurons
15.1M signed connections
1.8 ms synaptic delay"] C --> D["⚑ Descending neurons
P9 Β· MDN Β· DNa01/02
giant fiber Β· aDN1 Β· MN9"] D --> E["πŸ•Ί Grey Leno
ragdoll Β· walk Β· turn Β· flinch
voice Β· retch Β· fart"] C --> F["πŸ’Š Dopamine
PAM βˆ’ PPL1"] G["πŸ‘ Crowd reaction"] --> F F -. "gates plasticity on
vocal motor synapses" .-> C style A fill:#d2332a,color:#fff,stroke:#7c1a17 style C fill:#110608,color:#ffc94a,stroke:#ffc94a style E fill:#1d0b0e,color:#6ff3e2,stroke:#6ff3e2 style F fill:#1d0b0e,color:#f4e8dc,stroke:#b59c95 ``` This is what that looks like inside a network. A real raster from the toy brain in [`src/lif.js`](src/lif.js): silence, then a tomato lands at 150 ms and the activity cascades from the senses to the motor neurons.
Spike raster of a toy fly brain hit by a rotten tomato
## ⚑ The wiring the show touches Counts are the identified FlyWire neurons each input drives and each output reads, taken from the running build.
| Stage input | Cell types | Cells | |---|---|--:| | πŸ‘ Applause | JO-C/E/F antennal | 209 | | πŸ… Rotten tomato | LB1 bitter GRNs | 42 | | 🀒 Smells bad | Or56a (geosmin) ORNs | 39 | | 🧊 Sugar / snack | LB2d, LB3 sugar GRNs | 129 | | πŸ“£ Heckler looms | LC4 looming detectors | 104 | | 🎡 Music, low | JO-B, 30–300 Hz | 259 | | 🎡 Music, high | JO-A, 0.3–4 kHz | 99 | | 🍌 Fruit smell L / R | DM1–4, VA2 ORNs | 150 / 140 | | πŸ‘οΈ What Leno sees | R1-6 per eye | 400 / 400 | | Behaviour | Cell types | Cells | |---|---|--:| | Walk forward | P9 (DNp09, DNg97) | 4 | | Back up | MDN | 4 | | Turn L / R | DNa01, DNa02 | 2 / 2 | | Startle | Giant fiber DNp01 | 2 | | Groom | aDN1 (DNg62) | 2 | | Feed / talk | MN9 | 2 | | Voice | DNg02 + DNp13 | 27 | | Gag / retch | Pharyngeal MNs | 38 | | Fart | oviDN | 6 | | Reward / punish | PAM / PPL1 | 307 / 16 |
## πŸ”¬ The model, in two lines Every neuron, every 0.1 ms: ```text dv/dt = (vβ‚€ βˆ’ v + g) / Ο„m vβ‚€ = βˆ’52 mV, Ο„m = 20 ms dg/dt = βˆ’g / Ο„s Ο„s = 5 ms v > βˆ’45 mV β†’ spike, v ← βˆ’52 mV, g ← 0, refractory 2.2 ms every target: g += (signed synapse count) Γ— 0.275 mV, 1.8 ms later ``` These are the equations and parameters of [Shiu et al. 2024, *Nature*](https://www.nature.com/articles/s41586-024-07763-9). Run on the full FlyWire wiring, that model predicted which neurons drive feeding and grooming, and the predictions held up in real flies. FlyLeno adds three things on top, all optional and labelled in the UI: 1. **Lazy exact integration.** Between inputs a neuron's voltage has a closed form, so a cell is only stepped while it could still reach threshold. That is how 15 million connections run in a browser tab. 2. **Dopamine-gated learning.** The fly's own PAM (reward) and PPL1 (punishment) neurons are driven by the crowd. Their difference, `tanh((PAM βˆ’ PPL1) / 20 Hz)`, gates a three-factor plasticity rule on every synapse onto Leno's vocal motor neurons. Jokes that get applause get repeated. 3. **Spike-frequency adaptation** and **brain worms**. Toggle them in Brain settings. The worms only eat the cells Leno doesn't need. Deep dive: [`docs/NEUROSCIENCE.md`](docs/NEUROSCIENCE.md). ## 🎬 Tonight's rundown **Segments:** Opening Β· Monologue Β· Phone-in Β· Take it away, Johnny! Β· A word from our sponsor Β· Technical difficulties Β· Space scabies telethon Β· The rotten Γ©clair Β· Guest: Mr. Frog Β· Guest: The Jonkler Β· Guest: Kybo Rin Β· Guest: a goose Β· Sunday drive Β· Grey Leno dance party Β· Vote Leno Β· 500 years young Β· Do The Leno Β· Spin the Wheel of Leno Β· Lullaby Β· Sign-off **Events:** Goose Β· Spider-Leno Β· Swatter glove Β· Electric racket Β· Duendes Β· Clown car Β· The Rapture Β· Rain cloud Β· Mushroom Β· Falling rig Β· Tomato / pipe / rose storms Β· Standing ovation Β· Sugar shower Β· Heckler Β· Stagehand snack Β· We'll Be Right Back How to run a show: [`docs/GUIDE.md`](docs/GUIDE.md). ## πŸš€ Run the brain yourself This repo ships a small, readable LIF engine with the same neuron model, plus the landing page. ```bash git clone https://github.com/SpikeCalls/grey-leno-fly-brain cd grey-leno-fly-brain npm test # 8 tests: rest, Poisson rate, delay, inhibition, refractory cap, motor decode, dopamine, cascade npm run demo # a fly brain in your terminal npm run serve # the landing page with the live WebGL brain ``` `npm run demo` prints something like this: ```text sensory β”‚ @#@%%###%%%##%*@%#%#%%%%#%%#@%*@@%#@%%%%%%%#@%%#@%#%%%@%@@#%β”‚ central β”‚ .=+#%+########*%@###%#####%#%%##@%%###*#%%+%#*#*@%#*#*@@@@#β”‚ descending β”‚ +***+*+*++#++#*******+%*+%#=%=%*#++#*+@=#=#+**@+*=#=@*%*β”‚ motor β”‚ -=*-#=:**===#@-=*==#*%-#-##***=*@-*-#%#=-=##=%#=**-%@%β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 400 ms ``` Use the engine in your own code: ```js import { LIFNetwork, buildCSR, decodeMotor, dopamine } from './src/lif.js'; // neuron 0 excites neuron 1 through 40 synapses const net = new LIFNetwork(buildCSR(2, [[0, 1, 40]])); net.stimulate([0], 100); // Poisson drive, 100 Hz net.run(1000, (i, t) => console.log(`neuron ${i} spiked at ${t.toFixed(1)} ms`)); console.log(net.rate([1]), 'Hz'); ``` ## πŸ—‚οΈ Repository ```text grey-leno-fly-brain/ β”œβ”€β”€ src/lif.js LIF engine Β· CSR graph Β· motor decoder Β· dopamine Β· toy fly brain β”œβ”€β”€ test/lif.test.mjs node:test suite β”œβ”€β”€ examples/toy-brain.mjs terminal demo with ASCII raster and motor bars β”œβ”€β”€ site/ GitHub Pages landing: WebGL brain + live lab (no build step) β”œβ”€β”€ scripts/make-art.mjs regenerates banner.svg and raster.svg from real simulations β”œβ”€β”€ assets/ banner, raster, stills └── docs/ β”œβ”€β”€ ARCHITECTURE.md how FlyLeno is put together, module by module β”œβ”€β”€ NEUROSCIENCE.md the model, the connectome, learning, what is and isn't biology β”œβ”€β”€ GUIDE.md how to run a show └── SITE-ANALYSIS.md A-to-Z audit of flyleno.viosarcade.xyz with fixes ``` ## πŸ™ Credits - **Brain model:** Shiu et al. 2024, *Nature*, [philshiu/Drosophila_brain_model](https://github.com/philshiu/Drosophila_brain_model) (MIT). - **Connectome:** FlyWire v783. Dorkenwald et al. 2024 and Schlegel et al. 2024, *Nature*. - **Stimulus and motor neuron IDs:** partly via [erojasoficial-byte/fly-brain](https://github.com/erojasoficial-byte/fly-brain) (MIT). - **Grey Leno:** character and original model by **Vinesauce**. Model port by **huckleberrypie**: [Grey Leno for Dead as Disco](https://www.nexusmods.com/deadasdisco/mods/917). - **Stage:** an original procedural set inspired by the TUURD Talk show of *Nightmare Puppeteer*. Full list, including every sound: [`CREDITS.md`](CREDITS.md). This is a fan project and is not affiliated with Vinesauce, FlyWire, the authors above, or anyone named Leno.

β–Ά flyleno.viosarcade.xyz
If a fruit fly made you laugh, leave a ⭐