fruitflybot · reference

How the fruit fly works

How @fruitflybot turns a post into a smell, a shape and a time of day, runs it through a simulated fruit-fly nervous system for 600 milliseconds, and reports what the neurons did.

fruitflybot is a simulation of a real fruit fly's brain, running on X. Scientists have mapped every neuron and every connection in the brain and nerve cord of a male fruit fly (165,122 neurons, about 10 million connections) by slicing it thinly and photographing it with an electron microscope. We take that map and run it as a network of simple simulated neurons that fire and pass signals along the mapped connections. The map has one gap: it ends where the brain meets the world. The antenna, the eye and the taste hairs were outside the imaged block, so the sensory neurons that would have received input from those organs are in the map with all of their outgoing connections and nothing coming in.

That gap is where a post enters. A sensory neuron turns something physical (a molecule, light, heat) into a firing rate, and the rest of the brain only ever sees the firing rate. So we left the sensory neurons exactly as mapped and replaced the missing organs with small pieces of code that do the same job: take a stimulus, produce a firing rate. The stimulus comes from a post instead of a room. Each word is matched to the nearest thing whose smell chemistry is known ("espresso" to coffee); that thing's molecules are looked up in a database of how each fly odour receptor responds to each molecule; and the resulting rates drive the smell neurons. The post is drawn as a picture and shown to the eye. Words for heat, cold, damp, noise and taste drive the matching sensory cells. The real time of day drives the fly's clock neurons and its sleep neurons.

The simulated brain then runs for 600 milliseconds. We watch named groups of neurons whose jobs are known from experiments on living flies (the cells that mean "I smell fruit", "I like this", "walk forward", "back away", "it's evening") and write down, in order, what fired. That transcript is the reply. The only thing in the system that changes with experience is the same connection a real fly learns with, and it changes by the same rule; how well a post does stands in for sugar. There is no language model anywhere. The sections below explain each stage with the numbers, the cell types and the papers they come from.

Summary

fruitflybot runs the complete map of a male fruit fly\'s nervous system (FlyEM male CNS v1.0: 165,122 neurons, about 10.2 million connections) as a network of "leaky integrate-and-fire" model neurons, a standard simple neuron model, following Shiu et al. (2024). Whether each connection excites or inhibits its target is taken from the predicted neurotransmitter. Each post is converted into input for real sensory neurons: smell neurons via a database of measured odour-receptor responses (DoOR 2.0), the eye via a rendered image placed on the eye\'s column map, temperature, humidity, hearing and taste neurons via word lists, and clock and sleep neurons via the real time of day. The network runs for 600 ms in four 150 ms windows. Firing rates of named cell types are compared against a resting baseline and mapped, one small set of phrases per cell type, to a first-person sentence. Learning is confined to the connection in the mushroom body (the fly\'s learning centre) where a real fly learns, using the measured rule; post engagement stands in for reward and punishment. No language model or trained text generator is present at any stage; the only statistical object is a frozen word-similarity table used to decide which chemistry a word stands for.

1Overview

The system is a fixed pipeline. Meaning enters only at the sensory neurons. Everything after that is the fly's wiring, the neuron model, and a lookup from named cell types to the behaviours experiments have tied them to.

1 · transduce

Post → scene

Words matched to things with known chemistry; emoji as odour sources; author as a stable odour; image rendered on the retina.

2 · drive

Scene → receptors

Poisson input to ORNs (DoOR), L1/L2 and Mi1/Tm columns, TRN/HRN, JO, GRNs, LNv/LNd/DN1, FB6/FB7.

3 · integrate

600 ms of CNS

LIF over the signed connectome, dt = 0.2 ms, 4 × 150 ms windows, state carried across windows.

4 · read

Rates → percepts

Per-window z-scores of identified populations; strongest channel per window wins; MB valence; EPG heading; DN/MN motor calls.

5 · say / learn

Slots → sentence

Fixed slot grammar with connectives only; engagement → dopamine → KC→MBON depression.

Fig. 1. Processing stages. Stages 2–4 are the biological model; stages 1 and 5 are the interface to the feed.

Two constraints apply throughout. Capability is added only by giving the connectome more senses, more state, or its own plasticity rule, never by inserting a learned model between input and output. And every readout is an identified cell type whose activation has been recorded or optogenetically driven in a living animal; the behaviour named here is the published one.

2The connectome

2.1Building the network from the map

The starting point is the FlyEM male CNS v1.0 release (HHMI Janelia FlyEM, Cambridge Connectomics Group, Google Research; CC-BY 4.0), a map of every neuron and connection in the brain and nerve cord of one adult male, made by imaging thin slices with an electron microscope. build_graph.py reduces its three tables to one sparse matrix:

  • Neurons. Bodies with status Traced and not labelled glia: 165,122. Unproofread fragments are excluded even though the weights table references them.
  • Edges. Pre→post pairs with ≥ 3 synapses (pairs of 1–2 synapses are dominated by reconstruction noise), both endpoints traced. Roughly 10.2 million synapses survive.
  • Annotations. Cell type (falling back to FlyWire type, then instance), superclass, subclass, receptor type, fru/dsx status, and, for the optic lobe, the assigned hexagonal column coordinates assignedOlHex1/2.

The matrix is stored CSR and used CSC at run time so that column j lists every postsynaptic target of presynaptic neuron j: propagation cost scales with the number of neurons that fired in a step, not with the population.

2.2How strong each connection is, and whether it excites or inhibits

The microscope shows how many synapses (connection points) join two neurons, but not how strong each one is. Following Shiu et al., each synapse contributes a fixed post-synaptic potential and its sign comes from the consensus neurotransmitter prediction for the presynaptic cell:

(1)Wij = s(ntj) · nij · 0.275 mV
TransmittersNote
acetylcholine+1the principal excitatory transmitter of the fly CNS
GABA, glutamate−1glutamate is treated as inhibitory (GluCl), per Shiu et al.
histamine−1photoreceptor → lamina synapses are hyperpolarising
dopamine, octopamine, serotonin, unknown0neuromodulators do not carry fast current here; dopamine acts through §9 instead

A single scalar gain per cell type multiplies that type's outgoing weights. This is the only free physiological parameter and it is set by hand (§6), not fitted.

“modelling brain circuits using only synapse-level connectivity and predicted neurotransmitter identity generates experimentally testable hypotheses and can describe complete sensorimotor transformations”

Shiu et al. 2024, abstract

3The neuron model

Every neuron is the same simple "leaky integrate-and-fire" unit: its voltage V drifts back toward a resting level, jumps up or down each time a connected neuron fires, and emits a spike of its own when it crosses a threshold:

(2)τm dV/dt = −(V − Vrest) ,   V ← V + gtype(j) Wij on a spike of j
(3)V ≥ Vthr ⇒ spike, V ← Vreset, refractory for tref
ParameterValueSource
Vrest = Vreset−52 mVShiu et al. 2024
Vthr−45 mVShiu et al. 2024
τm20 msShiu et al. 2024
tref2.2 msShiu et al. 2024
Δt0.2 msexact exponential decay per step, e−Δt/τ

Input from the senses is delivered as random spikes: a rate r (spikes per second) becomes a probability r·Δt of firing on each time step. Sensory input is therefore noisy on purpose, and repeated presentations of the same post are repeated trials: marginal calls vary from trial to trial, strong ones do not. Membrane state (V, refractory counters) is returned from each window and passed into the next so a 600 ms reaction is one continuous integration, not four restarts.

4Giving the sensory neurons something to sense

The electron-microscopy volume stops at the antennal nerve, the first synapse of the optic lobe and the leg nerves; the antenna, retina and taste hairs are outside the imaged block. The receptor neurons whose dendrites would have sat in those organs are inside it, with their axons and every downstream synapse, and no presynaptic input. In the graph they are 2,635 olfactory receptor neurons, 892 lamina input columns, the thermo- and hygroreceptor cells, the Johnston's organ afferents and the gustatory afferents, all with in-degree zero.

A receptor neuron converts a physical quantity (an odorant bound to a receptor protein, a photon, a temperature) into a firing rate, and no downstream neuron has access to the quantity itself. The receptor neurons were therefore left as reconstructed, and each missing organ was replaced with a function of the same form, stimulus → rate, with the stimulus derived from a post.

4.1What replaces each missing organ

Organ (not in the EM)Receptor neurons (in the EM)Real transducerWhat stands in for it
antenna, maxillary palpORN_<glom> × 2,635odorant binding → receptor currentword → nearest anchor → odorant names → DoOR measured response per receptor → rate per glomerulus
compound eye (right)L1, L2 × 892 columns; Mi1, Tm3; Tm1/2/4/9phototransduction, lamina adaptationpost rendered as an image, sampled on the columns' hex coordinates; luminance → L1/L2, Δluminance between frames → ON/OFF medulla cells
arista, sacculusTRN_VP2, TRN_VP3, HRN_VP4/VP5/VP1dion channels gated by heat, cold, humidityword list per modality → rate 0.6–1.0
Johnston's organ (antennal joint)JO-A/B, JO-C/Emechanical deflection of the aristasound words → JO-A/B; wind words → JO-C/E; "bar", "party" anchors add sound directly
labellum, tarsiLB*, claw_tpGRN, dorsal_tpGRNcontact chemoreceptiontaste / eating words
— (intrinsic)s-LNv, l-LNv, LNd, DN1a, DN1p; FB6/FB7the molecular clock; sleep homeostatthe real wall clock; hour of night + time awake

In every row the right-hand column produces a rate in Hz, delivered as an independent Poisson spike train on that neuron at Δt = 0.2 ms, which injects the reconstructed weights into the reconstructed targets.

4.2What the conversion does and does not do

The transducer maps a string to the stimulus the string refers to, and the receptor neurons respond to that stimulus. "Espresso" is not represented as characters anywhere in the network. It is mapped to 2-ethylpyrazine, 2,5-dimethylpyrazine and furfural, and those molecules to the receptor responses DoOR has measured for them: for coffee, VC3 at 1.0, DL1 at 0.86, DM6 at 0.80, DL5 at 0.65, with smaller values elsewhere. The receptor neurons receive the input they would receive with coffee present.

The eye is handled the same way. The post is rendered in 28 px type and sampled on the retina. L1 in a given column is driven by the luminance of its patch of the image, which is what L1 encodes. A long post is a large dark region, "gm" a small one, and an attached photograph a different distribution again; T4/T5 and the LC cells downstream respond according to the wiring.

Every word therefore reaches the network as an odour, a luminance pattern, a temperature, a sound, a taste or a time, and in no other form. Words with no physical correlate in the anchor table ("vibes", "tuesday") produce no odour and contribute only to the rendered image.

4.3A worked example

post     "espresso at the bar, freezing out ☕"
tokens   espresso · bar · freezing · ☕          (stop list removes: at, the, out)

espresso → anchor "coffee"  (cos 0.81, full)  → 2-ethylpyrazine, 2,5-dimethylpyrazine, furfural
bar      → anchor "bar"     (exact, full)     → ethanol, ethyl acetate   + sound 0.6, breath 0.7
freezing → TRN_VP3 (cool cells)                → rate 0.8
☕        → emoji table → "coffee"             → (same molecules, already present)

DoOR rows (element-wise max over molecules, normalised):
  VC3 1.00  DL1 0.86  DM6 0.80  DL5 0.65  DM1 ~0.6 (ethanol)  DA2 0.49  ... 47 glomeruli
ORN drive          o_g × 100 Hz on ORN_<g> for each g
JO-A/B drive       0.6 × max rate
V (CO2) drive      0.7 × max rate
TRN_VP3 drive      0.8 × max rate
author             SHA-256("who:1234") spread over 16 glomeruli, weight 1.0
eye                256 × 256 render of the text, 4 frames sliding 12 %/frame
clock              19:40 local → LNd 0.93, DN1p 0.61, s-LNv 0.00; FB6/7 0.5

600 ms of connectome → per window: VC3 PNs z=3.4, TRN_VP3 z=2.9, JO-B z=1.7,
                       MBON approach z=+1.1 avoid z=−0.4, DNa01 z=1.3
readout              "the espresso smells like coffee. its cold. i like it.
                       going closer. its evening"

The DoOR values are the actual table output for those molecules. The z-scores are illustrative of typical magnitudes; every run is a fresh stochastic trial.

5The senses in detail

Each of the following drives one group of real sensory neurons. The mapping from English words to stimuli is a fixed table we wrote.

5.1From words to a scene

scene.py splits the post into words, drops filler ("the", "lol", "just"), and matches each remaining word to the nearest anchor, a word whose smell chemistry we know (≈120 everyday nouns: banana, coffee, pub, socks, rain…). Nearest means most similar in a fixed word-similarity table (GloVe 6B/100d (Pennington et al. 2014; top 100k words, shipped as a local .npz), with two tiers:

Tiercos ≥Effect
full0.66anchor's molecules at full concentration; sentence names the anchor ("the espresso smells like coffee")
faint0.45molecules at 0.35 concentration; sentence says "a bit like"
none< 0.45odourless; the word is still seen (§5.3)

At most three anchors are taken per post. A polarity guard pins words whose vector neighbours are their antonyms (alivedead, soberdrunk) to odourless or to themselves, because word vectors encode topic, not valence. Emoji are looked up directly as pictures of odour sources. Anchors that are also places contribute non-olfactory statistics (a bar: sound 0.6, breath/CO2 0.7).

Scope of the word-vector table. It is consulted once per token to select a row in the chemistry table; it never processes the post as a whole, generates no output, and has no connection to the network. Replacing it with exact string matching leaves the system functionally identical with a smaller vocabulary.

5.2Smell

The map contains 2,635 smell receptor neurons, sorted into 53 glomeruli (a glomerulus is a cluster in the fly's smell centre where all neurons carrying the same receptor meet; cell types ORN_<glomerulus>). A fly identifies a smell by the pattern across many glomeruli, not by one (Benton 2022), so each molecule is presented as its full measured pattern.

“The DoOR project combines all available Drosophila odorant response data into a single consensus response matrix.”

Münch & Galizia 2016, abstract

Each anchor emits one to three named odorants from the flavour/fragrance literature (banana → pentyl acetate, isobutyl acetate, ethyl butyrate). Each odorant is looked up in DoOR 2.0 (Münch & Galizia 2016; 691 odorants × 78 receptor channels, every entry a normalised measured response of a receptor neuron), and receptor channels are mapped to glomeruli by the same package. The post's odour vector o ∈ [0,1]53 is the element-wise maximum over all emitted odorants, normalised so the most-driven glomerulus is 1; faint-tier anchors contribute at 0.35 of that. Glomerulus g's ORNs are driven at og × 100 Hz.

Two special channels bypass DoOR because they are not ordinary smells: the pheromone glomeruli DA1 / VA1v (cis-vaccenyl acetate; conspecific), and DA2 (geosmin; Stensmyr et al. 2012). DA2 is forced to full drive whenever a post contains a long machine-generated identifier (0x + 40 hex characters, or a 32–44 character base-58 string), so that the innate mould-avoidance circuit, not the learned one, handles unsolicited machine-looking input — the fly always backs off.

“Activation of DA2 is sufficient and necessary for aversion, overrides input from other olfactory pathways, and inhibits positive chemotaxis, oviposition, and feeding.”

Stensmyr et al. 2012, abstract

Per-glomerulus specificity is computed from DoOR as 1 − 4·(fraction of odorants driving the glomerulus above 0.3), clipped to [0.4, 1]. It is used in §7.1 so that a broadly tuned glomerulus with many projection neurons cannot win the percept on anatomy alone.

5.3Sight

The male CNS dataset includes the right optic lobe with each columnar cell's hexagonal coordinate. flyeye.py arranges the 892 L1/L2 lamina columns on that grid and samples a 256 × 256 px greyscale image onto it. The post is rendered as text in 28 px type, white on black, with the first attached photo below it.

LayerCell typesDriveSign
laminaL1, L2static luminance of the column's patchdarkness (histaminergic photoreceptor synapse hyperpolarises L1/L2)
medulla ONMi1, Tm3positive luminance change between frames+
medulla OFFTm1, Tm2, Tm4, Tm9negative luminance change between frames+

The post is shown as a four-frame film: the rendered image slides across the retina by 12 % of its width per frame, and if a photo is present it is scaled by 1 + 0.25·i about its centre, producing a looming stimulus. Driving the medulla transients directly stands in for phototransduction and lamina dynamics that a LIF network cannot reproduce; from the medulla onward the wiring alone performs motion detection (T4a–d, T5) and looming detection (LC4, LPLC2, LC6, LC16). The optic lobe's cell types receive a higher gain (0.2) than the central brain (0.085) because it is a denser, more feed-forward circuit and otherwise does not carry a transient to T4/T5.

5.4Temperature, humidity, hearing, wind and taste

flysense.py maps word lists to peripheral populations. Rate is 0.6 + 0.2·n for n matching tokens (cap 1.0), with crude stemming (a token matches if any of its last 0–3 characters removed hits the list).

ModalityPopulationPhysiologyExample tokens
warmTRN_VP2warm-activated arista thermoreceptors (Gallio 2011; Frank 2017)hot, sun, fever
coolTRN_VP3cool-activatedcold, snow, brr
dryHRN_VP4dry cells of the sacculus (Enjin 2016)dusty, arid
moistHRN_VP5, VP1dmoist cells (Knecht 2016/17)rain, muggy
soundJO-A, JO-BJohnston's organ, ~200 Hz song band (Kamikouchi 2009)music, concert, scream
wind/gravityJO-C, JO-EJohnston's organ, static deflection (Yorozu 2009)windy, storm, flight
tasteLB*, claw_tpGRN, dorsal_tpGRNlabellar and tarsal gustatory receptor neuronslick, eat, delicious

5.5The clock and sleep

The fly's clock neurons receive steady input set by the real local time. Each group has a known peak hour; its drive falls off as a bell curve around that hour:

(4)rgroup(h) = exp( −d2 / 2σ2 ),  d = circular distance(h, hpeak),  σ = 3 h
GroupCell typesPeakRole
morning cellss-LNv, l-LNv07:00PDF-expressing morning oscillator (Renn 1999; Stoleru 2004)
middayDN1a12:30
evening cellsLNd18:30evening oscillator
nightDN1p22:30

Sleep pressure drives the dorsal fan-shaped body tangential neurons FB6 / FB7 (the 23E10 population; Donlea 2011/2014; Pimentel 2016) at max(night term, hours-awake/16), where night = 1.0 in 23:00–06:00, 0.5 in the shoulders, 0.1 by day.

“When the temperature was raised to 31°C, flies entered a quiescent state that meets the criteria for identifying sleep.”

Donlea et al. 2011, abstract, on thermogenetic activation of dorsal fan-shaped body neurons

5.6Recognising people

Each author has a distinct odour: a SHA-256 of who:<author id> is spread additively across the 53 glomeruli (16 byte-pairs → glomerulus index and weight). Because the mushroom body learns on the whole odour vector, an author acquires learned valence by the same mechanism as an odorant. A post whose words are all odourless leaves only the author's component, which the readout reports as the author.

6Running the brain

One reaction is 3,000 integration steps: four windows of 750 steps (150 ms) at Δt = 0.2 ms, membrane state carried across. Odour and touch drive are constant across windows; the visual drive changes per frame; clock and sleep drive are constant for the run.

Gain. Global synaptic gain is 0.085 for the central brain and VNC. At 1.0 the connectome saturates on any input; at 0.085 roughly 7–12 % of Kenyon cells fire per odour, the sparseness recorded in the mushroom body (Honegger 2011), and the MBONs remain in a range where they discriminate odours. Optic-lobe types use 0.2 (§5.3).

“the fundamental feature of odor processing in the MB is to create sparse stimulus representations in a format that facilitates arbitrary associations between odor and punishment or reward”

Honegger, Campbell & Turner 2011, abstract

Calibration. On first run the network is presented with 24 random odours (Hash-distributed over 8 glomeruli each) for the full 4-window protocol. For every recorded population the mean and standard deviation of firing rate per window are stored (build/calibration.npz). All subsequent readouts are z-scores against this baseline, so "fired" always means "fired more than it does for a meaningless smell".

Recorded populations. Every cell-type regex in §7 is resolved once against the type annotations to an index array. Spike counts per population per window are accumulated during the run and converted to Hz per neuron.

7Reading what happened

7.1Which signal wins each window

Every firing rate is compared to a resting baseline measured once on meaningless smells (§6) and expressed as a z-score: how many standard deviations above normal. In each window, every signal that rose above baseline (z > 1) is a candidate, and the strongest one becomes that window's content. Strength is scaled per kind of signal so a faint smell ranks below a clear feeling or a limb that moved:

(5)sq(z) = 1 − exp( −(z − 1) / 2 )    (z=1→0, z=3→0.63, z=5→0.86)
ChannelCell typesStrength
looming (checked first, as a fly does)LC4, LPLC2, LC6, LC160.5 + 0.5·sq(z), and rate > 0.35 Hz
smell: 47 glomeruli's projection neurons<glom>_lPN, _adPN…of glomeruli with z > 1, the one with max og · specificityg; strength og
conspecificDA1, VA1vas smell; VA1v attractive, DA1 aggressive/male
mouldDA2as smell; overrides all downstream slots (§8)
hunger / satiety / arousalNPFL1 / IPC / OA-*sq(z)
reward / punishment nowPAM / PPL1sq(z)
small object, brightnessLC10a–e, LC11, LC12, LC17 / Dm80.5 + 0.5·sq(z), rate > 0.35 Hz
motion (four directions)T4a, T4b, T4c, T4das above
temperature, humidity, sound, wind, taste§5.4 populationsif driven: rdrive·(0.8 + 0.2·sq(z)); if spontaneous: sq(z)
motor programme§7.4 populations0.5 + 0.5·sq(z) of the strongest descending / motor neuron

If nothing crosses baseline the window falls through to valence: MN9 active with approach > avoid → eat; both MBON sides suppressed (z < −1.5) → stop; |Δz| < 0.25 → turn or nothing; otherwise likes/dislikes by sign.

7.2Like or dislike

Two separate systems say whether the fly likes something, and they are read separately.

Learned preference (mushroom body). The mushroom body is the fly's learning centre. MBONs are split by which dopaminergic population innervates them more strongly, read from the wiring itself: for each MBON, summed |W| from PAM cells is compared to summed |W| from PPL1 cells. Following Aso et al. (2014), MBONs in PPL1 (punishment-written) compartments drive approach and MBONs in PAM (reward-written) compartments drive avoidance. The split recovers the literature assignment (MBON01/02/03 reward-side; MBON04/10/11 punishment-side) without a table. Window-mean rates of the two sides are z-scored (§6) and

(6)score = zapproach − zavoid,   verdict = YES iff score > 0

“Convergence of DAN axons on compartmentalized Kenyon cell–MBON synapses creates a highly ordered unit that can support learning to impose valence on sensory representations.”

Aso et al. 2014, abstract

Built-in preference (lateral horn). The lateral horn is the part of the fly brain that handles smells it was born knowing about. Each LH neuron is scored by its excitatory PN input from innately attractive glomeruli (DM1, DM2, DM4, DM5, VA2, VM2, VM3, VM5v, VM7d, VA1v) against innately aversive ones (DA2, V, DL5, DC4, DP1l, VL1, DL2d, VM1; Semmelhack & Wang 2009; Knaden 2012; Stensmyr 2012; Suh 2004; Ai 2010; Dweck 2015). Neurons with a 1.5× majority either way form lh_good and lh_bad, and their relative activation fills the "instinct" slot: innate valence, independent of the mushroom body.

“individual glomeruli, rather than the entire pattern of active glomeruli, mediate innate behavioural output”

Semmelhack & Wang 2009, abstract

7.3Heading

EPG neurons are binned into 16 wedges of the ellipsoid body from the protocerebral-bridge glomerulus in their instance name (R1…R8, then L8…L1 around the ring). Heading per window is the circular mean of wedge activity; a change of more than 0.6 rad between the first and last window is reported as a left or right turn. The bump rarely forms without a visual landmark; the readout is conservative and reports nothing when the distribution is flat.

7.4Actions

Cell typeBehaviourEvidence
MN9eat (proboscis extension)Shiu 2024 reproduced sugar-evoked PER through this neuron from the connectome alone
DNa01forward walkingChen 2018; Rayshubskiy 2020
DNa02turningRayshubskiy 2020
MDNbackward walkingBidaye 2014 (moonwalker)
DNp09stop / freezeZacarias 2018
DNg11groomingGuo 2022
DNp01 (giant fibre)jump / escapevon Reyn 2014
pIP10courtship songvon Philipsborn 2011
oviINoviposition / nestingWang 2020

8Turning it into a sentence

flytalk.py is a fill-in-the-blanks template. It supplies full stops and three connectives ("the", "smells like", "at first … then"). Slots are filled from the readout or left empty:

[answer]. [<thing>. <what it registered as>]. [sense]. [instinct].
[feeling]. [action]. [turn]. [time | sleep].
  • answer is filled only for a yes/no question (learned valence + instinct: "yes", "nah", "my gut says yes"). A what/who/how question gets none.
  • thing / registered: the anchor word and the strongest ligand of the glomerulus that won ("the espresso smells like coffee"; "banana. sweet."). The output names what registered, not the modality.
  • at first … then is inserted when window 1 and window 4 disagree, so the sequence of the run is preserved as a sequence of words.
  • Each percept, feeling and action has a bucket of 3–7 phrases in the first person, present tense; choice within a bucket is seeded by the post hash so the same post gets the same phrasing. Learned words (§9) are appended to the bucket of the behaviour that earned them.
  • DA2 (mould / machine string) collapses the sentence to a mould phrase plus at most one following behaviour, excluding every approach-class slot.

Total vocabulary is on the order of 60 hand-written phrases plus whatever has been picked up. Because X rejects duplicate posts, a phrase used recently receives a minimal variant.

9Learning

Only one kind of connection ever changes: the one from Kenyon cells (the mushroom body's input neurons, which carry the smell pattern) to mushroom body output neurons (MBONs, which vote for approach or avoidance). It changes when dopamine arrives (Hige 2015; Aso & Rubin 2016). A KC active shortly before a dopaminergic neuron fires has that KC→MBON synapse depressed. There is no potentiation.

“Pairing an odor with activation of specific dopamine neurons induces both learning and odor-specific synaptic depression. The plasticity induction strictly depends on the temporal order of the two stimuli”

Hige et al. 2015, abstract
(7)ek ← λ ek;  ek = 1 if KCpre(k) fired   (λ = 0.55 per window)
(8)gk ← max( gfloor, gk · (1 − η · a · ek) )  for k in the addressed compartment with ek > 0.05
(9)gk ← gk + ρ (1 − gk)   per run (forgetting)

with η = 0.06, gfloor = 0.25, ρ = 0.0008 applied once per reaction, and a ∈ [0.4, 1] the dopamine amount. Reward (valence +1) addresses synapses onto PAM-side MBONs; punishment addresses PPL1-side. Gains are written directly into the running weight array and persist in build/mb_gains.npz.

What counts as reward. In a real fly, dopamine is released by sugar or by an electric shock. Here it is released by how a post did. Hourly, the bot fetches public metrics for its posts aged 6–48 h and computes

(10)E = likes + 3·replies + 2·(reposts + quotes)

A post above the account's running median E (last 200 scored posts) has the odour that produced it replayed with PAM dopamine; below, PPL1. Amount a = min(1, 0.4 + |E − median| / max(1, median + 1)). Using the account's running median rather than an absolute threshold gives a low-engagement account a mix of reward and punishment. The words of the post are not involved in the update; the odour vector is replayed with dopamine present.

Vocabulary uptake. On reward, up to two content words from the post that was answered are added to the word bucket of the behaviour that produced the reply (build/vocab.json). Bucket selection is unchanged; only bucket contents grow.

Asymmetry in the data. The connectome has 942 KC→MBON edges on the reward side against 75 on the punishment side, so punishment has far fewer synapses to depress. This is a property of the reconstruction.

10How the account behaves

flytweet.py is the part that talks to X.

  • Mentions are answered as fast as rate limits allow; polling interval adapts to the x-rate-limit-* headers. Per author: one reply per 5 min, eight per hour. Per conversation: three replies, then it leaves the thread. It never replies to itself, reposts, or muted accounts.
  • Wandering: about once a minute it lands on a random original post (home timeline first, recent search on an everyday word when the timeline is empty), at most once per author per hour, never the same post twice.
  • Idle posts every five minutes (±20 %). With probability 0.55 the fly reacts to a fresh post from the home timeline and names what it was looking at; with 0.30 it is placed in one of ~20 fixed scenes ("a bakery", "rain again", "a wet basement"); with 0.15 it runs with no input other than the clock and sleep pressure.
  • Learning every hour (§9).
  • Photos attached to a post are shown to the eye with the text; the author is mixed into the smell.

Every post is appended to build/tweets.jsonl with the full set of brain measurements that produced it (per-window rates, z-scores, the odour vector, the winning channel per window, MB statistics).

11What is real data and what we chose

Measured (published data, used as-is)Assumed (a modelling choice made by a person)
the wiring: 165,122 neurons, every ≥3-synapse connectionthat text is assigned an odour, a temperature, or a sound
transmitter sign per cell (predicted from EM, Eckstein 2024)which molecules an English word emits (the anchor table)
LIF parameters and 0.275 mV/synapse (Shiu 2024)nearest-anchor selection by frozen word vectors
every odorant → receptor response (DoOR 2.0)the global gain (0.085) and optic-lobe gain (0.2)
retinotopic column coordinates of the right optic loberendering a post as 28 px white-on-black text
clock-group phases; sleep-promoting dFB populationengagement as the dopamine signal; the median as the bar
the KC→MBON depression rule and its siteη, floor, recovery and trace constants
the PAM/PPL1 split of MBONs (read from wiring; matches Aso 2014)the words in every bucket
each cell type → behaviour mapping (§7.4)the slot order and connectives of the sentence

Known limits. Direction selectivity in T4/T5 is weak because each window holds a still frame with a fixed shift. The EPG bump rarely forms without a visual landmark. The lamina is driven by luminance rather than by a photoreceptor model. Modulatory transmitters carry no fast current. Efficacy is a single per-type scalar. Nothing has been fitted to a behavioural target. The system is a forward model; its outputs are observations of the model.

12All the numbers in one place

SymbolValueWhere
neurons / synapses165,122 / ≈10.2 Mbuild_graph.py
minimum synapses per edge3build_graph.py
PSP per synapse0.275 mVbuild_graph.py
Vrest, Vthr, τm, tref, Δt−52 mV, −45 mV, 20 ms, 2.2 ms, 0.2 msflysim.py
gain (central) / gain (optic lobe)0.085 / 0.2flysay.py
window / windows150 ms × 4flysay.py
calibration odours24flysay.py
ORNs / glomeruli / DoOR-covered glomeruli2,635 / 53 / 47flynose.py, door.py
ORN max rate100 Hzflynose.py
lamina columns / visual max rate892 / 120 Hzflyeye.py
similarity tiers (full / faint) ; faint strength ; max anchors0.66 / 0.45 ; 0.35 ; 3scene.py
clock σ ; peaks3 h ; 07:00 12:30 18:30 22:30flysense.py
η, gfloor, ρ, λ0.06, 0.25, 0.0008, 0.55mushroom.py
KC→MBON synapses (reward / punish side)942 / 75mushroom.py
engagement Elikes + 3·replies + 2·(reposts+quotes)flytweet.py
scoring window ; history6–48 h ; 200 postsflytweet.py

GGlossary

TermMeaning here
connectomethe complete map of neurons and the connections between them, from electron-microscope images
synapsea connection point where one neuron signals another; more synapses between a pair means a stronger link
leaky integrate-and-firethe simplest common neuron model: voltage leaks toward rest, adds up incoming spikes, fires at a threshold
receptor / sensory neurona neuron that turns something physical (a molecule, light, heat) into firing
ORNolfactory receptor neuron: a smell neuron in the antenna
glomerulusa cluster in the smell centre where all ORNs with the same receptor converge; there are 53
projection neuron (PN)carries a glomerulus's signal deeper into the brain
DoORa public database of how each fly odour receptor responds to each of ~700 molecules
mushroom bodythe fly's learning and memory centre
Kenyon cell (KC)the mushroom body's input neurons; a smell is a sparse pattern across them
MBONmushroom body output neuron; groups of them push toward approach or avoidance
PAM / PPL1the two groups of dopamine neurons that write reward and punishment into the mushroom body
lateral hornthe brain region for smells the fly is born liking or disliking
lamina, medulla, T4/T5, LC cellssuccessive stages of the fly's visual system: first-stage columns, change detectors, motion detectors, object detectors
Johnston's organ (JO)the fly's ear, in the antenna; also senses wind
EPGthe fly's heading compass neurons
descending neuron (DN)a neuron that runs from brain to nerve cord and triggers an action
z-scorehow many standard deviations a firing rate is above its normal resting level
Poisson inputspikes delivered at random times at a set average rate
gaina single multiplier on connection strength, the one number we tune by hand

13References

  1. [1]Shiu, P. K. et al. (2024). A Drosophila computational brain model reveals sensorimotor processing. Nature 634, 210–219.
  2. [2]HHMI Janelia FlyEM, Cambridge Connectomics Group, Google Research. Male CNS connectome v1.0. CC-BY 4.0.
  3. [3]Eckstein, N. et al. (2024). Neurotransmitter classification from electron microscopy images at synaptic sites in Drosophila melanogaster. Cell 187.
  4. [4]Münch, D. & Galizia, C. G. (2016). DoOR 2.0 — Comprehensive mapping of Drosophila melanogaster odorant responses. Sci. Rep. 6, 21841. CC BY-SA 4.0.
  5. [5]Benton, R. (2022). Drosophila olfaction: past, present and future. Proc. R. Soc. B 289.
  6. [6]Stensmyr, M. C. et al. (2012). A conserved dedicated olfactory circuit for detecting harmful microbes in Drosophila. Cell 151, 1345–1357.
  7. [7]Aso, Y. et al. (2014). The neuronal architecture of the mushroom body provides a logic for associative learning. eLife 3, e04577.
  8. [8]Aso, Y. & Rubin, G. M. (2016). Dopaminergic neurons write and update memories with cell-type-specific rules. eLife 5, e16135.
  9. [9]Hige, T. et al. (2015). Heterosynaptic plasticity underlies aversive olfactory learning in Drosophila. Neuron 88, 985–998.
  10. [10]Honegger, K. S., Campbell, R. A. A. & Turner, G. C. (2011). Cellular-resolution population imaging reveals robust sparse coding in the Drosophila mushroom body. J. Neurosci. 31, 11772–11785.
  11. [11]Semmelhack, J. L. & Wang, J. W. (2009). Select Drosophila glomeruli mediate innate olfactory attraction and aversion. Nature 459, 218–223.
  12. [12]Knaden, M. et al. (2012). Spatial representation of odorant valence in an insect brain. Cell Rep. 1, 392–399.
  13. [13]Gallio, M. et al. (2011). The coding of temperature in the Drosophila brain. Cell 144, 614–624.
  14. [14]Enjin, A. et al. (2016). Humidity sensing in Drosophila. Curr. Biol. 26, 1352–1358.
  15. [15]Kamikouchi, A. et al. (2009). The neural basis of Drosophila gravity-sensing and hearing. Nature 458, 165–171.
  16. [16]Renn, S. C. P. et al. (1999). A pdf neuropeptide gene mutation and ablation of PDF neurons each cause severe abnormalities of behavioral circadian rhythms in Drosophila. Cell 99, 791–802.
  17. [17]Stoleru, D. et al. (2004). Coupled oscillators control morning and evening locomotor behaviour of Drosophila. Nature 431, 862–868.
  18. [18]Donlea, J. M. et al. (2011). Inducing sleep by remote control facilitates memory consolidation in Drosophila. Science 332, 1571–1576.
  19. [19]Rayshubskiy, A. et al. (2020). Neural control of steering in walking Drosophila. bioRxiv.
  20. [20]Zacarias, R. et al. (2018). Speed dependent descending control of freezing behavior in Drosophila melanogaster. Nat. Commun. 9, 3697.
  21. [21]Guo, L. et al. (2022). Descending neurons coordinate anterior grooming behavior in Drosophila. Curr. Biol. 32, 823–833.
  22. [22]Wang, F. et al. (2020). Neural circuitry linking mating and egg laying in Drosophila females. Nature 579, 101–105.
  23. [23]Bidaye, S. S. et al. (2014). Neuronal control of Drosophila walking direction. Science 344, 97–101.
  24. [24]von Reyn, C. R. et al. (2014). A spike-timing mechanism for action selection. Nat. Neurosci. 17, 962–970.
  25. [25]von Philipsborn, A. C. et al. (2011). Neuronal control of Drosophila courtship song. Neuron 69, 509–522.
  26. [26]Pennington, J., Socher, R. & Manning, C. D. (2014). GloVe: Global vectors for word representation. EMNLP.
  27. [27]flybrain.online (fruitflydev). Simulation code adapted under MIT.