A fly's brain mapped in entirety in under 16MB
Janelia and Google published the wiring diagram of most of a fruit fly's brain. It turns out to fit — all 21,739 neurons and 3.5 million connections of it — inside a machine with no operating system, with room to spare. And a connectome makes an unusually good test of a computer.
Note: This is a guest post by Reza Tabibazar, Avriz Engineering. Implementation and analysis with Claude (Anthropic). Every number below came off a real run, and the picture is actual program output.
Somebody mapped a brain
In January 2020 the FlyEM team at Janelia Research Campus, with Google's Connectomics Group doing the segmentation, released the hemibrain: a reconstruction of most of the central brain of a fruit fly, traced neuron by neuron from electron microscopy. Not a model of a brain. The actual wiring of one particular animal.
They released it under CC-BY, which means anyone can download it and do as they like provided they say where it came from. So we did.
21,739 neurons3,550,403 connections between them14,329,229 synapses in those connections
It fits in under 8MB
A unikernel has no filesystem, so there is nothing to read the data from at runtime. The connectome has to travel inside the binary.
That sounds worse than it is. 21,739 neurons need only sixteen bits of index, so each connection costs two bytes rather than the eight a naive pair of 32-bit integers would take. Stored as compressed sparse rows, the complete adjacency of an animal's brain comes to about seven megabytes. The finished unikernel image is 7.9 MB and boots in a 16 MiB instance with about half the memory still free.
There is something quietly startling about that number. A fly does a great deal with its brain — it flies, it navigates, it learns smells, it courts — and the complete map of the part that does most of it is smaller than a phone photograph.
Every connection in the hemibrain, binned into a 720×720 grid. Rows are presynaptic neurons, columns postsynaptic, both ordered by cell type — so the blocks are real structure, not an artefact of file order. Bright squares on the diagonal are populations wiring to themselves; the long bands are hub cells that talk to nearly everything. Computed and sent out over a serial console by a machine with no operating system.
Two things we found
1. The fly's brain is one loop
A group of neurons is strongly connected if you can get from any one of them to any other by following synapses forwards. It is the graph-theory version of "can these cells influence each other, round and round".
The hemibrain has 51 such groups. The largest contains 21,689 of the 21,739 neurons -- 99.8% of
the brain. Fifty neurons sit on their own, and everything else is in one enormous recurrent circuit in which every cell can, eventually, affect every other.
It is not a pipeline from senses to muscles with some feedback bolted on. It is very nearly one loop, with the sensory cells hanging off the edge.
2. Everything is three synapses from the eye
Start at the 2,097 lobula columnar neurons -- the cells that carry vision out of the optic lobe and into the central brain -- and count synaptic hops outward:
0 hops 2,097 neurons (the visual output cells themselves)1 hop 6,0462 hops 13,4533 hops 142
21,738 of the 21,739 neurons are reachable, and none is more than three synapses away. Exactly one neuron in the dataset cannot be reached from the visual system at all.
Whatever the fly is doing with what it sees, the wiring gives it very little distance to do it in.
Why a connectome is a good test of a machine
Graph algorithms are precisely the kind of workload where a wrong answer looks exactly like a right one. "51 components" is just a number. Nothing about it looks broken. If a processor drops a bit somewhere in three and a half million edges, you get a different number and no indication that anything happened.
So every result here is computed twice, by algorithms that share no machinery.
Components, two ways. Tarjan's algorithm finds strongly connected components using a "lowlink"
number and a single stack. Gabow's path-based algorithm finds them with two stacks and no lowlink at all. They are genuinely different ideas that happen to answer the same question.
Component numbers are arbitrary, so both partitions are relabelled by the smallest neuron each one contains, and hashed:
SCC Tarjan found 51 components, Gabow found 51SCC Tarjan eefd2d18bd3da22a Gabow eefd2d18bd3da22a -- OK, the identical partition
Not "both found 51". The identical assignment of all 21,739 neurons to groups.
Distances, two ways. Breadth-first search answers with a queue, visiting neurons in careful order.
Repeated relaxation answers by sweeping every edge in the graph over and over, lowering whatever can be lowered, until a whole sweep changes nothing; no queue, no ordering, a completely different shape of computation. It is slower on purpose.
DEPTH 0 of 21739 distances disagree
And the free one: the out-degrees of every neuron must add up to the number of connections. It costs nothing and it catches a corrupted index immediately.
We do this because this platform has previously been measured returning different answers to identical arithmetic, roughly once in four thousand operations, until it was root-caused to a register-preservation bug in the interrupt path. Since then every workload we publish carries an oracle.
Both machines run on BareMetal Cloud - a Haswell-EP Xeon with 16 MiB of memory and no operating system, and on an arm64 laptop:
BareMetal Cloud arm64 laptopcomponents 51 51partition hash eefd2d18bd3da22a eefd2d18bd3da22alargest component 21,689 (99.8%) 21,689 (99.8%)depth histogram 2097/6046/13453/142 2097/6046/13453/142rendered matrix 7fdc63c636938fde 7fdc63c636938fde
Two very different processors, one with an operating system and one with none at all, agreeing on the structure of an animal's brain down to the last bit.
What we are not claiming
We are not claiming that we simulated a fly brain, or learned anything about how one works. We computed exact structural facts about a graph and checked them two ways. The neuroscience is its authors'; what this shows is that an entire animal's connectome fits in sixteen megabytes, and that two unrelated algorithms can be made to agree on it exactly.
Nor is this the whole fly. The hemibrain covers most of the central brain of one hemisphere. The
complete adult brain, 139,255 neurons, is FlyWire, Princeton-led and published in 2024. Its 3.7 million connections would fit here too, at about 8.4 MB. That is the obvious next one.
Data: hemibrain v1.2, Janelia Research Campus FlyEM team, segmentation by Google's Connectomics Group, CC-BY 4.0. Scheffer et al., "A connectome and analysis of the adult Drosophila central brain", eLife 2020. A single C file plus a generated data table, no dependencies beyond a freestanding compiler. Previously in this series: an ant colony, a hardware random number generator, a pile of sand, a maze, a melting magnet, a shape that never repeats, a gas that un-mixes itself, and two computations that know when to stop lying.
Caveat: This post is an opinion piece from a user of Return Infinity's BareMetal Cloud product. Return Infinity supports the guest blogger's research but cannot confirm the method and conclusions. In case of questions or feedback, please contact the blogger directly.