← All projects

fly

Drosophila brain connectome simulation with LIF neurons and a NeuroMechFly body

If you plug a real insect connectome into a real insect body and just let the dynamics run, does anything that looks like behavior fall out - without any learning at all? This project wires the FlyWire Drosophila melanogaster connectome (~139K neurons, ~50M synapses) into a biomechanical fly via flygym / NeuroMechFly, then closes the loop. The brain is modeled as a Leaky Integrate-and-Fire network with a sparse weight matrix derived directly from FlyWire synapse counts and neurotransmitter signs (acetylcholine excitatory, GABA / glutamate inhibitory). The body provides MuJoCo-simulated 42-DoF legs, compound eyes, and odor sensors. Each timestep, sensory inputs feed visual / olfactory / proprioceptive neurons, the LIF network steps forward, and descending and motor neuron firing rates drive the leg actuators.

The interesting constraint is staying CPU-tractable at this scale, which the implementation handles via scipy.sparse matmuls in a tight vectorized NumPy LIF loop. The codebase is small and opinionated - connectome loader, neuron dynamics, body wrapper, simulation loop, visualization, analysis - runnable end-to-end from a single CLI with a synthetic-connectome fallback for development without the full data download. No learning anywhere in the stack; the question is what the wiring alone produces.