Playing Chess with a Fruit Fly Connectome: An Unconventional Experiment in Dopamine-Driven Reinforcement Learning

A fruit fly's real neural connectome, loaded into PyTorch and trained to play chess via reinforcement learning.
Reddit user AdilSiddiqui mapped Google's fruit fly whole-brain connectome (~164,000 neurons) into PyTorch, constraining signals to travel only along real biological synapses, then used reinforcement learning to train this fixed sparse topology to play chess. The reward mechanism — dubbed "virtual dopamine" — triggers synaptic weight updates only on legal moves or captures. The central question: can a learning algorithm carve out functional pathways in a rigid biological topology where no new connections can be added? The project is open-source on GitHub, supports local GPU training, and includes a community ELO leaderboard challenge.
A Bold Hypothesis: Teaching a Biological Brain's Wiring Diagram to Play Chess
While most machine learning projects keep stacking wider and deeper fully connected networks, one developer (Reddit user AdilSiddiqui) took a radically different path: using the real neural connectome of a fruit fly as the backbone of a neural network, then training it to play chess with reinforcement learning.
The core question driving this project is simple yet deeply counterintuitive — can reinforcement learning carve out functional computational pathways on its own, within a rigid matrix dictated entirely by biological structure? In other words, if the connections between neurons aren't randomly initialized, freely learnable weights, but instead a fixed topology strictly constrained by real biological synapses, can learning still happen?
Importing 164,000 Neurons into PyTorch
The author used connectome data published by Google, covering approximately 164,000 neurons, and mapped this biological wiring diagram into PyTorch. The most critical design constraint: signals can only travel along synaptic connections that actually exist in the biology.
This is fundamentally different from a traditional dense neural network. In a standard network, neurons in each layer connect to nearly every neuron in the next, producing a dense weight matrix. Here, the connectivity matrix is sparse and predetermined by biological structure — you cannot conjure a synaptic connection that doesn't exist. Learning can only adjust the strengths of connections that are already there.
From an engineering standpoint, this amounts to optimizing over a sparse graph with a strict structural prior. That constraint is simultaneously a limitation and a potentially interesting inductive bias: the connectivity structure of a real biological brain is itself the product of billions of years of evolutionary selection.
Connectome refers to a complete map of all neurons and their synaptic connections within an organism's nervous system. The fruit fly (Drosophila melanogaster) whole-brain connectome, jointly released by Google and the Janelia Research Campus, is one of the most complete full-brain wiring diagrams of any animal, containing roughly 146,000 neurons and over 50 million synapses (numbers vary slightly across dataset versions). Producing this map took researchers years of work, primarily through serial electron microscopy of brain tissue slices followed by manual and AI-assisted annotation. The fruit fly was chosen over mammals because its nervous system is relatively compact, yet its behaviors — flight, foraging, learning — are complex enough to make it a "gold-standard model organism" for connectomics research. The key engineering challenge of loading this sparse graph into PyTorch is that the connectivity between 164,000 nodes must be stored and computed as a sparse matrix; using standard dense matrix multiplication would incur prohibitive memory and compute costs.
Using "Virtual Dopamine" as the Reward Signal
The project's reinforcement learning mechanism is described by the author as "virtual dopamine." The approach is straightforward: synaptic weight updates are only applied when the model makes a legal chess move or captures an opponent's piece.
The analogy is direct — dopamine plays a reward and reinforcement role in biological neural systems, and the author equates adjusting synaptic weights with releasing a dopamine signal. Legal moves and captures serve as positive reward events, driving updates to connection strengths.
This design draws a conceptual parallel between reward shaping in reinforcement learning and reward mechanisms in neuroscience. While this is more of an analogy than rigorous biological modeling, it provides a clear operational path for guiding learning on a fixed topology: leave the structure untouched, and only adjust existing connection weights at the moment of reward.
An Open RL Environment: Come Compete for the Leaderboard
The author has open-sourced the complete project on GitHub (fly-connectome-chess), along with a training pipeline that runs on a local GPU:
- After cloning the repo, you can click the "Train" button in the Web UI to start training immediately;
- The project is positioned as a "unique reinforcement learning environment" aimed at anyone who wants to experiment on their own GPU;
- The author also launched a leaderboard-style challenge: if your trained model achieves a higher ELO score than his, submit a PR containing your
weights.ptfile.
This crowdsourced training mechanic — submitting a weights file as a PR — gives the project a community-competition flavor while lowering the barrier for others to participate and reproduce results.
Why This Experiment Is Worth Paying Attention To
Beyond win rates and ELO scores, the genuinely interesting aspect of this project lies in the idea it proposes: replacing human-designed network architectures with a biological connectome.
Mainstream deep learning architecture design (Transformers, CNNs, MLPs, etc.) is fundamentally a product of human engineering intuition. The connectome represents a different possibility — directly borrowing the connectivity structure that biological evolution produced as a computational substrate, then using learning algorithms to discover functional pathways within it. This kind of exploration typically lives at the intersection of neuromorphic computing and connectomics in the academic literature.
That said, a clear-eyed perspective is warranted: using a fruit fly connectome to play chess doesn't inherently mean it's more efficient or more powerful than a dense network. The fruit fly's nervous system never evolved the ability to play chess, and forcing it to perform this task is more of a proof-of-concept exploration — a test of whether the path of "sparse biological topology + reinforcement learning" is viable at all. Its value lies in posing the question and providing a reproducible experimental platform, not in drawing performance conclusions.
Neuromorphic computing is a computational paradigm that aims to mimic the structure and signaling mechanisms of biological neural systems. Representative hardware includes Intel's Loihi chip and IBM's TrueNorth chip. Unlike deep learning on GPUs, neuromorphic systems typically use Spiking Neural Networks (SNNs), which transmit information via discrete "spike" events rather than continuous floating-point values, offering efficiency advantages in low-power, event-driven scenarios. This project does not use a spiking mechanism — it operates within a standard backpropagation/weight-update framework — so it differs from neuromorphic computing at the hardware level. It's better described as "a software experiment that borrows biological topology" rather than a true neuromorphic implementation. Nevertheless, the core question it raises — whether a fixed, sparse biological topology can support arbitrary learning tasks — has direct relevance for neuromorphic architecture design.
Closing Thoughts
This is a quintessential independent developer project: start with a strange question, then actually build it. It stitches together connectomics, reinforcement learning, and game AI in a way that is modest in scale and makes no claims of performance breakthroughs — but delivers an open, playable, reproducible experimental environment. For anyone interested in neuromorphic computing, sparse networks, or non-standard RL environments, a project like this is itself an invitation to get your hands dirty.
Background: The Neuroscience of Dopamine
In real neuroscience, the dopaminergic system — particularly the pathway from the ventral tegmental area to the nucleus accumbens — encodes not "pleasure" itself, but reward prediction error: the difference between the reward actually received and the reward that was expected. This mechanism is the biological counterpart to the temporal difference (TD) algorithm in reinforcement learning. When an unexpected reward arrives, dopamine levels rise and strengthen associated synaptic connections (the "neurons that fire together, wire together" principle of Hebbian plasticity); conversely, when an expected reward fails to materialize, dopamine levels drop and connections weaken.
This project's "virtual dopamine" is a significant simplification: only legal moves and captures serve as discrete positive events that trigger weight updates, with no negative penalties and no explicit modeling of reward prediction error. This makes it closer to a naive "event-driven weight potentiation" than a full TD learning implementation — but that simplification also makes the biological analogy more intuitive and the implementation more lightweight.
Related articles

The AI Virtual Star Meltdown: A Trust Crisis in the Age of AI Idol Manufacturing
An AI-generated virtual star melts down on live TV, exposing the trust crisis behind the AI idol boom. We examine the business logic, technical limits, and regulatory gaps.

Raspberry Pi 5 EEPROM Update Blocks Manual RAM Upgrades: Error Code 9 Sparks Controversy
Raspberry Pi 5's pieeprom-2024-09-23.bin update adds an OTP memory validation check that throws Error Code 9 'SDRAM mismatch' on manually upgraded RAM, blocking boot. Is it a stability measure or anti-repair strategy?

datasette-auth-github 1.0 Released: Fixing Session Expiry Issues
Simon Willison releases datasette-auth-github 1.0, fixing auth sessions expiring too early due to a missing Cookie Max-Age attribute — especially improving Mobile Safari login experience.