↓ Skip to main content
  1. Projects/

Fly Brain Robot: A Real Fly Connectome Driving Robots From a Camera

Pranav
Author
Pranav
Coding with Physics, Physics-ing with code
Research in progress, all in simulation (Isaac Lab and MuJoCo). Most results below are one training seed unless a table says otherwise. Code isn’t public yet. This page grew out of the UBC Rover arm work.

What it is
#

I wired the mapped brain of a fruit fly into robots. A camera image goes in, and motor commands come out the other end of the fly’s own wiring diagram:

camera → fly optic lobe → FlyWire central brain → MANC nerve cord → robot

  • Eye and optic lobe. The wrist camera image is resampled onto a hexagonal fly-eye lattice and run through a connectome-constrained model of the optic lobe (flyvis, Lappalainen et al. 2024), or through a simpler retina that feeds the fly’s visual projection neurons (LC/LPLC/LT) directly.
  • Central brain. The FlyWire adult brain connectome, either a 10,328-neuron sub-graph run as a rate network (the “r4” brain used for most training) or the whole 139k-neuron brain as a spiking network (Shiu et al. 2024 style leaky integrate-and-fire).
  • Nerve cord. Descending neurons (DNs) leave the brain and go into a slice of the MANC male ventral nerve cord, down to 144 front-leg motor neurons.
  • Robot. A small readout turns DN or motor-neuron activity into joint commands for a 6-DOF arm (the UBC Rover dev arm, Franka, UR10e), or into velocity commands for a Unitree Go2 or a Crazyflie.

There’s no robot state fed to the policy. The brain only sees pixels, plus the arm’s own joint sensors.

Biological or computational?
#

Short answer: computational, constrained by biology. It’s a model whose wiring comes from real electron-microscopy data, not a simulation of a fly.

part from real data modelled or invented by me
who connects to whom FlyWire synapse counts between real neurons; MANC DN → motor-neuron edges; neurotransmitter identity for sign which sub-graph I keep (the 10k-neuron r4 cut is mine)
neuron dynamics — tanh rate units or LIF neurons with shared, generic constants; units are arbitrary, not Hz or mV
optic lobe connectome-constrained flyvis network (itself trained on a motion task) how camera pixels map onto eye columns
what gets trained — per-cell-type gain scales, biases, input encoders and the motor readout; individual synapse weights stay as measured
sense → neuron mapping which neuron classes are loom / motion detectors (published annotations) how strongly pixels drive them
neuron → robot mapping — every gain from DN activity to joints or velocity, and the robot bodies themselves

The honest way to ask “does the wiring matter?” is to keep everything else fixed and swap the real graph for a shuffled one with the same neurons and the same number of connections per neuron (degree-matched random, or a rewire that also keeps cell types). Most of the results below are that comparison.

Headline results
#

Untrained brain: loom escape, real vs rewired
#

No training at all. The whole spiking FlyWire brain, a hand-written eye that drives the loom-detecting LPLC2/LC4 neurons, and a fixed DN → motion mapping. The control is the same brain with its edges rewired (degree-preserving).

body real FlyWire rewired
no body, loom on both eyes giant fiber 243/281 Hz, plus DNp02/04/11 giant fiber silent
no body, loom on the left eye DNa01/02 fire on the right only → turn away giant fiber silent
24 simulated flies, swatter, 3 strikes 0 / 24 swatted 15 / 24 swatted
dev arm (MuJoCo), ball from the left giant fiber 260 Hz, arm pans away and retracts 11.7 cm no response
dev arm (Isaac Lab), looming ball giant fiber peak 300 Hz, some DN active in 69/71 frames giant fiber 0, DNs active in 8/55 frames
Crazyflie, ball from left / right / front 0 / 18 hits, giant fiber fired 18/18 18 / 18 hits, giant fiber never fired
Go2 quadruped, ball from left / right / front 0 / 12 hits 12 / 12 hits

The direction of escape (turn away from the side the ball comes from) isn’t written anywhere in my code; it comes out of the wiring. What is hand-written is “giant fiber spike = climb / back off” and every gain. Two caveats: the Go2’s giant fiber fires when the ball appears (an OFF transient), not as it grows, so that row shows “real wiring escapes, rewired doesn’t” more than loom detection; and the drone’s dodge is mostly a climb.

Trained brain: camera-only tasks (r4)
#

Trained by DAgger from a scripted expert, camera only, 45-minute cap per run, best in-training eval (256 episodes). One seed. The camera MLP baseline gets the same budget.

task r4 fly brain camera MLP full fly (optic lobe → spiking brain → cord)
pick 100% 99.2% 68.8% (unstable)
moving block (6 cm/s) 100% 99.6% 7.8%
distractor blocks 98.8% 98.8% 88.3%
lighting changes 100% 98.8% —
dodge a thrown ball 81.2% 93.4% —
clutter 73.0% 90.6% 20.3%
catch 49.2% 41.4% 14.8%
stalk a moving target 47.3% 55.5% 0%
place 36.3% (90 min) 27.0% —
erratic moving block 28.5% 22.7% —
camouflaged block 16.8% 7.0% 0%
stack 3 0% 0% —

The fly brain trains fine on most tasks, but the MLP is about as good or better on most of them. A connectome isn’t a free win as a controller. The full chain through the spiking brain and nerve cord works but is unstable.

Swap the gripper, keep the brain
#

The r4 pick brain fine-tuned on new end effectors on the dev arm:

effector best eval time to get there
parallel 2-finger (default) 100% —
fin-ray / insect-tarsus fingers 100% 1 min
underactuated 3-finger hand 100% 1 min
suction cup 100% 4 min
LEAP dexterous hand (1-D synergy) 68.0% (41% at end) 10 min

Swap the robot, keep the brain
#

robot result
Franka Panda 0% zero-shot, then 99.6% after 11 min of fine-tuning
UR10e + Robotiq 2F-85 plateau at 63% (55% at end); 15/16 in the recorded policy video
Kinova JACO2 not trained: my scripted expert only manages 1/16 (the single thumb gets pushed open)
Unitree Go2, walk to a rolling ball connectome 100% vs degree-matched random 96.9%: wiring doesn’t matter here
Crazyflie, trained dodge not a clean result yet (hit rate never settled)

Does the wiring beat an MLP? Pre-registered test
#

An earlier single-seed run hinted that the fly brain beat an MLP on an oversized 8 cm block (93% vs 26%). Before running the camera version I wrote down the rule: drop the claim unless the connectome beats the MLP by at least 20 points in 2 of 3 seeds on the 8 cm block. Five arms (real wiring, degree-matched random, type-preserving rewire, MLP, GRU), three seeds each, all trained from scratch at matched samples and updates. The MLP and GRU get ~3.5× more trainable parameters.

condition real random rewire MLP GRU
training block (5 cm) 99.6 / 100 / 99.6 97.7 / 93.0 / 99.6 99.6 / 99.6 / 100 100 / 100 / 98.0 100 / 99.6 / 99.6
8 cm block (decision row) 0 / 0 / 0 0 / 0 / 0 0 / 3.5 / 1.2 0 / 0 / 0 0 / 0 / 0.4
4 cm block 62.1 / 77.3 / 25.0 22.3 / 13.3 / 8.6 74.6 / 55.5 / 50.0 2.7 / 7.4 / 7.4 5.1 / 25.8 / 1.2
7 cm block 9.0 / 19.9 / 63.3 14.5 / 49.6 / 8.6 42.2 / 34.0 / 58.6 90.6 / 64.1 / 39.1 34.8 / 46.1 / 14.8
pixel noise σ 0.1 37.5 / 40.6 / 84.8 45.3 / 56.6 / 23.4 96.5 / 94.1 / 91.4 60.9 / 1.2 / 27.7 23.0 / 49.6 / 11.7

Success %, seeds 13 / 37 / 71, 256 episodes per cell.

Verdict: claim dropped. Every brain scores about 0% on the 8 cm block, so real − MLP was under +20 points in 3 of 3 seeds. Two things are worth following up, with no decision attached: on the 4 cm block real wiring beat the MLP by +49 ± 28 points and the random graph by +40 points, but the type-preserving rewire did about as well as real wiring (−5 points). And on pixel noise the rewire was better than real wiring. Both point at cell-type structure mattering more than individual connections.

Chimera: mouse visual cortex in front of the fly brain
#

Swap the fly’s eye for 47,438 neurons of real mouse primary visual cortex wiring (MICrONS, 6.06 M connected pairs, frozen), connected to the fly’s visual projection neurons through one trainable linear layer. The control is the same mouse neurons with their edges shuffled. Early results:

task mouse V1 (real) mouse V1 (shuffled) fly-only r4
left/right selectivity, untrained (a.u.) 0.163 0.012 —
pick, seed 13 100% 93.4% (17% at end) 100%
pick, seed 37 100% 98.4% —
pick, seed 71 running — —
dodge 71.5% (58% at end) 37.1% (3% at end) 81.2%

The dodge gap is the largest real-vs-shuffled difference in the whole project so far, but it’s one seed with one shuffle. Caveats: 97% of the mouse axons aren’t proofread, there’s no retina or LGN, the retinotopy is a guess from soma position, and the adapter has 261k effective weights. It’s a test of “does cortical wiring help inside a fly host,” not a model of a mouse.

Infrastructure: connectome forge
#

Making this fast enough to iterate meant rewriting how connectomes are loaded and run. All exact to float rounding or bit-exact:

what before after speedup
load a compiled connectome 0.8–1.3 s 1–3 ms ~400×
train step, full FlyWire (CPU, fwd+bwd) 34.7 ms 11.5 ms 3.0×
train step, whole fly CNS: FlyWire + all of MANC (161,779 neurons) 45.4 ms 13.9 ms 3.3×
train step, synthetic 10× FlyWire (1.39 M neurons) 525 ms 242 ms 2.2×
memory per edge 40 B 16 B 2.45×
spiking LIF, full 15 M-edge brain (event-driven) — — 4.8×

Videos
#

The full chain on the UBC Rover dev arm: a 32×32 fly-eye view from the wrist camera (inset) drives the brain and nerve cord, shown live on the right, and the arm picks up the block (slow motion).
The camera fly brain fine-tuned to a Franka Panda: 0% to 99.6% in 11 minutes.
Dodge: the r4 brain pulls the arm out of the way of a looming ball, then picks up the block (81% best eval, slow motion).
Same brain on a LEAP dexterous hand driven by a single grasp synergy (68% best).
Untrained whole FlyWire brain, real wiring: the looming ball fires the giant fiber (DNp01) at 200–240 Hz and the arm pulls back.
Same scene, rewired brain: every descending neuron stays at 0 Hz and the arm doesn’t react.
Untrained fly brain on a Unitree Go2: real wiring backs away from the ball, rewired gets hit.
Crazyflie trained to dodge from its cameras with the connectome brain (not a clean result yet).
Chimera: mouse V1 wiring feeding the fly brain on the dodge task (71.5% best vs 37.1% shuffled).
Pre-registered test, real-wiring arm (seed 13) on the training block.

Connectome or MLP? (coming soon)
#

I’m building a small browser game: you watch a robot driven by either the real fly connectome or an MLP (or a scrambled connectome) and try to guess which. Given the tables above, I expect it to be hard. The playable demo isn’t public yet; it’ll be linked here when it is.

What’s new and what isn’t
#

Connectome-driven bodies aren’t new: Shiu et al. 2024 ran the whole fly brain as a LIF model, flyvis trained a connectome-constrained optic lobe, and other groups have put frozen fly connectomes on simulated arms with state inputs. The narrow thing I’m doing is closing the loop from a real camera image through the fly’s own visual system, brain and nerve cord to several different robots, and testing every claim against a rewired copy.

Data, licences and citations
#

  • FlyWire connectome, used under CC BY-NC 4.0, so this project is non-commercial. FlyWire Consortium; Dorkenwald et al., Neuronal wiring diagram of an adult brain, Nature 2024 (doi); Schlegel et al., Whole-brain annotation and multi-connectome cell typing of Drosophila, Nature 2024 (doi). Eye map from Codex.
  • MANC: Takemura et al., A connectome of the male Drosophila ventral nerve cord, eLife 2024 (doi).
  • MICrONS: MICrONS Consortium, Functional connectomics spanning multiple areas of mouse visual cortex, Nature 2025 (doi), CC BY 4.0, via the Zenodo conversion.
  • flyvis: Lappalainen et al., Nature 2024 (doi). Whole-brain LIF: Shiu et al., Nature 2024 (doi).
  • Robots: Franka (Apache-2.0), UR10e (BSD-3), Robotiq 2F-85 (BSD-2), Kinova JACO2 (BSD-3), Unitree Go2 (BSD-3), Crazyflie (Bitcraze open hardware; USD under NVIDIA Isaac asset terms). Isaac Lab and its pretrained Go2 walking policy: BSD-3.

Similar projects

Ranked by shared tags — click a tag above to filter the projects page.

  1. 1 UBC Rover - Arm Autonomy, RL and Rover Vision