Robots run by the wiring of a fly's brain

Each robot sees through a fruit fly's eye neurons, feels its body through the fly's body-sense neurons and moves through the fly's command neurons. Everything in between follows the real connection map of the fly brain. Only the connection strengths are learned.

Code on GitHub What it found Run it yourself by S. M. Nihal Ahmed

What it found

Project concluded, October 2026. The same fly wiring, grown step by step with a camera, light-adapting eyes, the fly's smell pathway and memory, learned every handling task up to picking only the ripe tomatoes off a plant, by sight and smell, at 98 %. On any truss of two to six tomatoes it plateaus at 67–72 % (task 14), while a scripted teacher solves 98 %.

How the robots are wired

The fly brain has been mapped neuron by neuron: about 139,000 neurons and 15 million connections (FlyWire). For each robot I take the few thousand neurons that lie on the real pathways from the fly's eye and body sense to its command neurons, keep who connects to whom and whether each connection excites or inhibits, and train only the connection strengths with reinforcement learning.

The eye drives the fly's photoreceptors: in the first robots one camera pixel per photoreceptor, in the drone and the Panda arm a fly-like compound eye whose facets feed the R1–6, R7 (ultraviolet) and R8 (green) cells. Body readings go into ascending neurons, the channel that normally carries body sensation up to the fly's brain. The robot is driven from descending neurons, the brain's outgoing commands.

Every task below is a single training run, so read the numbers as first results, not a benchmark. The videos are short; each one has full-screen in its controls.

1

Balance a ball on a tray, given its position as numbers

Done

The first network used the 1,000 most connected fly neurons, with inputs and outputs picked by me rather than by biology. It learned to keep a rolling ball on a flat tray in about 100,000 steps and coped with noise, pushes and a heavier ball. An easy start, so the tasks got harder.

2

A tilt-maze puzzle, given the ball's position as numbers

Partly

Like the wooden labyrinth toy: tilt the board so the ball rolls round the walls into the green goal, and stop it there. The network gets the wall layout but not the route. On one fixed maze it reached 30–40 % after a million steps, still rising; new random mazes were too hard.

Shortcuts it found, and how they were closed

It learned to flick the ball over the walls (fixed with a glass lid), and to hover in and out of the goal to collect reward (fixed by taking the resting reward back if the ball leaves).

3

Balance a ball by camera, wired like a fly

Done

Then the robot was rewired through the fly's own channels, as in the diagram, and the ball's position was taken away: the brain gets only a 16×16 camera image and its joints. From 250,000 steps on it kept the ball for the full 10 seconds, also with a heavier ball and random shoves.

All tests
Test (10 new episodes)Kept the ball 10 sMean steps (of 500)
Normal conditions100 %500
Ball three times heavier100 %500
Random pushes on the ball100 %500
Light noise on the camera image0 %144
Strong noise on the camera image0 %63
Ball removed from the camera image0 %28

Without seeing the ball it fails at once, so it really steers by what comes through its eye. Its weak spot is a noisy picture, which it never saw while learning.

4

The tilt maze, seen only through the camera

Done

The same camera brain had to see the walls, goal and ball in a 16×16 picture, find the way round and stop the ball in the goal. With fast motors it pinned the ball in the goal's corner and never counted as solved. With slower, smoother motors and practice starts along the route, it solved every test from 1.1M steps, in about 2.6 seconds.

All tests
Test (10 episodes)SolvedMean steps (of 300)
The trained maze100 %132
Ball three times heavier100 %141
Random pushes on the ball60 %220
Noise on the camera image0 %300
Ball removed from the camera image0 %300
Mazes it has never seen0 %300

It steers by what it sees, but it memorised this one maze rather than learning to read walls. Training on a new random maze every episode stalled, which is one reason the project moved to a real robot arm with more varied but simpler tasks.

5

A drone with a fly's compound eyes

On hold

A fly's brain evolved to steer flight, so the next robot was a small quadcopter seeing through two compound eyes of 160 facets each, covering almost every direction. A simple stabiliser keeps it level, the job a fly's halteres do outside the brain; the 4,000-neuron fly brain decides where to fly. Task: find a yellow ball somewhere in a room, among blue decoys, in wind and gusts, and hover on it.

What was learned building it

A first version painted the floor green: the yellow ball was camouflaged against it, much as a flower can be in grass, so the room is now grey. A penalty for jerky commands punished the network's own exploration and stalled learning, so it was removed. The drone is paused to focus on the arm.

6

Franka Panda arm: reach a block it finds by eye

Done

A real lab robot (Franka Panda with its two-finger gripper), set up the way robot-learning benchmarks do it: the brain's command neurons say "move the hand this way, open or close", and a controller turns that into joint motions, much as a fly's nerve cord turns descending commands into leg movements. Two compound eyes: one on a head beside the table to find things, one on the wrist to line up. Task: bring the gripper just above a yellow block that appears somewhere new each time, with blue decoys around.

First run · 109/150 (73 %)

rightcentreleft near25521 66644 46643 56664 far26532

After edge practice · 141/150 (94 %)

rightcentreleft near36665 66666 56666 56666 far56565

Each cell: a block position on the table (5 × 5 grid, seen from the robot), number of successes out of 6 tries with different starts. Stronger colour = more successes.

Tests, corners and what went wrong on the way
Test (best brain, 20 episodes)Reached
Normal conditions90 %
No decoy blocks90 %
Three times more noise in the eyes75 %
Brightness changes twice as large (±40 % instead of ±20 %)70 %
Yellow block made invisible5 %
Exact corner tip (20 tries)First runAfter edge practice
Centre (reference)1820
Far left915
Near left611
Near right510
Far right104

Corner misses end about 30 cm away, drifting towards the table centre: at the extreme tips the block is a small, dim dot for the head eye and outside the downward wrist eye, so the brain falls back to where blocks usually are. Decoys hardly matter (82–83 % with 0, 1 or 2).

On the way: a success rule that also demanded a nearly still hand could not be met under the network's own exploration jitter (even a perfect pilot with that jitter passed 27 %), so it became "stay within 3 cm for 0.2 s". The first run peaked at 90 % and then declined, so the best brain was kept and fine-tuned at a lower learning rate, with more practice blocks near the table edges.

7

Franka Panda arm: grasp the block and lift it

Done

Same robot, eyes and brain, plus touch: the brain feels whether each finger presses on something, like a fly's mechanosensors. It must close both fingers on the yellow block, lift it to a point 8 cm straight above where it lay, and hold it there.

Trial and error alone (v9) got the first lifts after 2 million steps and about one success in five by 3.2 million, but the lifts were sloppy: the block was typically carried about 20 cm sideways while going up.

Teacher, then practice (v10): a scripted teacher that knows where the block is showed the fly brain the right move in the situations the brain itself got into (10 short rounds, 165k steps, the method called DAgger). Then the brain practised on its own with trial and error. The teacher only supplied training targets: the fly brain never receives the block's position, and every test, map and video below is the brain alone, using its eyes. Within 0.6 million practice steps it solved 84 %, and around 90 % from then on.

Before: trial and error only (v9) · 52/200 (26 %)

rightcentreleft near01410 03112 22353 03623 far02332

After: teacher, then practice (v10) · 180/200 (90 %)

rightcentreleft near68787 87788 67688 67888 far66688

Each cell: a block position on the table (5 × 5 grid, seen from the robot, decoys removed), number of successes out of 8 tries with different starts. Before: block at least 7.5 cm up at the end (v9's own, looser rule). After: block held within 2.5 cm of the point straight above its start (the stricter rule). The right edge is still the weakest.

Precision, before and after (200 new layouts each)
MeasureTrial and error (v9)Teacher, then practice (v10)
Grasped the block85 %100 %
Block 7.5 cm or more up at the end29 %98 %
Held at the target point at the end (within 2.5 cm)0 %94 %
Distance from the target point at the end (median)20.4 cm1.3 cm
Largest sideways drift while in the air (median)23.4 cm1.1 cm
Time to finish (median, of 4 s)–1.5 s
Test (best brain, 50 episodes)v9v10
Normal conditions16 %90 %
No decoy blocks24 %90 %
Three times more noise in the eyes8 %96 %
Brightness changes twice as large (±40 % instead of ±20 %)20 %60 %
Yellow block made invisible0 %0 %

It still works only by eye (0 % with the block invisible). Lighting is the weak spot: it never saw lighting changes while practising. One training run.

How the teacher rounds went

Round 1 the teacher drives every step; then the brain drives more and more (50 %, 25 % …) while the teacher keeps saying what it would do. The brain alone solved 0 % after rounds 1–2, up to 56 % after round 7, then fell to 4 % by round 10: once the brain drove almost all the time, the examples filled with its own near-misses, and it lost the final lift while keeping a clean reach and grasp. Practice with trial and error then took it from 4 % to about 90 %. During practice a second network that judges how well things are going (the critic) saw the true positions; it is used only for learning, never for acting.

Before: trial and error alone (v9)

For 2 million steps it found the block, went down to it and learned to close its fingers, but never completed a lift. At 2.15 million steps the first full lifts appeared, and by 3.2 million it solved about one attempt in five, often swinging the block sideways while raising it.

How it got there, and the tests
StepsChangeEffect
0–0.7Mstart from the reaching braingoes down to the block, never grasps
0.75Msome practice episodes start at the block (open, or already holding it)learns to close and hold
1.1Mexploration noise reset once, lower learning rateaim restored; grasps; lifts a little
2.15M–first full lifts
3.2M–best brain: about 1 in 5 solved
Test (best brain, 50 episodes)Solved
Normal conditions16 %
No decoy blocks24 %
Brightness changes twice as large (±40 % instead of ±20 %)20 %
Three times more noise in the eyes8 %
Yellow block made invisible0 %

One training run; 50-episode tests swing by about ±10 points. Videos and tests always start from scratch (no help), unlike some practice episodes.

Checks before training
Behaviour (40 episodes)ReturnLifted
Random, or doing nothing20 %
Hovering above the block (the reaching brain)130 %
Touching it with a closed gripper150 %
Grasping but never lifting310 %
Scripted pilot with training-like noise5278 %
Scripted pilot6692 %

Every step towards the goal pays more, so the reward cannot be gamed by stopping halfway.

8

Franka Panda arm: pick the block and place it in a bin

Done

A shallow red bin (14 × 14 cm, 1.5 cm rim) appears somewhere new on the table each time, away from the yellow block. The fly brain has to find both by eye, grasp the block, carry it over the bin, lower it onto the bin's floor, let go and move its hand away. Solved = the block rests inside the bin, touched by neither finger, for 0.2 s, within 6 seconds.

Same recipe as the lift: starting from the lift brain, a scripted teacher (knows where block and bin are) showed it the right moves for 10 short rounds, then it practised on its own. The teacher rounds alone already reached 82–88 %; practice then held it at 84–92 %, levelling off within 0.2 million steps. Total: 0.77 million steps, under 4 hours on the desktop.

Where the bin was · 160/200 (80 %)

rightcentreleft near86586 75366 78676 88776 far77763

Each cell: a bin position on the table (5 × 5 grid, seen from the robot), number of successes out of 8 layouts with the block, decoys and start placed at random. Weakest: the bin near the middle of the table and in the far-left corner.

Tests and what goes wrong (best brain)
Test (50 episodes)Solved
Normal conditions92 %
No decoy blocks92 %
Three times more noise in the eyes86 %
Brightness changes twice as large (±40 % instead of ±20 %)58 %
Yellow block made invisible0 %
200 new layouts
Grasped the block94 %
Carried it over the bin90 %
Solved (in the bin, released)84 %
Block centre to bin centre when placed (median)1.0 cm
Time to solve (median)2.7 s

On 200 layouts it solved 84 %, against 92 % on the 50-episode test: the honest figure is somewhere in the high 80s. The most common miss (7 %): it holds the block 2–3 cm above the bin floor and never lowers it (in the case examined, the block was gripped high and hung tilted between the fingers). Then: never grasping the block (6 %), and ending with the block in the bin but still held (1–2 %). Lighting remains the weak spot, as for the lift.

9

Franka Panda arm: sort blocks by colour

Done

A sorting station: three identical red bins in a row along the far side of the table, and one block per episode, yellow, blue or orange at random. Yellow goes into the left bin, blue into the centre, orange into the right. The bins look the same, so the only way to know where a block goes is to see its colour, through the fly's photoreceptors (brightness, UV and green channels).

Started from the pick-and-place brain: 10 teacher rounds, then practice. In 0.5 million steps (about 3 hours) it solved 98 % of the evaluation episodes.

Does it really sort by colour? (300 new layouts)
Block colourSolvedLeft binCentre binRight binNo bin
Yellow (→ left)98 %101002
Blue (→ centre)92 %09809
Orange (→ right)97 %00873

Every block that landed in a bin landed in the right one: the colour decides the bin. The 14 misses (5 %) never reached a bin at all: dropped on the way (6), still holding it at the end (5), never grasped (3). Blue, the decoy colour it was taught to ignore in earlier tasks, is the weakest. Placed blocks end a median 1.3 cm from the bin centre; sorting takes a median 2.8 s.

Test (best brain, 50 episodes)Solved
Normal conditions92 %
Three times more noise in the eyes84 %
Brightness changes twice as large (±40 % instead of ±20 %)50 %
Block made invisible0 %

Brightness changes hurt colour sorting the most (50 %), probably because brightness is one of the three channels the colours differ in (not yet checked per colour). A first design, with bins coloured like the blocks and at random places, failed in the teacher rounds (0 %): a big yellow bin looked like "the yellow thing" too, so the brain could no longer find the block.

Changing light: fly-like light adaptation in the eyes (v14)

Real fly photoreceptors adapt to the light level: each receptor type adjusts its sensitivity to the light it currently receives, so the brain gets contrast rather than absolute brightness. The eye model now does the same (with photon noise that grows in dim light). The brain then practised under normal light only, so every other lighting below is new to it.

Fixed brightness (40 layouts each)×0.4×0.5×0.7×1×1.4×2×2.5
v12: practised ×0.8–1.20 %0 %15 %90 %0 %0 %0 %
v13: practised ×0.5–25 %42 %92 %82 %70 %62 %0 %
v14: adapting eyes, practised ×0.8–1.2100 %100 %100 %100 %100 %100 %100 %
Lighting adaptation cannot simply cancelv12v13v14
Uneven: one side of the view ×2, the other ×0.53 %3 %48–60 %
Uneven, milder: ×1.4 / ×0.7––88 %
Tinted: receptor types ×0.7 / ×1.4 / ×1.015 %30 %98 %

Practising under many brightness levels (v13) only helped inside the practised range. Adapting eyes made overall brightness irrelevant (largely by design: adaptation cancels a global change), corrected a colour cast (like colour constancy), and handled moderately uneven light it never saw. At normal light it also sorted better than ever: 98 % of 300 new layouts, none in a wrong bin. Strongly uneven light remains the weak spot.

10

Ripe or rotten, by smell alone

Done

The brain grows a sense. The trained 4,000-neuron brain was kept exactly, and the fly's smell pathway from the FlyWire map was added to it: 106 olfactory receptor neurons (53 receptor types, two antennae) and 370 neurons on their routes into the existing brain, mostly antennal-lobe projection and local neurons. How each receptor type responds to each chemical comes from measured fly data (the DoOR database). Two antennae sit beside the gripper.

The task. One fruit, ripe or rotten, looking exactly the same. Ripe goes left, rotten right. Ripe fruit smells of fruity esters; rotten fruit of fermentation (ethanol, acetic acid, ethyl acetate, diacetyl), which mainly drives the fly's acid-sensing receptors. The videos show the true fruit and what the antennae report; the brain only gets the smell.

Does it really decide by smell?
FruitSolvedRipe binRotten binNo bin
With smell (300)Ripe99 %16601
Rotten97 %01294
Antennae silenced (100)Ripe97 %6002
Rotten0 %3701

Without smell it still picks up and carries every fruit, but always to the ripe bin: "ripe" is its default, and the smell of rot is what sends a fruit to the other bin. Nothing else in the scene gives the answer away. Honest limits: the fruit recipes are simplified, some receptor responses were never measured (counted as none), the odour plume is smooth rather than turbulent, and the mushroom body (odour learning) is not included yet.

11

Greenhouse, phase 1: pick a tomato off the plant

Done

Towards a real job. The end goal is a greenhouse harvesting robot: an arm on a cart that drives a loop through tomato rows, picks ripe tomatoes into a basket, removes rotten ones and unloads after each lap. Phase 1 is the core skill. One cherry tomato hangs on its stalk from a plant; the arm comes at it from the front and above, the way greenhouse harvesting robots do, closes on it, pulls until the stalk snaps, and drops it into the basket beside the robot. Touching the plant costs reward (a broken stem costs a grower weeks of fruit). Same brain as task 10, so it can still smell.

What does it use smell for?
Smell (50 layouts each)SolvedClosest to the tomato
Normal98 %0.5 cm
Antennae silenced0 %4.1 cm
Smell coming from 6 cm beside the tomato96 %0.6 cm
Full-strength smell everywhere20 %13.5 cm

It finds the tomato by sight (moving the smell aside does not move the hand), but uses how strong the smell gets as the hand closes in to time the grasp: without smell it stops 4 cm short and never closes. Nobody taught it this; the teacher only ever moved by the true tomato position. Honest limits: the plant the eyes and physics see is simple (a stem, a branch, the stalk, three leaves; the leafy plant in the videos is drawn for viewers only), stems do not bend, and the hand brushes the stalk briefly in most picks. Strongly uneven light breaks it, as in the sorting task.

12

Greenhouse, phase 2a: pick only the ripe tomato

Done

Choosing. Three cherry tomatoes hang side by side on a truss; one is ripe, the others green or turning. Pick the ripe one, leave the rest. The fly's own eye failed here, and we measured why: its facets are about 11° apart, so from the head the three tomatoes are one blur, and even the wrist eye read ripeness at only 85–92 %. So, as harvesting robots do, the hand now carries a close-range depth camera (like an Intel RealSense D405). Its image, 16×10 pixels of colour and distance, goes into the same fly-brain neurons the wrist eye used, each pixel to the facet pointing the same way, so the fly's visual pathways stay in place. The head keeps the fly eye; smell is unchanged.

What it took (three failed tries first)
  1. The eye was too coarse from a distance, so the teacher now first brings the hand close to the truss, the same move whatever is ripe, then goes for the ripe one.
  2. A bug in the eye model: a thin stalk hid the whole tomato from the wrist eye at grasping distance. Fixed.
  3. The teacher had a memory the brain lacks (it kept its earlier choice): in 12 % of situations its choice was not one the brain could make from what it senses. Now it decides from the present only.
  4. One step at a time: one ripe tomato among three first, two ripe next.

Each fix was found by measuring rather than guessing: a linear read-out of "is this tomato ripe" from each sense showed where the information was missing. The camera then made it 100 %. Honest limits: the camera is an engineering part, not a fly eye; it has no white balance yet, so tinted light (12 %) and uneven light (0 %) break it; the brain still uses smell to time its grasp.

13

Greenhouse, phase 2b: pick every ripe tomato, gently

Done

Repeating, remembering, not bruising. One or two of the three tomatoes are ripe. The arm must pick one, drop it in the basket, come back, find the next and pick it, without picking an unripe one and without bruising any fruit: any knock harder than 5 N, or a hard landing in the basket, fails the harvest. The robot got what real harvesters have: a front depth camera on the cart that sees the whole truss (into the fly's head-eye neurons), a gripper whose force is capped below what bruises a tomato, and an observation pose it returns to after each fruit. The fly brain got memory: each neuron keeps part of its activity from one moment to the next.

Each step, measured on the same 200 layouts
BrainSolvedUnripe pickedBruisedTime
Without memory and front camera (dashboard)~66 %–––
Two cameras + memory + gentle82 %2 %11 %5.2 s
+ smooth (touching other tomatoes costs)79 %4 %9 %4.9 s
+ front camera zoomed (34° → 26°)79 %0.5 %10 %4.9 s

The zoom was found from the videos: the hand went to the orange tomato first, looked, then took the red one. At 34° a tomato covered about 1.4 pixels of the front camera; at the tomato's pixel, red and orange were told apart 93 % of the time, at 26° 99 %.

What went wrong on the way
  1. Memory made learning blow up: carrying all of each neuron's activity over scrambled the copied brain. Now each neuron learns how much to keep, starting at 5 %.
  2. The second tomato was never taken: the arm would have had to remember where it was for ~3 s of carrying. Real harvesters look again; so does this one now, from a pose aimed by its camera.
  3. The way back knocked tomatoes (up to 80 N): now it rises out of the basket first.
  4. Practice slowly made it worse (90 % → 60 %): learning rate lowered.
  5. The physics engine blew up after a knocked tomato flew into the table: a flung tomato now ends the try as a lost fruit.

Honest limits: bruises still fail 10 % of layouts, mostly a finger hitting the ripe tomato on the final approach (an impact within one 40 ms control step; stopping the push on contact did not help); a dropped tomato 4 %; tinted or uneven light breaks the cameras (no white balance); one training run.

14

Greenhouse, phase 2c: any truss

Done

No two trusses alike. Two to six tomatoes hang on irregular stalks along a zig-zag stem; one to three are ripe. Same robot and fly brain as task 13 (two depth cameras, smell, memory, a gripper that cannot squeeze hard). A bruise of any tomato, by a knock above 5 N or a hard landing, fails the harvest. The scripted teacher it learned from solves 75–83 % of these trusses.

Each step, measured on the same 200 layouts
BrainSolved3 ripeRipe in basketBruised
Teacher, then practice (4M steps)60 %~42 %324 / 37328 %
+ a bruise ends the try62 %~31 %292 / 37315 %
+ each tomato paid once (final)67 %~51 %321 / 37314 %

Ending the try at the first bruise halved the bruising, but the arm learned to stop after its first tomato: following the hand showed it standing back for the rest of the time, never trying again, and more time did not help. The reason was the reward: every tomato already in the basket kept paying a little each moment, and a bruise would end all of it, so not trying was the safe choice. Paying each tomato once, when it lands, banks it; finishing the truss pays the rest.

Honest limits

Bruises still fail 14 % of layouts (mostly the fingers closing on the ripe tomato, or knocking a neighbour on the way in); in 10 % the arm still stops before the last ripe tomato; tinted or uneven light breaks the cameras (no white balance); one training run. Training on a GPU (MuJoCo MJX, Kaggle T4) was measured and was slower than the training PC for this contact-rich scene, so it stays on the CPU.

How far the fly brain reaches: the closing experiments

The goal afterwards was a near-perfect teacher and a fly brain at 95 %. The teacher got there; the brain did not.

AttemptSolved
Scripted teacher, rebuilt from its own failure list (1,000 new trusses)98 %
The v19 brain on that version of the task (200 trusses)72 %
Copying the teacher again (imitation, 5 variants)best 26 %
+ a learned speed for every neuron / all 156 command neurons instead of 64no effect
Teacher drives the start of each practice try, the brain the rest (Jump-Start RL)71 % (no gain)

The cameras are not the problem: a standard machine-learning model reads the teacher's “close now” moment from exactly the brain's inputs almost perfectly, and the distance to 0.3 mm. Watching the copying brain step by step found why it froze: closing or opening the hand happens on one step per tomato, and it learned the average, a hand that stays open. Weighting those moments removed the freeze (5 to 17 of 40 trusses), but never brought copying past the brain's own practice. On this task the fly brain plateaus at 67–72 %, and the arm series ends here.

Where the arm series ends

The aim was to test whether a fly brain can learn basic human-like handling tasks with a robot arm. Over fourteen tasks it got as far as any truss of tomatoes, where it plateaus at 67–72 % (task 14). Since the next steps add more of the same kind of decision, they are left as open directions:

  1. Rotten and infected fruitgrey mould and rot by look and smell, into a separate reject bin so it does not spread
  2. A real plantleaves that hide fruit, bending stems, fruit at different heights, leaf shadows (uneven light)
  3. The greenhouse loopthe arm on a cart driving a loop through the rows, stopping at each plant, unloading after each lap
  4. Mushroom body and real armthe fly's odour-learning centre; the vision part on a low-cost real arm with real cherry tomatoes

What is biological here, and what is not

PartStatus
Which neurons are used (eye, body sense, commands)Real fly cell types
Who connects to whom, excitatory or inhibitoryReal wiring
Route from eye through optic lobe and central brain to commandsReal pathways
Connection strengthsStart from real synapse counts, then retrained
NeuronsSimple rate units, not spiking cells
The eye's inputEarly arm: a 16×16 grey image. Drone and Panda: a fly-like compound eye with real photoreceptor types, but 160 instead of ~800 facets per eye and 25 instead of ~200 images per second
Below the brainA controller turns hand commands into joint motions (Panda) or keeps the drone level, standing in for the nerve cord and halteres, which the brain map does not include
Depth (tasks 12–14)Robot depth cameras, fed into the eye neurons by layout; flies judge distance mainly from motion, not stereo depth
LearningReinforcement learning (PPO) and imitation of a scripted teacher, not how a fly learns

So this is not a simulated fly mind. It uses the fly brain's circuit layout as the design of a robot controller, and asks how well that design can learn tasks a fly never does.

Run it yourself

Runs on a laptop, a free Kaggle notebook or an always-on Linux PC (see scripts/desktop/).

git clone https://github.com/nihal4/connectome-tray-balance
cd connectome-tray-balance
pip install -r requirements.txt

python scripts/download_connectome.py     # fly wiring + cell types
python scripts/download_panda.py          # Franka Panda model (MuJoCo Menagerie)
python scripts/build_flybrain.py --eye compound --facets 160 --n 4000 --hops 5
python scripts/train.py --env panda_reach --policy connectome \
       --subset data/flybrain_eye160_N4000.npz --profile desktop --random_start 0.3