Biological Processing Units and a Commodore 64
A scientist at Johns Hopkins named Joshua Vogelstein and his lab did something unusual in 2025. They took a map of a fruit fly larva’s brain, every single neuron and every wire between them (about 3,000 cells and 65,000 connections), and used it as the skeleton of an artificial intelligence program.
Most AI you hear about today uses a structure called a transformer. Transformers do a lot, but they were built from scratch by humans. Nobody fully understands why their internal wiring works, and they burn a ton of electricity. A single query to one of today’s big models uses more energy than a fruit fly’s entire brain uses in a day.
Vogelstein’s idea was simple. Evolution has already designed working brains over hundreds of millions of years. A fruit fly’s brain is tiny compared to ours, but it flies, navigates, remembers smells, learns, and makes decisions on about 6 milliwatt-hours per day. Why not use that design as a starting point for AI?
You don’t try to simulate a living fly brain. You take the wiring diagram (scientists call it a connectome), freeze it as the backbone of a computer program, and only train the input and output layers. (“Layers” is the word AI people use for the horizontal slabs of a neural network. A network is a stack of layers, each one doing some math on its input and handing the result up to the next.) The brain in the middle stays exactly as the fly has it. The program learns by figuring out how to feed data into the fly brain and read the answer back out.
Vogelstein called this a Biological Processing Unit, or BPU. On simple tasks like recognizing handwritten digits, it did about as well as a standard AI with many more moving parts. On the ChessBench benchmark, a 2-million-parameter BPU beat a parameter-matched transformer head to head (74% vs 67% puzzle accuracy). Add minimax search on top and it hits 91.7%, which beats a 9-million-parameter transformer too. (ChessBench is a standard AI test. You feed the model millions of real chess positions and score how often it picks the move a strong chess engine would play.) The small-data result is even better. A 233,000-parameter BPU trained on only 10,000 games was roughly 10 times as accurate on puzzles as any transformer the authors tested at that small-data budget, including a 270-million-parameter baseline. The rule of thumb in modern AI is “more parameters win.” This result says the fly’s wiring is pulling its weight, and a smaller network shaped like a real brain can beat a bigger one built from scratch.
In practice, that means you can do the same job on a smaller computer that uses less electricity and costs a lot less to train. Training a frontier-scale transformer is a data-center job that costs millions of dollars and ties up racks of GPUs for weeks. A BPU that holds its own at a fraction of the size might train on a single workstation in a few hours, then run later on a drone, a wearable, or a cheap microcontroller. That’s the kind of AI you could put in a product.
How This Is Different From an LLM
If you’ve been paying any attention to AI in the last few years, everything you hear about is a large language model, or LLM for short. The handful of top-tier ones are usually called the frontier models. As of 2026, the six that matter commercially are ChatGPT (OpenAI), Claude (Anthropic), Gemini (Google), Llama (Meta), Grok (xAI), and DeepSeek’s R series. They’re all transformers, running hundreds of billions of parameters on racks of GPUs, and each one cost tens to hundreds of millions of dollars to train. A BPU is a very different animal.
A frontier LLM starts as a blank slate. It has hundreds of billions of parameters, and they all start out random. (A neural net is a huge stack of multiplications and additions, and every number being multiplied or added is a parameter that training adjusts.) You train it by forcing the model to predict the next word on the internet, trillions of times, on racks of GPUs for weeks. After that, the knowledge sits smeared across the weights in ways nobody fully understands.
The BPU is almost the opposite. It’s 3,016 neurons, wired exactly the way a real fruit fly larva’s are, and they’re all frozen. The only weights you train are the input encoder and the output decoder, usually a few hundred thousand parameters. You can do the whole training run on a laptop in a few hours.
That’s a factor of roughly 10 million in size and 10 billion in training cost. And the real fly runs its entire body on that wiring.
LLMs bet that if you give a blank structure enough data, it’ll figure out everything it needs to know from scratch. That bet has worked better than anyone predicted. BPUs bet that evolution already solved a version of the problem. Instead of rediscovering the answer with gradient descent on the open web, you inherit the structure for free and only teach the edges. (Gradient descent is the training procedure that gives a random set of weights a trillion tiny nudges until they produce the right outputs.)
The first bet is winning commercially. I like the second bet because it’s orders of magnitude cheaper, uses orders of magnitude less electricity, and you can at least partly look at it and explain why it works. LLMs are generalists. Ask one for a sonnet, a debugged function, or a summary of your inbox, and it will have a reasonable go at all of it. A BPU isn’t a chatbot and never will be. It’s a pattern recognizer that happens to use biology as its substrate. That’s fine for anything that has to run somewhere you can’t drag a data center along, like defense gear, wearables, satellites, or anything that works offline. The industry calls this “edge computing.”
Why I’m Building This
I don’t just want to read the paper. I want to run it on ordinary hardware, because the details a paper leaves out are usually where you learn the most. But I want to understand what I’m building before I build it, so I started with an earlier paper from the same line of research.
The Paper That Started It
Before Vogelstein’s 2025 paper, there was a 2017 paper in Science by Sanjoy Dasgupta, Charles Stevens, and Saket Navlakha. They took a much smaller slice of the fly brain, the part that processes smell, and asked a question that’s weird for a biologist but pretty normal for a computer scientist. What is this circuit actually computing?
The fly has about 50 types of smell receptors. Those feed into a set of roughly 2,000 neurons called Kenyon cells in a structure called the mushroom body. Each Kenyon cell samples a small, random handful of the 50 input channels from the smell receptors, maybe six. When a smell arrives, each Kenyon cell sums its six inputs. Then an inhibitory neuron (a neuron whose job is to shut other neurons off rather than make them fire more) called APL reaches across all 2,000 Kenyon cells and silences everyone except the top 5% that got the biggest sums.
What’s left is a sparse binary fingerprint. Out of 2,000 Kenyon cells, about 100 are active. That fingerprint is what the fly remembers. Two similar smells produce fingerprints that overlap a lot. Two different smells barely overlap at all.
Dasgupta and coauthors noticed that this is an exact match for a computer science tool called locality-sensitive hashing. Classical LSH takes a high-dimensional vector and produces a short binary hash such that nearby vectors get similar hashes. You use it to find “things like this one” in a big database without comparing against every entry. Reverse image search, plagiarism detectors, and duplicate-document finders all lean on it.
The fly got there first, apparently by the late Cambrian period.
The 2017 paper found that the fly’s version, which I’ll call the fly-hash, beats classical LSH on standard benchmarks, especially when you only get a few hash bits per item. The 2025 BPU paper uses the same fly and the same idea of letting biology do the hard part. It just uses a much bigger piece of the connectome.
If I can reproduce the 2017 result, I’ll understand the 2025 result a lot better when I get there.
How the Fly-Hash Works, in Plain English
Here’s the whole algorithm. I’ll write it out once in English and once in about fifteen lines of Python.
- You have an input vector. (A vector is just a list of numbers. The dimension is how long the list is.) For the fly, that’s 50 smell-receptor activities, so a 50-dimensional vector. For MNIST (the standard “hello world” dataset of machine learning: 70,000 handwritten digits, 28 by 28 pixels each), it’s a 784-pixel digit unrolled into one row, so a 784-dimensional vector.
- You have a big random sparse projection. Make a table of “Kenyon cells.” Each cell picks a few input dimensions at random and just adds them up. That gives you a much longer vector of activations.
- Winner-take-all. Keep only the positions with the biggest activations. Set everything else to zero. The paper uses the top 5%, so if you had 2,000 Kenyon cells you keep 100.
- The result is a sparse binary vector. That’s the hash.
Explaining this at a coffee shop
Three blue dots on the left light up. Those are smells hitting the fly’s nose right now. Six gold lines fan out to a single circle in the middle. That’s the one Kenyon cell that happened to be watching all three of those receptors, so it wins the competition. The red bar that slides in is the APL neuron, silencing every Kenyon cell except the winner. The winner’s slot at the bottom row goes black. That row, mostly empty with one filled square, is the fly’s answer to “what is this smell?” A similar smell lights mostly the same slots. A different smell lights different ones.
Two things matter here:
- The wiring is random and never changes. When each Kenyon cell is “born” in the fly, it chooses which six receptors to monitor by coin flip. That choice stays fixed for the rest of the fly’s life, and nothing about it is ever learned. Modern AI works the other way around. In a transformer, every number inside the network gets nudged billions of times during training until the whole thing produces useful outputs. The fly gets its wiring for free and just uses it.
- The first step makes the representation bigger, not smaller. If you’ve heard the word “hash” in programming (MD5, SHA1, Python’s
hash()), you probably think “take a big file and squash it into a tiny fingerprint.” The fly does the reverse. It takes 50 receptor readings, blows them up into 2,000 Kenyon-cell sums, and then throws away all but the loudest 5%. What comes out is a long, mostly-empty vector instead of a short, crammed one. It looks wasteful, but that’s why similar smells produce overlapping tags. A small change in the input only nudges which cells are loudest. A classical hash would scramble the whole fingerprint.
Here it is in Python, ignoring any optimization:
import random
def build_projection(n_input=50, n_kenyon=500, samples=6, seed=42):
rng = random.Random(seed)
return [sorted(rng.sample(range(n_input), samples)) for _ in range(n_kenyon)]
def fly_hash(input_vec, projection, wta_percent=5):
# 1. sparse random projection: each Kenyon cell sums a few inputs
activations = [sum(input_vec[i] for i in cell) for cell in projection]
# 2. winner-take-all: keep the top wta_percent
n = len(activations)
k = max(1, n * wta_percent // 100)
top = sorted(range(n), key=lambda i: (-activations[i], i))[:k]
# 3. sparse binary output
tag = [0] * n
for i in top:
tag[i] = 1
return tag
That’s it. You don’t even need numpy. About fifteen lines of plain Python cover the core idea of the 2017 paper and a good chunk of the 2025 paper too.
Does It Actually Act Like a Hash?
Back to that word “hash.” If you come from programming, it probably means MD5, SHA, or Python’s built-in hash(). Those are designed to scramble (sorta). Flip one bit of input, and the output looks completely different. That’s what makes them useful for checking whether a file was tampered with, or for distributing keys into a dictionary.
The fly-hash is a different kind of hash. It’s locality-sensitive, which means similar inputs produce similar outputs. You don’t use it to check whether two photos are byte-for-byte identical. You use it to find photos that are kind of like this one.
A locality-sensitive hash is only useful if that’s true, so I built a tiny test with 20 black-and-white pictures on a 5-row by 10-column grid (fifty cells total, which conveniently matches the fly’s 50 smell channels). I arranged them in 10 pairs. Within each pair, the two images are small variations of each other (shift one pixel, add a stub, that kind of thing). Across pairs, the images are completely different shapes.
plus_small: plus_wide:
.......... ..........
....##.... ....##....
..######.. .########.
....##.... ....##....
.......... ..........
The full set of twenty:

All twenty reference patterns. Each row is two class pairs. Within a pair, the two patterns are small variations of each other (shift, stub, one-cell flip). Across classes, the shapes have nothing in common.
If the hash works, plus_small and plus_wide should produce overlapping hashes. And neither should overlap much with, say, a checkerboard pattern.
What does “overlap” mean here? Each hash is a list of 25 winning cells (out of 500 total). The overlap between two hashes is the number of cells that show up in both winner lists. Some numbers to keep in mind:
- 25 out of 25 means identical hashes (every winner is shared).
- 0 out of 25 means the hashes share no cells at all.
- About 1.25 is pure chance. If you picked 25 winners out of 500 cells at random for each hash, chance alone gives you about 25 × (25/500) = 1.25 shared winners on average. Anything well above 1 is a real signal. Anything near 1 is noise.
Higher overlap = more similar. That’s what we want to see on the within-class pairs.
Here are all ten class pairs I ran, each showing the overlap between that class’s two variants:
| within-class pair | shared winners |
|---|---|
| diag_clean / diag_kink | 22 of 25 |
| x_plain / x_centered | 19 of 25 |
| fill_solid / fill_hole | 18 of 25 |
| vbar_plain / vbar_notch | 16 of 25 |
| box_full / box_clipped | 16 of 25 |
| corners_block / corners_tag | 16 of 25 |
| hbar_plain / hbar_stub | 15 of 25 |
| plus_small / plus_wide | 13 of 25 |
| arrow_plain / arrow_tail | 12 of 25 |
| check_plain / check_extra | 9 of 25 |
Average across those ten within-class pairs: 15.6 out of 25. In other words, on average, 60% of the winners of one variant are also winners of the other variant.
Now compare that to the 190 across-class combinations (every other way to pair two patterns that aren’t each other’s variant). Average overlap across those: 1.9 out of 25. That’s barely above the random-chance baseline. Pick any two patterns that are supposed to be different, and the hash says they have almost nothing in common.
So the signal is roughly 8x stronger within a class than across classes. That’s what “locality-sensitive” means in practice. The fly is doing nearest-neighbor matching, and we get to watch.
Matching the Paper on MNIST
The 20-bitmap demo shows the algorithm works on toy inputs. The paper does something harder. It runs fly-hash on real handwritten digits from MNIST, the dataset described above, and compares it against the standard computer-science tool that solves the same problem.
That standard tool is called SimHash. It’s what a computer scientist who had never heard of this fly paper would build. Imagine drawing a bunch of random lines through your data and, for each line, writing down whether the input landed on the left side or the right side. That string of yes/no answers is the hash. It’s simple and fast, and it’s good enough that people ship it in production.
The test is called nearest-neighbor retrieval. You take a fresh image and find the items in a big database that are most similar to it. Here’s how it’s scored. You have 10,000 reference images stored in a database. You hand the hash a fresh image it has never seen before, and ask it to pick the 200 references most similar to the query. Then you check how many of those 200 picks really are among the 200 most similar images. (You know the real top 200 because you can compute them by brute force ahead of time. That’s the answer key.) A perfect hash gets all 200 right and scores 1.0. A random hash scores near zero. The name for this score is mean average precision, or mAP for short.
Both hashes get the same bit budget per image. A bit budget is how many 1s and 0s (bits) each image’s hash gets. I tested 2, 4, 8, 16, and 32 bits. Both hashes get the same storage per image, and the only difference is how they decide which bits go where.

fly-hash beats classical SimHash at every hash-bit budget. The gap is largest when you have only a few bits to spend. Averaged over three random seeds.
| hash bits | fly-hash | classical SimHash | fly beats by |
|---|---|---|---|
| 2 | 0.062 | 0.003 | 26x |
| 4 | 0.106 | 0.008 | 14x |
| 8 | 0.184 | 0.029 | 6.5x |
| 16 | 0.292 | 0.077 | 3.9x |
| 32 | 0.408 | 0.173 | 2.4x |
Fly-hash wins at every bit budget (higher is better). The biggest margin is at the smallest budgets, where you have to squeeze a handwritten digit into just two or four bits of identity. At 32 bits, classical SimHash finally starts to tell 200 MNIST digits apart with some skill. Fly-hash is still more than twice as good.
My graphed numbers are slightly steeper than the paper’s, but the shape of the curve and the conclusion are the same. The gap comes from small choices the paper doesn’t spell out (retrieval size, tie-breaking, preprocessing), and I checked that twiddling those doesn’t change which hash wins.

My measured fly-hash mAP against the paper’s reported numbers on MNIST. The paper’s values are eyeballed from its Figure 2 and should be treated as approximate. My curve is a little steeper at the low-bit end and a little higher at the high-bit end, but fly-hash still beats classical at every budget.
That’s what I wanted to see. It isn’t an exact replication, but the algorithm does what the paper says on real data against a real baseline. Blowing the input up and then keeping only the winners is a better way to do nearest-neighbor hashing when you only have a few bits to spend.
Now Put It on a Commodore 64
You knew this was coming, right?
Vogelstein’s 2025 paper uses a 3,000-neuron connectome and trains input and output layers with PyTorch on a modern GPU. None of that fits on a Commodore 64. But the 2017 fly-hash, shrunk down to 500 Kenyon cells and 20 reference patterns, absolutely does. (A “reference pattern” here is one of the twenty toy bitmaps shown earlier. They’re the C64’s tiny library of known smells to compare new inputs against.)
I’m not doing this just for laughs. Running an algorithm on a computer that’s a million times slower than your laptop forces you to understand it completely. You can’t hide behind import numpy or torch.nn.Linear or the Metal GPU in my Macs that run 4.26 TFLOPS (trillion floating-point operations per second).
The Commodore 64’s 6510 CPU at ~1 MHz can, at best, perform about 300,000 operations per second, and we only have 64k of RAM. You end up counting bytes, and you count every instruction in the inner loop. By the time the thing runs on a 1 MHz 6510, you know exactly what the Mac GPU was doing for you for free, which is most of the algorithm.
There’s a second reason too, and I’ll come back to it at the end. The memory and compute footprint that the C64 forces on you is similar to that of the 50-cent embedded microcontrollers made in the last fifteen years. If the fly-brain algorithm works at C64 scale, it works on a two-dollar chip you can solder to a breadboard and run off a battery for a month.
So let’s do it.
Are YOU keeping up with the Commodore?
Here’s the memory budget at the scale I picked:
| thing | bytes |
|---|---|
| projection (500 cells × 6 indices) | 3,000 |
| 20 reference patterns (50 bits each) | 1,000 |
| 20 reference hashes (25 active each) | 500 |
| working arrays | ~2,000 |
| program code | ~1,000 |
That’s under 8 KB of core data on a machine with 38,911 bytes free after BASIC loads. Pretty comfortable.
The projection and reference hashes get generated on my desktop once and exported as BASIC DATA statements. The Python side writes files like:
REM FLY-HASH PROJECTION: 500 KENYON CELLS X 6 INPUTS EACH
REM 3000 BYTES TOTAL, INDICES 0..49
10000 DATA 1,7,14,15,17,40,5,6,8,34,43,47,1,2,5,13
10010 DATA 41,49,23,24,30,46,7,15,18,26,32,42,...
The C64 reads that with READ into an integer array and off we go.
The hash loop in Commodore BASIC V2 is a direct translation of the Python:
1000 REM HASH PATTERN P INTO QT
1010 FOR K=0 TO NK-1
1020 AC%(K)=PAT%(P,PR%(K,0))+PAT%(P,PR%(K,1))+PAT%(P,PR%(K,2))
1030 AC%(K)=AC%(K)+PAT%(P,PR%(K,3))+PAT%(P,PR%(K,4))+PAT%(P,PR%(K,5))
1040 NEXT K
1050 REM WINNER-TAKE-ALL
1060 FOR W=0 TO NW-1
1070 MX=-1:KX=-1
1080 FOR K=0 TO NK-1
1090 IF AC%(K)>MX THEN MX=AC%(K):KX=K
1100 NEXT K
1110 QT%(W)=KX
1120 AC%(KX)=-1
1130 NEXT W
1140 RETURN
PR%(K,S) is the input dimension that the S-th sample of Kenyon cell K looks at. PAT%(P,D) is bit D of pattern P. AC%(K) is the sum for Kenyon cell K. The winner-take-all loop finds the maximum, writes it to the output tag, blanks it out with -1, and repeats 25 times.
For you Commodore nerds now yelling at me: Integer variables with % are actually slower than floats in BASIC V2, because the interpreter converts them back to floats for every arithmetic operation. I used them anyway because they halve the array memory, which matters more than speed here.
Running It
Let’s get the BASIC program into the C64 and let it start crunching.
Each pattern number gets an OK when it passes. The Python reference generator pre-computes what the 25 winner indices should be for each of the 20 patterns, writes them into BASIC DATA statements, and the C64 compares its own hash against those reference indices pattern by pattern. OK means every winner index matched the Python reference. 20 OKs means the 6510 and my laptop agree on all 500 winner-cell decisions.

Stock C64 running the fly-hash on all 20 reference patterns. 20 passed, 0 failed. About 45 minutes from RUN to READY on a 1 MHz 6510.
Forty-five minutes on a real 1 MHz 6510 is a long time to watch a demo. Load the program, type RUN, go make coffee, come back, and the last pattern is just being checked. That’s why the next version of this code is written in 6502/6510 assembly. The projection loop and the winner-take-all loop together account for almost all of those 45 minutes, and both translate cleanly to native 6502.
Making It Fast
BASIC V2 is slow. The hash’s inner loop does roughly three thousand pattern-byte lookups plus three thousand additions per pattern, and the winner-take-all does twelve thousand comparisons. Multiply by the interpretation overhead and you get 45 minutes.
So I wrote the two slow inner loops in 6502 assembly and left BASIC in charge of everything else. BASIC still loads the projection, references, and patterns from DATA into fixed memory addresses. BASIC still drives the outer loop and prints results. But the inner work happens in 465 bytes of hand-written machine code at $c000, called from BASIC with sys 49152 once per pattern.
Here’s the projection loop in 6502, which replaces BASIC lines 1020-1030. Those two BASIC lines sum six pattern bytes through layers of array-index math. The assembly reads the values through two pointers and doesn’t use floating point at all:
projectloop
; 0th input index for this kenyon cell
ldy #0
lda (projptr),y
; y = that index (0..49)
tay
; a = pattern[index] (0 or 1)
lda (patptr),y
sta tempsum
ldy #1
lda (projptr),y
tay
lda (patptr),y
clc
adc tempsum
sta tempsum
; ... same for samples 2..5 ...
; +1 so 0 can mean "already picked"
clc
adc #1
; activations[cell] = sum + 1
ldy #0
sta (actptr),y
; advance projptr by 6, actptr by 1,
; count down cellcount, loop
Each instruction takes 2 to 5 clock cycles on the 6510, and there’s no floating point anywhere in there.

The same 20 patterns and reference hashes, now in assembly. 18.57 seconds instead of 45 minutes, and the 6502 inner loop fits in 465 bytes.
Twenty passed, zero failed, 18.57 seconds. That’s about 145 times faster than BASIC, and I haven’t even tuned the assembly yet. The winner-take-all is still a naive O(n) scan done twenty-five times, and the projection still uses 16-bit address arithmetic everywhere.
An algorithm from a 2017 Science paper now runs fast enough to use on a forty-three-year-old computer, with a processor that’s a LOT less powerful than your Apple Watch.
Pushing to MNIST Scale with an REU
The 20-pattern demo shows the algorithm works, but it doesn’t show it’s useful. For that, I want real data, meaning thousands of handwritten MNIST digits, indexed by fly-hash and searched by the C64 itself. The math on that is rough. Ten thousand MNIST references, each hashed to 25 winner cell indices stored as 16-bit integers, is half a megabyte of reference tags alone. A stock Commodore 64 has 64 KB of RAM total, most of it unavailable once BASIC loads.
Commodore shipped a fix for this in 1985, the RAM Expansion Unit, or REU. It’s a cartridge stuffed with extra RAM chips plus a built-in copier called a DMA controller. DMA stands for “direct memory access,” and the idea is that the cartridge can move a chunk of its own memory into the Commodore 64’s main memory in one request, without the main CPU having to ferry each byte by hand. On a 1 MHz chip, that’s the only way the numbers work. The original REU held at most 512 KB, but modern drop-in replacements, such as the Ultimate 1541-II+, have an REU that looks like original Commodore hardware to the C64.
I can hear the purists screaming, but just hang with me here. I want to demonstrate that a simple computer can do this work without getting caught up in religious wars.
Mine goes up to 16 MB, and I can preload content from an SD card at boot. For our purposes, 16 MB is plenty to hold:
- the 500-Kenyon-cell projection matrix (6 KB)
- ten MNIST test digits (8 KB)
- ten thousand reference digit hashes (500 KB)
- ten thousand ground-truth labels (10 KB)
All generated on the Mac, packed into a 16 MB binary file, and copied to an SD card that the Ultimate II+ reads on boot.
The C64 side is a new BASIC driver that calls a new 881-byte 6502 routine at $c000. For each of the ten pre-loaded test digits, the assembly:
- DMAs the query image from REU into C64 RAM, binarizes the pixels
- Hashes it with the same 500-cell, 25-winner fly-hash
- Builds a 63-byte bitmap of the query’s winner cells
- DMAs each of the 10,000 reference hashes one at a time, counts bitmap overlaps, and maintains a top-5 leaderboard
- DMAs the five winning labels from the REU’s labels region
- Returns to BASIC, which prints one row of the results table
Each query takes 28 seconds on a real 1 MHz 6510, and most of that is the 10,000 REU-to-C64 reads of 50 bytes each. The full ten-query run is under five minutes.

Real MNIST retrieval on a real Commodore 64 with a 16 MB REU. For each of ten pre-loaded test digits, the C64 hashes the digit and returns the five most-similar references out of ten thousand. 42 of 50 top-5 predictions match the query’s true label.
Slot 0 is a handwritten “7”. The C64 hashes it, walks all 10,000 references in the REU, and returns five references the fly-hash says are most similar. All five are labeled “7”. Slots 1 through 4 are also a clean 5 for 5. Slot 5 retrieves four 9s and one 4 for a “9” query, which is close. Slot 6 is harder. The “4” comes back as 4, 4, 4, 9, 9, so it gets three right. Slot 9 is the tough one, a weird-looking “2” that gets pulled back as 1, 3, 1, 3, 3. That’s zero out of five.
84% top-5 accuracy on real MNIST, from a forty-three-year-old computer and an expansion cartridge designed about three decades before the paper it’s running was written.
Neat-O.
What the C64 Proved
Step back from the 1982 aesthetic for a second (or don’t, I’ve not stopped loving it). The whole classifier, twenty reference patterns plus a 500-Kenyon-cell projection, fits in about 8 KB of data and another 2 KB of code. That fits comfortably in an ATmega328, the chip inside an Arduino Uno, or an ESP32, a dollar-and-a-half microcontroller with Wi-Fi. It also fits in a couple dozen other microcontroller families that run around 160 MHz and draw tenths of a watt.
160 MHz is roughly 160 times faster than the C64. A modern 32-bit core also does about 6 times as much work per clock as a 6510, so call it 1000x faster overall. The same algorithm, at the same scale we just proved correct, would run in a few seconds on a thing you can put on a breadboard and power with a battery for a month.
The Commodore 64 is the fun part, but the microcontroller version is a real chip you can buy today, and it’s cheap.
So, what would you actually do with that chip?
Where a BPU Earns Its Keep
Nobody is going to use a BPU to write code or summarize PDFs. The better question is where an LLM can’t go, and what a fly-brain-sized network could do there.
Here are three examples:
On-orbit image triage. A cubesat (a small standardized satellite, each unit a 10-cm cube, often no bigger than a shoebox) in low Earth orbit runs its camera and computer on a few watts. Downlink bandwidth is scarce and expensive. You don’t want to downlink every frame. You want the spacecraft to sort images on board: ship or no ship, smoke plume or shadow, new road since last pass or not. An LLM won’t fit in the spacecraft’s RAM, let alone run on that power budget. A BPU fits with plenty of room to spare. That’s the kind of problem DARPA’s O-CIRCUIT program is aimed at.
Wearable health. A smart ring or watch that continuously classifies what you’re doing (walking, running, sitting, falling down, sleeping badly, having a heart event) needs to run for a week on a battery and can’t depend on your phone having a signal. The classifier has to be tiny and fast, and it has to keep working when conditions change. Most wearables cheat by offloading inference to a phone or the cloud. A classifier this small could run right on the ring.
Smell. The fly circuit we just replicated is a smell classifier. It’s good at nearest-neighbor-style “is this like any of these reference things” problems because that’s the problem it evolved to solve. Point a small electronic nose at an industrial pipeline and have it continuously sniff for the 200 volatile organic compounds that mean “leak.” Point it at a cargo container and have it notice cocaine or fentanyl. Point it at a loaf of bread in a grocery supply chain and have it call out the beginnings of mold. There’s real money in this, and current AI hasn’t broken into it, partly because LLMs are the wrong shape for the job. The algorithm we ran on the Commodore 64 is closer to the right shape than any of the frontier models.
None of those places can host a frontier LLM, and none of them should be sending every detection to the cloud. A fly-hash this size fits fine.
I’m sure if we sat here for 20 minutes, we could come up with a hundred more.
I triple dog dare you.
Just for Fun: The Same Algorithm on a Timex 2068
A friend of mine had a Timex Sinclair 2068 as a kid and cut his first programming teeth on it. He brought that up last week, and the idea of putting the fly-hash on a 2068 stuck. After a couple of days hanging out with him, I traded a spare TI-99/4A to get my hands on a real 2068 of my own. I kept everything the same as the C64 demo, with the same reference data, 500 Kenyon cells, and 20 patterns. Only the processor (a Z80 instead of a 6510) and the BASIC dialect are different.

My Timex Sinclair 2068. Look at the keys. Every one of them has three or four legends printed on it for the different shift modes. PRINT lives on the P key, OR lives on the U key, GO TO is on G, and so on. That’s what BASIC entry looks like on this machine.
I should say up front that I find the Sinclair-style keyboard input model nearly impossible to use. On a real 2068 (and the Spectrum it descends from), you don’t type BASIC keywords letter by letter. Each key is overloaded with a whole keyword that gets entered as a single token, and which keyword you get depends on which of several shift modes the editor is in. Pressing P in the right mode gives you PRINT. Pressing it in a different mode gives you the letter P. Coming from a Commodore keyboard, where every keystroke is just the character on the cap, it feels like trying to type with mittens on.
The trouble started with memory. Sinclair BASIC stores every numeric value in a DATA statement as ASCII text and a hidden 5-byte float. A 500-by-6 numeric array eats 15 KB on its own. The full set of weights comes to about 35 KB as DATA statements, and the arrays they load into need another 21 KB or so. The 2068 has roughly 41 KB free for BASIC, so it doesn’t fit.
So the data goes into strings instead, packed as CHR$ codes:
- The 3,000 projection indices become 3,000 single characters in
A$. Each character isCHR$(35 + value), which keeps every byte within printable ASCII and avoids the double quote. - The 1,000 pattern bits are just
'0'and'1'inB$. - The 500 reference indices need two characters each (since they go up to 499) and live in
C$as base-90 pairs.
That gets the data down from about 35 KB unpacked to 5 KB packed. The whole program, arrays included, fits with about 13 KB to spare.
Sinclair BASIC has its own quirks. Arrays are 1-indexed instead of 0-indexed. LET is mandatory on every assignment. The screen pauses with a scroll? prompt every 22 lines unless you POKE 23692,255 to keep the counter cranked up. None of it’s hard, you just have to remember it.
All 20 patterns match the reference hashes. That’s the same answer the C64 produced, on a different chip family and in a different BASIC dialect.

Timex 2068 chewing through the 20 patterns. Twelve in, eight to go. No scroll prompt thanks to POKE 23692,255.

20 PASS, 0 FAIL. 403,224 frames at 50 Hz is 8,064 seconds, which works out to a little over two and a quarter hours.
The Timex BASIC isn’t faster than the Commodore BASIC. In fact, it’s slower by a good margin. At least my implementation is. I’m sure there are Spectrum people screaming at me right now. Calm down. The same algorithm at the same scale took 45 minutes in Commodore BASIC on a 1 MHz 6510, and a little over 2 hours in Sinclair BASIC on a 3.5 MHz Z80. The extra clock speed disappears into floating-point math and 2D array lookups. A Z80 assembly version would be the obvious next step, to match the 6502 port. That’s a job for another weekend, if I can stomach this keyboard for one more minute.
What This Is Warming Up For
All of this is Phase 0 of a bigger project. Next up is the actual Vogelstein 2025 paper: 3,016 larva neurons, MNIST digit recognition, plus CIFAR (basically MNIST-but-harder: small color photos of ten object categories like airplane, cat, and truck). It’ll run on my Mac mini’s built-in GPU, which is fast enough to train the whole thing at home in a few hours.
After that, the open question is whether more biology buys more performance. The adult fruit fly’s full wiring diagram was recently mapped by the FlyWire project. It has 139,000 neurons, roughly fifty times the size of the larva’s. Does the bigger brain handle harder tasks, or does it not help at all? I’d like to find out.
Dasgupta, Stevens, and Navlakha did the hard part in 2017. I just translated their algorithm to two 1980s chips and confirmed the answer still comes out right.
The Commodore 64 and Timex 2068 don’t solve any of those open problems. What they do is let me hold the algorithm in my hand and watch it move, on the slowest machines I care about.
For me, that’s what retro computing is for, and it’s why I’m happy to spend weekends on this kind of thing. LLMs won the last decade by betting that scale and data can stand in for structure. BPUs bet that for the problems a data center can’t reach, six hundred million years of evolution still beats last year’s GPU allocation. Both bets can be right. I want to spend some time with the second one.
So I loaded the demo on a real C64, typed RUN, and watched a 1982 computer do what a fruit fly does. Then I did it again on a Timex. Pretty neat for a weekend project.
Glossary
Terms that show up in this piece without a full definition, for anyone (me included) using this as a study guide. The five big ones (parameter, gradient descent, vector/dimension, inhibitory neuron, MNIST) are explained where they first show up. Everything else is below.
Sparse random projection. The first step of the fly-hash. Each output cell (“Kenyon cell”) only looks at a small random handful of the inputs, not all of them. “Random” because which inputs get looked at is chosen once with a random number generator and frozen forever. “Sparse” because the handful is small: about 10% of the inputs in the paper, fewer in smaller versions.
Winner-take-all. A general neural-circuit pattern where a group of competing cells silences all but the strongest few. In the fly’s mushroom body, the APL neuron implements an approximate winner-take-all across the ~2,000 Kenyon cells, leaving about 5% active. In machine learning, the same pattern shows up under names like “top-k,” “k-sparse coding,” and “lateral inhibition.”
Kenyon cells/mushroom body. The mushroom body is a paired structure near the top of the fly’s brain, named after its shape. Its principal neurons are the Kenyon cells, named after Frederick Kenyon, who identified them in 1896. They’re where the fly stores odor memories, and they’re what the 2017 paper is about.
Substrate. The physical or structural thing doing the computing. Silicon is the substrate of a CPU. Transformer weights are the substrate of an LLM. The fly connectome is the substrate of a BPU. The distinction matters because the same algorithm can run on different substrates (with very different power and size costs), and a different algorithm on the same substrate can make a completely different machine.
Transformer. The neural-network architecture behind every LLM you know. Its big idea is called “attention.” Each token in the input (word, pixel, whatever) gets to look at every other token and decide how much it cares about each. The results are combined, passed through a few standard layers, and handed to the next attention block. Repeat that dozens of times, and you’ve got GPT. Introduced in a 2017 Google paper called Attention Is All You Need.
Large language model (LLM). A transformer trained on enormous amounts of text (books, web pages, code) to predict the next word given the preceding words. That one objective, at sufficient scale, produces systems that can summarize, translate, write code, and chat. ChatGPT, Claude, Gemini, and Llama are all LLMs.
Connectome. A complete wiring diagram of a nervous system: every neuron, every synapse, every direction of every connection, mapped out from electron microscopy reconstructions. The fruit fly larva was the first whole-animal brain connectome, published by Winding et al. in 2023. The adult fly followed via the FlyWire project.
Nearest-neighbor retrieval. Given a query item and a database of reference items, return the references most similar to the query. “Similar” could mean lowest Euclidean distance, highest cosine similarity, fewest differing bits, whatever the problem needs. The engine behind image search, song identification, recommendation systems, and plagiarism detection.
Edge computing. Any computation that happens close to where the data is generated, without shipping it off to a cloud data center. A smart thermostat guessing “you’re home” from a motion sensor is edge computing, and so is a satellite sorting images in orbit. Anything that can’t rely on network connectivity counts, and anything that has to run on a battery mostly has to run this way.
Spectral radius. The largest magnitude among the eigenvalues of a matrix. Not in this article, but it will come up in the next one: reservoirs need their recurrent weight matrix to have a spectral radius below 1 to avoid “exploding dynamics” where the signal grows without bound when the network is iterated.
Reservoir / reservoir computing. Also not in this article. A neural-network architecture where a large recurrent middle layer is fixed at initialization and only the input and output projections are trained. The BPU is a reservoir whose middle happens to be a real fruit fly brain instead of a random matrix.