Abstract
In dynamic environments, animals make behavioural decisions on the basis of the innate valences of sensory cues and information learnt about these cues across multiple timescales1–3. However, it remains unclear how the innate valence of a sensory stimulus affects the acquisition of learnt valence information and subsequent memory dynamics. Here we show that in the Drosophila brain, interconnected short- and long-term memory units of the mushroom body jointly regulate memory through dopamine signals that encode innate and learnt sensory valences. By performing time-lapse in vivo voltage-imaging studies of neural spiking in more than 500 flies undergoing olfactory associative conditioning, we found that protocerebral posterior lateral 1 dopamine neurons (PPL1-DANs)4 heterogeneously and bidirectionally encode innate and learnt valences of punishment, reward and odour cues. During learning, these valence signals regulate memory storage and extinction in mushroom body output neurons (MBONs)5. During initial conditioning bouts, PPL1-γ1pedc and PPL1-γ2α′1 neurons control short-term memory formation, which weakens inhibitory feedback from MBON-γ1pedc>α/β to PPL1-α′2α2 and PPL1-α3. During further conditioning, this diminished feedback allows these two PPL1-DANs to encode the net innate plus learnt valence of the conditioned odour cue, which gates long-term memory formation. A computational model constrained by the fly connectome6,7 and our spiking data explains how dopamine signals mediate the circuit interactions between short- and long-term memory traces, yielding predictions that our experiments confirmed. Overall, the mushroom body achieves flexible learning through the integration of innate and learnt valences in parallel learning units sharing feedback interconnections. This hybrid physiological–anatomical mechanism may be a general means by which dopamine regulates memory dynamics in other species and brain structures, including the vertebrate basal ganglia.
Subject terms: Classical conditioning, Neural circuits, Learning algorithms, Long-term memory
In the brain of fruit flies, the mushroom body achieves flexible learning by using interconnected short- and long-term memory units for dopamine-mediated integration of innate valences with learnt valences obtained through experience.
Main
When navigating changing environments, animals evaluate the innate and learnt valences of sensory cues. The former represent predictions that may promote survival, such as those about threats or food, whereas the latter represent updates to these predictions based on experience2. Many species process innate and learnt valences in distinct neural pathways, which may promote behavioural reliability and flexibility1,3,8. Whether innate valences shape the acquisition of learnt valence information, and what functional benefits such interactions might confer, have remained unknown.
One possibility is that innate valences modulate learning through dopamine teaching signals that convey both innate and learnt information. Mammalian dopamine neurons (DANs) encode reward predictions and prediction errors, as well as motivational values9 and novelties or identities of unfamiliar cues, showing that DANs can signal certain innate facets of sensory cues10. In Drosophila, DANs also process innate and learnt valences. The PPL1 and protocerebral anterior medial (PAM) clusters of DANs provide the fly mushroom body with negative and positive reinforcement signals, respectively, that drive synaptic plasticity and learning5,11. Notably, co-activation of DANs and odour-responsive, mushroom body Kenyon cells induce olfactory learning12,13. But DANs also innately respond to odorants, not just to aversive or rewarding stimuli14.
The PPL1-DANs and MBONs interconnect in a parallel-recurrent circuit of multiple learning units sharing widespread feedback connections5,6 (Fig. 1a). Multiple memory traces can exist concurrently across different units; in each unit, one DAN controls synaptic plasticity. DANs also receive recurrent signals from MBONs conveying learnt valence information6,7,15. We hypothesized that DANs integrate innate valence signals coming from the sensory system (through the mushroom body) and learnt valences stored in the memory (by MBONs).
We tested this hypothesis through long-term optical voltage-imaging studies in more than 500 flies. Unlike Ca2+ imaging, voltage imaging reports neural spikes with millisecond resolution, revealing spiking excitation and suppression16. We studied how PPL1-DAN teaching signals encode and integrate innate and learnt valences, and found that this integration allows short-term memory to regulate long-term memory formation through MBON → DAN feedback, enabling complex interactions between short- and long-term memory.
Long-term voltage imaging
To image spiking across an olfactory conditioning assay (Fig. 1b and Supplementary Video 1), we used a laser microsurgical preparation17 for long-term imaging18 and predominantly the positive-polarity voltage indicator, pAce16, a FRET–opsin indicator we created based on our earlier negative-polarity indicator using an opsin from the algae Acetabularia19. Using Split-GAL4 fly lines5, we expressed pAce in five PPL1-DAN (PPL1-γ1pedc, -γ2α′1, -α′2α2, -α3 and -α′3m) and six MBON (MBON-γ1pedc>α/β, -γ2α′1, -α2sc, -α′2, -α3 and -α′3) subtypes (Extended Data Fig. 1a–i and Extended Data Table 1).
Extended Data Table 1.
A table of the fly lines created in this study and of the fly genotypes used in each figure panel.
Using 1-kHz imaging of mushroom body compartments innervated by PPL1-DAN axons and MBON dendrites, we found variable spontaneous spiking and bursting rates across all 11 neuron types (Fig. 1c–e and Extended Data Fig. 1a–i). Spike-detection fidelity values, d′, and error rates were satisfactory in all neuron types (Extended Data Fig. 1j–l). In MBONs, spikes back-propagated from axonal regions into dendrites (Extended Data Fig. 2 and Supplementary Video 2), which might facilitate spike-timing-dependent plasticity20.
PPL1-DANs encode innate valences heterogeneously and bidirectionally
To assess valence coding, we tracked PPL1-DAN responses to punishments (electric shock), rewards (sucrose) and odours. After the onset of shock pulses to the thorax, spiking increased in PPL1-γ1pedc, -γ2α′1 and -α3 neurons, and decreased after shock offset, whereas sucrose-intake decreased spiking in PPL1-γ1pedc, -γ2α′1, -α′2α2 and -α3 neurons (Fig. 2a–e).
We next tested behavioural odour preferences without voltage imaging. We delivered odours from a fly’s front left or right side and recorded its locomotor responses on a trackball towards or away from the odour (Fig. 2f). We found five odours that evoked responses from vigorous approach to vigorous avoidance, indicating wide-ranging odour valences (Fig. 2f–h and Extended Data Fig. 3a,b).
Using these five odours, we imaged PPL1-DAN and MBON responses. Unlike the odour-evoked excitations observed in Ca2+-imaging studies13,14,21, we found that odours bidirectionally modulated PPL1-DAN spiking, according to flies’ odour-evoked behavioural responses (Fig. 2c,i; Extended Data Fig. 3c–h). An exception was PPL1-α′3, which mainly exhibited excitations. MBONs had excitatory responses with amplitudes unrelated to odour valence22 (Extended Data Fig. 4a–g).
Across the five odours, the responses of DANs and MBONs correlated positively with those of other DANs and MBONs, respectively, but negatively across the two cell classes (Fig. 2i,j). MBON-α2sc was an exception, with odour responses resembling those of PPL1-DANs. PPL1-DAN odour responses correlated well with odour-evoked behavioural responses, apart from PPL1-α′3. The MBON odour responses were more variable across flies and correlated more weakly with behaviour. Thus, PPL1-DAN responses enabled more-accurate classifications of odour valences (Extended Data Fig. 4h), suggesting that DAN odour coding is not merely inherited through feedback from MBONs but instead reflects diverse inputs6.
Learning induces bidirectional plasticity across PPL1-DANs and MBONs
To probe mushroom body coding and plasticity during learning, we developed an associative conditioning assay for head-fixed flies behaving on a trackball or undergoing voltage imaging (Fig. 3a–d). As with conventional T-maze conditioning assays, ours had six training bouts, each with sequential exposures to a pair of conditioned-stimulus (CS+ and CS−) odours of the same initial valence. In each bout we paired a 30-s CS+ delivery with a 30-s pulsed electric shock to the fly. After conditioning with innately attractive odours, flies reduced their approaches to the CS+ but not to the CS− for 1 h or more (Fig. 3b,c).
Voltage-imaging experiments showed that CS−-evoked responses in all PPL1-DANs were unaltered by conditioning (Fig. 3e and Extended Data Fig. 5). CS+-evoked responses of PPL1-α′2α2 and -α3 evolved across 3–6 training bouts, changing from odour-evoked decreases in spiking to evoked increases and then back to evoked decreases after 1 h, suggesting that learnt valence information transiently alters valence coding in these cells. PPL1-γ1pedc consistently exhibited CS+-evoked spiking decreases, but with diminished amplitudes at 5 min, but not 1 h, after conditioning. PPL1-γ2α′1 and -α′3 neurons were unaffected by conditioning, as was spontaneous DAN spiking. After training, the differential changes in evoked spike rates, which we quantified using a CS+ versus CS– bias (Methods), were biased to the CS+ in PPL1-α′2α2 and -α3 but not in other PPL1-DANs.
Unlike PPL1-DANs, after training, MBONs-γ1pedc>α/β and -γ2α′1 had decreased CS+-evoked responses that returned to near-baseline values about 1 h later, in agreement with previous studies12, whereas decreased CS+-evoked responses in MBON-α3 persisted for more than 1 h (Fig. 3f and Extended Data Fig. 6). Spontaneous spiking by MBON-α3, but not by other MBONs, increased after training.
MBON-α3 plasticity encodes long-lived memory and depends on innate odour valence
Previous studies have suggested that the γ and α compartments of the mushroom body differentially regulate short- and long-term memories11,23. To assess this, our voltage-imaging studies lasted either 24 h or 48 h after associative conditioning (Fig. 4a–d and Extended Data Fig. 7a–c). Depressions of CS+-evoked responses endured for less than 1 h in MBON-γ1pedc>α/β neurons, whereas those of MBON-α3 persisted for more than 24 h. To test the necessity of this long-lasting plasticity for long-lasting memory, we blocked neurotransmitter release from MBON-α3; this impaired memory at 3 h but not 5 min after training, verifying the selective importance of MBON-α3 for long-lasting memory (Extended Data Fig. 7d,e).
Next, we examined how innate valences influence long-lasting plasticity by comparing conditioning with attractive versus repulsive odour pairs. After three training bouts with attractive odours, CS+- but not CS−-evoked responses in MBON-α3 switched from spiking increases to decreases, which became more pronounced after three more bouts (Fig. 4a,c). This plasticity gradually decayed but remained after 24 h. The CS+/CS− bias fell below its pretraining level for all postconditioning time points except 24 h.
By comparison, after only three training bouts with repulsive odours, CS+ and CS− presentations evoked suppressions of MBON-α3 spiking across >24 h and 3 h, respectively (Fig. 4b,d and Extended Data Fig. 8a). CS+/CS− response biases were statistically unchanged until 24 h after conditioning. There were also CS+- and CS−-evoked suppressions of MBON-γ1pedc>α/β spiking and diminished odour responses in MBON-α2sc, unlike the case with attractive odours (Extended Data Fig. 8b,c). Overall, innate odour valence greatly influenced MBON-α3 plasticity and thereby long-lasting memory.
MBON-γ1pedc>α/β feedback to PPL1-α3 shapes MBON-α3 plasticity
To investigate long-lasting plasticity in MBON-α3, we studied the bidirectional teaching signals from PPL1-α3 and how PPL1-α3 responds to co-occurring stimuli with similarly or oppositely signed valences. Pairing five shock pulses with either attractive or repulsive odours evoked PPL1-α3 dynamics that combined the specific activity patterns elicited by the odour or shocks individually (Fig. 4e–h). Attractive odours reduced shock-evoked spiking, but repulsive odours did the opposite, in a manner consistent with PPL1-α3 linearly summing its responses to the individual stimuli. PPL1-γ1pedc behaved similarly (Extended Data Fig. 8d–g). Overall, PPL1-DAN spiking conveyed the net valence of paired stimuli, explaining why conditioning with attractive versus repulsive odour pairs yields very different plasticity in downstream MBONs.
We considered candidate circuit mechanisms for net valence coding by PPL1-α3, including feedback from several MBONs6, and identified feedback from MBON-γ1pedc>α/β as likely to have a central role. Clues motivating this hypothesis were the matching durations of learning-induced depression of the odour responses of MBON-γ1pedc>α/β and the short-lasting potentiation for PPL1-α3 (Fig. 3e,f), suggesting that depressed inhibitory feedback from MBON-γ1pedc>α/β disinhibits the odour responses of PPL1-α3.
We tested the role of this feedback in innate odour-valence coding by knockdown of GABAA receptor expression in PPL1-α3 (Extended Data Fig. 9). This disrupted the range and bidirectionality of innate valence coding in PPL1-α3. Downregulating expression of the glutamate-gated chloride channel (GluCl-α) also disrupted innate odour-valence coding in PPL1-α3, suggesting that this coding depends on feedback from multiple MBONs.
Next, we tested the role of feedback inhibition from MBON-γ1pedc>α/β in associative conditioning. Using two genetic expression systems, we imaged PPL1-α3 spiking while blocking MBON-γ1pedc>α/β neurotransmission. In these flies, during training with attractive odours, PPL1-α3 exhibited slight odour-evoked spiking increases that were unaffected by training (Fig. 4i,j). In control flies, odours evoked normal decreases in PPL1-α3 spiking, which after conditioning switched for the CS+ to evoked increases. These results suggest that, during learning, the initial depression of CS+ responses in MBON-γ1pedc>α/β increases CS+ responses in PPL1-α3, which then gates the formation of long-lasting plasticity in MBON-α3 for long-lasting memory.
To test this interpretation, we optogenetically activated MBON-γ1pedc>α/β to maintain its inhibitory feedback signals at a high level during conditioning with attractive odours (Fig. 4k–m). Control flies showed reduced attraction to the CS+ at 5 min and 3 h after conditioning, whereas flies receiving MBON-γ1pedc>α/β excitation during conditioning had memory impairments at 3 h but not 5 min after conditioning. This selective impairment shows that removing the strong feedback from MBON-γ1pedc>α/β is crucial for long-lasting memory formation.
Computational model of valence integration and memory trace interactions
To analyse how valence signals interact, we modelled three modules (γ1, α2 and α3), interconnected according to the fly connectome6,7 (Fig. 5a and Supplementary Information). The nine neurons of the model comprise DANs and MBONs, two Kenyon cells (KCs), which transmit olfactory signals, and a shock-sensing neuron. The DANs integrate shock-related and olfactory signals with MBON→DAN feedback. The bidirectional, anti-Hebbian plasticity of the model was motivated by our findings of bidirectional valence coding and distinct conditioning outcomes using attractive versus repulsive odours. Specifically, KC activation coinciding with DAN activation or suppression respectively weakens or strengthens the corresponding KC→MBON connection (Fig. 5b and Extended Data Fig. 10a,b).
In the model, the initial input strengths of the DANs set their innate odour-valence representations. KC→MBON plasticity allows learnt valences to shape DAN dynamics through MBON→DAN feedback, enabling existing short-term memories to gate long-term memory formation during further training. After conditioning, KC→MBON plasticity decays at rates reflecting the memory-retention properties of each module. Model fits to measured spike rates (Figs. 2i, 3e,f, 4c,d and Extended Data Fig. 8b,c) determined these and other parameter values (Fig. 5c and Extended Data Fig. 10c–m). A roughly 30-min plasticity time constant governs the faster memory decay of the γ compartment, whereas the two α compartments have a roughly 100-min decay. Beyond 3 h after conditioning, plasticity in the α compartments decays with another much slower time constant (Supplementary Information).
We assessed how odour valences shape plasticity in the model and quantified innate valences of hypothetical attractive or repulsive odorants, respectively, by the negative or positive changes in DAN spiking they evoked. As in real experiments, conditioning involved odour pairs of equal innate valence. One training bout with attractive odours weakly depressed, or even slightly potentiated, odour-evoked spiking in all three MBONs; simulated conditioning with repulsive odours more strongly depressed odour-evoked MBON spiking (Fig. 5d). After six training bouts, MBON-α2sc and -α3 had valence-dependent CS+/CS− response biases for more than 24 h (Extended Data Fig. 11). Thus, as found experimentally, the innate valences of sensory cues regulated their plasticity dynamics.
Next, we explored how learnt valences and inhibitory feedback from MBON-γ1pedc>α/β to DANs influence subsequent conditioning. In model versions without this feedback, plasticity decreased by 2–8% in MBON-γ1pedc>α/β, was eliminated in MBON-α2sc, and declined in MBON-α3 by 0–36% at 15 min after conditioning, and by 36–63% at 3 h (Fig. 5e,f). Despite this diminished plasticity of the KC→MBON-α3 connection when MBON-γ1pedc>α/β feedback to PPL1-α3 was removed, at 15 min after conditioning MBON-α3 firing remained almost fully suppressed by odour presentation, as was the case for models with feedback (Fig. 5e). However, without feedback, odour presentation incompletely suppressed MBON-α3 spiking at 3 h after conditioning. Thus, consistent with experimental results, learnt valences promote the long-lasting plasticity of the model in MBON-α3, owing to feedback from MBON-γ1pedc>α/β.
The model made several testable predictions. First, it predicted that synaptic depression levels should depend on the inter-stimulus interval (ISI) between conditioning stimuli. This resembles the ‘spacing effects’ observed in many species, in which learning protocols repeated at longer intervals induce long-term memories more effectively24,25. When we increased the ISIs for model training from 60 s to 900 s, short-term (5 min) depression in MBON-γ1pedc>α/β gradually declined (Fig. 5g). MBON-α3 exhibited prominent, ISI-dependent plasticity at 3 h and 24 h after conditioning; plasticity was maximized by an ISI of around 360 s, owing to the countervailing influences of sensory adaptation and MBON-γ1pedc>α/β feedback (Extended Data Fig. 10e–g). In real flies, six training bouts with an ISI of 360 s induced greater long-lasting depression in MBON-α3 than an ISI of 60 s or 900 s (Fig. 5h).
The model also predicted that the extinction of a long-lasting memory trace, reflecting MBON-α3 plasticity, should depend on innate odour valence and the time elapsed since conditioning. After repeated conditioning bouts, the CS+-evoked responses of the model in PPL1-α3 initially increased but gradually decayed by around 1 h later. Hence, within this first hour, the CS+ is not only associated with the unconditioned stimulus (US) in the short-term-learning unit but also acts as a reinforcer in the long-term units (Extended Data Fig. 11d,f). Consequently, postconditioning re-exposures to unpaired CS+ and CS− odours influenced MBON-α3 plasticity in a valence- and time-dependent manner (Fig. 5i and Extended Data Fig. 10h). For simulated attractive odours, extinction bouts starting ≥60 min but not ≤30 min after conditioning erased conditioning-induced MBON-α3 depression, as measured 3 h after conditioning (Fig. 5i and Extended Data Figs. 10h and 12). For repulsive odours, extinction bouts induced more modest, transient changes in the CS+/CS− response bias of MBON-α3. To test these predictions, 3 h after conditioning we measured MBON-α3 response biases in conditioned flies that either had no extinction sessions or an extinction session at either 10 min or 2 h after conditioning. These measurements supported the model, verifying the predicted valence and time dependence of plasticity after extinction training (Fig. 5j).
In the model, extinction training soon after associative conditioning can paradoxically extend the longevity of plasticity in the long-term memory compartment (Fig. 5i). To test this, we compared the CS+/CS− response biases of MBON-α3 in conditioned flies with either no extinction training or with extinction training 10 min after conditioning. Strikingly, extinction training increased MBON-α3 plasticity, assessed 35 min after conditioning (Fig. 5k and Extended Data Fig. 12b). In the model, this effect arises from learnt valences encoded by PPL1-α3, which allows unpaired CS+ presentations to reinforce the previously formed plasticity in the long-term memory units, even as they extinguish plasticity in the short-term unit. The learnt valence makes the CS+ a self-reinforcer.
Discussion
Dopamine-based valence integration modulates mushroom-body memory dynamics and seems suited to reserve long-lasting memories, which may be costly energetically26, for reliable, frequently encountered associations. Our voltage-imaging studies of these effects involved more than 500 flies and provided some important advantages over Ca2+ imaging (Extended Data Fig. 13a–h and Supplementary Discussion). The quantitative, verifiable predictions arising from our model illustrate the potency of combining spike-rate and connectomic data as modelling constraints.
Valence integration by PPL1-DANs regulates memory dynamics
PPL1-DANs integrate the innate and learnt valences of sensory cues; the tally can be positive or negative, augmenting reports that PPL1-DANs signal negatively valued stimuli27,28. During the initial cycles of aversive conditioning, PPL1-DANs sum the innate valences of cue and reinforcer. This leads to the depression of KC→MBON connections, especially in fast (γ1 and γ2) learning units. The net valence signal discourages learning of contradictory associations (such as innately attractive cues paired with punishment), which may not be ecologically reliable and elicit smaller dopamine signals and less plasticity than innately aversive cues paired with punishment. The fast-learning unit (γ1) can rapidly adjust fly behaviour. Through feedback interactions, short-term memory traces in γ1 also gate the formation of long-term traces for repeated, reliable associations. After repeated conditioning, diminished feedback inhibition from γ1 allows DANs of the slower learning units (α2 and α3) to undergo short-lived potentiation of their sensory-evoked responses, which encode the net CS+ valence (innate plus learnt) and induce long-lasting plasticity in α2 and α3. Because α2 is more responsive to learnt CS valences than to unconditioned stimulus punishments, this unit seems poised to detect repetitions of cues from prior associative events. In α3, both net odour valence and the unconditioned stimulus drive learning. The γ2 and α′3 compartments respectively respond to locomotion29 and odour novelty21 and may have specialized learning roles. Sensory data, diverse teaching signals and both short- and long-term memory traces all interact in the mushroom body to execute assorted learning rules in parallel, creating complex memory dynamics (Extended Data Fig. 13i).
Connectome- and physiology-constrained computational model
Multiple models of the mushroom body include compartmentalized, KC→MBON synaptic plasticity gated by KC–DAN co-activation15,30–37 but differ over whether they treat appetitive33 or aversive30,35 learning (or both15,31,32,34), signalling of prediction errors15,30–32, interactions between appetitive and aversive learning units15,31,32,34, single compartments35–37 or both short- and long-term learning units15,34, and various lateral and feedback connections. Our model reveals key features of the parallel-recurrent PPL1-DAN/MBON learning system, enacts distinct learning algorithms in short-term and long-term memory (STM and LTM) modules, and makes new predictions. Although several aspects have appeared previously, the model distinctively combines quantitative use of the fly connectome to determine connections, parameter optimization through global fits to spike-rate data, bidirectional plasticity, KC→DAN inputs driving innate odour-valence coding, and MBON→DAN feedback from STM to LTM units for DAN integration of innate and learnt valences, which no previous model we have seen describes.
The bidirectional plasticity implies that KC activation paired with DAN inhibition strengthens the KC→MBON synapse. This model feature is based on the bidirectional encoding of innate valences, distinct plasticity induced by attractive and repulsive odours, and memory-trace extinction induced by unpaired attractive CS+ odours. In mammals, negative dopamine signals can encode negative prediction errors38. In flies, inactivation or activation of PAM-γ3 DAN, which is normally inhibited by rewards, artificially reinforces appetitive or aversive memories, respectively39. Analogous studies should be done with PPL1-DANs.
In our model, anti-Hebbian plasticity supports distinct learning algorithms in different compartments. In the STM (γ1) module, stimulus-evoked DAN signalling is invariant across learning, and MBON-γ1pedc>α/β plasticity relies on the CS+–US co-occurrence. The slower-acting (α2 and α3) modules enact prediction-based algorithms by means of CS+-evoked dopamine signals that increase over repeated conditioning cycles to convey the learnt valence of the CS+ and promote LTM formation. This highlights how inhibitory feedback from MBON-γ1pedc>α/β to PPL1-α′2α2 and PPL1-α3 regulates LTM formation, assigning functions to these recently identified connections6.
Excitatory feedback connections from MBON-α2sc and MBON-α3 to PPL1-α3, which might in principle support ‘prediction error’ computations, were fitted to negligible strengths in our model, implying that the α2 unit in the model does not influence long-term plasticity in MBON-α3. Thus, prediction error signals may not be prime drivers of plasticity for our training protocol. Previous work implicates α2 in diverse memory-related functions11,40, but studies of α2 plasticity report varying results23,41. Here, PPL1-α′2α2 encoded learnt valences after training with odours of either valence, but MBON-α2sc exhibited plasticity only for repulsive odours (Extended Data Fig. 8c). A two-module version of our model with γ1 and α3 units generated almost identical parameter values and LTM dynamics in α3 as the three-module version (Extended Data Fig. 10i–m and Supplementary Fig. 1).
The circuit implementation of valence integration in our model leads to testable predictions about LTM. The model exhibits a spacing effect in memory encoding and predicts enhanced long-lasting plasticity when associative events are spaced at particular optimal time intervals. Mechanistically, plasticity strength in the LTM unit depends on the offsetting influences of sensory adaptation and feedback from the STM unit. These processes have distinct time courses, which jointly set the optimal ISI. For ISI values shorter than optimal, sensory adaptation dominates, slowing LTM formation. For ISI values longer than optimal, the STM decays, weakening LTM induction.
The model also predicts that extinction of a long-lasting memory trace depends on the timing of extinction bouts and the innate valences of the sensory cues. Notably, in flies conditioned with attractive odours, the timing of subsequent re-exposures to the CS+ odour strongly influenced MBON-α3 plasticity; extinction bouts 10 min after conditioning strengthened the original α3 plasticity, whereas extinction bouts 2 h after conditioning weakened it (Fig. 5i,j). These effects reflect dynamic competition between innate appetitive and learnt aversive valences, which PPL1-α3 encodes with relative amplitudes that vary across time and learning phases. Soon after conditioning, PPL1-α3 encodes the learnt aversive valence of an innately attractive CS+, enabling the CS+ to act as its own reinforcer and enhance α3 plasticity.
This competition between innate and learnt valences drives an interplay between STM and LTM that is mediated by feedback inhibition. Unlike previous conceptions, in which spontaneous neural activity during an offline consolidation period transfers memory from STM to LTM modules, in our model, memory is not directly transferred. Instead, feedback from the STM module gates plasticity in the LTM module during training bouts subsequent to the first. Frequent co-occurrences of two stimuli may indicate a reliable relationship that an animal should remember. Crucially, the gating mechanism allows rapid LTM formation in α3 once the repeated association has been detected, unlike in models that encode LTM in slow-changing synapses. The gating also adjusts learning and extinction speeds for odours of different valences; CS+–US pairs of opposite valences lead to slower LTM formation plus a memory trace that is more extinction prone. The Supplementary Discussion describes additional valence interactions and explains why CS− stimuli can induce MBON plasticity.
Outlook
Our model focuses on aversive conditioning and the γ1, α2 and α3 modules, but it neglects modules central to appetitive conditioning6,11. Future voltage-imaging experiments should examine the full mushroom body circuit, whether appetitive learning involves valence integration, and paradigms mixing appetitive and aversive reinforcement. How DAN spiking relates to dopamine release should be directly measured, which might clarify plasticity dynamics in α2. Our model neglects plasticity induced by DAN activity in the absence of KC excitation13,29, which future models should explore.
Overall, the parallel-recurrent DAN and MBON circuitry flexibly regulates memory by using innate and learnt valences, and exhibits some striking effects, such as self-reinforcement of an unpaired, previously learnt CS+. When extrapolated to the mammalian basal ganglia, this finding (Fig. 5k) suggests why habits can be so hard to break. Because many facets of dopamine-based learning are evolutionarily conserved, mushroom-body mechanisms that guide decision-making over multiple timescales may provide insights into how heterogeneous dopamine signalling and recurrent connections between learning modules shape memory dynamics in other species.
Methods
Fly stocks
The FlyLight Project Team at Janelia Research Campus provided flies of the Split-GAL4 lines MB504B-GAL4, MB502B-GAL4, MB065B-GAL4, MB304B-GAL4, MB085C-GAL4, MB093C-GAL4, MB080C-GAL4, MB077B-GAL4 and MB542B-GAL4. We obtained R82C10-LexA (54981), 20×UAS-jGCaMP7b (79029) and 13×LexAop-jGCaMP7b (80915) from the Bloomington Drosophila Stock Center. In some experiments, we used other Bloomington fly lines to block neurotransmission through expression of the tetanus toxin light chain42 (UAS-TnT, 28838) or to knockdown expression of either the GABAA receptor43 (UAS×RDL-RNAi, 52903) or the glutamate-gated Cl−-channel44 (UAS×GluCl-α-RNAi, 53356). R. Davis (Scripps Institute) provided TH-LexA flies and D. Anderson (Caltech) provided 20×UAS-CsChrimson-tdTomato flies. We outcrossed all strains with w1118 wild-type flies for five generations to minimize differences in genetic background.
To create 20×UAS-Ace2N-mNeon-v2, 20×UAS-pAce and 13×LexAop-pAce flies that express the Ace-2N-mNeon-v2 and pAce FRET–opsin voltage indicators16,19,45, we synthesized codon-optimized Ace2N-mNeon-v2 and pAce genes (GenScript Biotech) with a Drosophila Kozak sequence before the start codon. We then subcloned the Ace2N-mNeon-v2 and pAce cDNA into the XbaI and XhoI restriction sites of the pJFRC7-20×UAS-IVS-mCD8::GFP and pJFRC19-13×LexAop2-IVS-myr::GFP vectors (Addgene 26220 and 26224). After verifying the constructed plasmids pJFRC7-20×UAS-IVS-Ace2N-mNeon-v2, pJFRC7-20×UAS-IVS-pAce and pJFRC19-13×UAS-IVS-pAce by sequencing, we used a commercial transformation service (Bestgene) to create two transgenic fly lines for each construct by inserting them into two phiC31 docking sites, the attP40 on the second chromosome and VK00027 on the third chromosome, for further combination with GAL4 or LexA driver lines.
All imaging and behavioural experiments used female flies (3–8 days old at the time of laser surgery). We raised flies on standard cornmeal agar medium with a 12:12 h light:dark cycle at 25 °C and 50% relative humidity. Before surgery or behavioural tests, we chose flies informally in a random manner from a much larger group raised together for all studies; there was no formal randomization procedure for selecting flies. Extended Data Table 1 lists the transgenic fly lines we created for this study, as well as the genotypes and total number of flies used in each imaging and behavioural experiment and for each figure panel. Experimenters were not blind to the genotypes of the flies used. All data collection and analyses were done automatically using computer software that was uniformly applied to all flies irrespective of their genotype.
When imaging flies with more than one fluorescently labelled neuron type, in most cases we focused on one neuron type per fly to achieve recordings with a sufficiently high signal-to-noise ratio. In a subset of flies, we were able to image two or even three neuron types concurrently with satisfactory signal-to-noise ratios. This means the total number of flies imaged is less than the sum of the n-values reported in the figure panels. In most experiments, we tested at least 12 flies per neuron type, except that we tested 4–6 flies per type for Extended Data Fig. 3c and 10 flies per condition for Figs. 2b,e and 5j,k and Extended Data Figs. 7d,e and 9c,f–h.
Odorants
We tested flies’ responses to the following monomolecular odours: ethyl acetate (CAS 141-78-6, Sigma-Aldrich), isoamyl acetate (CAS 123-92-2, Sigma-Aldrich), benzaldehyde (BEN; CAS 100-52-7, Sigma-Aldrich), 1-octen-3-ol (CAS 3391-86-4, Sigma-Aldrich) and 3-octanol (CAS 589-98-0, Sigma-Aldrich). We diluted ethyl acetate, isoamyl acetate, 1-octen-3-ol and 3-octanol into 1% and 10% concentrations and BEN into 0.3% and 3% concentrations (v/v) with mineral oil. We also tested a natural odour, apple cider vinegar (ACV, Bragg).
Mounting of flies for behavioural, voltage-imaging or optogenetic experiments
In brief, to mount flies for behavioural experiments on a trackball or for in vivo imaging studies of neural activity, we anaesthetized the flies on ice for 1 min. We then transferred them to the cooled surface (around 4 °C) of an aluminium thermoelectric cooling block. When viewing the fly through a dissection microscope (MZ6, Leica) and using a multi-axis stage to manipulate the entire cooling block, we brought the posterior of the fly’s thorax into contact with a fused silica optical fibre 125 μm in diameter (PLMA-YDF-10/125, Nufern) on a custom-made plastic fixture that was secured on the mounting apparatus directly above the fly. We applied around 1 μl of ultraviolet light-curing epoxy (NOA 89, Norland) to the contact point between the fibre and the fly’s thorax and cured the epoxy with ultraviolet for 30 s. Finally, to reduce head motion, we fixed the fly’s head to the thorax using ultraviolet-curable epoxy, after which we considered the fly to be fully mounted. We conducted behavioural testing and imaging experiments in separate sets of flies, because we found that the blue illumination used for voltage imaging substantially disrupted normal, odour-driven fly behaviour.
Laser microsurgery
To create an imaging window in the fly’s cuticle, we used a laser microsurgery system based on an excimer laser with a wavelength of 193 nm (EX5 ArF, GamLaser), as detailed previously17,18. After transferring a mounted fly to the surgery station, we created an optical window in the cuticle by laser drilling a hole 150 μm in diameter (30–40 laser pulses delivered at 100 Hz, 36 μJ per pulse, as measured at the specimen plane). This microsurgical procedure normally removed the cuticle, air sacs and fat bodies, exposing the underlying brain tissue. Occasionally, further rounds of laser dissection or manual cleaning of the cuticle were needed owing to variations in head size and fly age. Immediately after surgery, we applied 1 μl of ultraviolet-curable epoxy (NOA 68, Norland; 1.54 refractive index; approximately 100% optical transmission for wavelengths between 420 nm and1,000 nm) and cured it for 30 s to seal the cuticle opening. We did this under a dissection microscope while using a desktop ultrasonic humidifier (AOS 7146, Air-O-Swiss) to keep the local environment around the fly at around 60% humidity. After mounting the fly, we put a coverslip (22 × 22 mm, number 0, Electron Microscope Sciences) above the fly’s head and placed a small drop (about 1 μl) of water between the coverslip and the fly cuticle.
High-speed fluorescence voltage imaging
To image neuronal voltage dynamics, we used a custom-built upright epi-fluorescence microscope and a 1.0 NA water-immersion objective lens with a 20× magnification (XLUMPlanFL, Olympus). We used a 503/20 nm excitation filter (Chroma), a 518 nm dichroic mirror (Chroma) and a 534/30 nm emission filter (BrightLine). Using the 500-nm-wavelength module of a solid-state light source (Spectra X, Lumencor), we illuminated the sample with an intensity of 3–7 mW mm−2 at the specimen plane. We acquired images at 1,000 Hz, using a scientific-grade camera (Zyla 4.2, Andor) and 2 × 2 pixel binning. For Ca2+ imaging experiments with the jGCaMP7b indicator46, we used the same set-up and illumination conditions but acquired images at 100 Hz.
Odour delivery to awake flies
To deliver odours to flies’ antennae, we used a custom-built olfactometer that delivered a constant airflow (200 ml min−1) to the fly through either a control path (air passed through mineral oil) or an odour path (air passed through mineral oil with dissolved odorant). Airflow and odours went through a probe needle (1.7 mm inner diameter, Grainger) placed at a 45-degree angle in the horizontal plane and around 3 mm away from the fly’s antennae on the right side (Fig. 2f). Each trial lasted for 15 s, and odour was delivered during the (5 s, 10 s) interval in the trial. For all experiments in which we studied a fly’s responses to multiple different odours, we presented the odours in a pseudo-random order with intervals of at least 2 min between odours. In neural-imaging experiments, as we delivered odours, we imaged neuronal voltage dynamics through the transparent window in the cuticle made above the brain’s right hemisphere by laser microsurgery.
Electric shock and sucrose delivery
To deliver electric shocks to a fly, we glued a pair of electric wires (0.4 mm diameter; R26Y-0100, OK Industries) to both sides of the thorax with electrically conductive glue (Wire Glue). After the glue dried, the resistance between the two wires was 10–30 MΩ. During each trial, we delivered either three (Fig. 2a,d) or five (Fig. 4g,h and Extended Data Figs. 8d–g and 13d–g) electric shock pulses (0.2 s long, 20 V, delivered 1.8 s apart) using a constant-voltage stimulator (STM200, Biopac Systems), starting 5 s after trial onset.
To image neural responses to sucrose feeding, we positioned the tip of a microlitre syringe (Microliter 701, Hamilton) about 1 mm below the fly’s proboscis. By manually pushing the syringe to deliver around 1 µl of saturated sucrose solution, we allowed the fly to sample the liquid with its proboscis, inducing feeding. In each 15-s imaging trial, we delivered the sucrose solution during the (5 s, 10 s) interval in the trial.
Measurements of fly locomotion on the trackball
To determine the locomotion of individual flies walking on a trackball (Figs. 2f–h, 3a–c and 4l,m and Extended Data Figs. 3a,b and 7d,e), we used a set-up similar to that of previous studies47–49. Specifically, two optical USB pen mice (i-pen mouse, Finger System) were aimed at the equator of an air-suspended, hollow, high-density polyethylene ball (6.35 mm diameter with a mass of around 80 mg; Precision Plastic Ball). The pen mice were 2.3 cm away from the ball and tracked its rotational motion (120 Hz read-out). We converted the pair of digital readouts from the pen mice into a forward displacement on the ball plus a rotational angle for each time bin. We computed the fly’s forward and turning velocities using code written in MATLAB (v.2018b, MathWorks).
Olfactory conditioning on the trackball
After mounting flies and attaching electric wires to the thorax (see above), we positioned flies on the trackball using a 3D translation stage. Before olfactory conditioning began, we allowed flies to rest on the trackball for at least 30 min to minimize the effect of the cold anaesthesia used during the mounting process. For all conditioning studies, we used two attractive odours, ACV and 1% ethyl acetate, each of which served as either the CS+ or the CS− in a counterbalanced manner across the flies used in each group. A 1 h memory experiment comprised one training session and three testing sessions (Fig. 3a–c).
In the training session, we delivered six bouts of CS+ and CS− odour pairs to flies sequentially (30 s per odour exposure, with 135 s of fresh air between successive odours). During delivery of the CS+ odour, we also administered to the fly 16 electric shock pulses of 20 V amplitude (each pulse of 0.2 s duration, with 1.8 s between successive pulses), starting 3 s after the onset of the CS+ odour. This 30-s pairing is longer than the CS+–US pairings of 1 s or 5 s often used in conditioning assays for tethered flies12,50, because we found that brief pairing durations did not reliably induce behavioural changes that lasted for hours. To capture the time course of learning, we measured behavioural responses to the CS+ and CS− before, during and after conditioning, instead of assessing the conditioned response at only one time point, as in the T-maze assay51.
In each testing session, we delivered three bouts of CS+ and CS− odour pairs to flies (5 s per odour exposure, with 60 s of fresh air between presentations of the CS+ and CS− odours and also between bouts). We recorded flies’ forward and turning velocities on the trackball in the three testing sessions (‘before’, 5 min and 1 h). The ‘before’ session occurred 5 min before the training session and assessed the odour-induced behaviour of the flies when they were still naive. The 5 min and 1 h memory-testing sessions respectively began 5 min and 1 h after the end of the training session. In a 3 h memory experiment (Fig. 4l,m and Extended Data Fig. 7d,e), the third testing session occurred 3 h after the training session.
To minimize the bias of flies’ turning behaviour on the trackball, we delivered odours to the left side of flies’ antennae in half of the experiments and to the right side in the other half. Positive values of the fly’s walking speed represent walking forwards, and negative values represent walking backwards. Positive values for rotational velocity indicate that the fly turned towards the direction of odour delivery, and negative values indicate that it turned in the opposite direction.
Measurements of conditioning-induced neural plasticity
After mounting flies and attaching a pair of wires to deliver electric shocks to the thorax (see above), we allowed flies to rest for more than 30 min before training to minimize the effect of the cold anaesthesia we used in the mounting process. Each 1-h imaging experiment to study memory comprised two training and four testing sessions (Fig. 3d).
Each fly first underwent one bout of imaging before conditioning, in which we examined neural spiking responses to the two odours to be used during conditioning (CS+ and CS−; each odour was presented for a duration of 5 s with an interval of 120 s between odours). Next, each fly had three bouts of training, in each of which the fly received a paired presentation of the CS+ (30 s in duration) and the unconditioned stimulus (electric shocks; 16 pulses of 0.2 s duration, 20 V in amplitude, spaced 1.8 s apart; the first pulse started 3 s after the onset of the CS+), and an unpaired presentation of the CS− (30 s in duration, with intervals of 135 s between odours). Then, 5 min after the end of the training bouts, each fly had a mid-training imaging bout to assess the odour-evoked spiking responses. At 5 min after the end of the mid-training imaging bout, each fly had three more bouts of training. Then the fly had another two imaging bouts at 5 min and 1 h after the training. All imaging bouts had the same internal timing structure (Fig. 3d).
In the 24-h memory imaging experiments (Fig. 4a–d and Extended Data Fig. 7a), we used the same protocol for odour and shock delivery as in the 1-h experiments, except that we added two more testing sessions, 3 h and 24 h after training. We kept the flies glued on the optical fibre across the entire 24 h period. To avoid any potential effects caused by food deprivation over this period, we fed the flies with sucrose water at 3 min after the 3 h session and at 30 min before the 24-h and 48-h sessions.
At each time point across associative conditioning, for each neuron type studied we calculated for each fly the differences between its CS+- and CS−-evoked spike rates, subtracted the bias value measured for the same fly before conditioning in the before-training imaging session, and termed the result the CS+ versus CS− bias. We then averaged the bias values across flies. This bias, which, by definition, is zero in the before-training session, was inspired by the two-way choice index that is commonly used to characterize flies’ responses in the T-maze behavioural assay51.
In the experiments of Fig. 5j, studying memory extinction, we used three groups of flies: a control group that received memory training (three bouts of CS+/US association, as in the training session of 1-h experiments); an ‘early’ extinction group that received memory training and then underwent an extinction session starting 10 min after the end of the training; and a ‘late’ extinction group that received training and then had an extinction session starting 2 h after training. For all three groups, we imaged the neural activity in three testing sessions (before, 5 min and 3 h). The before-training session was 5 min before the training session, and the 5 min and 3 h sessions respectively started 5 min and 3 h after the end of the training session. The extinction session involved three bouts of CS+ and CS− odour exposure, as in the training session but without electric shocks. The experiments reported in Fig. 5k had a similar structure, except that there was no late-extinction group and the 3 h imaging session was replaced with an imaging session 35 min after associative conditioning.
Analyses of imaging data
To extract traces of neuronal voltage activity, we first used an algorithm, NoRMCorre52, to correct computationally the raw (1 kHz) fluorescence videos (see the High-speed fluorescence voltage imaging section above) for lateral displacements of the brain. To improve the signal-to-noise ratios of the videos, we applied a denoising algorithm that was based on a singular value decomposition. This involved first reshaping the raw video into a matrix, , where p is the total number of video frames and d is the number of pixels in the field of view. We then decomposed Y as a product, Y = UC, where U is a set of k low-rank components , and are weighting coefficients. The components U are assumed to be semi-unitary, without loss of generality, and were obtained by computing the singular value decomposition of Y. The number, k, of low-rank components that we retained in U was determined by requiring that the set of retained singular vectors captured more than 95% of the variance in the raw video. We then calculated the coefficients as C = UTY. For each row of the coefficient matrix, after reshaping it back into a two-dimensional image, we applied the BM3D image-denoising algorithm53, which applied a nonlinear thresholding operation to obtain a denoised set of coefficients, . We determined the denoised video as and reshaped it back to its original dimensions.
After denoising the fluorescence videos, we manually selected one to three regions of interest that contained the anatomical structures of the targeted cell types expressing the voltage indicator (Extended Data Fig. 1 shows regions of interest for all the fly lines used for imaging). We then computed spatially averaged, time-dependent changes in relative fluorescence intensity, ΔF(t)/F0, where F0 is the mean fluorescence in the region of interest averaged over the entire video and t is time. Next, we computationally corrected the resulting fluorescence traces for photobleaching by parametrically fitting a sum of two exponential functions to the mean fluorescence trace, F0, and then normalizing F0 by the parametrically fitted trace. To identify neural spikes, we high-pass filtered the ΔF(t)/F0 trace by subtracting a median-filtered (40 ms window) version of the trace and then identifying as spikes the local peaks that surpassed a threshold value. Because different cell types had distinct spiking rates and signal-to-noise ratios, we used different threshold values for spike detection in different cell types (more than 3 s.d. for PPL1-DANs and MBON-α2sc, more than 2 s.d. for MBON-γ1pedc>α/β and MBON-γ2α′1, and more than 2.5 s.d. for MBON-α′2, -α3 and -α′3m). We calculated the spiking rate using the number of spikes that occurred in a sliding 100 ms window. Burst ratio was computed as the number of spikes occurring less than 20 ms after the preceding spike divided by the total number of spikes in the trial.
To compute mean optical spike waveforms, we temporally aligned each identified spike in a trial to the time at which its peak value of ΔF(t)/F0 occurred. We performed a spline interpolation (10 μs sampling) of the mean waveform, and from this we determined the spike amplitude.
We also used a signal-detection framework to compute the spike-detection fidelity, d′, which characterizes the ability to correctly distinguish instances of a spike from background noise fluctuations in the fluorescence trace19,54. As we described previously54, when we use N successive samples of photon counts from a photodetector, F = (F1, F2, …, FN), to detect spikes, the distribution of F follows Poisson statistics in the shot-noise-limited regime. We can use the distribution to express two mutually exclusive hypotheses: the null hypothesis, H(0), which posits the absence of a spike; and the alternative, H(1), which posits that a spike occurred at time zero. The d′ value was calculated as d′ = (μL(1)− μL(0))/σL, in which μL and σL represent the mean and variance, respectively, of the distributions of the log-likelihood ratio, L(f), for each of the two hypotheses.
The mean, μL, and variance, σL, of the distribution of L(f) under the null hypothesis, H(0), of no spike having occurred, and under the alternative hypothesis, H(1), that a spike occurred, are given by:
where ν denotes the sampling rate, F0 represents the baseline fluorescence intensity from time periods that contained no neural spike, and sn is the mean fluorescence signal at each time bin in a time period that contains the averaged waveform of the identified spikes for each imaging trial (N = 51 bins, 1 ms per bin).
Odour classification
For odour classification analysis (Extended Data Fig. 4h), we used PyTorch55 (v.1.7.1; www.pytorch.org) to train computational classifiers that identified odours on the basis of patterns of activity in PPL1-DAN or MBON neural populations. Because we imaged different cell types in different flies, we first constructed datasets of the responses of neural populations from ‘virtual flies’22 by combining data from the five subtypes of PPL1-DAN or the six subtypes of MBON to produce aggregate PPL1-DAN or MBON population datasets. For each cell type, we used recordings from 12 different real flies and their neural responses to each of five odours. To construct a dataset of PPL1-DAN neural-population odour-evoked responses for an individual virtual fly, we randomly selected one of the 12 real flies studied for each of the NPPL1 = 5 different PPL1-DAN cell types and combined their odour-evoked responses. This enabled us to create response datasets for 125 different virtual PPL1-DANs, each of which responded to Nodours = 5 different odours. We used an analogous approach to construct datasets of MBON neural-population odour-evoked responses and combined the data from randomly selected flies for each of the NMBON = 6 different MBON types. This approach would have allowed us in principle to create 126 different datasets of virtual MBON population responses, but in practice we constructed only 125 such datasets so we would have an equal number of MBON and PPL1-DAN virtual flies. To create shuffled datasets, we took the same two sets of 125 virtual flies and within each set we randomly reassigned the neural responses across the set of odours.
To create classifiers of odour identity on the basis of the odour-evoked neural-population responses of virtual flies, we randomly assigned 90% of the virtual flies to a training set, 5% of the virtual flies to a validation set, and the remaining 5% to a testing set. We used the validation set to evaluate trained classifiers and tune hyperparameters, but we used the testing set only at the end to determine the rate of correct classifications attained with the optimized classifier. We used linear support vector machines56 to create a multiclass linear classifier of odour identity. To perform odour classification using the set of all Nodours × 125 virtual PPL1-DAN odour-evoked responses, we created a vector classifier function, f, for which the value for the i-th odour-evoked neural response (1 ≤ i ≤ Nodours × 125) was
where WPPL1−DAN is a matrix of size Nodours × NPPL1, xi is a vector of size NPPL1 that expresses the PPL1 responses of a specific virtual fly to one of the odours, and b is a bias vector of size Nodours. For computational purposes, we rewrote f as
where W is a matrix of size Nodours × (NPPL1 + 1) comprising WPPL1−DAN in its top NPPL1 rows and the vector b in its last row, and is a vector of size (NPPL1 + 1) comprising xi in its first NPPL1 entries and 1 in its last entry. Given a set of odour-evoked neural responses, the multiclass linear classifier predicted the odour identity, j, as , that is, according to the entry of the vector classifier function that yielded the maximum value.
To train the model, we optimized W by using a hinge loss function that penalized incorrect odour predictions. For the i-th odour-evoked response (1 ≤ i ≤ Nodours × 125), its contribution to the total loss was found by summing the penalties incurred for all incorrect classifications
where the index j runs over the individual odours, odourtrue,i refers to the odour that evoked the i-th neural response and which is thus the correct classifier result for the i-th response, and 1 is used as a margin to help enforce successful classifications. To optimize W, we averaged the loss function across individual batches of Nbatch = 200 odour responses chosen randomly without replacement from the full set of Nodours × 125 responses, with inclusion of an L2 regularization penalty to minimize the entries of W:
Here λ = 10−4 is an L2 regularization hyperparameter that we optimized empirically using the validation dataset. We then used the Adam optimizer to update the matrix elements of W:
where α = 5 × 10–4 is a hyperparameter that specifies the learning rate and that was optimized using the validation dataset, and Adam(∇Wloss(W)) refers to the Adam optimizer, an extension of stochastic gradient descent that adjusts the learning rate during training to improve convergence. (We used the standard parameter values of the Adam optimizer to adjust the learning rate57). To train the classifier, we optimized W by updating its matrix elements across ten full passes through the entire set of Nodours × 125 odour responses. Empirically, we found that extra training did not further improve classification accuracy. We used the same procedures and optimization parameters to train odour classifiers that were based on the set of odour-evoked MBON responses.
Finally, to test the performance of our classifiers, we divided the testing dataset of virtual flies into 120 different sub-testing sets, each with 200 different virtual flies, each with 5 different odour responses. For each sub-testing set, we computed the classification performance as the sum of the number of correctly identified odours divided by 1,000. The box-and-whisker plot of Extended Data Fig. 4h shows the distribution of classification performance values across these 120 different datasets. Note that this classification analysis provides an underestimate of the extent to which individual real flies could classify odour valences on the basis of MBON responses, because our classifiers cannot make full use of the intra-fly correlations between the responses of different MBONs, whereas real flies could in principle use such correlations to create better classifiers.
Optogenetic studies
To provide all-trans-retinal, which is an essential cofactor for CsChrimson activation58, we dissolved all-trans-retinal powder in 95% ethanol to make a 20 mM stock and diluted it with fly food to 400 µM. We collected adult female flies (2 days old) and transferred them to the 400 µM retinal food for 3–5 days before the optogenetics experiments (Fig. 4l,m). To the light-on group of flies, we delivered 30 pulses, each lasting 0.5 s, of red light (625 nm, 0.5 Hz, 25 µW mm−2) during CS+ and CS− exposures by using a collimated LED (M625L4, ThorLabs), whereas the light-off group did not receive these pulses of illumination.
Computational model
We simulated computationally a model of the neural circuitry that controls associative conditioning-induced aversive behaviours in Drosophila. The model characterized the interactions of KCs, MBONs and DANs in three interconnected learning modules (γ1, α2 and α3) of the mushroom body (Fig. 5a). The KCs sparsely encode the CS+ and CS– odour stimuli, and the DANs encode the electric-shock punishments. Dopamine modulates the strengths of the synaptic connections between the KCs and the MBONs, thereby altering the strength of the associative memory. The MBONs gather signals from the KCs to control approach or avoidance motor behaviours (Fig. 5a). Our model used a set of ordinary differential equations to capture how the neural activity patterns of the mushroom body and the synaptic weights change with time. The model thereby describes how associative information is stored and retrieved in the short-term (γ1 module) and long-term memory compartments (α2 and α3 modules) of the mushroom body.
The Supplementary Information presents differential equations that characterize the dynamics of the neural spiking rates and synaptic weights in the model (§2 and §3, respectively, of the Supplementary Information). The network architecture (Fig. 5a) is based on the synaptic connections in the fly brain connectome7 (Janelia hemibrain v.1.2.1). If the number of synapses between two neurons is less than 5 in the connectome, we set the corresponding synaptic weight term in the model to be zero. This approximation substantially reduced the number of parameters used in the model. We inferred the values of non-zero synaptic weights by parametric fits of the model to the experimental data on neural spike rates, without further consideration of the number of synapses between neurons (Supplementary Tables 1 and 3).
Concurrent activation of a KC and its corresponding DAN in the model modifies the synaptic weight of the KC→MBON connection according to a bidirectional, anti-Hebbian plasticity rule. The anti-Hebbian rule implies that the KC→MBON synaptic weight decreases if a punishment appears just after odour presentation but increases if the punishment precedes the odour (Extended Data Fig. 10b). In all of our experimental and simulation studies, we used a fixed CS+–US interval of 3 s (Figs. 3a,d, 4k,5b and Extended Data Fig. 10b).
The differential equations in sections 2 and 3 of the Supplementary Information form a complete set that models the time-varying neural activity and synaptic weights in the γ1, α2 and α3 modules. We simulated these equations using the MATLAB (Mathworks) function ode15s(), which solves the differential equations numerically. However, this approach is time consuming and takes around 14 s to obtain results using each set of parameters. For this reason, we simplified the model using several approximations (see sections 4 and 5 of the Supplementary Information for details). First, we approximated the activation functions of KCs and DANs as linear functions. Second, we assumed that the membrane time constants of KCs, DANs and MBONs (τKC,i, τMBON,j and τDAN,j) are sufficiently brief (about 10 ms) to allow the spike rates of KCs, DANs and MBONs to attain their steady-state values in associative-conditioning and testing bouts. Third, we assumed that the resting intervals between training and testing bouts or between successive training bouts are much longer than the duration of the training and testing bouts (Figs. 3a,d and 4k), which allowed us to focus our analyses on discrete time points corresponding to the individual training and testing bouts. Finally, we used time-averaged values of KC and DAN spike-rate changes to calculate the changes in the values of the synaptic weights between KCs and MBONs. Using these approximations, we simplified the computational model into a recursive set of equations using discrete time-points (sections 4 and 5 of the Supplementary Information). The time needed to simulate each set of parameters for the simplified model was only about 0.02 s, which is roughly 700-fold faster than the time needed to simulate results for one parameter set of the full model. The recursive formulation of the model also helped us to understand key facets of mushroom-body circuit dynamics and plasticity (sections 4–6 of the Supplementary Information). Notably, Supplementary Information equation 5.20 is plotted in Extended Data Fig. 10a and shows that, given the fixed CS+–US interval (3 s) used in all of our experiments and simulations, in the model’s recursive formulation the anti-Hebbian plasticity rule reduces to one in which a linear integration of the innate and learnt valences governs the change in the KC→MBON synaptic weight. The amplitudes of these changes differ between the different compartments of the mushroom body because the different PPL1-DANs respond with distinct amplitudes to the unconditioned stimulus (an electric shock).
By putting the experimental conditions and model parameters (θ) into the recursive formulation of the model, we simulated the spike rates of DANs and MBONs in our experiments. Then we optimized the parameters of the model by fitting the model outputs to our experimental spike-rate data (Figs. 2i, 3e,f and 4c,d and Extended Data Fig. 8b,c). The fitted results from the optimized model are shown in Fig. 5c and Extended Data Fig. 10c,d. We assumed that the measured neural spike rates, under all experimental conditions, were governed by independent normal distributions. This assumption allowed us to estimate the optimized values of the model parameters and their confidence intervals (Supplementary Information section 7 and Supplementary Table 3). Using the model and its optimized parameters, we predicted the neural firing rates and their confidence intervals for experiments that had not yet been done. These predictions well matched the subsequent experimental results (Fig. 5g–k).
Because PPL1-α′2α2 does not respond to the unconditioned stimulus electric shock (Fig. 2a,d), and because the α2 compartment does not influence the long-term plasticity of MBON-α3 in the model using the conditioning protocols of this paper, we simplified the model with γ1, α2 and α3 compartments (Fig. 5a) into a two-module model with only the γ1 and α3 compartments (Extended Data Fig. 10i). The two different model variants generated nearly identical predictions for valence-dependent long-term memory formation and extinction in the α3 compartment (Fig. 5e–k and Extended Data Fig. 10k–m). Moreover, for all parameters common to both model variants, the fitted parameter values were statistically indistinguishable between the two-module and three-module versions (Supplementary Table 3 and Supplementary Fig. 1).
Statistical analyses
We performed all statistical analyses using MATLAB (v.2018b and v.2020b, Mathworks) software. We chose sample sizes using our own and published empirical measurements to estimate effect magnitudes. For statistical testing, we performed non-parametric Kruskal–Wallis and Friedman ANOVAs to avoid making assumptions about normal distributions or equal variances across groups. To perform post hoc pairwise statistical comparisons, we used two-sided versions of the Mann-Whitney U-test or the Wilcoxon signed-rank test (respectively abbreviated to ‘U-test’ or signed-rank test’ in the figure captions) with a Holm–Bonferroni correction for multiple comparisons.
Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.
Online content
Any methods, additional references, Nature Portfolio reporting summaries, source data, extended data, supplementary information, acknowledgements, peer review information; details of author contributions and competing interests; and statements of data and code availability are available at 10.1038/s41586-024-07819-w.
Supplementary information
Source data
Acknowledgements
We acknowledge research grants from the NIH BRAIN Initiative (U01NS120822 to M.J.S. and G.V.) and the NSF NeuroNex Program (DBI-1707261 to M.J.S. and K. Deisseroth). We thank Jane Li, Y. Gong, J. Savall, S. Sinha and T. Baer for technical assistance, and the members of the Janelia Research Campus, R. Davis (Scripps Institute) and D. Anderson (Caltech) for fly strains.
Extended data figures and tables
Author contributions
C.H. and M.J.S. conceptualized the project. C.H. performed experiments and analysed data. J. Luo created transgenic flies and the computational model. J. Luo and C.H. conducted model simulations. S.J.W. performed odour-classification analyses. L.A.R. assisted in conceptualizing the computational model. J. Li designed the denoising algorithm for analysing voltage-imaging data. V.A.P., M.K. and G.V. developed and provided voltage indicators. M.J.S. supervised the project. C.H., M.J.S. and J. Luo wrote the manuscript. All authors edited the manuscript.
Peer review
Peer review information
Nature thanks Barbara Webb and the other, anonymous, reviewer(s) for their contribution to the peer review of this work.
Data availability
The Source data files for each figure and Extended data figure in this paper contain data for individual figure panels and statistical results, including for statistical comparisons that are not explicitly marked in the figures. The raw voltage-imaging data are available from the corresponding authors on reasonable request. The neural voltage activity traces are available at Zenodo at https://zenodo.org/uploads/10998457 (ref. 59). Source data are provided with this paper.
Code availability
We used open-source image algorithms for motion correction (NoRMCorre52; https://github.com/flatironinstitute/NoRMCorre) and for image denoising (BM3D53; https://webpages.tuni.fi/foi/GCF-BM3D). We used the PyTorch55 machine learning framework (v1.7.1; www.pytorch.org) for classification analysis. The software code to run our computational model of the MB is available at https://github.com/schnitzer-lab/Luo_Huang_2024_MB_model.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
These authors contributed equally: Cheng Huang, Junjie Luo
Contributor Information
Cheng Huang, Email: huang.cheng@wustl.edu.
Madhuvanthi Kannan, Email: mkannan@umn.edu.
Ganesh Vasan, Email: gvasan@umn.edu.
Mark J. Schnitzer, Email: mschnitz@stanford.edu
Extended data
is available for this paper at 10.1038/s41586-024-07819-w.
Supplementary information
The online version contains supplementary material available at 10.1038/s41586-024-07819-w.
References
- 1.Root, C. M., Denny, C. A., Hen, R. & Axel, R. The participation of cortical amygdala in innate, odour-driven behaviour. Nature515, 269–273 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Tye, K. M. Neural circuit motifs in valence processing. Neuron100, 436–452 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Isosaka, T. et al. Htr2a-expressing cells in the central amygdala control the hierarchy between innate and learned fear. Cell163, 1153–1164 (2015). [DOI] [PubMed] [Google Scholar]
- 4.Mao, Z. & Davis, R. L. Eight different types of dopaminergic neurons innervate the Drosophila mushroom body neuropil: anatomical and physiological heterogeneity. Front. Neural Circuits3, 5 (2009). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Aso, Y. et al. The neuronal architecture of the mushroom body provides a logic for associative learning. eLife3, e04577 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Li, F. et al. The connectome of the adult Drosophila mushroom body provides insights into function. eLife9, e62576 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Scheffer, L. K. et al. A connectome and analysis of the adult Drosophila central brain. eLife9, e57443 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Eschbach, C. et al. Circuits for integrating learned and innate valences in the insect brain. eLife10, e62567 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Schultz, W. Dopamine reward prediction-error signalling: a two-component response. Nat. Rev. Neurosci.17, 183–195 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Engelhard, B. et al. Specialized coding of sensory, motor and cognitive variables in VTA dopamine neurons. Nature570, 509–513 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Aso, Y. & Rubin, G. M. Dopaminergic neurons write and update memories with cell-type-specific rules. eLife5, e16135 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Hige, T., Aso, Y., Modi, M. N., Rubin, G. M. & Turner, G. C. Heterosynaptic plasticity underlies aversive olfactory learning in Drosophila. Neuron88, 985–998 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Cohn, R., Morantte, I. & Ruta, V. Coordinated and compartmentalized neuromodulation shapes sensory processing in Drosophila. Cell163, 1742–1755 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Siju, K. P. et al. Valence and state-dependent population coding in dopaminergic neurons in the fly mushroom body. Curr. Biol.30, 2104–2115 (2020). [DOI] [PubMed] [Google Scholar]
- 15.Eschbach, C. et al. Recurrent architecture for adaptive regulation of learning in the insect brain. Nat. Neurosci.23, 544–555 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Kannan, M. et al. Dual-polarity voltage imaging of the concurrent dynamics of multiple neuron types. Science378, eabm8797 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Sinha, S. et al. High-speed laser microsurgery of alert fruit flies for fluorescence imaging of neural activity. Proc. Natl Acad. Sci. USA110, 18374–18379 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Huang, C. et al. Long-term optical brain imaging in live adult fruit flies. Nat. Commun.9, 872 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Gong, Y. et al. High-speed recording of neural spikes in awake mice and flies with a fluorescent voltage sensor. Science350, 1361–1366 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Markram, H., Lübke, J., Frotscher, M. & Sakmann, B. Regulation of synaptic efficacy by coincidence of postsynaptic APs and EPSPs. Science275, 213–215 (1997). [DOI] [PubMed] [Google Scholar]
- 21.Hattori, D. et al. Representations of novelty and familiarity in a mushroom body compartment. Cell169, 956–969 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Hige, T., Aso, Y., Rubin, G. M. & Turner, G. C. Plasticity-driven individualization of olfactory coding in mushroom body output neurons. Nature526, 258–262 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Jacob, P. F. & Waddell, S. Spaced training forms complementary long-term memories of opposite valence in Drosophila. Neuron106, 977–991 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Tully, T., Preat, T., Boynton, S. C. & Del Vecchio, M. Genetic dissection of consolidated memory in Drosophila. Cell79, 35–47 (1994). [DOI] [PubMed] [Google Scholar]
- 25.Smolen, P., Zhang, Y. & Byrne, J. H. The right time to learn: mechanisms and optimization of spaced learning. Nat. Rev. Neurosci.17, 77–88 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Mery, F. & Kawecki, T. J. A cost of long-term memory in Drosophila. Science308, 1148 (2005). [DOI] [PubMed] [Google Scholar]
- 27.Galili, D. S. et al. Converging circuits mediate temperature and shock aversive olfactory conditioning in Drosophila. Curr. Biol.24, 1712–1722 (2014). [DOI] [PubMed] [Google Scholar]
- 28.Villar, M. E. et al. Differential coding of absolute and relative aversive value in the Drosophila brain. Curr. Biol.32, 4576–4592 (2022). [DOI] [PubMed] [Google Scholar]
- 29.Berry, J. A., Cervantes-Sandoval, I., Chakraborty, M. & Davis, R. L. Sleep facilitates memory by blocking dopamine neuron-mediated forgetting. Cell161, 1656–1667 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Zhao, C. et al. Predictive olfactory learning in Drosophila. Sci Rep.11, 6795 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Bennett, J. E. M., Philippides, A. & Nowotny, T. Learning with reinforcement prediction errors in a model of the Drosophila mushroom body. Nat. Commun.12, 2569 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32.Springer, M. & Nawrot, M. P. A mechanistic model for reward prediction and extinction learning in the fruit fly. eNeuro10.1523/ENEURO.0549-20.2021 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Jiang, L. & Litwin-Kumar, A. Models of heterogeneous dopamine signaling in an insect learning and memory center. PLoS Comput. Biol.17, e1009205 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 34.Gkanias, E., McCurdy, L. Y., Nitabach, M. N. & Webb, B. An incentive circuit for memory dynamics in the mushroom body of Drosophila melanogaster. eLife11, e75611 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 35.Faghihi, F., Moustafa, A. A., Heinrich, R. & Wörgötter, F. A computational model of conditioning inspired by Drosophila olfactory system. Neural Netw.87, 96–108 (2017). [DOI] [PubMed] [Google Scholar]
- 36.Wessnitzer, J., Young, J. M., Armstrong, J. D. & Webb, B. A model of non-elemental olfactory learning in Drosophila. J. Comput. Neurosci.32, 197–212 (2012). [DOI] [PubMed] [Google Scholar]
- 37.Smith, D., Wessnitzer, J. & Webb, B. A model of associative learning in the mushroom body. Biol. Cybern.99, 89–103 (2008). [DOI] [PubMed] [Google Scholar]
- 38.Chang, C. Y. et al. Brief optogenetic inhibition of dopamine neurons mimics endogenous negative reward prediction errors. Nat. Neurosci.19, 111–116 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39.Yamagata, N., Hiroi, M., Kondo, S., Abe, A. & Tanimoto, H. Suppression of dopamine neurons mediates reward. PLoS Biol.14, e1002586 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.Felsenberg, J., Barnstedt, O., Cognigni, P., Lin, S. & Waddell, S. Re-evaluation of learned information in Drosophila. Nature544, 240–244 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41.Sabandal, J. M., Berry, J. A. & Davis, R. L. Dopamine-based mechanism for transient forgetting. Nature591, 426–430 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 42.Sweeney, S. T., Broadie, K., Keane, J., Niemann, H. & O’Kane, C. J. Targeted expression of tetanus toxin light chain in Drosophila specifically eliminates synaptic transmission and causes behavioral defects. Neuron14, 341–351 (1995). [DOI] [PubMed] [Google Scholar]
- 43.Liu, X., Krause, W. C. & Davis, R. L. GABAA receptor RDL inhibits Drosophila olfactory associative learning. Neuron56, 1090–1102 (2007). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 44.Liu, W. W. & Wilson, R. I. Glutamate is an inhibitory neurotransmitter in the Drosophila olfactory system. Proc. Natl Acad. Sci. USA110, 10294–10299 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45.Kannan, M. et al. Fast, in vivo voltage imaging using a red fluorescent indicator. Nat. Methods15, 1108–1116 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 46.Dana, H. et al. High-performance calcium sensors for imaging activity in neuronal populations and microcompartments. Nat. Methods16, 649–657 (2019). [DOI] [PubMed] [Google Scholar]
- 47.Clark, D. A., Bursztyn, L., Horowitz, M. A., Schnitzer, M. J. & Clandinin, T. R. Defining the computational structure of the motion detector in Drosophila. Neuron70, 1165–1177 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48.Gaudry, Q., Hong, E. J., Kain, J., de Bivort, B. L. & Wilson, R. I. Asymmetric neurotransmitter release enables rapid odour lateralization in Drosophila. Nature493, 424–428 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49.Savall, J., Ho, E. T. W., Huang, C., Maxey, J. R. & Schnitzer, M. J. Dexterous robotic manipulation of alert adult Drosophila for high-content experimentation. Nat. Methods12, 657–660 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 50.McCurdy, L. Y., Sareen, P., Davoudian, P. A. & Nitabach, M. N. Dopaminergic mechanism underlying reward-encoding of punishment omission during reversal learning in Drosophila. Nat. Commun.12, 1115 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 51.Tully, T. & Quinn, W. G. Classical conditioning and retention in normal and mutant Drosophila melanogaster. J. Comp. Physiol. A157, 263–277 (1985). [DOI] [PubMed] [Google Scholar]
- 52.Pnevmatikakis, E. A. & Giovannucci, A. NoRMCorre: an online algorithm for piecewise rigid motion correction of calcium imaging data. J. Neurosci. Methods291, 83–94 (2017). [DOI] [PubMed] [Google Scholar]
- 53.Dabov, K., Foi, A., Katkovnik, V. & Egiazarian, K. Image denoising by sparse 3-D transform-domain collaborative filtering. IEEE Trans. Image Process.16, 2080–2095 (2007). [DOI] [PubMed] [Google Scholar]
- 54.Wilt, B. A., Fitzgerald, J. E. & Schnitzer, M. J. Photon shot noise limits on optical detection of neuronal spikes and estimation of spike timing. Biophys. J.104, 51–62 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 55.Paszke, A. et al. PyTorch: an imperative style, high-performance deep learning library. Adv. Neural Inf. Process. Syst.32, 8026–8037 (2019).
- 56.Cortes, C. & Vapnik, V. Support-vector networks. Mach. Learn.20, 273–297 (1995). [Google Scholar]
- 57.Kingma, D. P. & Ba, J. Adam: a method for stochastic optimization. Int. Conf. Learn. Represent.10.48550/arXiv.1412.6980 (2015).
- 58.Klapoetke, N. C. et al. Independent optical excitation of distinct neural populations. Nat. Methods11, 338–346 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 59.Huang, C. & Schnitzer, M. Data for Huang, Luo, et al. Dopamine-mediated interactions between short- and long-term memory dynamics, Nature, 2024. Zenodo10.5281/zenodo.10998457 (2024). [DOI] [PMC free article] [PubMed]
- 60.Handler, A. et al. Distinct dopamine receptor pathways underlie the temporal sensitivity of associative learning. Cell178, 60–75 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The Source data files for each figure and Extended data figure in this paper contain data for individual figure panels and statistical results, including for statistical comparisons that are not explicitly marked in the figures. The raw voltage-imaging data are available from the corresponding authors on reasonable request. The neural voltage activity traces are available at Zenodo at https://zenodo.org/uploads/10998457 (ref. 59). Source data are provided with this paper.
We used open-source image algorithms for motion correction (NoRMCorre52; https://github.com/flatironinstitute/NoRMCorre) and for image denoising (BM3D53; https://webpages.tuni.fi/foi/GCF-BM3D). We used the PyTorch55 machine learning framework (v1.7.1; www.pytorch.org) for classification analysis. The software code to run our computational model of the MB is available at https://github.com/schnitzer-lab/Luo_Huang_2024_MB_model.