Essay:

I Wired an LLM to a Fly's Brain

What happened when I gave a language model a piece of a fruit-fly nervous system and withheld the meaning of its controls.

By Vishnu Rajkumar

Sep 17, 202616 min read#ai#agentic-ai#software#technology
Ryland Grace reaches towards Rocky, a spider-like alien, through a transparent enclosure in Project Hail Mary
A different nervous system, and a different question about intelligence.

I

In 2020, Google Research and HHMI Janelia released the Drosophila hemibrain, a synapse-resolution reconstruction covering roughly 25,000 neurons and more than 20 million neural connections. The scale mattered, but so did the change in form. A piece of nervous system that had existed as biological tissue could now also be traversed as data.

The work was possible because connectomics had itself become partly an AI problem. Electron microscopy produces vast volumes of imagery. Individual neurons have to be followed through those images across section after section, reconstructed in three dimensions, matched across synapses, proofread and eventually annotated. Google's flood-filling networks and related machine-learning systems helped automate a task that would otherwise have been impossible at this scale; Janelia and the wider research community supplied the biological interpretation and enormous amounts of human verification.

The maps kept getting larger. The FlyWire collaboration later reconstructed an entire female fruit-fly brain. In 2026, Google Research, Janelia and collaborators published the complete male central nervous system: 166,691 neurons spanning the brain and ventral nerve cord, with roughly 125 million synaptic connections.

Three views of a colour-coded reconstruction of the adult Drosophila central nervous system
The adult Drosophila central nervous system reconstructed at synaptic resolution.

That last part changes the character of the object. The ventral nerve cord is where the brain begins to meet the machinery of the body. The dataset no longer stops at a brain in isolation; it extends into circuits involved in turning sensation and internal state into action.

AI had already helped reconstruct the wiring. I wanted to put an AI on the other side of it.

Moving through the fly connectome: neurons, synapses and structure at a scale difficult to comprehend from a static map. Data: HHMI Janelia, Cambridge Connectomics Group and Google Research. Video: Philip Hubbard / HHMI Janelia.

II

Most contemporary agents operate under a hidden advantage: their environment arrives with semantics attached.

A tool might be called search_web, send_email or query_database. The tool name already narrows the hypothesis space. Its description tells the model what sort of effect to expect. Its parameters tell it which dimensions matter. Even before the first action, much of the intellectual work has been done elsewhere.

An API is compressed prior understanding.

Biological systems are not arranged for the convenience of their controller. A nervous system does not expose turn_left(). It does not tell you whether forward motion belongs to one neuron, a population, a temporal pattern or a relationship between several circuits. There are cells, connections and consequences, but the verbs have not been supplied.

That became the experiment. I wanted to know whether a general-purpose language model could acquire a useful control vocabulary when the actuators were available but their meanings were withheld.

The more interesting phrase turned out to be control vocabulary. Controlling the toy world was easy enough that a conventional controller could outperform what I built. The interesting part was watching meaningless intervention points gradually acquire operational meaning.

III

I used Janelia's Male CNS dataset through neuPrint and started around a bilateral pair of descending neurons called DNa01. Descending neurons are useful territory for this kind of experiment because they sit near the transition from higher neural processing into circuits capable of affecting the body.

The first extraction around DNa01 contained 1,288 neurons. I later expanded the neighbourhood by another hop and pruned it into a circuit small enough to run repeatedly on my M4 Mac - 493 neurons connected by 631 weighted edges.

Network diagram with the bilateral DNa01 neurons at the centre, surrounded by first- and second-hop neurons
The full connectome contains 166,691 neurons. The experiment did not need all of them. This is the smaller circuit that emerged around DNa01.

Those edges came from the connectome. The dynamics did not.

A wiring diagram is not an executable nervous system. Anatomical connectivity leaves out much of what determines biological activity: membrane dynamics, receptors, neuromodulation, inhibition, the recent history of the circuit, the state of the animal and the sensory environment around it. Treating the connectome itself as a runnable fly would turn a useful dataset into a story it cannot support.

So I used deliberately simple dynamics. Activity propagates through retained outgoing connections, weighted by their relative strength. It decays between steps and passes through a saturating non-linearity.

raw[target] += activity[source] * normalized_weight

next_activity[target] = 1 - exp(-GAIN * raw[target])

activity *= DECAY

Five propagation steps were enough for the interventions I cared about to reach the downstream motor neurons in the extracted circuit.

I think of the result as a connectome-constrained artificial nervous system. Its topology comes from biology. Its physiology belongs to the experiment.

IV

Before giving anything to a language model, I needed to establish that the circuit contained a usable control surface.

Stimulating one of the DNa01 neurons produced this downstream motor recruitment at the second propagation step:

left motor     1.051
right motor    0.038

Stimulating its counterpart produced almost the reverse:

left motor     0.026
right motor    1.418

I collapsed the asymmetry into a crude directional measure.

directional_score = right_motor - left_motor

The two interventions therefore produced scores of roughly -1.013 and +1.392.

At this point the biological names stopped being useful. I removed them.

Qwen 3.5 9B, running locally through Ollama, received only integer neuron IDs. It could list the available intervention points, stimulate one and observe the resulting motor trajectory. Some IDs were useful, some weak, some nearly inert. The model was explicitly told not to infer anything from the numbers themselves.

Its experimental notebook began filling with measurements like these -

Opaque interventionDirectional effect
10760+1.392
801371+1.184
800544+0.882
800497+0.635
9025010.000
8038430.000
800832-0.092
801666-0.417
10442-1.014
800613-1.045

The absolute ranking has no biological significance. The circuit is truncated and its connections are renormalized, which can make downstream interventions appear disproportionately strong. The interesting change was happening at another level.

Before the first experiment, 10760 was an integer. Afterwards it was an integer associated with a repeatable causal effect. Repeat the process often enough and an actuator that began without semantics starts behaving like a concept.

Terminal output showing Qwen stimulating opaque neuron IDs and recording left- and right-motor responses
Qwen probing the nervous system through interventions rather than a predefined catalogue of actions.

Ordinary software moves from an abstraction to its implementation.

meaning → interface → action

Here the order was reversed.

action → consequence → inferred meaning

V

Direction alone is still a weak vocabulary. Knowing that one actuator pushes the system one way and another pushes it the opposite way does not tell you how much to use.

So I replaced the classification task with a control problem. The model received an arbitrary target directional score and could choose both the neuron and a stimulation strength between zero and one.

For a target of -0.50, Qwen first tried neuron 800613.

800613 @ 0.90  → -0.391
800613 @ 1.00  → -0.422

Increasing the dose had not produced enough movement. It changed intervention points.

10442 @ 0.50   → -0.523

For +0.25 it chose:

800497 @ 1.00  → +0.251

For -0.90:

10442 @ 0.887  → -0.906

A requested +0.80 initially produced:

800544 @ 0.91  → +0.563

The model then abandoned that actuator and tried -

10760 @ 0.58   → +0.838

Across the four targets, the final absolute error averaged about 0.017. It took seven interventions in total.

There is no mystery hiding in those numbers. The simulator is deterministic, the response curves are smooth and the search space is tiny. What interested me was the progression in the behaviour of the controller. The first experiment asked what does this do? The next asked how much of this produces that?

That is already a form of system identification.

VI

The circuit then acquired a body.

The world is a twenty-by-twenty plane. The body has a position and heading; somewhere else is food. Qwen knows the food's bearing and distance but has no direct movement primitive. It cannot request a twenty-degree turn or a one-unit step.

Every action still begins as neural stimulation. Motor activity is converted into body motion through a deliberately transparent rule -

directional_score = right_motor - left_motor

turn_delta = 35 * tanh(directional_score)

drive = left_motor + right_motor + neutral_motor

step_distance = min(
    1.25,
    0.75 * drive
)

This creates a closed loop:

flowchart LR
    subgraph Controller
        Q["Qwen 3.5 9B"]
    end

    subgraph Embodied_System["Embodied system"]
        A["Neural intervention<br/>single or paired"]
        C["493-neuron circuit"]
        M["Motor recruitment<br/>left / right / neutral"]
        B["Body motion<br/>turn + translation"]
        W["Target geometry<br/>food bearing + distance"]
    end

    Q -->|selects stimulation| A
    A --> C
    C --> M
    M --> B
    B --> W
    W -->|observation| Q

The first embodied runs were poor, but useful. Qwen found interventions that corrected heading quickly; the same interventions also coupled rotation and translation. Strong stimulation moved the body but turned it sharply. Small stimulation preserved alignment but barely covered distance.

The controller settled on the obvious local strategy - use less stimulation.

It became precise enough to avoid large heading errors and weak enough to run out of moves halfway to the target.

One twenty-move run began 11.402 units from the food and ended at 6.007. It had learned to steer before it had learned how to travel.

VII

The next change came from that failure. Instead of inventing a forward() primitive, I allowed two neural intervention points to be active during the same propagation cycle.

history = circuit.simulate_many({
    neuron_a: strength_a,
    neuron_b: strength_b,
})

Both signals enter the circuit together. Whatever happens afterwards is produced by the network and the body mapping, not by averaging two movements outside the neural system.

This gave the controller a new degree of freedom. Two interventions with opposing rotational effects could partially cancel each other while preserving enough combined motor recruitment to translate the body. Forward movement, or something close to it, could therefore emerge as a relationship between controls even though no individual control meant forward.

Across 63 actions from four development runs, single-neuron stimulation produced a mean translation of 0.536; paired stimulation produced 0.811. Mean progress toward the food increased from 0.401 to 0.513, while mean absolute body rotation fell from 18.13° to 10.05°.

These numbers are descriptive rather than causal. The controller selected different actions under different circumstances, so this was not a clean single-versus-paired ablation. It nevertheless exposed something important in the structure of the control problem.

SinglePaired
Mean translation0.5360.811
Mean distance progress0.4010.513
Mean absolute body turn18.13°10.05°
FlyBrain console showing an arena trajectory, paired neuron stimulation, motor recruitment and Qwen's resulting movement data
The embodied experiment: neural interventions on the left, resulting motor state and movement on the right.

Paired stimulation gave the system more authority, but not automatically better judgement. One failed run used paired interventions fifteen times and ended more than six units from the target. Another successful run needed only three. The new capability widened the action space; Qwen still had to learn when the composition was useful.

VIII

The run that changed the experiment most did not succeed.

The body approached to roughly 0.984 units from the food. The target was almost inside the goal region. It then overshot.

Simulation arena showing a dotted path crossing the circular target, with the triangular agent stopped beyond it
Movement arrived before control. The agent could change its world before it understood how much change an action would produce.

After crossing the target, the food's relative bearing shifted abruptly. Qwen interpreted that shift as evidence that its body had rotated by a similarly large amount and began correcting for a turn that had mostly happened in its visual field rather than its body.

The problem looked like steering until I examined the variables.

food_bearing_change contained two different physical causes - rotation of the observer and translation of the observer relative to the target. From far away, the distinction was often small enough to ignore. Near the food, a short translation could throw the target from one side of the visual field to the other.

The controller had been asked to reason over a collapsed variable.

I split it into four measurements:

body_turn_deg
body_translation
food_bearing_change_deg
distance_progress

That small change altered the quality of the control problem. Qwen could now distinguish what its body had done from what had happened to the target's apparent position.

I keep returning to this part because it reaches beyond navigation. Reasoning quality depends on the distinctions made available to the reasoner. If two causally different phenomena are collapsed into one variable, a better model may simply become more articulate about the wrong object.

Intelligence is partly the construction of variables.

IX

A cleaner success came after the world was randomized. Seed 1759407152 began with the body 10.416 units from the food, at an unfamiliar position and heading. The controller had twenty physical actions. It reached the target in fifteen.

The route was not elegant. It travelled 15.248 units to gain 10.084 units toward the target, a path efficiency of 0.661. But this was no longer the fixed geometry on which the earlier controller had been developed.

At the fifteenth move the remaining distance fell from 1.008 to 0.332, comfortably inside the 0.800 goal radius. The final intervention was a paired stimulation of 10760 and 801371, both at 0.40.

FlyBrain console showing a completed fifteen-move trajectory to the food and a successful run scorecard
A later run from a randomized starting state. Fifteen interventions were enough to reach the target.

A conventional controller could solve this geometry with considerably less drama. The navigation itself is not the achievement I care about. The sequence that preceded it is.

An integer acquired direction. Direction acquired magnitude. Actuators acquired relationships. Relationships produced composite motion. A sensory failure forced a new distinction. The same controls eventually behaved differently during cruise and near the target.

The useful abstraction was not supplied at the beginning. It accumulated through interaction.

X

The development logs make the trajectory less neat than the final screenshot suggests.

RunActionsPair / singleFinal distancePath efficiencyOutcome
00342475 / 26.46967.5%incomplete
002710202 / 184.25987.7%failed
000355183 / 150.67984.6%success
0001431815 / 36.15841.9%failed

This is closer to the actual texture of the work. The system was not designed once and then evaluated. Failures kept revealing assumptions hidden in the apparatus. Single stimulation exposed the coupling between steering and propulsion. Overshooting exposed the sensory confound. Near-target behaviour exposed the need to reduce authority during docking.

Even the visualiser carried assumptions I had forgotten about. Once I randomized the world, the TUI crashed because part of its drawing code still expected the original fixed starting coordinate. The simulator had moved on to variable worlds while its observer still believed in a constant one.

The current environment randomizes starting position, initial heading and food location. Initial separation is constrained to roughly 8–12.5 units so the runs remain broadly comparable, and every world records a seed for exact replay. Qwen receives the relative observation, not the absolute coordinates.

One recent world began here:

start       (11.595, 12.476)
heading      185.26°
food         (10.591, 3.005)
distance       9.524
seed        1931025017

Qwen's first physical action was:

10760 @ 0.50
10442 @ 0.50

The resulting circuit activity produced:

left motor          0.557
right motor         0.761
body rotation       +7.03°
translation          1.042
distance progress   +0.275

The next useful result will not be another attractive trajectory. It will be a distribution across randomized worlds with the prompt, dynamics and tool surface frozen.

XI

There is a pleasing loop in how this experiment became possible.

Machine learning helped create the connectome in the first place. Google's neural-mapping work used machine vision to reconstruct neurons from electron-microscopy imagery at a scale human tracing alone could not sustain. Janelia and collaborators then proofread, annotated and organised those reconstructions into something neuroscientists could query.

The progression is remarkable. The hemibrain exposed tens of thousands of neurons. Whole-brain connectomes followed. The 2026 Male CNS resource extends across 166,691 neurons, from the brain into the ventral nerve cord, and includes 11,691 annotated neuron types.

Connectomics is steadily turning neural anatomy into a computational object.

FlyBrain Zero asks a question on the other side of that conversion. Once biological structure becomes machine-readable, what happens if a machine is allowed to act through it while being denied the human descriptions of what the parts are supposed to mean?

The first AI helps recover the structure.

The second has to recover an interface.

XII

There is a hard boundary around the result.

My working circuit contains 493 neurons out of more than 166,000. The neural dynamics are artificial. Synaptic sign and inhibition are not yet represented faithfully. The graph is truncated and renormalized. The body is invented, the physics are trivial, the world contains one objective, and the candidate pool deliberately includes neurons I already knew were motor-relevant. Qwen also receives substantial scaffolding about how to conduct the experiment.

The successful run therefore says very little about whether an LLM could control a biological fly. It says nothing useful about the relative biological importance of 10760, 800613 or any other intervention in this simulator.

The narrower result is enough - a general-purpose model entered a causal system with opaque actuators and acquired enough structure through intervention to use those actuators for control.

That is the part I think deserves attention.

XIII

Tool use is becoming one of the dominant metaphors for AI agency. We measure progress partly by how many environments a model can operate through browser, terminal, database, calendar, codebase, CRM, robot.

But every clean tool conceals a prior act of intelligence.

book_flight(origin, destination, date) has already decided that origin, destination and date are the dimensions that matter. send_email(to, subject, body) contains an ontology of communication inside its signature. Parameter names are instructions about reality.

The agent inherits the decomposition.

Most of the physical and social world does not arrive that way. Machines develop faults that do not correspond neatly to their dashboards. Organisations behave through incentives that are rarely represented in their formal processes. Biological systems contain causal structures long before we know what to call them.

The harder problem begins before tool selection.

It begins with discovering what the tools are.

XIV

This is also why the experiment changed how I think about where intelligence sits.

10760 does not contain the concept of turning. The concept appears only after that intervention is embedded in a particular circuit, propagated through particular dynamics, converted through a particular body and measured inside a particular world.

Change the body and the operational meaning changes. Remove embodiment and turning disappears entirely.

The abstraction therefore belongs neither to the neuron nor to Qwen alone. It emerges in the relationship between an agent, an actuator and the consequences that follow.

Software engineering spent decades moving in the opposite direction. We encountered difficult machinery, understood enough of it to name useful operations, then hid the machinery beneath those names. Each generation inherited a cleaner interface.

AI agents now live near the top of that inheritance. They receive our nouns, verbs, parameter names and decompositions of reality, then surprise us with how fluently they use them.

There may be more to learn by occasionally taking the interface away.

Give the system actuators whose names mean nothing. Let consequences supply the first semantics. Let failed predictions alter the distinctions it uses. Then watch for the point at which an integer begins to behave like a concept.

Software normally starts with an abstraction and hides the machinery.

Here the machinery came first.

The abstraction had to be found.


Technical notes

Dataset: Janelia / Google Research Male Drosophila CNS connectome, male-cns:v1.0

Model: Qwen 3.5 9B running locally through Ollama

Working circuit: 493 neurons, 631 weighted edges

Initial extraction: 1,288 neurons, 1,345 collapsed edges

World: 20 × 20 units, randomized start position, heading and target

Goal radius: 0.80

Maximum physical actions: 20

Repository: [To Be Updated]

Current status: randomized-world benchmark in progress

Sources

  • Google Research — Releasing the Drosophila Hemibrain Connectome
  • Google Research — A connectomics milestone: Mapping the complete male fruit fly brain
  • Berg et al. — Sexual dimorphism in the complete connectome of the Drosophila male central nervous system, Cell, 2026
  • Janelia / neuPrint — Male CNS v1.0 dataset

WRITTEN BY

Vishnu Rajkumar

Vishnu leads AI engineering at Microland and writes about artificial intelligence, systems, judgment, work and technological change.

About the author →