AI 项目

FlyWire Fly Lab · 果蝇全脑实验室

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

FlyWire Fly Lab · 果蝇全脑实验室 项目封面或真实界面
HTML主要技术栈
25GitHub Stars
4Forks
631索引文件
GNU General Public License v3.0许可标记
2026-10-29最近更新

01 / PROJECT OVERVIEW

项目研究解读

这个项目把神经科学复现、具身仿真和浏览器游戏连成一条可交互路径:真实果蝇连接组、LIF 神经元、五感、蘑菇体学习、物理身体与开放世界。更难得的是仓库同时记录不能复现的部分、数据许可和 24,250 次虚拟实验,不把仿真结果包装成未经验证的科学结论。

brian2computational-neuroscienceconnectomedrosophilaflywireneural-simulationneuromechflyreproducibility

02 / CORE CAPABILITIES

值得关注的能力

  1. 01

    15,055 个真实连接组神经元在浏览器中运行

  2. 02

    视觉、听觉、嗅觉、味觉、触觉与环境感知

  3. 03

    连接 NeuroMechFly 物理身体和多种互动实验

  4. 04

    完整复现说明、实验日志与数据许可边界

03 / ENGINEERING

工程与仓库结构

仓库以 HTML 为主要实现语言,研究快照包含 631 个文件、35 个主要顶层入口。已提供 README 作为使用与能力说明。 项目最近更新时间为 2026-10-29,许可标记为 GNU General Public License v3.0。

01DATA_LICENSE.md

项目文件与实现资料

02LICENSE

项目文件与实现资料

03README.md

项目文件与实现资料

04README.zh-CN.md

项目文件与实现资料

05REPRODUCTION.en.md

项目文件与实现资料

06REPRODUCTION.md

项目文件与实现资料

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.html

06 / REPOSITORY MAP

目录证据导览

这里列出快照中的前 631 个索引文件中的代表路径,帮助你快速定位源码、文档、测试与资源。

  • .github/workflows/ci.yml
  • .gitignore
  • DATA_LICENSE.md
  • LICENSE
  • README.md
  • README.zh-CN.md
  • REPRODUCTION.en.md
  • REPRODUCTION.md
  • connectome_vision_loop.py
  • docs/.nojekyll
  • docs/article.html
  • docs/cover.jpg
  • docs/ecobox.html
  • docs/ecobox/AUDIT.md
  • docs/ecobox/PLAN.md
  • docs/ecobox/RESULTS.md
  • docs/game.html
  • docs/i18n.js
  • docs/icon-180.png
  • docs/index.html
  • docs/log/report.md
  • docs/og.jpg
  • dodge/audit.js
  • dodge/autoplay.js
  • dodge/backward_sweep.js
  • dodge/backward_v4.js
  • dodge/brain.js
  • dodge/brand_hero.b64
  • dodge/brand_icon.b64
  • dodge/browser_test.js
  • dodge/build.py
  • dodge/collect_life.py
  • dodge/collect_v3_results.py
  • dodge/collect_v4_results.py
  • dodge/collect_v6_results.py
  • dodge/companions.js
  • dodge/court.js
  • dodge/diagnose.js
  • dodge/export_gait.py
  • dodge/export_nt.py
  • dodge/export_poses.py
  • dodge/export_soma.py
  • dodge/eye.js
  • dodge/eyecam.js
  • dodge/eyecam_geom_test.js
  • dodge/field_contrast.js
  • dodge/fly_dodge.template.html
  • dodge/front_end_compare.js
  • dodge/game_core.js
  • dodge/gf_looming_check.py
  • dodge/landing_pose_check.py
  • dodge/legs.js
  • dodge/legs_test.js
  • dodge/life_test.js
  • dodge/looming_threshold.js
  • dodge/measure_neurons.js
  • dodge/measure_neurons_fullbrain.py
  • dodge/measure_perturb.js
  • dodge/mission_test.js
  • dodge/missions.js
  • dodge/mutant_test.js
  • dodge/nature.js
  • dodge/nature3d.js
  • dodge/nature_test.js
  • dodge/notebook_ids.json
  • dodge/odor_v4.js
  • dodge/parity_test.js
  • dodge/plasticity.js
  • dodge/probe_subcircuit.py
  • dodge/sense_modulation.js
  • dodge/sensor_drive.js
  • dodge/sensor_reach.py
  • dodge/sensor_reach_v4.py
  • dodge/smoke_test.js
  • dodge/sound_priming.js
  • dodge/step1_encoding.js
  • dodge/step3_flight.js
  • dodge/step_v3.js
  • dodge/subcircuit.py
  • dodge/subcircuit_v2.py
  • dodge/subcircuit_v3.py
  • dodge/subcircuit_v4.py
  • dodge/subcircuit_v5.py
  • dodge/subcircuit_vs_fullbrain_knockouts.py
  • dodge/takeoff_planning.js
  • dodge/takeoff_timing.js
  • dodge/touch_test.js
  • dodge/v2_refs_summary.py
  • dodge/v4_olfaction_runaway.py
  • dodge/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 size138,639 neurons, 15,091,983 weighted connections, dt = 0.1 ms
One second of brain time2.5 s wall-clock (Brian2, 1 s sugar stimulus)
Virtual knockout screen24,250 whole-brain segments, 14.68 machine-hours, three sensory pathways
Sub-circuits in the browserCourt 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 extension0.596 / 10
Water taste → proboscis extension0.879 / 10
Antennal mechanosensation → grooming0.911 / 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 search49.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 seedsdrops only 3.5 percentage points
External search, 6-ply vs teacher at 4 / 6 / 8 ply31–9 / 19–21 / 6–14
External search, 10-ply vs teacher at 8 ply13–7
Reasoning depth (which readout)Agrees with depth-8 searchvs randomvs old teachervs teacher (1-ply)vs teacher (2-ply)
146.6%40–065–70–6574–88–3835–65
244.7%40–049–118–3370–117–1327–72–1
346.3%40–064–98–3865–110–2534–64–2
448.1%40–064–100–3673–109–1831–69
547.5%40–085–81–3467–99–3431–68–1
648.5%40–065–94–4187–94–1930–69–1
849.5%40–072–88–4064–108–2833–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
HearingReaches 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
SmellNegative: reaches no motor readout; sugar contacts in 10 min, intact 7.667, anosmic 8.667
Interoceptive ISNNegative, 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 stateOnly modulates taste-receptor gain: starts eating on sugar contact 100% of the time when starved, 32% when sated — and an unprogrammed satiety emerges
WallsNegative: 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.

LayerWhat it isWho can change it
World rulesfood, water, temperature, wind and rain, beetles, terrainyou
Genes (10 numbers)learning rate, exploration, flight tendency, preferred temperature, metabolism, caution, four innate biasesevolution
Plastic layeradjustable weights beside the brain that bias its innate reflexesthis fly's lifetime; not inherited
Connectome15,055 neurons; escape, proboscis extension, steering and backing-up are built-in reflexesnobody
  • 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