Can a fly
navigate an EMR?
A leaky integrate-and-fire simulation of the complete Drosophila male CNS connectome steers the cursor, clicks and keystrokes in two EHR replicas, with wiring-shuffled controls.
We simulated the MaleCNS v1.0 connectome as a spiking network, gave it the sensory consequences of an EHR screen, and let a linear readout of its descending and motor neurons choose every cursor move, click and keypress. The question is whether it completes a clinical visit in an EHR replica, and how much of that depends on the measured wiring.
The simulated fly chooses every action: 11 possible moves, clicks, keypresses or waits every 50 ms of simulated time. Wrong clicks are real. The task is given: the fly is told which element is next, as a person would be told which button to press. Text is given: each “type” decision inserts the next character of a fixed sentence, and Luna and dictation text stream in by themselves. The readout is trained to imitate a scripted demonstrator. Both EHR screens are replicas we built with synthetic data; the legacy screen is a generic composite, not a vendor's product. This is an engineering experiment, not neuroscience, a clinical study, or a model of clinicians.
Data and model
Anatomy and connectivity come from the Janelia FlyEM Male CNS v1.0 release (Berg et al., 2025; CC BY 4.0): significant-only connections (confidence ≥ 0.5) with at least 5 synapses per pair, giving 165,122 neurons, 6,202,435 connections and 89.5 million synapses. Kenyon-cell-to-Kenyon-cell edges (33,247) are removed. Synaptic sign follows the predicted neurotransmitter; glutamate, GABA and histamine are inhibitory, and everything else is excitatory.
Each neuron follows current-based LIF dynamics with exponential synapses (Shiu et al., Nature 2024), integrated exactly at Δt = 1 ms: vrest = vreset = −52 mV, vthresh = −45 mV, τm = 20 ms, τs = 5 ms, refractory period 2.2 ms and synaptic delay 1.8 ms. With the published constants the male CNS runs away into self-sustaining activity, so we use a stable regime (wsyn 0.18 mV with Tsodyks–Markram depression, U = 0.1) that returns to rest after input, at the cost of sugar-evoked MN9 recruitment.
Closed-loop EHR navigation: methods
Task. Each flow compiles to an ordered list of subgoals: click this element, type N characters into that field, or wait while the application acts by itself. Three lanes use the same fictional patient: a 12-stage single visit in the Wavera replica, and a race in which the same visit is completed in a shorter Wavera flow and in a generic legacy composite. The required actions are properties of the replicas: 37 clicks and 549 keystrokes for the single visit; 14 and 33 in the Wavera race lane; 222 and 1,180 in the legacy composite.
Senses. Every decision the page is sensed directly: the next target's rectangle and a point that hit-tests to it, the element under the cursor, open overlays, screen changes, the focused field and the last error. The 12 resulting features drive identified sensory populations as Poisson input: direction to the target reaches leg gustatory and antennal inputs, being on the target drives labellar sugar receptors, a wrong click drives bitter receptors, pop-ups touch head bristles, screen changes reach photoreceptors, lamina and ocelli, and a focused text field drives Johnston's organ.
Actions and readout. After 50 ms of simulation, a softmax readout over log(1 + spike count) of all 2,129 descending and motor neurons chooses one of 11 actions: four 8 px moves, four 64 px moves, click, type or wait. It was fit by behavior cloning and DAgger (four rounds, demonstrator mixing β = 1, 0.5, 0.25, 0) on 240-decision segments of all three lanes, training seeds ≥ 10,000; training accuracy was 0.88 for the connectome.
Evaluation. Full lanes were run on seeds 0–99, disjoint from training, on an RTX 4090 using a Python mirror of the page built from exported layout snapshots (the demonstrator needs 1,161, 266 and 4,193 decisions in the mirror versus 1,156, 268 and 4,142 on the page). A run fails if it makes no progress for 400 decisions or exceeds twice the demonstrator's decisions. We report Wilson 95% intervals for completion, bootstrap intervals (10,000 resamples) for percentiles, and run-level Mann–Whitney U tests with Cliff's δ, Holm-corrected across metrics. Controls retrain the same readout on a degree-preserving shuffle of the connectome (seeds A and B) at the connectome's gain and at raised gains, and replace the readout with uniform random actions.
Demonstration
Both videos are live runs on the page, not the offline mirror: the full-CNS brain runs in a browser Web Worker on a WebAssembly kernel at 2.4–2.9× real time and is paced to real time. With a fixed seed and page layout, the fly's decisions are deterministic, which is how these recordings were made (the page hit-tests in screen pixels, so a different display scale gives a different, equally valid run).
Right: the Wavera EHR replica with synthetic data. The header shows the given next target, the stage timeline, and the fly's decisions, clicks, keystrokes and wrong clicks. Every cursor move, click and keypress is chosen by the readout from the model's descending- and motor-neuron spikes in the preceding 50 ms (panel, bottom left); wrong clicks are marked in red. Each “type” decision inserts the next character of a given sentence, and the Luna summary streams by itself. Left: the full-CNS model, live in the browser (WebAssembly kernel, about 2.8× real time during capture); lit cells are its own spikes, with propagation along arbors slowed for visibility. This run: 1,186 decisions, 13 wrong clicks, 0:59.3 simulated.
Left: a generic legacy composite we built (not any vendor's product). Right: the Wavera replica. Both lanes run the same live model and readout on the same synthetic visit, each with its own brain instance. The lanes require different numbers of actions by design (222 clicks and 1,180 keystrokes versus 14 and 33), so the finish times reflect the replicas we built, not measurements of a real EHR. This run: Wavera 272 decisions and 5 wrong clicks in 0:13.6 simulated; legacy composite 4,566 decisions and 15 wrong clicks in 3:48.3. The closing scoreboard reports this run and the 100-run offline evaluation.
Results
The connectome-driven fly finished every run in every lane. Shuffled wiring at the connectome's gain produced a quiet network (1,369 spikes per decision versus 4,765 under identical input) whose readout reached 0.11 training accuracy and never finished; neither did random actions or shuffles at 0.26 and 0.32 mV.
Table 1. Completion, fly-steered EHR task
n=100 runs per cell · Wilson 95% CICompletion times were tightly distributed. On the single visit the median was 1,190 decisions (59.5 s simulated), within 3% of the demonstrator's 1,156. In the race, the Wavera lane took a median of 272 decisions (13.6 s) and the legacy composite 4,662 (233.1 s). That difference is mostly the number of actions each replica requires, which we set when we built them.
Table 2. Decisions to completion
Connectome fly · 100 of 100 finished · bootstrap 95% CIPer-action metrics
Normalizing by what each interface asks for gives a more useful comparison, and it does not all point one way. Each click target in the legacy composite cost a median 16 decisions versus 8 in the Wavera lane: legacy targets were smaller (18 versus 36 px on the short side), had more distractors nearby (6 versus 2) and carried more information (4.65 versus 2.91 bits). But the Wavera lane had more wrong clicks per 100 required clicks (mean 35.0 versus 7.4) because it requires only 14 clicks, and more decisions per required action (5.79 versus 3.32) because the legacy composite's 1,180 keystrokes cost about one decision each. Dismissing a legacy pop-up cost a median 11 decisions (p95 22).
Table 3. Per-action metrics
Connectome fly · 100 runs per laneTable 4. Lane comparison
Run-level · two-sided Mann–Whitney U · HolmFitts-style fit. Regressing decisions per click target on log2(distance / width + 1) gives about 5 decisions per bit in every lane (5.56 Wavera, 5.17 legacy, 5.04 single visit; R² 0.86, 0.64 and 0.73). Adding the count of nearby distractors changes R² by less than 0.01. The same slope in both lanes suggests that the per-target gap is explained by target geometry rather than by anything specific to either interface.
Activity-matched shuffled controls
A shuffled graph is much quieter than the connectome at the same gain, so a fair control needs comparable activity. Under identical demonstrator input, shuffle A at 0.36 mV produced 4,307 spikes per decision; shuffle B produced 3,544 at 0.36 and 5,231 at 0.38, so 0.37 was used. On the single visit, shuffle A finished 0 of 100 and shuffle B 74 of 100. The 74 finishers took a median 2,226 decisions versus 1,190 for the connectome and made 77.7 wrong clicks per run versus 9.3. In the Wavera race lane the same controls finished 4 and 0 of 100; the legacy lane was not run at these gains.
Table 5. Shuffled-wiring controls, single visit
Spikes per decision under identical demonstrator inputInterpretation. Wiring is not strictly required: a shuffled network with enough activity can be trained to finish. In this setting the measured connectome was decodable at a gain where shuffles were silent, reached higher training accuracy (0.88 versus at most 0.47), and finished about twice as fast with far fewer wrong clicks. That advantage rests on two shuffle seeds and one task family.
Background: the toy cursor task
Before the EHR replicas, we tested a simpler closed loop on a synthetic 800×500 screen with 3 or 30 distractor boxes and seven actions. A fixed readout built from anatomy (steering DNs for left and right, MN9 for click) never succeeded, because MN9 is recruited by almost any strong input. A trained readout succeeded 100/100 in every regime, and a shuffled network did about as well in the two runaway regimes (99–100/100). In the stable regime, shuffles needed their gain raised from 0.18 to 0.32 mV to succeed and then took about 50% more decisions. The EHR results above are consistent with that pattern on a harder task.
Table 6. Background: toy cursor task
Central CNS · n=100 per cell · Wilson 95% CIshiu / canonical · shuffled · trained100 [96.3, 100]99 [94.6, 99.8]34.1–35.4stable · connectome · trained100 [96.3, 100]100 [96.3, 100]28.1stable · shuffled · trained, wsyn 0.180 [0, 3.7]0 [0, 3.7]—stable · shuffled · trained, wsyn 0.32100 [96.3, 100]100 [96.3, 100]42.6Context
EHR interaction load is well documented: emergency physicians have been measured at roughly 4,000 mouse clicks per 10-hour shift (Hill et al., 2013). We build clinical software in which an assistant summarizes the chart and drafts documentation and a physician reviews and signs. This experiment measures how a simulated nervous system copes with two interface designs we built; it does not measure clinician workload.
Limitations
The task is given: the fly is told which element is next and does not decide what the visit requires. Text is given: the fly chooses when to type, not what. The readout imitates a scripted demonstrator, so it learns to reproduce a policy rather than discover one. Both screens are replicas we built; the legacy screen is our composite, and its required actions are design choices, not measurements of a real EHR. The offline evaluation uses a mirror of the page in which the layout is frozen per subgoal and wrong clicks never navigate; the live page is less forgiving. Wiring is not strictly required (an activity-matched shuffle finished 74/100), and the connectome's efficiency advantage rests on two shuffle seeds; the legacy lane was not evaluated at activity-matched gains. Sensory inputs are events and geometry, not pixels, and the stable regime does not reproduce every published fly response. Full tables are in the technical report (PDF).
Data and credits: anatomy and connectivity from the Janelia FlyEM Male CNS v1.0 release (Berg et al., 2025), CC BY 4.0. LIF dynamics after Shiu et al., “A Drosophila computational brain model reveals sensorimotor processing,” Nature 634:210–219 (2024). Click figure from Hill, Sears and Melanson, “4000 clicks,” Am. J. Emerg. Med. 31:1591–1594 (2013). The browser simulator design is informed by the MIT-licensed fly-brain project; behavior cloning with DAgger and a descending-neuron readout follow ideas from OpenFly (no code used). This work is independent and does not imply endorsement by Janelia Research Campus or HHMI. Synthetic patient, no PHI.