FlyWire Fly Lab · 果蝇全脑实验室
在 16GB 笔记本上运行果蝇全脑连接组,并把 15,055 个神经元接进浏览器世界。

01 / PROJECT OVERVIEW
项目研究解读
这个项目把神经科学复现、具身仿真和浏览器游戏连成一条可交互路径:真实果蝇连接组、LIF 神经元、五感、蘑菇体学习、物理身体与开放世界。更难得的是仓库同时记录不能复现的部分、数据许可和 24,250 次虚拟实验,不把仿真结果包装成未经验证的科学结论。
02 / CORE CAPABILITIES
值得关注的能力
- 01
15,055 个真实连接组神经元在浏览器中运行
- 02
视觉、听觉、嗅觉、味觉、触觉与环境感知
- 03
连接 NeuroMechFly 物理身体和多种互动实验
- 04
完整复现说明、实验日志与数据许可边界
03 / ENGINEERING
工程与仓库结构
仓库以 HTML 为主要实现语言,研究快照包含 631 个文件、35 个主要顶层入口。已提供 README 作为使用与能力说明。 项目最近更新时间为 2026-10-29,许可标记为 GNU General Public License v3.0。
项目文件与实现资料
项目文件与实现资料
项目文件与实现资料
项目文件与实现资料
项目文件与实现资料
项目文件与实现资料
04 / USE CASES
适合用在哪里
- 计算神经科学科普
- 具身智能与世界模型实验
- 浏览器交互式科学展示
05 / QUICK START
从仓库开始
以下命令摘自项目 README 或根据仓库地址生成。请先阅读源仓库的安装要求、许可和脚本,再在自己的环境中运行。
# 1. Environments (several conda envs that cannot be merged; see setup.sh)
bash setup.sh cpu # brain-fly-cpu: Brian2 + numpy 1.26
bash setup.sh flygym # flygym: FlyGym 2.1 + torch
# 2. Upstream code (not redistributed here; see DATA_LICENSE.md §4)
git clone https://github.com/eonsystemspbc/fly-brain external/fly-brain
# 3. Smallest experiment: stimulate sugar taste neurons, watch the proboscis motor neuron MN9
conda activate brain-fly-cpu
python run_experiment.py --preset sugar --t_run 1
# → 398 active neurons; MN9 left 98 Hz / right 69 Hz (official notebook's left/right naming); all other descending neurons 0
# 4. Open the game locally
python3 dodge/build.py && open results/dodge/fly_dodge.html
python3 eco/build.py && open docs/ecobox.html06 / REPOSITORY MAP
目录证据导览
这里列出快照中的前 631 个索引文件中的代表路径,帮助你快速定位源码、文档、测试与资源。
.github/workflows/ci.yml.gitignoreDATA_LICENSE.mdLICENSEREADME.mdREADME.zh-CN.mdREPRODUCTION.en.mdREPRODUCTION.mdconnectome_vision_loop.pydocs/.nojekylldocs/article.htmldocs/cover.jpgdocs/ecobox.htmldocs/ecobox/AUDIT.mddocs/ecobox/PLAN.mddocs/ecobox/RESULTS.mddocs/game.htmldocs/i18n.jsdocs/icon-180.pngdocs/index.htmldocs/log/report.mddocs/og.jpgdodge/audit.jsdodge/autoplay.jsdodge/backward_sweep.jsdodge/backward_v4.jsdodge/brain.jsdodge/brand_hero.b64dodge/brand_icon.b64dodge/browser_test.jsdodge/build.pydodge/collect_life.pydodge/collect_v3_results.pydodge/collect_v4_results.pydodge/collect_v6_results.pydodge/companions.jsdodge/court.jsdodge/diagnose.jsdodge/export_gait.pydodge/export_nt.pydodge/export_poses.pydodge/export_soma.pydodge/eye.jsdodge/eyecam.jsdodge/eyecam_geom_test.jsdodge/field_contrast.jsdodge/fly_dodge.template.htmldodge/front_end_compare.jsdodge/game_core.jsdodge/gf_looming_check.pydodge/landing_pose_check.pydodge/legs.jsdodge/legs_test.jsdodge/life_test.jsdodge/looming_threshold.jsdodge/measure_neurons.jsdodge/measure_neurons_fullbrain.pydodge/measure_perturb.jsdodge/mission_test.jsdodge/missions.jsdodge/mutant_test.jsdodge/nature.jsdodge/nature3d.jsdodge/nature_test.jsdodge/notebook_ids.jsondodge/odor_v4.jsdodge/parity_test.jsdodge/plasticity.jsdodge/probe_subcircuit.pydodge/sense_modulation.jsdodge/sensor_drive.jsdodge/sensor_reach.pydodge/sensor_reach_v4.pydodge/smoke_test.jsdodge/sound_priming.jsdodge/step1_encoding.jsdodge/step3_flight.jsdodge/step_v3.jsdodge/subcircuit.pydodge/subcircuit_v2.pydodge/subcircuit_v3.pydodge/subcircuit_v4.pydodge/subcircuit_v5.pydodge/subcircuit_vs_fullbrain_knockouts.pydodge/takeoff_planning.jsdodge/takeoff_timing.jsdodge/touch_test.jsdodge/v2_refs_summary.pydodge/v4_olfaction_runaway.pydodge/v4_olfaction_silencing.py
07 / SOURCE NOTES
README 原文摘录
保留原始说明便于复核。中文研究结论以当前快照为依据,后续变化请以 GitHub 仓库为准。
flywire-fly-lab
English · 中文
**Start with [REPRODUCTION.en.md](REPRODUCTION.en.md)** (中文): every claim of each paper we checked, what we got, and what we could not do.
The full lab notebook is [docs/log/report.md](docs/log/report.md) (Chinese).
**Running the whole Drosophila brain connectome on a 16 GB laptop, wiring it to a body, shipping it as a browser game — and doing 24,250 virtual surgeries on it.** It documents what works, what does not, and every mistake the author caught in their own work.
▶ Play online (15,055 real neurons firing in your browser, living in a 3D landscape) · ▶ Ecobox · Full report · Data license ⚠
The web pages follow your browser language (English or Chinese; there is a switch in the corner). The code comments and the lab notebook are in Chinese. This README is generated by scripts/render_readme.py from the same result files as the Chinese README, so the numbers match. Issues in English are welcome.🎬 Videos
| ▶ Open-world nature A 3D world with gravity and weather and no edges, inhabited by the 15,055-neuron fly | ▶ All five senses Vision, hearing, smell, taste, touch, temperature, humidity; mushroom-body learning, dopamine, six legs | ▶ Gomoku against a fly brain Line patterns → fly brain → one linear readout; its thinking drawn on the board | ▶ Brain + physics body The same brain drives NeuroMechFly (MuJoCo): stops to eat at fruit, turns away from a warm "odor B" source by itself |
What this is
In 2024 FlyWire published the complete connectome of the adult fruit-fly brain; Shiu, Sterne et al. built a whole-brain leaky integrate-and-fire (LIF) model on top of it; Eon Systems open-sourced that model.
This repository is a complete reproduction plus extensions, all done on one 16 GB M1 Pro MacBook:
| Model size | 138,639 neurons, 15,091,983 weighted connections, dt = 0.1 ms |
| One second of brain time | 2.5 s wall-clock (Brian2, 1 s sugar stimulus) |
| Virtual knockout screen | 24,250 whole-brain segments, 14.68 machine-hours, three sensory pathways |
| Sub-circuits in the browser | Court version 5,563 neurons / 432,437 connections; life & nature 15,055 / 814,649 (incl. mushroom body) |
Key findings
1. "Is the model accurate?" is the wrong question — its reliability is local. Same parameters, same decision threshold, three pathways; agreement with the paper (Cohen's κ, chance-corrected, all three normalized to the null median) differs a lot:
| Pathway | κ | vs real optogenetic experiments |
|---|---|---|
| Sugar taste → proboscis extension | 0.59 | 6 / 10 |
| Water taste → proboscis extension | 0.87 | 9 / 10 |
| Antennal mechanosensation → grooming | 0.91 | 1 / 1 (testable) |
2. Redundancy cannot be predicted from the wiring diagram. The pre-registered hypothesis was "backup = disjoint paths to the output". Measured correlation: -0.008 (sugar) / +0.013 (water) — not weak, zero, with metric degeneracy ruled out. To know whether two neurons back each other up, you have to knock both out and run it.
3. One behaviour, two circuits. Sugar and water both trigger proboscis extension through the same motor neuron MN9, but their active neurons overlap by only a third and their hubs are private: CB0883 never fires in the water pathway, and knocking out CB0051 does nothing in the sugar pathway. Knocking out the inhibitory neuron Phantom multiplies water-pathway output by 3.0 (whole brain, null-median normalized).
4. Our own pre-registered "concentration → predictability" hypothesis was refuted by our data. The JON pathway is the most concentrated (Gini 0.922) yet the least predictable from wiring alone (G3 0.288 open four > four, open three > …) is entirely correct, and its first choice agrees with a depth-8 search 49.5% of the time (random 1.5%, no brain 34.8%). Given to a rules-only search, it beats the hand-written teacher 31–9 (6-ply vs 4-ply) and 13–7 (10-ply vs 8-ply). But a shuffled connectome (48.8%) and a random network of the same size (51.1%) do no worse; head to head 23–16–1 — the real connectome contributes nothing special to Gomoku; the look-ahead is done by the search, not the fly. See docs/log/report.md §46.
Gomoku: playing against a fly brain
The game page (Digital Fly Lab) has a Gomoku tab: a 15×15 board, and the live spike / descending-neuron / sensory panels show the fly that is playing.
- Three match types: you vs the fly (you play black, with renju forbidden moves), fly vs fly (each side has its own 5,563-neuron brain), fly vs teacher.
- Reasoning depth (1–6, 8) can be switched at any time. Each depth is a trained readout whose labels were "the best move found by an N-ply search"; no search runs while playing, only model inference.
- Its thinking is drawn on the board: orange circles = the model's probability for each candidate; numbered ghost stones = the continuation it expects.
- Real-brain check: each move's line patterns are re-run through the real fly brain and compared with the trained value table.
- External search (off by default): hands the fly's value table to an alpha-beta search. That is an algorithm, not the fly, and the page says so.
How it plays: for a candidate point, take one line in each of 4 directions (4 cells on each side; each cell empty / mine / theirs / edge). There are only 14,641 such patterns, few enough to run every one through the brain: 8 cells × 3 states = 24 channels, each wired to about 61 real sensory neurons, Poisson-driven for 300 ms; downstream spikes are counted (4 input assignments × 3 random seeds, averaged). A move's score = 4 attacking lines + λ × 4 defending lines.
| First choice agrees with depth-8 search | 49.5% (random 1.5%, no brain 34.8%) |
| External test set (25,146 positions from the Wine engine, never trained on) | 47.0% |
| Unseen Poisson seeds | drops only 3.5 percentage points |
| External search, 6-ply vs teacher at 4 / 6 / 8 ply | 31–9 / 19–21 / 6–14 |
| External search, 10-ply vs teacher at 8 ply | 13–7 |
| Reasoning depth (which readout) | Agrees with depth-8 search | vs random | vs old teacher | vs teacher (1-ply) | vs teacher (2-ply) |
|---|---|---|---|---|---|
| 1 | 46.6% | 40–0 | 65–70–65 | 74–88–38 | 35–65 |
| 2 | 44.7% | 40–0 | 49–118–33 | 70–117–13 | 27–72–1 |
| 3 | 46.3% | 40–0 | 64–98–38 | 65–110–25 | 34–64–2 |
| 4 | 48.1% | 40–0 | 64–100–36 | 73–109–18 | 31–69 |
| 5 | 47.5% | 40–0 | 85–81–34 | 67–99–34 | 31–68–1 |
| 6 | 48.5% | 40–0 | 65–94–41 | 87–94–19 | 30–69–1 |
| 8 | 49.5% | 40–0 | 72–88–40 | 64–108–28 | 33–67 |
Pre-registered criterion "model trained on depth-8 labels beats model trained on depth-1 labels, ≥ 55% over 200 games" → does not hold (36.0%).
Equally important: (1) the real connectome contributes nothing special (shuffled 48.8%, random network 51.1%); (2) self-play reinforcement ("dopamine"-style three-factor rule) is a negative result: 6–194 against the pre-reinforcement table, and the reward-prediction error is computed outside the connectome; (3) every number of Gomoku v1 is void: stimuli were not cleared between inputs (pattern A alone = 252 spikes, A after B = 1,901). Details: §46.
Life mode: the five senses go to real receptors; the connectome does the rest
A single fly (sub-circuit v4: 6,296 neurons, adding hearing, two olfactory glomeruli and 4 interoceptive neurons) lives in an open world where day and night, fruit, puddles, odours, buzzing, heat, wind, dust and incoming balls just happen. Each one reaches the fly only as a physical quantity at its real receptors — there is no "smell it, go there" or "hear it, run" rule.
| Measured | |
|---|---|
| Hearing | Reaches the giant fibre in one hop. Sound alone never triggers takeoff, but it advances the looming response: takeoff lead 435 → 825 ms, dodges 24 → 38 / 100; deafened, back to 425 ms |
| Smell | Negative: reaches no motor readout; sugar contacts in 10 min, intact 7.667, anosmic 8.667 |
| Interoceptive ISN | Negative, and opposite to the literature: driving it lowers MN9 while eating sugar from 44.1 to 2.5 Hz (it promotes feeding in real flies). It signals via a neuropeptide the LIF model lacks; off by default, sign not flipped to fit |
| Body state | Only modulates taste-receptor gain: starts eating on sugar contact 100% of the time when starved, 32% when sated — and an unprogrammed satiety emerges |
| Walls | Negative: touch alone cannot avoid walls — 270 mm travelled in 3 min in a rectangle (stuck in a corner), 93% of the time on the wall of a round arena; hence this world has no walls |
Details: §47.
Ecobox: you design the world; it learns and evolves by itself
Open the Ecobox → (docs/ecobox.html, a single offline-capable file)
An unattended round terrarium: food that rots, puddles that dry up, day and night, wind, rain, beetles. You give the fly no task and cannot change its reward — the reward is only that its body's six internal states (hunger, thirst, stamina, health, scent, body temperature) got closer to comfortable. All you can change is the world.
| Layer | What it is | Who can change it |
|---|---|---|
| World rules | food, water, temperature, wind and rain, beetles, terrain | you |
| Genes (10 numbers) | learning rate, exploration, flight tendency, preferred temperature, metabolism, caution, four innate biases | evolution |
| Plastic layer | adjustable weights beside the brain that bias its innate reflexes | this fly's lifetime; not inherited |
| Connectome | 15,055 neurons; escape, proboscis extension, steering and backing-up are built-in reflexes | nobody |
- Single-fly learning: after 30 consecutive lives, learning is frozen and the fly is tested in unseen worlds — no learning 425 s, learned ≥ 1800 s (× 4.231, censored); a time-shuffled-reward control does not improve; 9 of 10 other individuals learn; a long-term training task with 10 fresh individuals: 10/10 learn, 10/10 on a re-test in new worlds (
node eco/train_long.js, 210 lives).
What it learns: "stop and drink when you touch water" (in the connectome, water taste drives the proboscis motor neuron MN9 to only 13 Hz in the real brain — not enough innately) and "turn less while humidity is rising". It does not learn to find water from a distance: 422 s vs 417 s in a drought world.
- Evolution with 32 flies: no fitness function — only well-fed, well-watered flies accumulate eggs. Beetle swarm: lifespan 408 → 926 s, flight tendency falls; Calm: lifespan 451 → 930 s, flight tendency flat; Sparse: lifespan 406 → 481 s, flight tendency flat. Pre-registered criterion (different worlds push flight tendency in different directions) passes. Flight is a decision, not a controlled skill: whether to take off is up to the fly, the flight itself is a fixed trajectory — flight control is not wired into the connectome, and we do not pretend it can learn to fly.
- Discovery cards: lying flat, hugging the glass, spinning in place, camping on food… reward hacking and failures are dete

