GFly

How it works

Short version: the whole brain fits in a tab and runs at close to real time. Here is how.

1. The data is too big to load directly

The release is up to 13 GB of tables in a Google Cloud bucket, and the bucket does not allow web pages to read it. So the work is done once, offline, and the result is shipped as ordinary files.

2. From 13 GB to 75 MB

The size comes down in four steps. None of them changes a single connection or synapse count. A fifth step, dropping weak connections, does, and it is a choice you make from the Brain menu.

  1. Keep only what a simulation reads. Most of the 13 GB is the 124 million synapses listed one by one, each with its position in the volume and a confidence score, plus the shape of every neuron. A spiking model never asks where a synapse sits, only which neuron talks to which and through how many synapses. Janelia publishes exactly that summary: 25.6 million neuron pairs, each with a synapse count. With the neuron annotations and transmitter table it is 560 MB to download, and it is the only part the build reads.
  2. Renumber the neurons. The release names neurons with 64-bit ids. The 164,740 neurons are sorted once and every connection refers to a neuron by its position in that list, 0 to 164,739, which fits in 4 bytes. The original ids are kept in a separate 1.3 MB table, so the mapping is exact both ways.
  3. Write the graph as rows, not as a list of pairs. Connections are sorted by source neuron. Then the source need not be written on every line: one table of 164,741 offsets says where each neuron's row starts and ends. What remains per connection is a 4-byte target and a 2-byte synapse count, 6 bytes. Two bytes hold counts up to 65,535 and the largest count in the release is 2,591, so every count is stored as it is. The full brain is 154 MB this way.
  4. Compress, and let the browser unpack it. Plain gzip halves that to 75 MB. The browser inflates it with its own decompressor straight into typed arrays; there is no text to parse and no objects to build, so the standard brain is ready about 130 ms after the last byte arrives.

Checked, not assumed. The shipped full brain has 25,568,639 connections summing to 124,039,080 synapses, the same two numbers as the source table. The 13 GB release and the 75 MB file describe the same wiring; what the file leaves out is where each synapse sits, its confidence score and the neurons' shapes, none of which the model reads. The outline in the brain view is a separate 1.4 MB shell.

The fifth step is optional. A connection is a count of synapses between two neurons; weak ones are many and unreliable. Keeping only connections with 5 or more synapses drops three quarters of the list and keeps nearly three quarters of the synapses. Sizes are before and after gzip.

SynapsesConnectionsOf all synapsesRawShipped
1+25,568,639100%154 MB75 MB
5+6,236,42672%38 MB20 MB
10+2,749,55854%17 MB9 MB
20+1,060,45036%7 MB3.5 MB

The brain shape, the fly model and the neuron list add 5 MB to whichever brain you pick.

3. It runs fast enough

Each neuron is a simple integrate-and-fire unit with the settings from the published whole-brain model. Only neurons that fire touch their connections, and only neurons that are doing something get updated. One thread, plain JavaScript.

BrainTime stepSpeed
6.2M connections1 ms0.95× real time
6.2M connections, with the room1 ms0.35× real time
2.7M connections1 ms1.11× real time

4. Three things the raw data gets wrong

The wiring gives you connections and synapse counts, not how neurons behave. Three fixes were needed before anything fly-like happened.

  • Inhibition needs something to inhibit. A silent brain cannot be turned down. Every neuron is given a small standing push, just below firing.
  • Cells have a floor. Without one, the most-connected neurons drifted to −300 mV, which no cell can do, and could never fire. They now stop at −75 mV.
  • Synapse counts are not strength. Some cells get 35,000 inputs, most get a few hundred. Each cell's input is scaled toward the average.

5. What you give up

Dropping weak connections loses 28% of synapses, unless you pick the full brain. Every synapse is the same strength per count, and every neuron the same type, which is not true in the animal. The time step is 1 ms rather than the 0.1 ms a careful study would use. For behaviour on the scale of a turn or a jump, that is fine.

Does it act like a fly?

That is what The Room tests.

Open The Room