FlyCore

FlyCore is the software that runs the fly brain in real time, natively and directly in the browser. All demos run on it.

The 3D view needs WebGPU or WebGL2.

input neuronsneurons read out

Requirements

The network has 138,639 neurons and 15.09 million signed connections. Depending on the model it is evaluated 12 to 50 times per second, and its state is carried from step to step. Each time step requires one sparse matrix-vector product, which has to finish within a few milliseconds, including in the browser.

Structure

The core is written in Rust, without the standard library (no_std), without external dependencies and without unsafe code. It contains the complete computation: the sparse product, the connections to the machine, the state update and the preparation of the inputs, including its own floating-point functions. All platforms therefore return the same results.

Only the sparse product is platform-specific. In the browser it runs as a WebGPU kernel, with WebAssembly (SIMD) as a fallback.

Exactly as in training

Every model file contains a recorded run from training. The engine replays it in the browser and matches it to within a millionth.

One time step

24 neurons of the fly brain in their real shape, with the measured locations of their synapses. A recorded run of the model plays on top: each neuron glows with its activity; where signal flows, a pulse runs along the sending neuron's branches to the synapse, the synapse flashes, and the signal continues into the receiving neuron. Cell bodies are drawn for orientation; in insects they sit at the brain's surface, off the signal path. Click a cell body or a name to show one neuron with its partners.

excitatory signalinhibitory signal

The sign follows the neurotransmitter predicted for the sending cell (Eckstein et al. 2024), as in Shiu et al. 2024: acetylcholine excitatory, GABA and glutamate inhibitory. Each neuron has its own resting level and time constant, as real neurons do. The wiring diagram does not record them, so they are learned for each task.

Rhythm

Fly neurons do not all fire in step, and when they are active relative to each other matters. In our model every neuron therefore carries a phase next to its activity, and how fast it turns is learned.

State per neuronreal + imaginary partRecurrent step, WebGPU5.5 ms
StimulusActivity

The walking model uses this rhythm to keep the body upright.

What the demos download

Each demo downloads one file: the 15,091,983 connections of the fly brain as a sparse matrix, each neuron's resting level and time constant, the rhythm where the model uses one, and the connections to the machine. In 32-bit floating point this is 126 MB. The packed format stores the synapse counts as integers and is lossless for the connections; this gives 40 to 72 MB. The demos load this file once and then compute locally.

Timings

In the browser one step of the fly brain takes 4 to 9 ms with WebGPU, fast enough for 50 steps per second. Natively a step takes 2.4 ms on ten CPU cores.

Neuron groups

The neurons are grouped by function: where the brain receives its input, the brain itself, and where the brain is read. A machine connects at these places.

Inputs18,669
  • Visual afferents10,855CursorGazePlay
  • Mechano / auditory afferents2,656
  • Olfactory receptor neurons (antennae)2,279Cursor
  • Taste, temperature, humidity, other562
  • Ascending (body state)2,317CursorWalkPlay
Core118,471
  • Central brain32,379
  • Optic lobes86,092GazePlay
Outputs1,485
  • Descending neurons1,299CursorWalkPlay
  • Motor / endocrine186