Skip to main content
eLife logoLink to eLife
. 2023 May 4;12:e74434. doi: 10.7554/eLife.74434

Principles for coding associative memories in a compact neural network

Christian Pritz 1,, Eyal Itskovits 1, Eduard Bokman 1, Rotem Ruach 1, Vladimir Gritsenko 1, Tal Nelken 1, Mai Menasherof 1, Aharon Azulay 1, Alon Zaslaver 1,
Editors: Yuichi Iino2, Timothy E Behrens3
PMCID: PMC10159626  PMID: 37140557

Abstract

A major goal in neuroscience is to elucidate the principles by which memories are stored in a neural network. Here, we have systematically studied how four types of associative memories (short- and long-term memories, each as positive and negative associations) are encoded within the compact neural network of Caenorhabditis elegans worms. Interestingly, sensory neurons were primarily involved in coding short-term, but not long-term, memories, and individual sensory neurons could be assigned to coding either the conditioned stimulus or the experience valence (or both). Moreover, when considering the collective activity of the sensory neurons, the specific training experiences could be decoded. Interneurons integrated the modulated sensory inputs and a simple linear combination model identified the experience-specific modulated communication routes. The widely distributed memory suggests that integrated network plasticity, rather than changes to individual neurons, underlies the fine behavioral plasticity. This comprehensive study reveals basic memory-coding principles and highlights the central roles of sensory neurons in memory formation.

Research organism: C. elegans

Introduction

Learning and memory processes are presumably universal in the animal kingdom, forming the basis for adaptive behavior. An intriguing form of these behavioral adaptations is known as associative learning, where a link between two unrelated cues is formed. The famous pavlovian dogs set a classical example: These dogs were trained to associate a sound stimulus (the conditioned stimulus, CS) with food (unconditioned stimulus, US). Consequently, the mere auditory cue prompted the dogs to salivate in expectation of their meal (Pavlov, 1910).

To synthesize an adaptive associative memory that elicits an adaptive response upon future encounters with the CS, both the CS and the US must be encoded in the neural system. Moreover, their encoding needs to be logically integrated such that the behavioral response will match the expected valence that the CS predicts (Josselyn and Tonegawa, 2020). Whether the CS was associated with a positive or negative experience, this valence remains associated with the CS.

Animals have come up with different strategies for encoding associative memories. In flies, olfactory associative learning is centralized in the mushroom body, where it is distributed among various neurons and synapses to code both the US valence and the CS odorant (Bilz et al., 2020; Roselli et al., 2021; Widmann et al., 2018). Mammalian brains are thought to encode associative memories in a decentralized fashion where interconnected areas, distributed across various areas of the brain, link up to encode memory traces. For example, associative fear memories are thought to be distributed among the amygdala that encodes the valence⁠, the hippocampus, which encodes the context, and the cortical neurons, which provide the specific sensory information (Josselyn and Tonegawa, 2020).

In that respect, sensory neurons also proved to play important roles in the formation of associative memories. Their learning-induced neuroplasticity was observed across various sensory modalities (e.g. olfactory, gustatory, auditory, and visual), and is thought to confer improved detection and enhanced attention towards important cues encountered in the past (Åhs et al., 2013; McGann, 2015).

Extracting the principles by which memories are formed within neural networks requires first to identify the brain regions, and preferably, the individual coding neurons. To this end, Caenorhabditis elegans worms offer an appealing research system. Their compact nervous system consists of 302 neurons, and a detailed blueprint of all the chemical and electrical connections is available (Cook et al., 2019; White et al., 1986; Witvliet et al., 2021). Moreover, the number and the identity of the neurons are invariant and individual neurons can be identified based on their position and anatomy across different individuals.

Though equipped with a small neural network, C. elegans can form both associative and non-associative memories (Ardiel and Rankin, 2010; Loy et al., 2021; Sasakura and Mori, 2013). To form associative memories, worms are typically conditioned with a chemical (e.g. an odorant, salt, or low pH) or a mechanical stimulus in the presence or the absence of food, to form positive or negative associations, respectively (Adachi et al., 2010; Amano and Maruyama, 2011; Kauffman et al., 2010; Oda et al., 2011; Rankin, 2000; Torayama et al., 2007; Wen et al., 1997). Following successful conditioning, attraction to the conditioned stimulus is enhanced or reduced depending on whether the training paradigm includes food (positive training) or not (negative training), respectively. Just like in higher organisms, these memories can be classified into short- and long-term memories, where the former last for a couple of hours and the latter may persist for days (Amano and Maruyama, 2011; Kauffman et al., 2010).

Whole-brain functional imaging can be used to extract the individual neurons whose activity was modulated following memory formation. In C. elegans, advanced microscopy techniques allow imaging neural dynamics of the entire network with cellular resolution in both restrained and freely behaving animals (Hallinen et al., 2021; Kato et al., 2015; Nguyen et al., 2016; Schrödel et al., 2013; Toyoshima et al., 2020; Venkatachalam et al., 2016; Yemini et al., 2021). In particular, studying neuroplasticity with cellular resolution allows addressing intriguing questions that were hitherto considered mainly based on theoretical grounds. For example, how do individual sensory neurons code and integrate both the stimulus and the valence? How many neural resources are required to form an associative memory, and more fundamentally, are there general organizing principles by which associative memories are encoded within a neural network?

Here, we have systematically studied how the four types of associative memories (positive/negative associations, each formed as a short- or long-term memory) are encoded within the compact neural network of C. elegans. We found that short-term, but not long-term, memories are evident in the sensory layer of the animal. Moreover, individual sensory neurons code the CS and/or the US components of the memory in a distributed manner. This information is integrated by the downstream interneurons, which code both the short- and long-term memories. Given the distributed nature of the memory code, it is the combined modulated activity of all the involved neurons that gives rise to the adaptive behavioral response.

Results

Establishing four memory-formation paradigms using the same CS

We begin by establishing training paradigms that form robust traces of associative memories (Figure 1A). Building on existing protocols (Amano and Maruyama, 2011; Colbert and Bargmann, 1995; Kauffman et al., 2011), we trained C. elegans worms to form each of the four types of associative memories: short-term aversive (STAV), short-term appetitive (STAP), long-term aversive (LTAV), and long-term appetitive (LTAP). Notably, we used the same CS (the odorant butanone, BUT) for all training paradigms. This allowed us to extract memory traces that are unique to the training paradigm and that are independent of the specific CS used.

Figure 1. Training paradigms that form robust associative memories.

(A) Worms were trained to form each of the four types of associative memories: Short- and long-term memories (denoted along the horizontal axis), each trained using a positive or a negative unconditioned stimulus (US, vertical axis). Notably, the same conditioned stimulus, butanone (BUT), was used for all types of memory. STAP, short-term appetitive; LTAP, long-term appetitive; STAV, short-term aversive; LTAV, long-term aversive. In the LTAP training, seven rounds of 30 min starvation (no CS) and 30 min on food (+CS) were used. For LTAV training, two rounds of pairing starvation with BUT (each for five hours) were required. (B) A two-choice assay was used to quantify animals’ preference towards the conditioned stimulus BUT (against an alternative attractive choice, diacetyl). Scoring the number of worms reaching each of the choices provided the Choice Index (CI), which ranges from –1 (denoting complete aversion to the CS) to +1 (full attraction). Choice tests for positively- and negatively trained animals differed in concentrations and layout (Figure 1—figure supplement 1A) because of valence-specific effects on choice behavior (Figure 1—figure supplement 2). Learning indices (LIs), calculated based on these CIs, show the treatment-, stimulus-, and training- specific effects on the animals’ choice (Figure 1—figure supplement 3). (C) CI values as scored following the behavioral choice assays. Positively trained animals increased attraction while negatively trained animals reduced attraction towards BUT. (D) LIs calculated according to the equations provided in (B) on the data shown in (C). Significant stimulus- and training-specific LIs in all paradigms indicate experience-dependent modulation of behavior that is based on stimulus and valence. LIs were calculated by comparing experiments performed on the same day only (Figure 1—figure supplement 4 and Materials and methods). Experimental repeats (in C&D) were performed on different days and range between 4 and 21. Each experimental repeat is the average of three assay plates, each scoring 100-150 worms. Error bars indicate SEM. *p<0.05, **p<0.01, ***p<0.001 (one-sample t-test, FDR corrected; significant differences from the zero LI values).

Figure 1.

Figure 1—figure supplement 1. Behavioral choice assays using ethanol as the alternative choice reproduced the results obtained using diacetyl.

Figure 1—figure supplement 1.

(A) A layout of the two-choice assay. Based on published methods (Bargmann et al., 1993; Kauffman et al., 2010), a four-quadrant layout was used for scoring the preference of animals that underwent positive associative training. A two-opposing choices layout was used to score the preference of animals that underwent negative (starvation) associative learning. We used two alternative choice assays where either ethanol or diacetyl were presented as an alternative choice to the conditioned stimulus butanone. Note that butanone concentrations were different for appetitive and aversive assays because the valence of training causes valence-specific shifts in the choice behavior (see also Figure 1—figure supplement 2). (B) Using ethanol or diacetyl (Figure 1) as the alternative choices yielded similar preference results. Shown here are the results using ethanol, which can be compared with the results obtained by using diacetyl (Figure 1C). Positively trained animals were more attracted to butanone while negatively trained animals were less attracted to it. These results demonstrate that the four training paradigms form robust memory traces that can be behaviorally observed.
Figure 1—figure supplement 2. Appetitive and aversive training paradigms shift the preference to butanone.

Figure 1—figure supplement 2.

(A–B) Positive training increased attraction towards higher concentrations of butanone (blue areas) when compared to mock-trained (A) or naive (B) animals over a range of butanone concentrations. We, therefore, used a concentration dilution of 10-1 (blue arrow) for the positive training (with food) and for the subsequent choice assays (Figure 1 and Figure 1—figure supplement 1). (C–D) In contrast, following negative (starvation) training, animals’ attraction towards butanone decreased, but only at the lower concentrations of butanone (compared to mock-trained controls (C) and naive animals (D), red areas). The maximal reduction was noted at the 10-3 dilution (red arrow) so we used this concentration in the choice assays (Figure 1 and Figure 1—figure supplement 1). This concentration is in agreement with previous studies that used the same concentrations following aversive training (Colbert and Bargmann, 1995). For each concentration, we included 2-10 independent repeats, each consisting of 3 plates with ~100 animals. Error bars indicate SEM.
Figure 1—figure supplement 3. Inferring memory components by comparing different experimental groups.

Figure 1—figure supplement 3.

In each of the experiments (neuronal imaging or behavioral choice assays), we always assayed naive and mock-trained animals, in parallel to the trained animals. Mock-trained animals underwent the same training treatment (e.g. starvation) but were unexposed to the conditioned stimulus (CS) butanone. Naive animals were left untreated but were assayed in parallel to the mock-trained and the trained animals. These comparisons were also used to calculate the differential (delta) activities for the PCA analysis. Stimulus-specific: When comparing the trained groups (aversive or appetitive) and the associated mock-trained controls, the impact of the CS (smell of butanone) becomes evident. Therefore, the observed differences are termed stimulus-specific. The conditioned stimulus (CS) can be estimated from both aversive and appetitive regimes. As appetitive and aversive training regimes render the animals in different physiological conditions, CS effects need to be assessed independently for each training regime. Treatment-specific: To control for the changes introduced merely by the treatment itself (e.g. food availability), we compared the outputs between mock-trained and naive animals to yield the treatment-specific component. This is an estimate for appetitive and aversive unconditioned stimuli. Valence-specific: When comparing negative training to positive training, the differences are due to the context (valence) of the experience (starvation or food availability), and are hence termed valence-specific. Training-specific: When trained animals are compared to naive animals, differences introduced by the entire training procedure (US + CS) become apparent. These differences are referred to as training-specific.
Figure 1—figure supplement 4. The behavioral choice assays are subject to high day-to-day variability and a same-day difference analysis reduced this variation.

Figure 1—figure supplement 4.

Behavioral variability can be reduced by comparing same-day choice indices (CIs). This was done by calculating learning indices (LIs, see Figure 1B, D) extracted from CIs assayed on the same day only. (A) CI values widely vary within each tested group. For example, shown are short-term positively trained and mock-trained groups as provided in Figure 1C. Lines connect two groups assayed on the same day. Thus, when considering same-day results, the significance becomes apparent as trained animals always enhance attraction towards the CS (positive training). p-Value is of a paired t-test. (B) When calculating the stimulus-specific learning index (CItrained – CImock-trained), we always considered the two measurements from the same day. We used a one-sample t-test against 0 (=paired t-test) to detect any change in the choice that is a result of learning. When expressing the change in the CIs as the stimulus-specific learning index (CItrained – CImock-trained), the variance decreases (12.0% less than in CItrained and 30.8% less than in CImock-trained). This results (in this example) in a 285-fold lower p-Values.Variance = var, p = p-value. Vertical lines indicate the mean.

To form positive (appetitive) or negative (aversive) associations, we exposed the worms to BUT in the presence or the absence of food, respectively. To form short-term memories, for which behavioral changes last for up to 2 hr (Kauffman et al., 2010), we trained the worms for 1 hr or 90 min for appetitive or aversive conditioning, respectively, and assayed the animals within 30 min following the training period. For long-term memories, which typically last for 1–2 days (~10% of the worms’ lifespan), we used a repetitive-training protocol that lasted for ~12 hr and then assayed the animals 14 hr post the training period (Figure 1A, see also Materials and methods for details). In parallel to the trained animals, we always included in the analysis two important control groups: mock-trained animals (animals that underwent training in the absence of the CS BUT) and naive animals, which were left untreated.

To verify that these training paradigms form robust memory traces, we analyzed the attraction of trained animals to BUT, the CS (Figure 1B). For this, we used a standard two-choice assay, where worms were free to choose between the CS and an alternative attractant, diacetyl (DA). Based on the worms’ distribution after 1 hr, we calculated the Choice Index (CI) which provides a quantitative measure for the animals’ preference towards the CS over the alternative (Figure 1B and Figure 1—figure supplement 1A).

Following training, positively- and negatively trained animals shifted their preferences towards the CS in a concentration-dependent manner (Figure 1—figure supplement 2): Aversively trained animals decreased attraction towards the CS at lower concentrations, while the attraction of positively trained animals increased only at higher concentrations of the CS BUT (Figure 1—figure supplement 2). Thus, for chemotaxis assays, we used a 10-1 BUT concentration for positively trained animals, and a 10-3 concentration for the negatively trained animals (Figure 1—figure supplement 1A).

Worms trained to form positive associations were significantly more attracted to BUT than mock-trained or naive animals (Figure 1C). Similarly, worms trained to form negative associations were significantly less attracted to BUT when compared to mock-trained or naive animals (Figure 1C). These behavioral changes were evident in both short- and long-term training paradigms. Similar results were also obtained when assaying with ethanol, which was used to dilute BUT, instead of DA as the alternative choice (Figure 1—figure supplement 1B).

We next quantified the explicit effects of the CS (BUT) and the US valence (starvation/appetitive experiences) on the behavioral output. For this, we used the CI values to compute the Learning Index (LI), which reflects the difference between the CI of the different experimental groups within a training paradigm (Figure 1B and Methods). The treatment itself (US, CImock - CInaive) led to negligible changes in the choices (Figure 1D). By contrast, significant changes in the choice, of both training-specific (CItrained - CInaive) and stimulus-specific (CS, CItrained - CImock), were observed across all training paradigms, indicating that the modulated behavior was due to the presence of the CS (BUT) (Figure 1—figure supplements 24). Furthermore, the change in the choice corresponded to the valence of the experience: appetitively trained animals increased their choice of BUT, while aversively trained animals decreased their choice (Figure 1D). Thus, the change in choice behavior was dependent on both the stimulus and the valence of the experience.

Taken together, using the same CS (BUT), the four types of associative memories could be robustly formed: positive (appetitive) experiences which increased attraction towards BUT, and negative (starvation) experiences which decreased this attraction. Both positive and negative associations were successfully formed for short- and long-term periods.

A comprehensive functional analysis of the chemosensory system following memory formation

We systematically analyzed neuroplasticity of the sensory system, naturally focusing on the chemosensory neurons (Figure 2—figure supplement 1) as well as on two of the main downstream interneurons AIA and RIA (Figure 2 and Figure 2—figure supplement 2A and B). The AIA neuron is directly and richly innervated by chemosensory neurons, and hence, forms a hub in processing sensory output (Witvliet et al., 2021). RIA integrates sensory signals with the head position, thereby affecting choice of locomotion directionality (Hendricks et al., 2012; Hendricks and Zhang, 2013; Ouellette et al., 2018). We measured neural activity for all the four training paradigms (Figure 1A), including the matched mock-trained control groups and naive animals. For this, we used several reporter strains, each expressing GCaMP in either a set or in individual types of neurons (see Materials and methods). We restrained the animals in a microfluidic device (Chronis et al., 2007) and allowed them to habituate to the imaging conditions before using a fast-scanning confocal system to image dynamics from individual neurons during exposure and removal of the CS butanone (Figure 2). Neural identities were unambiguously extracted using available anatomic maps (Durbin, 1987; White et al., 1986) and by comparing to reporter strains with known neural identities (Figure 2—figure supplements 3 and 4).

Figure 2. A comprehensive functional analysis of the chemosensory system including key interneurons.

(A) A comprehensive systematic analysis of neural dynamics in naive, trained, and mock-trained animals across all four training paradigms (STAP, STAV, LTAP, LTAV). Neural dynamics were measured following exposure to (ON) or removal of (OFF) the conditioned stimulus butanone. Shown are the mean activities of the chemosensory neurons. The color bar indicates fluorescence normalized by the ground state of the neuron (see Methods for details). Statistical analysis suggested that at the population-level, activities of AWCW and AWCS correspond to AWCON and AWCOFF, respectively (see Figure 2—figure supplement 3A–D for a detailed analysis). (B) Mean activity of the RIA and AIA interneurons. Activities were extracted from the neurites. For RIA, we analyzed activity within the dorsal and the ventral regions of the neurite (see also Figure 2—figure supplement 1C and D and Materials and methods). Due to large amplitude differences between interneurons, the color bar indicates fluorescence normalized by the maximal fluorescence (ΔF/Fmax). nr, nerve ring; nrD/V, dorsal/ventral sides of the nerve ring; In both panels, presented are the means of 9–17 animals per each experimental group (column), resulting in a coverage of 2-17 traces per neuron (median=13). Only neurons with at least six traces were analyzed.

Figure 2.

Figure 2—figure supplement 1. Identifying the individual chemosensory neurons in the pan-chemosensory reporter strain.

Figure 2—figure supplement 1.

The pan-chemosensory reporter strain was constricted by expressing GCaMP3 and NLS-mCherry under the control of the osm-6 promoter which drives the expression of all of the amphid sensory neurons. (A) A confocal micrograph of the pan-chemosensory reporter strain. Segmentation of the individual neurons relies on the nuclear mCherry expression (red), while GCaMP3 allows reading changes in cytoplasmic Ca2+ levels as a proxy for neural activity. (B) Approximate in-situ position of the individual chemosensory neurons as projected during our analysis using in-house MatLab scripts. The nuclear mCherry segmentation is based on a Gaussian fit described in Toyoshima et al., 2016. (C–D) We image the entire volume of the animals and our image analysis pipeline extracts the bilateral symmetric sensory neurons. Identification is based on anatomic charts (see Materials and methods). Scale bars in A, C, & D are 5 μm.
Figure 2—figure supplement 2. Interneurons anatomy and the region of extracted activity.

Figure 2—figure supplement 2.

(A) Activity in the AIA interneurons was extracted from the neurite (AIAnr, red) since the soma remained largely non responsive (see also Figure 5—figure supplement 1). (B) Activity in the RIA interneurons is observed in the dorsal (RIAnrD, red) and the ventral (RIAnrV, green) compartments. Activities in these compartments are antiphasic. The sensory-evoked signal (RIAnrS, marked by blue lines) is non-compartmentalized and is evident in both compartments (Hendricks and Zhang, 2013). (C) The activity of the AIY neurons is extracted from the synaptic density along the neurite close to the nerve ring (AIYnr, red). Scale bars are 5 μm.
Figure 2—figure supplement 3. Discriminating between the two bilateral AWC neurons.

Figure 2—figure supplement 3.

Discriminating between the two AWC neuron in the pan-chemosensory GCAMP reporting strain was done by comparing their response dynamics to activities extracted from a second reporter strain. In this second reporter strain, the two AWC neurons express GCaMP, but the AWCON neuron, in addition, expresses mCherry. AWC neural activities in the pan-sensory strain were classified into strongly responding (AWCS) and weakly responding (AWCW) AWC neurons as in each animal the two AWC neurons showed marked differences in response amplitude. This classification is consistent with the activation pattern observed in the reporter strain with known AWC identities: (A, B) When using the pan-sensory reporter strain (Posm-6::GCaMP), the two AWC neurons exhibited distinct activities in response to butanone removal. One neuron showed high magnitude responses in trained and mock-trained animals for both short-term positive (STAP) and short-term aversive (STAV) training paradigms (denoted as AWCS). The second neuron exhibited weak responses in mock-trained animals (designated as AWCW), but robust strong responses following STAV and STAP training. Note the differences in mean activity between the conditions in the AWCW neuron (line graphs, n=9-15). (C, D) Imaging activity of both AWC neurons where the identity of AWCON and AWCOFF is known. Here, the AWCOFF neuron showed strong responses to butanone removal in both trained and mock-trained animals. These dynamics correspond to the AWC high neuron shown in panel A. Accordingly, AWCON matches the dynamics corresponding to AWC low (compare line graphs below, n=6-16). Note that in naive and mock-trained conditions, one of the AWC neurons is inactive (or very weakly active). Hence, we termed this neuron as AWCw (weak) while the other active neuron we termed AWCS (strong). In the trained conditions, both neurons are activated, though there is a clear distinction between their amplitudes. Based on the activation patterns obtained from the known AWC-identity reporter strains, activation of the AWCOFF neurons is usually faster and higher than that of AWCON. Hence, at the neural population dynamics of the weakly activated AWC (AWCW) and the stronger activated AWC (AWCS), it is plausible to identify them as AWCON and AWCOFF, respectively. (E–L) In butanone-diacetyl exchange experiments, AWC neurons also exhibit asymmetric activity in response to switching between butanone and diacetyl. (E, F) In the pan-sensory reporter strain, one of the AWC neurons responded with lower amplitude and slower activation dynamics upon butanone removal. (I, J) This activity was mirrored by the AWCON neuron as indicated by a reporter line with a known AWCON identity. (G, H) The other AWC neuron responded with a higher amplitude upon diacetyl removal, although the AWCOFF showed decreased responses (K, L). Of note, while the AWCOFF neuron showed differential activities between the two reporter strains, the pan-sensory neuron still showed intact learning-induced chemotaxis behavior which was similar to the WT animals (see Figure 4—figure supplement 5). Note that AWCOFF presumably got sensitized to diacetyl removal while in the naive state still maintaining vestiges of butanone sensitivity (see H). As the two reporter strains have vastly different degrees of GCaMP expression and GCaMP expression has been shown to alter synaptic transmission and firing properties of neural networks (Singh et al., 2018; Steinmetz et al., 2017), it is likely that these variable activities are due to differences in GCaMP expression. n=10 for the Posm-6::GCaMP strain and n=14 for the str-2-GCaMP3; srsx-3::GCaMP3 reporter strain. (M, N) Activities of AWC neurons with and without levamisole were generally in agreement. There were levamisole-induced differences in the response of the AWCON neuron. Data derived from imaging of the reporter strain with known AWC identity (str-2::GCaMP3; srsx-3::GCAMP3; str-2::ChR2-mCherry). Dynamics with levamisole copied from panels E-F (n=14). The vertical white line at t=0 in heatmaps denotes the time of stimulus exchange. Line plots show mean activity with SEM (shaded color). The different colors denote the trained animals in a given paradigm. Gray rectangle indicates butanone exposure.
Figure 2—figure supplement 4. Discriminating between the URX and CEPD neurons: Butanone removal elicits responses in the URX neurons, but not in the CEPD neurons.

Figure 2—figure supplement 4.

Imaging the pan-chemosensory reporter strain, we observed a response to butanone removal in the dorsal side of the lateral ganglion. Since both the CEPD and the URX neurons are positioned in close proximity at that region, it was impossible to distinguish between them and tell which neuron is actually responding. We, therefore, used two additional strains, each expressing a calcium reporter exclusively in one of these neurons. These experiments showed that the URX neurons respond to butanone removal. (A) CEPD neurons do not respond to butanone off-step. Imaging the strain Pdat-1::GCaMP3 (PS6250 Zaslaver et al., 2015), which drives expression in the dopaminergic neurons and which CEPD is one of them. n=5 animals. (B) Neural responses in a strain expressing cameleon in URX (Pgcy-37::YC2.60 Gross et al., 2014). A clear sharp response is detected in the URX neurons upon butanone removal (n=3 animals). The blue line above the heat maps indicates the time course of the stimulus switch (on to off); Bottom panels, mean responses of the traces shown in the upper panels. Shaded-red areas around the mean curves indicate SEM.
Figure 2—figure supplement 5. Neural activities of naive animals.

Figure 2—figure supplement 5.

Activities of all neurons studied in this work as measured in naive animals. For each neuron (except for AVA, AVE, and AIY), shown are three activity plots: Dark blue, responses following the switch between buffer and butanone (33.5 mM). Light blue, responses following the switch between diacetyl (11.6 μM) and butanone (3.35 mM). Brown, responses following switching between two buffer media to control for possible pressure and rhodamine effects. Gray-shaded rectangles denote the presence of the CS butanone. In all imaging experiments, we added rhodamine to the butanone solution to accurately determine the timing of stimulus exchange. To account for possible evoked responses due to rhodamine itself (which included chloride ions in its solution), we measured neural responses following an exchange of buffers where rhodamine was added to only one of the buffer streams. Multiple sensory neurons (AWA, ASH, AWC, AWB, ASJ, and URX), including the interneurons AIA and RIA, show robust responses upon butanone stimulation (dark blue curves, 33.5 mM butanone, 333-fold dilution) when comparing to buffer/buffer exchange (brown curve). Note that activities in ADF, ADL, and ASG were excluded from analysis because of cross-read artifacts from nearby neurons with high-amplitude activities. AWC neurons can be further categorized into AWCON and AWCOFF subclasses (see Figure 2—figure supplement 3). Interestingly, with the herein-used butanone concentration, neuron-class-specific reporters show that AWCON neurons are not responsive to butanone in naive animals but are responsive in STAV- and STAP-trained animals (see Figure 3C–E and Figure 2—figure supplement 3). AWCON neurons were shown to be activated following butanone removal (Kato et al., 2014; Larsch et al., 2013). AWCOFF neurons responded upon butanone removal in naive animals (see Figure 3—figure supplement 2 and Figure 2—figure supplement 3), thereby corroborating their roles in chemotaxis as previously described (Torayama et al., 2007). AWA neurons showed responses following butanone presentation, possibly in a concentration-specific manner, since a previous study did not observe AWA responses towards butanone at lower concentrations (Larsch et al., 2013). Activity responses to butanone in ASH, AWB, ASE, ASJ, and URX neurons were not reported hitherto. It is unclear, however, which of those neurons directly sense and respond to butanone, and which are downstream to these primary neurons. When comparing butanone/diacetyl exchanges (light blue curves) with buffer controls (brown curves), it is evident that AWA, AWC, AWB, ASER, ASK, ASI, and ASJ respond to either butanone/diacetyl switches. Note that for a few neurons, their baseline activity is elevated due to genuine activity. For example, the AWA neurons respond to both butanone and diacetyl (see Figure 4B–D Figure 4—figure supplement 4A–F). As a consequence, the baseline activity when exchanging between them is always elevated. It is interesting to point out that AWCON and AWCOFF show differential response patterns (Figure 2—figure supplement 3) The interneurons, AIY, AIA, and RIA show responses to the diacetyl butanone exchange. However, interneuron responses are hallmarked by more activity unrelated to the stimulation, and thus, similarly elevated baselines (grey shaded background indicates the presence of butanone, white background areas indicate the presence of diacetyl). Note that the sensory-evoked signal in RIA is denoted as the net calcium flux (derivative of the activity, F.s–1). The command neurons AVA and AVE were least affected by butanone/diacetyl exchange (only baseline shift). The asterisks indicate significance levels in t-tests (FDR corrected for multiple comparisons), on summed activity 10 s following stimulus exchange.

Short-term memories are evident in the sensory- and the inter-neurons, while long-term memories are evident primarily in the interneurons

Previous studies showed that the chemosensory neuron AWCON responds to BUT already at the naive state of the animals (Kato et al., 2014; Larsch et al., 2013). We found that additional chemosensory neurons participate in encoding BUT in naive animals, namely, AWA, ASH, AWB, ASJ, URX, as well as the interneurons AIA and RIA (Figure 2 and Figure 2—figure supplement 5). However, neurons that participate in memory coding presumably show modulated response activities following training. To extract these neurons, we calculated the difference in the mean amplitude response between all possible pairwise comparisons of the various experimental groups, namely, naive, trained, and mock- trained animals, for each of the four training paradigms (Figure 3A–B).

Figure 3. The activity of sensory neurons is predominantly modulated following short-term training paradigms, while the activity of interneurons is modulated following both short- and long-term training paradigms.

(A–B) Differences in the mean maximal amplitudes of neural activities across the different experimental groups. Differences between pairwise groups are denoted by the Δ in the header. (A) Chemosensory neurons. (B) Interneurons with nr(D/V) meaning neurite (Dorsal/Ventral). The leftmost sector denoted all possible comparisons that provide the different coding measures. For example, US + compares the positively mock-trained animals to naive animals to yield the coding specific of the positive unconditioned stimulus. TR, treatment-specific coding; SL, short- vs long- term. The middle and the rightmost sectors denote short-term and long-term specific differences including the valence (VAL) and the conditioned stimulus (CS) specific coding or the short and long-term memory, respectively. Black or white rectangles denote exposure or removal of butanone (BUT), respectively. Note that for sensory neurons (A) higher amplitude differences are observed predominantly in short-term paradigms. In interneurons (B), high amplitude differences are observed for both short- and long-term training paradigms. Colorbar denotes the difference in the maximal amplitude of the two neural responses. Rectangles marked with a border line are significant differences: Gray * p<0.05, Black ** p<0.01. (C–E) The sensory neuron AWCW shows a significant differential activity following formation of short-term memories. Analysis suggests that the AWCW population activity corresponds to the one of AWCON (Figure 2—figure supplement 3A–D). (C) Heat maps of individual neurons (=animals) denoting neural activities in each of the four training paradigms. The vertical white line at t=0 denotes the time of BUT removal. (D) Mean activities, based on data from C. The different colors denote the experimental group in each of the four paradigms. The shaded gray background indicates BUT exposure, and shaded area around the mean activity indicates standard error of the mean. (E) Integrated activity during the first 10 s following BUT removal (based on the dynamics shown in C, n=7-15). Black vertical lines denote the mean of summed activity, and the dots present the individuals. *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected for multiple comparisons). (F) Two examples of mean AWCW responses comparing different experimental groups. Green, Short-term appetitive (STAP); Red, Short-term aversive (STAV); Gray, appetitively mock-trained animals. Comparing response dynamics of STAP and the associated mock controls reveals a significant difference (denoted on the left side). This difference marks a stimulus-specific component of the memory. In contrast, the difference between STAP and STAV is negligible (shown as a blue box on the right), suggesting that the AWCON neuron does not code the valence component of the memory. The boxes’ color code matches the different colors shown in panel A. The three dynamic curves shown here are taken from panel D to highlight the groups being compared.

Figure 3.

Figure 3—figure supplement 1. The gained responses in AWCON following short-term appetitive training require intact synaptic transmission.

Figure 3—figure supplement 1.

(A) In naive wild-type animals, the AWCON neuron does not respond to butanone removal (blue). Short-term positive training modulates the activity of the AWCON neuron which becomes responsive to butanone (blue, naive: 10 animals; green, trained: 9 animals). (B) In animals, defective in neuropeptide release (unc-31), AWCON dynamics is similar to the one observed in wild-type animals as shown in panel A. (blue, naive: 9 animals; green, trained 12 animals). (C) In animals defective, in synaptic transmission (unc-13), the increased response in the AWCON was abolished (blue, naive: 5 animals; green, trained: 5 animals). (D) Bar graphs showing summed neuronal activity 15 s following the stimulus exchange. Blue, naive animals; green, trained animals. Dots in the bar graph indicate individual repeats. Shaded areas in line plots indicate SEM. *p<0.05, **p<0.01 (t-test, FDR corrected).
Figure 3—figure supplement 2. The sensory neurons whose activity responses were modulated following short-term, but not long-term, training paradigms.

Figure 3—figure supplement 2.

The sensory neurons, AWCS (corresponds to AWCOFF A, B, C), AWA (D, E, F), ASH (G, H, I), and ASK (J, K, L) show significantly differential activity following the formation of short-term memories only. Heat maps (A, D, G, J) denote the activities of individual neurons (=animals) in each of the training paradigms. The vertical white line at t=0 denotes the time of stimulus exchange. In the mean activity plots (B, E, H, K), the different colors denote the trained animals in a given paradigm. Shaded gray background indicates butanone exposure, and the shaded area around the mean activity indicates the standard error of the mean. Scatter plots (C, F, I, L) present the summed neuronal activity post the stimulus switch. Blue, naive worms; Gray, mock-trained worms. Black bar p<0.05, gray bar p<0.01, light gray p<0.001(t-test, FDR corrected). (A, B, C) In the AWCOFF neuron, responses following STAV- and STAP-training were significantly increased. STAV-trained animals exhibited significantly higher responses when compared to the mock-trained animals (scatter plots and Figure 3—figure supplement 3), suggesting stimulus-specific coding (n = 7-15 animals). (D, E, F) STAV-trained animals showed significantly lower responses than naive animals in AWA neurons. Horizontal dotted lines in line graphs highlight amplitude differences between STAV and STAP (n = 9-17 animals). (G, H, I) In ASH neurons, activity is increased after STAV training only. Note the significant difference from the STAV-trained animals, mock-trained controls and naive animals. (n=9–17 animals). (J, K, L) In ASK neurons, STAV, STAV-mock, and LTAV-mock conditions are significantly increased compared to the naive condition (n=9–17 animals). Note that the slope in ASK neural activity is caused by receding activities after initial light activation due to the onset of imaging.
Figure 3—figure supplement 3. Individual activity traces of chemosensory neurons in naive and mock-controlled animals.

Figure 3—figure supplement 3.

(A) AWCW (corresponds to AWCON) activity in response to butanone removal; (B) AWA activity during butanone presentation; (C) ASK activity during butanone presentation; (D) AWCS (corresponds to AWCOFF) activity during butanone removal; (E) ASH activity during butanone removal; Lines in the heat maps denote individual animals (neurons). The vertical white line at t=0 indicates the time of stimulus exchange.
Figure 3—figure supplement 4. Interneurons exhibited modulated activities following both short- and long-term training paradigms.

Figure 3—figure supplement 4.

(A, D, G, J) Heat maps denoting activity of individual neurons. (B, E, H, K) mean activity. The colors denote the training paradigms. Shaded areas around the mean indicate SEM (C, F, I, L) Summed activity of individual trials post stimulus exchange. * p<0.05, ** p<0.01, *** p<0.001 (t-test, FDR corrected). (A–C) AIA neurite (AIAnr). The activity of AIA following LTAV training is higher compared to its activity following LTAP training or naive controls. Note that the difference between LTAV and the associated mock controls might be due to a baseline shift (see also supplementary Fig. S14A). (D–F) Sensory-evoked activities in the RIA (RIAnrS) expressed as the derivative of activity (dF/dt in F.s–1). Note that the calcium influx is significantly reduced in appetitively trained animals and their mock-controls compared to naive animals. (G–I) Activity in the RIA dorsal neurite (RIAnrD). (J–L) Activity in the RIA ventral neurite (RIAnrV). In long-term memory, aversively trained animals show differential activity when compared to naive and mock-trained animals controls (see also line graph and Figure 3—figure supplement 5).
Figure 3—figure supplement 5. Individual activity traces of interneurons in naive and mock-controlled animals.

Figure 3—figure supplement 5.

(A) AIA neurite (AIAnr) activity in response to butanone presentation. (B) RIAnrD activity during butanone presentation. (C) RIAnrV activity during butanone presentation. (D) RIAnrS activity (expressed as the net calcium flux, F.s–1) during butanone removal. Lines in the heat maps denote individual neurons. The vertical white line at t=0 indicates the time of stimulus exchange.

For example, while the AWCW neuron (identified as AWCON, see Figure 2—figure supplement 3) shows mild innate responses to BUT in naive and mock-trained animals, its response activity was significantly heightened following short-term appetitive (STAP) and short-term aversive (STAV) training paradigms (Figure 3C–F). Since the sole difference between the trained and the corresponding mock-trained animals was the presence of the CS (BUT) during the training period, the differential activity suggests that the AWCW neuron may be coding the stimulus component of the memory. No significant differences were observed in the responses of the AWCW neuron when comparing STAP and STAV-trained animals, further strengthening the possibility that this neuron codes the stimulus rather than the valence component of the memory. A similar change in AWCON neural activity was also observed by Cho and colleagues (Cho et al., 2016). Interestingly, this training-associated increased activity depended on intact neurotransmission (Figure 3—figure supplement 1), suggesting that network activity, rather than cell-autonomous processes, underlie the response plasticity in the AWCON neuron.

In addition to AWCON, the neurons AWCOFF, ASH, and ASK also showed significant modulated responses (Figure 3A and Figure 3—figure supplements 2 and 3). Most striking, the changes in neural responses were observed predominantly for the short-term training paradigms, while only minor negligible changes were detected following long-term training paradigms (compare the two rightmost sectors in Figure 3A).

In contrast to sensory neurons, interneurons showed marked changes in their responses following training in both short- and long-term paradigms (Figure 3B and Figure 3—figure supplements 4 and 5). For example, we observed significant increased activity in the ventral compartment of the RIA neurons as well as in the AIA neurites following training in the long-term negative paradigm (Figure 3—figure supplement 4).

Together, these results indicate that sensory responses to the CS were primarily modulated following formation of short-term, rather than long-term, memories. Moreover, this training-induced plasticity was distributed across various chemosensory- and inter- neurons.

Sensory neurons code both the stimulus and the unconditioned stimulus in short-term memories

The systematic functional analysis revealed small, though significant, differences in neural responses (Figures 23). This is in contrast to the differences observed in behavioral outputs that showed a strong experience-dependent shift in preference towards the CS when presented with an alternative choice (Figure 1 and Figure 1—figure supplement 1B). Thus, to better resolve potential neural differences in encoding aversive and appetitive memories, we mimicked the conditions set during the behavioral assays and imaged neural responses using DA as the alternative choice to the CS BUT. We repeated the comprehensive functional imaging experiments, this time focusing on the short-term training paradigms in which the chemosensory neurons showed extensive modulated activities (Figure 4A–B and Figure 4—figure supplement 1). Strikingly, a systematic analysis of naive, trained, and mock-trained animals following positive and negative training paradigms revealed significant activity changes in most of the chemosensory neurons (Figure 4A–B and Figure 4—figure supplements 2 and 3). In particular, three neurons (AWA, ASER, and AWCON) stood out with marked differences in their activity (Figure 4B–J and Figure 4—figure supplement 4A–F).

Figure 4. Short-term training broadly modulates activity of the sensory neurons.

(A) Differences in the mean maximal amplitudes of neural activities across the different experimental groups. Differences between pairwise groups (denoted by the Δ in the header) denote the different coding-specific measures. Rectangles marked with a border line denote significant differences: Light gray * p<0.05, dark gray ** p<0.01, Black ***p<0.001. (B–J) The sensory neurons, AWA (B-D, n=9–16 animals), ASER (E-G, n=8-10 animals), AWCON (H-J, n=9-16 animals, see Figure 2—figure supplement 3E–L), show significant differential activities following the formation of short-term memories. Heat maps (B, E, H) denote activities of individual neurons in each of the training paradigms, and vertical white lines at t=0 denote the time of stimulus exchange BUT/DA. Line plots (C, F, I) show mean activity with SEM (shaded color). The different colors denote the trained animals in a given paradigm. Blue, naive animals; Gray, mock-trained animals. Shaded gray rectangles indicate butanone exposure. Dotted lines in panel I (AWCON) denote the maximal amplitude of aversively and appetitively trained animals. Dots in group-scatter graphs (D, G, J) represent the summed neuronal activity post the stimulus switch; black lines denote the population mean. *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected). (K) Classification accuracy of the different training conditions when considering response dynamics of individual neurons. Shown are the macro F1 scores following using a random forest classifier. Blue line denotes the score of a random classification, indicating that when considering single neurons, the accuracy is better than randomly expected. Dash line indicates an F1 score of 50%. Error bars indicate standard deviation from a cross validation. ***p<0.001 (t-test against random F1 score, FDR corrected). (L) Classification accuracy of the different training conditions when considering a growing number of neurons to be included in the model (indicated by the horizontal arrow). Continuous purple line denotes the real data; dashed black line is when using a scrambled data where neuronal responses were randomly assigned to various training paradigms. Shaded area around the lines indicates standard deviation from cross-validation. (M) Line-normalized confusion matrix for the data. When including activity from all sensory neurons, the classification efficiency exceeds 90%. Scores of true positives, positioned along the diagonal, range from 81% to 97%.

Figure 4.

Figure 4—figure supplement 1. A comprehensive functional analysis of the chemosensory system and key interneurons following training in short-term paradigms.

Figure 4—figure supplement 1.

We systematically analyzed neural dynamics in naive, trained, and mock-trained animals in short-term training paradigms (STAP, STAV), and neural dynamics were measured following the switch between butanone (BUT) and diacetyl (DA). (A) A representative activity dynamics during alternating switches between BUT and DA. Prior to the onset of imaging (one minute before t=0) the animals were habituated to the imaging light illumination. Neuronal activity is taken from an AWCOFF neuron. (B) Shows the population means of the chemosensory neuronal activation. The color bar indicates fluorescence normalized by the ground state of the neuron (see Materials and methods for details). (C) Population means of AIY, AIA, RIA, AVA, and AVE interneurons. For RIA, we analyzed activity within different segments of the neuron (see also Figure 2—figure supplement 2B, C and Materials and methods). Due to large amplitude differences between the interneurons, the color bar indicates fluorescence normalized by the ground state (ΔF/FG). For all neurons, 6–18 animals were imaged within each experimental group (column), resulting in a median coverage of 12 traces per neuron. Shown are the traces 10 s before and 30 s after stimulus exchange (total 40 s).
Figure 4—figure supplement 2. Chemosensory neurons showing modulated activities following short-term training paradigms.

Figure 4—figure supplement 2.

The sensory neurons ASI (A-C), AWB (D-I), ASH (J-L),ASJ (M-R,V,W) ASK (S-U) showed significantly differential activity following the formation of short-term memories. For each neuron, shown are the individual traces (heat maps, A,D,G, J, M, P, and S), mean activity (line plots, B, E, H, K, N, Q, and T). and the summed activity of individual traces (C,F,I,L,O,R, and V) post the stimulus switch across all training paradigms. In heat maps, the vertical white line at t=0 denotes the time of stimulus exchange. In the mean activity plots, the different colors denote the trained animals in a given paradigm. Shaded gray background indicates butanone presence and the shaded area around the mean activity indicates the standard error of the mean. *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected). The ASJ neurons (M - R) responded to both butanone and diacetyl exposure with multiple, variable activations (see oscillating activations in U and W. Individual trials are depicted. Note multiple activations in the bold, highlighted trace). Interestingly, appetitively trained animals exhibited heightened activity following butanone exposure compared to aversively trained animals (N, and Q, green arrows). In contrast, aversively trained animals show higher activity following diacetyl exposure (N and Q, red arrows). U and W display individual activation traces. Note that multiple activations occur following a single stimulus exchange.
Figure 4—figure supplement 3. Individual activity traces of chemosensory neurons in naive and mock-controlled animals.

Figure 4—figure supplement 3.

(A) ASER activity during butanone exposure. (B) AWCON activity during butanone removal. (C) ASI activity during butanone removal. (D) ASH neurons during butanone removal. (E, F) AWB neurons during stimulus exchange, respectively. (G–H) ASJ neurons. (I) ASK neurons during butanone removal (diacetyl exposure) Lines in the heat maps denote means of individual animals. The vertical white line at t=0 indicates the time of stimulus exchange.
Figure 4—figure supplement 4. The two AWA reporter lines differ in their response kinetics but carry the same memory-coding logic.

Figure 4—figure supplement 4.

Shown are the individual neurons (heat maps A, D, G, J), mean activity (line plots, B, E, H, K) and the summed activity of traces of individual neurons (C, F, I, L) post the stimulus switch across all training paradigms. In heat maps, the vertical white line at t=0 denotes the time of stimulus exchange. In the mean activity plots, the different colors denote the trained animals in a given paradigm. Shaded gray background indicates butanone exposure, and the shaded area around the mean activity indicates the standard error of the mean. *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected). (A-F) Activities in AWA neurons as measured in the pan-chemosensory reporter strain. (A-C) Activities in response to butanone of trained animals were decreased in a stimulus-specific manner (compared to the mock-trained animals). (B) Valence-specific responses (green vs red curves) are observed following the switch from BUT to DA. Note that aversively trained animals respond stronger to diacetyl than appetitively trained animals, suggesting forwarded movement in the presence of diacetyl (the alternative choice) in aversively trained animals (n=9–16 animals). (G-L) Activities in the AWA neurons as measured from a second reporter strain expressing GCaMP3 in AWA and AIY (Pgpa-6::GCaMP3; Pmod-1::GCaMP3). This strain recapitulated the decreased AWA activity of the trained animals in response to butanone (see gray curves vs colored curves in H). In contrast, valence-specific differences are now observed in response to exposure to butanone. Here, the activity of appetitively trained animals is higher than that of aversively trained animals, suggesting more forward movement in appetitively trained animals when encountering butanone (n=13–18 animals). (M-N) The overall logic of AWA responses in the two reporter strains is the same. (M) Pan-chemosensory (osm-6::GCaMP); (N) the Pgpa-6::GCaMP3. While differences between aversively trained and appetitively trained animals exist in both strains, in the pan-chemosensory line, the differences manifest during the diacetyl presentation, where negatively trained animals responded with a higher amplitude compared to the positively trained animals. In contrast, the Pgpa-6::GCaMP line showed a strong response following positive training and no response following negative training (valence-specific differences). However, this was apparent in the BUT presentation (namely, the switch from DA to BUT). Thus, the reversed activities are observed in response to flipped switches of the stimuli, effectively, coding the same memory logic. It is important to remark that the short-term learning behavior of the pan-chemosensory reporter strain (shown in A-F & M) is not different from wildtype behavior (see Figure 4—figure supplement 5) We believe these variable activity patterns to be the result of variable GCaMP3-expression load in our reporter lines.
Figure 4—figure supplement 5. The WT and the pan-chemosensory reporter strain show similar behavioral outputs following training.

Figure 4—figure supplement 5.

(A, C) Chemotaxis indices from the pan-chemosensory reporter strain following training for positive (A) and negative (C) associations. (B, D) Comparison of the calculated learning indices between the pan-chemosensory reporter strain and WT animals. (Data from the pan-chemosensory reporter line is depicted in lighter hue; N2 wild-type data is held in slightly darker colors; The data for the WT animals is shown in Figure 1D). The two strains showed comparable behavioral outputs without significant differences. Asterisks denote a significant difference from zero, indicating successful training that modulated chemotaxis choice behavior. *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected). STAP short-term appetitive memory, STAV short-term aversive memory.
Figure 4—figure supplement 6. ASER and AWA neurons show high animal-to-animal variability.

Figure 4—figure supplement 6.

(A–G) For each neuron, shown are the analysis of the trial-to-trial and the animal-to-animal variabilities. For each such analysis, shown are the individual activity traces (heat maps) and the mean activity (line plots) divided into responding and non-responding groups. The bar graphs denote the fraction of responding (pink) and non-responding (purple) for each training paradigm. Notably, trial-to-trial variability was detected in all neurons, underscoring that neural responses are inherently noisy. However, high animal-to-animal variability, which averages six trial repeats per animal, was mainly detected in the AWA and ASER neurons. For the ASER neurons (A) ~50% of the naive and STAV-trained animals showed responses. Thus, there is a bimodality within the population of the animals which disappears following training (or mock training) in specific paradigms. For the AWA neurons (B–C) Naive and various training groups showed bimodality at the animal population level (animal-to-animal) in their responses to the switch between DA and BUT. To categorize the activity as responding or non-responding, we used a threshold that was differentially set for each neuron. Importantly, the conclusions from these analyses were not sensitive to the chosen threshold.
Figure 4—figure supplement 7. Activity of sensory neurons can be used to identify the training conditions by classification algorithms.

Figure 4—figure supplement 7.

(A) A sampling scheme for training and testing data by splitting trials within individuals. Each animal was subjected to six repeats of stimulus presentation. For each neuron, these six repeats were randomly partitioned into two groups: three repeats that were used for training, and the other three repeats that were used for data testing. Each of the three repeats was averaged to obtain one vector for each animal. This procedure was performed for each neuron, and averaged activities for each neuron were then concatenated. Each animal thus produced two independent activity vectors: one for training (red) the classifying algorithm and one for testing it (green). (B) To avoid over-parameterization in the concatenated neuronal activity vectors, we performed feature reduction by binning timepoints. Prediction accuracy (macro F1 score) started to drop only after crossing the 20-fold reduction threshold (dashed line). Consequently, all classifications were performed on 20-fold feature-reduced activity vectors. (C–D) when classifying the memory conditions based on trials (C) or individual animals (D, sampling see A) using the random forest algorithm, nearly all neurons were significantly better predictors than if using a random classification (blue line). AWA alone produced >50% accuracy (F1 score). Classification was performed on trials with a 80/20 split between the training and the testing datasets, respectively. *p<0.05, **p<0.01, ***p<0.001 (t-test against random F1, FDR corrected). (E) Prediction accuracy increases the more neurons are included in the classifying model when predictions are based on dataset partitioning ‘within the individual’ (see A). Note that the scrambled label control does reproduce the increase in prediction accuracy when adding neurons. (F) When trials per animal are averaged and animals are partitioned in training and test data using 80/20 split, the classification error increases. All classifiers still perform better than scrambled label controls. In particular, the neural net performs three times better than expectation and clearly shows an increase in accuracy as neurons are added to the model. The neural net was composed of three layers with 50, 40, and 70 neurons, respectively. K-means nearest-neighbor used the distances to the next nine data points. The random forest consisted of 350 decision trees.

In naive and mock-trained animals, the AWA neurons strongly responded upon switching from DA to BUT (Figure 4B–D). However, in trained animals (positive and negative), the AWA neurons showed no responses, suggesting that these changes code the stimulus component. When switching back from BUT to DA, the AWA neurons in trained animals were activated. This activation was significantly stronger in STAV-trained than in STAP-trained animals (Figure 4—figure supplement 4D–F), suggesting differences between aversive and appetitive encoding as well. Repeating these experiments in an additional AWA reporter strain similarly showed stimulus and valence specific modulations, although the response dynamics differed from the one observed in the pan-sensory reporter strain (Figure 4—figure supplements 4 and 5).

The ASER neuron displayed marked activity responses in naive animals upon the switch from DA to BUT. This response was completely lost in STAP-trained and all mock-trained animals, but not in STAV-trained animals (Figure 4E–G). This suggests that the ASER neuron may be coding the stimulus component of the memory as well as the positive (US+) and the negative (US-) experiences of the training paradigms. Activity changes in the AWCON neurons were hallmarked by a large increase in all treated groups (when compared to the naive group), which is indicative of coding both the aversive and appetitive US (Figure 4H–J, Figure 2—figure supplement 3E–H). Activity changes of other sensory neurons were more subtle: for example, ASI, AWB, and ASJ neurons appeared to be related to the differences between aversive and appetitive experience (Figure 4—figure supplements 2 and 3).

In some paradigms, the AWA and ASER neurons exhibited marked variability in their responses (Figure 4—figure supplement 6A–B). For example, the ASER neuron responded in only ~50% of the naive or STAV-trained animals. This bi-modal distribution was observed when considering both trial-to-trial and animal-to-animal responses (in the following, the term ‘trial’ refers to individual BUT/DA exchanges, where animals underwent six cycles of such trials (exchanges), Figure 4—figure supplement 6A). Interestingly, this variability decreased following training (e.g. STAP and the associated mock group) as most animals (or trials) showed homogeneous responses. Other neurons did not show a marked animal-to-animal variability (Figure 4—figure supplement 6D–G).

As multiple chemosensory neurons changed activity following training in each of the paradigms, we next asked how many neurons need to be considered to accurately describe each of the training-associated states such that their combined activity can distinguish between these training paradigms. We trained several classifiers (including k-means, random-forest, and a neural net) on a fraction of the data, after which we tested the model accuracy on the remaining data (see Materials and methods). All classifiers provided similar results (Figure 4L–M and Figure 4—figure supplement 7E and F): When considering single neurons only, classification accuracy (measured as F1 scores) was rather low for all sensory neurons (up to 50%), though the scores were significantly higher than randomly expected (Figure 4K and Figure 4—figure supplement 7). When considering sets of sensory neurons, the decoding of the underlying training paradigm was better the more neurons were added to the model. Combining activities of all chemosensory neurons together resulted in 90% decoding efficiency, irrespective of the classification algorithm used (Figure 4L–M and Figure 4—figure supplement 7E–F).

These results demonstrate that the different training paradigms induce fine changes in a large fraction of the sensory neurons, suggesting that short-term memories are widely distributed across the chemosensory system, where each neuron may code the CS and/or the positive/negative experiences of the training paradigm.

The modulated activity in the sensory neurons propagates to the interneurons

We next asked how these fine modulated activities are reflected in the downstream interneurons. The chemosensory neurons are presynaptic to several key interneurons, including AIY, AIA, and RIA (Cook et al., 2019; White et al., 1986; Witvliet et al., 2021). In particular, the AIY neurons are key immediate postsynaptic targets of the AWA, ASE, and AWC neurons that showed marked modulated activities following training. We therefore repeated the short-term training paradigms in strains expressing GCaMP in these interneurons (see Materials and methods). Activity profiles of these interneurons were extracted from their neurites since the soma activity remained largely static (Figure 5—figure supplement 1), consistent with previous reports (Chalasani et al., 2010; Hendricks and Zhang, 2013; Itskovits et al., 2018). Of note, for the AIY interneuron, we used a line expressing GCaMP in both the AIY and the AWA neurons, allowing simultaneous recordings of these two neurons from the same animal (Itskovits et al., 2018).

Neural responses in the AIY neurons largely recapitulated the responses observed in the AWA neurons (Figure 5A–D and Figure 5—figure supplement 2M–P). This suggests that the AIY neurons, similarly to the AWA neurons, might encode the stimulus component of the memory. The activity in the AIA neurons was significantly increased in positive mock-control animals while naive and positively trained animals responded similarly, indicating that AIA neurons are probably sensitive to the treatment itself (US+) rather than to the stimulus (Figure 5E–F and Figure 5—figure supplement 1E–H). A similar tendency was observed in the aversive training paradigm.

Figure 5. Training-induced modulated activity of the interneurons.

(A–D) AWA and AIY activities measured simultaneously from the same animal. Note the similarity between the mean activities of the AWA (A) and AIY (C) neurons in trained animals (n = 13-19 animals). (E–F) AIA activities across all training paradigms. (E) Individual traces of trained animals (top) and mean activities (bottom). AIA Activity was significantly reduced following positive-associated training only (n = 6-18 animals). (G–H) Sensory-evoked component of the time-derivative of the neural activity Hendricks et al., 2012; Jin et al., 2016 of RIA across all training paradigms. RIA Activity was significantly increased following negatively associated training only (n=12-16 animals). (A, C, E, G) Heatmaps show responses of single neurons. Line graphs show the mean activity. Colors denote the training paradigm. Shaded areas in the line plots indicate presence of the CS butanone. (B, D, F, H) Integrated activity during the first 10 s following stimulus exchange. Black horizontal lines denote the mean of summed activity, and the dots present the means of each individual trials. Significance is according to the bar color: *p<0.05, **p<0.01, ***p<0.001 (t-test, FDR corrected).

Figure 5.

Figure 5—figure supplement 1. Stimulus-induced calcium dynamics is observed in the neurites of AIA and AIY, but not in the cell soma.

Figure 5—figure supplement 1.

Shown are the traces of individual neurons (heat maps, A, C, E, G), mean activity (line plots, B, D, F, H), and exemplary traces for AIA (I, J) and AIY (K, L) neurons in both the soma and the neurites. In the heat maps, the vertical white line at t=0 denotes the time of stimulus exchange. In the mean activity plots, the different colors denote the trained/naive animals in a given paradigm: blue, naive; green/red, STAP/STAV; gray, mock trained. Shaded gray background indicates butanone exposure, and the shaded area around the mean activity indicates the standard error of the mean. (A, B) Neural activities following a diacetyl-to-butanone switch in AIA neurons (neurite and soma) following appetitive training and associated controls (n=6–18 animals). (C, D) Neural activities following a diacetyl-to-butanone switch in AIA neurons (neurite and soma) following aversive training and associated controls (n=6–18 animals) (E, F) Neural activities following a butanone-to-diacetyl switch in AIA neurons (neurite and soma) following appetitive training and associated controls. (F) Note that the neurite shows increased activity in all training conditions while activities at the soma remain unchanged (arrowhead, n=6–18 animals). (G, H) Neural activities following a butanone-to-diacetyl switch in AIA neurons (neurite and soma) following aversive training and associated controls. (H) Note that the neurite shows increased activity in all training conditions while activities at the soma remain largely unchanged (arrowhead, n=6–18 animals). (I-L) Individual traces of activities in the soma and the neurite within the same AIA (I, J) and AIY (K, L) neurons. The vertical black line denotes a change of 150% (2.5-fold) neural activation. In both neurons, neural activations are only evident in the neurites and not in the soma. In AIY only, we had few successful simultaneous measurements of the soma together with the neurite. These recordings are in good agreement with previous observations (Itskovits et al., 2018), documenting an apparent lack of soma activations. The colors of the traces correspond to the specific training paradigm as noted in (A, C, E, G). Scale bar in the sketch is 5 μm.
Figure 5—figure supplement 2. The individual activity traces and the mean activities of RIA and AIY interneurons in all training paradigms.

Figure 5—figure supplement 2.

Shown are the traces of individual neurons (heat maps A, C, E, G, I, K, M, O), mean activity (line plots, B, D, F, H, J, L, N, P) post the stimulus switch across all training paradigms. In heat maps, the vertical white line at t=0 denotes the time of stimulus exchange. In the mean activity plots, the different colors denote the training paradigms. Shaded gray background indicates butanone exposure, and the shaded area around the mean activity indicates the standard error of the mean. The left panel in line plots is the mean of the corresponding three leftmost heat maps shown above. The right panel of the line plots in the mean of the right-most heat maps shown above. Dynamics of naive animals are duplicated for convenience. (A–D) Activity in the dorsal neurites of RIA neurons (n=12–16 animals). (E–H) Activity in the ventral neurites of RIA neurons (n=12–16 animals). (I–L) Sensory-evoked signals in the neurites of the RIA neurons (expressed as the net calcium flux, F.s–1, n=12–16 animals). (M–P) Activity in the neurites of the AIY neurons (n=13–18 animals).
Figure 5—figure supplement 3. Activities in the AVA and AVE neurons were not modulated following training in the different paradigms.

Figure 5—figure supplement 3.

(A) Representative neural activities in AVA (blue) and AVE (red) command neurons. Note that AVA and AVE neurons were in their active state most of the time and largely unresponsive to the stimulus exchange (see panels O to T); This could be attributed to the fact that calcium imaging of command neurons in restrained animals is prone to artificial activity that may arise from fictive behavior (Hallinen et al., 2021). (B) Activity of AVA command neurons (blue) can be categorized into ‘activate’ and ‘inactive’ states (orange line) to quantify transitions between these neural states (see arrows). Green arrow marks the transition from inactive to active state and a red arrow marks the opposite. (C–H) With levamisole, AVA neurons do not show a response following short-term training when switching between the stimuli. The only noted difference is a shift in the baseline activity when comparing appetitively trained animals and their associated mock controls. These differences though are unrelated to the stimulus switch (n=9–16 animals). (I–N) To exclude the possibility that levamisole affects activity, AVA neurons were imaged in the absence of levamisole. Again, no differences were observed in the response dynamics following the stimulus switch. The only significant changes were the shifts in the baseline activity (see mean activity panels J & M, n=12–16 animals). These baseline shifts in aversively- and appetitively trained animals could be due to starvation-induced increase in AVA activity as previously reported (Lemieux et al., 2015). (O–T) Quantification of the state transitions in the AVA neurons (switching between ‘active’ and ‘inactive’ states) as defined in panel B. State transitions were scored during the 10 second interval following stimulus exchange. Heat maps (O, R) showing activation states for individual trials (yellow-active; blue-inactive). Line graphs (P, S) denote the state change frequency. Note that there is no difference in the frequencies between the different training paradigms. Bar graphs (Q, T) indicating the average number of state transitions within 10 seconds following stimulus exchange (t-test, FDR, adjusted; n=12–16 animals). (U–Z) Similarly, no differences in the activity of the AVE command neurons in response to stimulus exchange. Only the baseline activity shifts and this was unrelated to stimulus exposure (n=8–14 animals). (C, F, I, L, U, X) Heat maps of individual traces. Vertical white lines denote the stimulus exchange. (D, G, J, M, V, Y) Mean activity plots of AVA and AVE command neurons. Colors in the mean activity graphs denote the underlying training paradigms. Shaded areas around the mean indicate SEM. (E, H, K, N, W, Z) Summed mean activity for each individual 25 seconds post stimulus exchange (shorter integration intervals lead to similar results, data not shown). * p<0.05, ** p<0.01, *** p<0.001 (t-test, FDR corrected). A general remark to all panels, imaging procedures required a 30-min starvation period. However, since we always compare trained and mock trained group animals, which undergo exactly the same preparatory treatments, we essentially filter out these physiological effects. The overall ~30 min starvation could in principle modulate activity of neurons associated with local search behavior, like for example AVA and others (Gray et al., 2005; Lemieux et al., 2015; Skora et al., 2018). We therefore may capture such starvation-induced changes, however, since we always compare trained and mock trained group animals which undergo exactly the same preparatory treatments, we essentially filter out these physiological effects.

To describe the sensory-evoked responses in the RIA neurons, we followed previous reports and considered the derivative form of the activity (Hendricks et al., 2012; Jin et al., 2016). This sensory-evoked component was significantly increased following aversive experiences only, where the trained animals gained neural responses whereas naive and mock-trained animals showed minimal activity (Figure 5G–H and Figure 5—figure supplement 2I–L). These results suggest that the RIA neurons show stimulus-specific activity modulation in aversive conditions.

We also studied activity changes in two major command neurons, AVE and AVA, that are positioned downstream to the aforementioned interneurons, and whose activity instructs a backward motion (Gray et al., 2005; Piggott et al., 2011). These neurons exhibited mostly baseline-level activity shifts that were unrelated to the switches between BUT and DA (Figure 5—figure supplement 3).

The activity of interneurons can be explained by a linear combination of the sensory neuron’s activities

Measuring dynamics of AWA and AIY neurons simultaneously from the same animal revealed a surprisingly low correlation between the two synaptic partners. In fact, only ~4–44% of the variance in AIY could be explained by the AWA activity across the different training conditions (Figure 6—figure supplement 1D–E). This suggests that additional neurons contribute to the overall dynamics of AIY, and possibly of other interneurons as well.

To study how the modulated activity of the sensory neurons impacts the activity of the interneurons, we considered a simple mathematical model where interneuron dynamics is dictated by a linear combination of the sensory neuron activities. For this, we averaged activities of each odor trial for each of the sensory neurons across all animals in the different paradigms (Figure 6—figure supplement 1I), and used a multivariate regression analysis to extract the weights that would best fit the activity of the AIY neurons (see Materials and methods). As expected, the more sensory neurons added to the model, the better was the overall prediction of the AIY activity (Figure 6A and D). When considering the combined activity of five sensory neurons types (namely, AWA, AWC, ASE, AWB, and ASG), up to 88% of the variance in the AIY neurons activity could be explained (Figure 6A–D). However, this improved accuracy was detected for the naive and the aversively trained animals (Figure 6A, pink arrows), while no improvement (compared to when considering AWA alone) was detected for the positively trained animals and the associated mock controls. This lack of improvement suggests that ASER, AWC, ASG, and AWB neurons contribute more to encoding the aversive experiences, while the AWA neurons were the prime contributors to the downstream AIY activity in appetitive experiences (Figure 6C and D). Overall, the highest portion of variance that explains AIY activity was obtained in the mock-trained animals, suggesting that the US experience alone may dominate the sensory-to-AIY input weights. This is particularly evident for the appetitive conditioning where the presence of food alone yielded a better fit to AIY activity than the training regime consisting of food and BUT combined. Model evaluation using F-statistics and cross validations indicated that different combinations of sensory neurons should be used to best explain the AIY activity in each of the training paradigms (Figure 6—figure supplement 1H). Together, these analyses indicate specific and distinct synaptic routes between the chemosensory neurons and the postsynaptic AIY interneuron are modulated in a paradigm-specific manner (Figure 6E).

Figure 6. Activity of AIY interneurons can be described as a linear combination of the sensory neurons’ activities.

(A–C) A multivariate regression analysis was used to explain AIY activity based on a linear combination of the sensory neurons activity. (A) A multivariate regression model of average AIY activities (color coded by the training condition) based on activities of either AWA alone (broken blue line) or the combination of 5 neuron types (AWA, AWC, ASE, ASG and AWB, black line). Dynamics shown are during 15 s after the diacetyl-to-butanone switch. Pink arrows indicate where the addition of more neurons to the model improved the fit to the AIY activity. (B) Activity scatter plots of the different sensory neurons vs AIY across all training paradigms. (C) Regression coefficients of the sensory neurons. R2 denotes the coefficient of determination. Asterisks denote the significance of regression coefficients in contributing to the linear combination. Note that the correlation coefficients for AWA strongly vary between conditions: green (pink) arrows indicate large (small) coefficients and hence strong (weak) effects on AIY activity. Error bars indicate confidence intervals. *p<0.05, **p<0.01, ***p<0.001 (t-test p-values for coefficients from regression statistics). (D) Gradual addition of sensory neurons to the linear combination model increased the variance explained in AIY Activity as reflected by the higher R2 scores (line plot in top panel). In Naive and in STAV, AWA alone explained very little of the AIY activity variance (dotted red frame) and adding more neurons increased the R2 scores. Appetitive conditions show a shallower increase in R2 since AWA alone explains more than half of the activity variance observed in AIY (dotted cyan frame). Note that the overall adjusted R2 does not deviate from R2, indicating that overall the model excluded insignificant regressors. (E) Summary of the sensory-to-AIY communication routes (chemical and electrical Choi et al., 2020) that are modulated by experience. Colors indicate in which memory type they are modulated, and arrow’s thickness indicates relative synaptic strength (White et al., 1986; Witvliet et al., 2021).

Figure 6.

Figure 6—figure supplement 1. Synaptic communication routes between sensory neurons and the AIY interneurons change in an experience-dependent manner.

Figure 6—figure supplement 1.

(A) Activities of AWA (red) and AIY neurites (blue) are only partially synchronized. Shown are response examples as measured from a reporter strain expressing GCaMP in both the AWA and the AIY neurons. (B) Correlation coefficients between AWA and AIY, as measured within the same animal, considerably vary. Calculating it for each stimulus exchange within each animal (see heat maps) shows variation within and between animals as well as between conditions. (C) Averaged correlation coefficients between AWA and AIY across the different training paradigms. These correlation values were low, except for STAP mock-trained animals. (D–E) When regressing AIY activities against AWA activities only (within the same animal), only a low portion of the variation in AIY activity can be explained. Shown is an univariate model describing 15 s of AIY activity following a diacetyl-to-butanone switch. (D) An univariate regression model of AIY activities based on AWA activities. Shown are the fits across all training paradigms. (E) Activity scatter plots of AWA vs AIY across all training paradigms. (F) Cross-validation of the multivariate regression model shown in Figure 6. Data for training and testing were randomly split 50/50. Regression coefficients were calculated on half of the data. Then R2 was calculated using these coefficients on the set-aside portion of the data. This procedure was repeated 10 times. Each field denotes the mean of R2. Note that in NAIVE and MOCK conditions the R2 values increase the more neurons are added to the model. In STAP, R2 decreases due to insignificant regressors (ASE, AWC, ASG, and AWB are not significantly contributing to AIY in STAP, see pane I and Figure 6C), and the AWA neurons account for most of the variance. (G) Cross-validation yields low R2 values for STAP and STAV. However, the regression coefficients show robust variation throughout conditions during re-testing. Scatter plots show regression coefficients of the AWA, ASER, ASG, and AWCON neurons as calculated based on the cross-validation shown in panel F. Single dots are regression coefficients of individual retrials. The Coloured bar represents the cross-validation mean and the black bar denotes the regression coefficient when using the entire data. Despite the low R2 values in cross-validation (F), the regression coefficients are consistently different across the various training paradigms, suggesting that the changes in the regression coefficients are genuine and generalizable. (H) Heatmap showing the F-statistics of the multivariate linear regression model. Adding individual neurons to the model across all conditions did not always significantly increase the variance explained by the model. For example, incorporating the ASER neuron to the model that already contained AWA, significantly increased the variance explained by the model in all conditions except for in the STAP paradigm. (I) Our approach for relating activities from the pan-sensory reporter strain (osm-6::GCaMP) with activities extracted from a reporter strain expressing GCaMP in both the AWA and the AIY neurons. Data points from simultaneous recordings of AWA and AIY activities within the same animal (blue field) are synched. To accurately relate the neural activity of AIY neurons to activities of sensory neurons measured in different animals (i.e. ASER activities originating from the pan-chemosensory strain, red field), we averaged each trial across all animals (gray arrows). This minimized animal-to-animal variation and allowed the use of activities originating from different animals within the same regression model (black arrow).

Sensory neurons and interneurons jointly code short-term memory

The analyses above indicated that neural activities were significantly modified in an experience-dependent manner. We next asked whether these combined changes provide a unique coding scheme for each of the memory components that jointly code the training paradigms. For this, we considered the changes in the activity dynamics of individual neurons across the different paradigms by calculating the difference in the neural activity between the training groups. For instance, subtracting the mean activity of aversively mock-trained animals from the mean activity of aversively trained animals, provides a measure for how much the CS changed the activity of that particular neuron (Figure 1—figure supplement 3 and Figure 7—figure supplement 1A). We calculated these activity differences for each of the six trials across all neurons to generate an activity delta matrix (see Materials and methods and Figure 7—figure supplement 1B).

Next, we performed a principal component analysis (PCA) on this difference matrix. Interestingly, the first two components of the PCA already generated distinct clusters, each cluster representing an experience component (Figure 7A). For example, both CS components (bluish colors, denoted by the difference between trained and the corresponding mock-trained animals, Figure 1—figure supplement 3) are clearly distinct from the US components (green/red colors, denoted by the activity difference between naive and mock-trained animals). Furthermore, even within the experience components, each condition is distinctly clustered. For example, the valence components, calculated by the differences within the corresponding trained and mock-trained groups (e.g. STAPT - STAVT and STAPM - STAVM), are grouped nearby, yet form two distinct clusters (yellow/brown colors, Figure 7A). When incorporating the data of the interneurons (AIY, AIA, and RIA), the separation between the clusters becomes even more prominent (Figure 7B). These findings suggest that individual experiences distinctly modulate the combined activity of the sensory and the interneurons.

Figure 7. PC analysis reveals unique population codes for each of the training paradigms.

(A–B) PCA scatter plot of the different experience components (Figure 1—figure supplement 3) as calculated based on the differences in neural activities: US+, appetitive unconditioned stimulus; US- aversive unconditioned stimulus; CS(AP) conditioned stimulus calculated from appetitive regime; CS(AV) conditioned stimulus calculated from the aversive regime. VAL(M) valence calculated from the mock-trained groups; VAL(T) valence calculated from the trained groups. (A) PCA when considering sensory neurons only. (B) PCA when combining sensory and interneurons. Note the better separation of clusters when interneurons are included in the analysis. (C) Map of activity changes associated with the various experience components. Blue arrows represent changes following butanone (BUT) exposure. Brown arrows reflect changes following exposure to diacetyl. Note some neurons (i.e. AWC) are OFF-type responders that react to stimulus withdrawal. Consequently, while the response change was recorded during DA presentation, the neuron is responding to BUT withdrawal. Shaded areas in the arrowhead indicate the standard deviation between trials.

Figure 7.

Figure 7—figure supplement 1. PC analysis reveals the encoding neurons in each of the training paradigms.

Figure 7—figure supplement 1.

(A) The effect of the specific paradigm on neuronal activities can be estimated by comparing the mean activities at the different paradigms. For instance, subtracting the activity of AWA neurons of mock-trained animals from the AWA activity of aversively trained animals reveals the activity changes that are due to the conditioned stimulus. See Figure 1—figure supplement 3 for all possible comparisons that yield the different memory components. (B) The conditioned and unconditioned stimulus components of the memory can be described as a vector of the activity differences across all neurons, including the six experimental trials performed for each animal. The AVA and AVE neurons were not included because they are not directly reacting to the stimulus exchange and are engaging in fictive reversal behavior (see Figure 5—figure supplement 3A). US + appetitive unconditioned stimulus; US–) aversive unconditioned stimulus; CS(AP) conditioned stimulus calculated from appetitive regime; CS(AV) conditioned stimulus calculated from the aversive regime; Valence (VAL) is the difference between aversive and appetitive conditions. (C) After subjecting the memory component matrix (B) to a principal component analysis, the associated loads and the PC scores from principal components that cluster the memory components are used to reconstruct the input data. This filters out variance that is unrelated to the memory components (see filtered data). Note that the filtered data is less noisy than the input data. For each neuron and memory component, we then sum up and normalize by the activity changes. Resulting changes are displayed as arrows (see M, Figure 7C) (D) Scatter plot of Principal Components 3 and 5, which were used to generate Figure 7C since they cluster the CS and the VAL. (E–L) To validate our PCA-based method, we generated activities of seven sensory neurons and three interneurons whose activities are linearly dependent on the activity of the sensory neurons. (E) Layout of the network underlying our simulated responses. Triangles, sensory neurons; hexagons interneurons. Arrows indicate the relative weights. Briefly, individual neural activation in naive state peaks were constructed with a positive sigmoid function for excitation and a negative sigmoid function for inhibition. Maximal amplitudes and exponential terms were assigned to different neuron types. Individual-to-individual variability was modeled by varying the amplitudes and exponentials (gaussian distribution). Acquisition-related noise was modeled with a slow 5-frame component (reflecting movement artifacts and fast detector-noise (both poissonian). Base-level variation was assumed as a fixed-value offset sampled from a gaussian distribution. Interneuron activities were constructed as linear combinations of sensory neuron inputs. (F) Other memory conditions were constructed by varying the sensory neurons in the naive state. We therefore assigned each task parameter an amplitude modification profile (each amplitude was varied by ±0.5 Units, indicated as colored squares). Memory conditions were then constructed by combination of the task parameters. STAP is CS added to US+, STAV is CS with US-, mock conditions are US +or US- alone. Thereby, we obtained an activity dataset of known changes that are very similar in noise level and in response shapes but lack other un-observable sources of variance such as activity changes dependent on the inner state of the animal. The matrix shows modifications to the response amplitudes of sensory neurons for each task parameter. Blue bars indicate modifications to butanone response, brown bars indicate changes to diacetyl response. Note that the actual detectable change in the neuron’s activity is strongly dependent on the peak shape, duration, and underlying noise level. The simulated activities are comparable to measured activities: (G) heat map of measured AWA activities. (H) Heat map of simulated activities of sensory neuron ‘C’. (I) Average activities of AWA neurons. (J) average activities of simulated sensory neuron ‘C’. Note the similar overall properties as in AWA (I). (K) Neuronal activities of sensory neuron ‘B’, The differences between trained and mock-trained animals are due to memory components while differences marked by pink arrows arise from noise. (L) When subjected to PCA, the simulated neuronal activity differences (deltas) produce a similar scattering pattern that groups the task parameters (as observed in our data, Figure 7B). (M) PCA-filtered estimation of task-parameter-dependent change for each neuron in the simulated data. Arrows show estimated changes. Shaded areas indicate standard deviation between trials. Blue and brown arrows denote responses to butanone and diacetyl, respectively. Neurons with large response amplitudes (i.e. NRN B) show robust changes that correlated with the assigned amplitude changes (compare amplitude modifications in F). Neurons that were not assigned amplitude changes (green arrowheads, neurons ‘E’ and ‘G’) do not exhibit changes. However, in some neurons (pink dotted frames, i.e. NRN ‘B’) there are changes that are only due to noise (see pink arrows in K). This effect is amplified when neurons are active over a longer time period (blue arrow in K). Conversely, when a neuron has a short and noisy response, it is hard to detect an activity change (arrows marked by blue dotted rectangles). (N) To mitigate the detection of noise-induced activity changes, we applied k-means nearest neighbor clustering based on peak amplitudes and the peak-amplitude-to-standard-deviation ratio. The detected changes were categorized as ‘real’ and ‘false’ changes. Note the region (dotted line) where real changes and noise overlap. As this classification is more sensitive to false negatives, we used this conservative classification regime on the experimental data to suppress false positives (Figure 7C).

The applied training regime is not the sole source for variation in neural activities. For example, differing network states (Gordus et al., 2015) and additional sensory inputs may significantly contribute to the overall modulated activity. To eliminate such plausible factors and to focus on the training-associated changes only, we reconstructed the original data based on the principal components 1, 2, 3 and 5, which best represented the experience components and their associated loads (see Materials and methods, Figure 7B and Figure 7—figure supplement 1D). We then plotted the reconstructed changes in the neural activities as arrows, where the length of the arrow represents the mean magnitude of the change associated with each of the experience components (Figure 7C). Notably, since this PCA-based method filters much of the variation in the data that is not associated with the experience components of the training paradigms, it provides a conservative, and presumably more accurate, representation for the role of neurons in each of the training paradigms.

It is evident that coding each of the memory components is distributed among several sensory neurons, where a few of them (e.g., AWCON) are broadly used to code most of these experience components. In addition, starvation itself, denoted by the US- experience component, involves activity modulation of multiple neurons. The changes in the activity of the interneurons showed marked variability, more than that observed in the sensory neurons (Figure 5). As a result, their activities were mostly filtered out following the PCA analysis and data reconstruction (see Methods and Figure 7—figure supplement 1C–N). Thus, the contribution of the interneurons to the overall neural representation is presumably underestimated. Together, these analyses show that experience components are distributed across various neurons that collectively form a unique population code for each of the training paradigms.

Short-term training paradigms modulate the directionality of animals during chemotaxis towards the CS

The comprehensive analysis of neural activities showed that training modulates response dynamics of sensory- and inter- neurons (Figures 27), which in turn modulates animal preference towards the training stimulus (Figure 1). We therefore asked what are the fine training-induced locomotion changes that may underlie the modulated preference towards the CS (BUT). To understand the effects of training paradigms on specific locomotion parameters, animals were imaged when choosing between BUT and DA in conditions similar to the choice tests (Figure 1) and the neural imaging analyses (Figures 36). A multi-animal tracking system was used (Itskovits et al., 2017) to extract key locomotion parameters, namely, animal’s speed, reversal frequency, and directionality (angle) towards the CS target (Figure 8A–B).

Figure 8. Short-term learning paradigms modulated the directionality towards the CS, but not the speed nor the reversal frequency.

(A) A layout of the choice experiments for the appetitive and the aversive short-term training paradigms. Note the different concentrations of the CS butanone (BUT) used in each case. + sign marks the starting position of the worms at the beginning of the assay. Scale is in cm. (B) The directionality of the animal trajectory towards the BUT target is given by the deviation angle, the angle between the animal’s directionality vector and the target. Deviation angles approaching zero mean a motion directed towards the target, and 180 degrees is directionality opposite from the target. (C) Plots of the deviation angle as a function of the distance from the target BUT (See panel A). STAP-trained animals make significantly smaller deviation angles than mock-trained and naive animals. In contrast, STAV-trained animals show significantly higher deviation angles than associated mock and naive controls. Note that the relative effect size is larger in aversive than appetitive animals and that animals migrate towards DA (arrow). The dotted horizontal line denotes 90 degrees. (D) Mean deviation angle in the proximal region (1.2-3.5 cm from the target, marked by gray area in C). (E) Plots of the speed as a function of the distance from the target BUT. (F) Mean speed angle in the proximal region (1.2-3.5 cm from the target, marked by gray area in E). (G) Plots of the reversal frequencies as a function of the distance from the target BUT. The units are given as reversals per centimeter worm track at the distance from the endpoint specified by the x-axis. (H) Mean reversal frequencies in the proximal region (1.2-3.5 cm from the target, marked by gray area in G). In C-H, shown are five independent experiments, each consisting of ~100 animals. Shaded areas around the plots indicate SEM. *p<0.05, **p<0.01, ***p<0.001 (rank-sum test, FDR corrected). (I–N) Simulations of choice behavior that test the contribution of each of the locomotion components to the behavioral output. Plots show the fraction of animals reaching the target over time. Each plot shows accumulation of simulated naive and trained animals by sampling locomotion parameters based on the measured data. Hybrid animals were simulated by sampling two of the parameters from the naive group and the relevant parameter from the trained group. Arrows indicate the magnitude of the effect between naive and hybrid simulated animals. See also Figure 8—figure supplement 1. (I, L) Sampling reversals from the STAV (I) or the STAP (L) trained group, while speed and directionality were sampled from the naive animals. Changes related to reversals are negligible (see arrows). (J, M) Sampling speed from the STAV (J) or the STAP (M) trained group, while reversals and directionality were sampled from the naive animals. Changes related to speed are negligible (see arrows). (K, N) Sampling deviation angle from the STAV (K) or the STAP (N) trained group, while speed and reversals were sampled from the naive animals. Changes related to directionality account for most of the difference between naive and trained groups (see arrows).

Figure 8.

Figure 8—figure supplement 1. Simulations of choice behavior based on measured locomotion parameters.

Figure 8—figure supplement 1.

Animal choice behavior can be reproduced in a simple random-tumble simulation that is based upon the experimentally measured locomotion components (reversals, speed, and deviation angle, see Figure 8C–H). For each step, ‘in-silico animals’ sample choice of direction, speed, and reversals from distributions derived from the measured data. Resulting paths shown in A resemble animal’s genuine tracks. In the measured data, the fraction of animals is estimated from fragmented tracks and this estimation is sensitive to artifacts while in simulations, the number of animals and position is known at any time point. Hence, the graphs in B,D and C,E are not fully equivalent to be compared. Moreover, metrics such as persistence of motion as a function of track length and initial decision of direction could not be measured with sufficient accuracy due to experimental restrictions and are thus not accounted for by the model; this simulation serves only to compare the relative contribution of the three motion parameters. In B-D, the means of 10 rounds of simulation with 100 animals in each run and virtual plate are shown. Shaded areas denote standard deviations. (A) Examples of simulated tracks of STAP-T and mock-trained animals. Each plate shows tracks of 10 animals per group. (B) Accumulation graphs of measured data show that appetitively trained animals are the slowest to accumulate at the butanone endpoint. (C) When simulating appetitive training, trained animals rapidly accumulate at the butanone endpoint while control groups are slower. A higher fraction of trained animals chooses butanone which is again in agreement with experimentally measured animal behavior (B). (D) Accumulation graphs of measured data show that aversively trained animals are the slowest to accumulate at the butanone endpoint. (E) When simulating aversive experience, accumulation of trained animals at the butanone endpoint is slower than that of control groups. Alos, a lower fraction of trained animals chooses butanone. These observations are in agreement with the experimentally observed animal behavior (D).

Positively trained animals were significantly more directed towards the CS target, while the negatively trained animals were the least directed towards the target (each paradigm compared to its naive and matched mock-trained animals, Figure 8C–D). Notably, animals that underwent aversive training with BUT showed a high deviation angle with low variance towards the alternative choice DA (Figure 8C, arrow), suggesting that the negative training increased aversion from BUT, and concomitantly, enhanced attraction to DA. Animal’s speed and reversal frequency showed mild though significant changes (Figure 8E–H). To test the contribution of these changes to the overall behavior, we simulated animal chemotaxis based on experimental locomotion parameters (Figure 8I–N, and see Figure 8—figure supplement 1 for explanation). These simulations indicated that animal directionality (the deviation angle from the target) accounted for most of the behavioral changes, while the contribution of the speed and the reversal frequency to the overall change in the locomotive behavior was negligible (Figure 8—figure supplement 1). These analyses suggest that training mainly affected animals’ directionality features: more directed following positive training and less directed following an aversive training.

Discussion

Ample studies demonstrated associative (conditioning) learning in C. elegans (Ardiel and Rankin, 2010; Cho et al., 2016; Kauffman et al., 2010; Loy et al., 2021; Oda et al., 2011; Sasakura and Mori, 2013). In this study, we systematically mapped each of the four types of associative memories (short- and long-term memories, each encoded using positive and negative associations) onto the compact neural network of C. elegans. By using the same CS (BUT) in all training paradigms, we were able to extract the individual neurons that code either the CS, the US (positive or negative), or both.

Of note, short- and long-term memories can also be categorized based on the involvement of transcriptional and translational processes: While classical short-term memories do not depend on such processes, long-term memories do (Asok et al., 2019). Indeed, long-term memories were shown to depend on crh-1 (a CREB homolog) and transcriptional changes (Freytag et al., 2017; Kauffman et al., 2010; Lakhina et al., 2015)⁠. However, short-term aversive conditioning with butanone was also shown to depend on RNAi and transcriptional changes (Juang et al., 2013). Thus, while the underlying molecular mechanisms may be paradigm or species specific (Cho et al., 2016), in this study, we classified the training paradigms into short and long-term memories based on the time period these memories were behaviorally persistent (e.g. modulated attraction to the conditioned stimulus, Figure 1 and Figure 8).

Sensory neurons’ activities code short-term memories while interneurons code both short- and long-term memories

Our findings indicated that short-term, but not long-term, memories were mostly evident in changes of the sensory neurons’ soma activities (Figure 9A–B). These short-term memories inflicted substantial changes in the stimulus response dynamics of multiple sensory neurons (Figures 24 and Figure 9C–D). It is possible that the limited sensory neuroplasticity observed in long-term memories was due to the specific training conditions used herein, for example, the specific use of BUT as the CS and the training durations. Indeed, when using isoamyl alcohol as the CS, and coupling this odornat with a long-term aversive training, a mild modulated activity was observed in both the AWCOFF and the ASH chemosensory neurons (Eliezer et al., 2019). Moreover, sensory neurons may still be coding long-term memories via modulation of the synaptic output and which is not reflected by soma calcium activity (Oda et al., 2011). Indeed, sleep is required for modulating the synatic structure between the AWC and the AIY neurons to sustain the long-term memory (Chandra et al., 2022).

Figure 9. Illustration of the sensory- and the inter- neurons participating in coding the different memory types.

Figure 9.

(A) Multiple chemosensory neurons respond to butanone (BUT). All these chemosensory neurons innervate the AIA interneuron while only a few innervate the AIY interneurons. Arrows indicate chemical synapses and resistor symbols indicate gap junctions (White et al., 1986; Witvliet et al., 2021). (B) Long-term memory is evident in the interneurons and probably associated synapses (violet) rather than in the chemosensory neurons. (C) Highlighted in blue are the neurons participating in coding the stimulus component of short-term memories. (D) Highlighted in red/green are the neurons participating in coding the valence component of short-term memories. The fraction of the red/green color indicates the estimated impact of the memory on neural activity. Note that we denote AWC neurons as not coding valence because in our BUT-only experiments and in studies of others (Cho et al., 2016) AWC neurons showed no differences between aversive and appetitive conditions. In B-D, the size of the shapes (triangle or hexagon) indicates the estimated impact of the memory on neural activity.

The limited involvement of sensory neurons’ activities in coding long-term associative memories may hint at an intriguing principle for coding memories in a compact neural network: Plasticity in the sensory neurons is likely to modulate sensory responses to various cues, possibly affecting innate behavioral outputs. For short-term memories, the modulated behavior will be brief, but for long-term memories, the impact on behavior will be long-lasting. Thus, for long-term memories, it may be advantageous to ‘clear’ information stored within sensory neurons and to relegate this information to the deeper layers of the network. This way, animals would quickly resume innate responses. The relegation of long-term memories to deeper layers can be viewed as analogous to the transfer process taking place in mammalian brains, where hippocampal short-term memories are moved for long-term storage in cortical areas (Rothschild, 2019). In addition, resetting the sensory neuron’s response dynamics may mitigate the limited sensory resources as more neurons may become available for coding new short-lived memories. Overall, the extensive sensory plasticity revealed herein is consistent with the idea that such plasticity may have evolved to increase animals’ fitness by improving detection and enhancing attention towards salient stimuli (McGann, 2015).

Interneurons showed modulated activity following the formation of both short and long-term training paradigms, though activity changes following long-term experiences were more prominent (Figure 3A, B, and Figure 9B–D). Indeed, interneurons were previously shown to participate in coding both short- and long-term memories (Jin et al., 2016; Oda et al., 2011). Analogous roles of sensory and interneurons in coding short and long-term memories were observed in the salt conditioning paradigm. At least three chemosensory neuron types are required for the formation and retrieval of salt learning (Jang et al., 2019; Watteyne et al., 2020). While short aversive salt conditioning modulated responses of the salt-sensing neuron ASER (Oda et al., 2011), long-term positive salt conditioning did not (Sato et al., 2021). However, the activity of the downstream interneuron AIB was modulated following the positive long-term conditioning (Sato et al., 2021).

Memory components are widely distributed across the sensory- and the inter-neurons

Activities of sensory neurons were broadly modulated by short-term experiences (Figure 4A and Figure 7C). The widely distributed changes in the chemosensory layer suggest that the sensory neurons encode the experience as a population code. Considering modulation of individual neurons only precludes accurate distinction between the training paradigms. But when considering all the chemosensory inputs, the underlying experience could be decoded with sufficient accuracy (Figure 4K–M), further highlighting the notion that the experience code is distributed among the sensory neurons.Within the distributed code of the experience components (Figure 7A and B), the PC-based analysis revealed how activity changes of individual neurons contributed to encoding the CS, the US, or both (Figure 7C and Figure 9C–D).

Assigning valence-coding neurons was somewhat limited due to the procedural differences in aversive and appetitive training paradigms. This was particularly evident when training for the long-term paradigms which involved several key procedural differences. Nevertheless, the procedural differences between positive and negative training in the short-term paradigms were minimal (see Materials and methods), so valence-coding neurons could be extracted with higher certainty. These analyses indicated that the ASJ and ASI neurons may be the strongest candidates for coding valence (Figure 4A, Figure 7C, Figure 4—figure supplement 2A–C, M–R and V–W). Indeed, the ASI neurons were shown to integrate information regarding food availability (Gallagher et al., 2013; Hapiak et al., 2013).

The observed activity changes were generally consistent with the experience logic (positive or negative). For instance, in aversively trained animals, switching from DA to BUT leads to ASER activation (Figure 4E–G), an activation that triggers a reversal behavior (Appleby, 2012; Suzuki et al., 2008) which prevents the animals from moving towards BUT. Changes in other neurons were harder to reconcile. For example, in both negatively and positively trained animals, activity in the AWA neurons was strongly reduced in response to BUT (Figure 4B–D). Thus, it is presumably the combined modulated activity of all sensory neurons that is being integrated into the downstream interneuron layer to express the adaptive behavioral responses.

The distribution of memory components among multiple neurons may evolve as an organizing principle in memory formation and storage. In flies, olfactory memories are encoded using a distributed code within the mushroom body (Bilz et al., 2020), and in mammalian brains, it is assumed that engram cells, the set of memory-storing neurons, are also widely distributed in the brain Josselyn and Tonegawa, 2020: the valence component in the amygdala (Liu et al., 2012), and the stimulus-specific information in sensory cortices (Jones et al., 2008; Morris et al., 1998; Ohl and Scheich, 2005; Sacco and Sacchetti, 2010).

Changes in AWCON responses are concentration-specific and depend on intact neural transmission

The AWCON neuron shows training-induced plasticity that is strongly dependent on the specific concentrations of the CS (BUT). For example, when stimulating the trained animals with low concentrations of the CS, both the CS and the US were coded by the AWCON neuron. Exposure to a ten-fold higher concentration of the CS suggested that the AWCON neuron coded the CS only (compare Figure 3D and Figure 4H). The strong dependence of the AWCON responses on the specific concentrations of the CS was also evident in a previous study where responses were observed only when stimulating the animals with the trained concentration, and regardless of the positive or the negative associating experience (Cho et al., 2016).

Furthermore, Cho et al., 2016 demonstrated that in butanone conditioning, the AWC sensory neuron coded the sensory history of the animal, while the downstream AIA interneuron coded the associative component of the memory. This sensory history is analogous to our observation made with BUT only in which the AWCON neuron codes strictly the CS, irrespective of the positive or the negative association.

The training-induced modulated activity of the AWCON neuron appears to be non cell-autonomous, since this plasticity was not observed in mutant animals, defective in neural transmission (Figure 2—figure supplement 3). This suggests that a network activity is required for recruiting a population of neurons for storing the memory.

The modulated activity of the AIY interneuron can be explained by the combined activity of the sensory neurons

Population coding requires integration of the coding sensory neurons into downstream neurons, such as the AIY interneuron. A regression analysis revealed that AIY activity can be explained via a simple linear combination of the sensory neurons (Figure 6). This analysis provided a quantitative measure for the relative contribution of the sensory neurons to the overall activity of the AIY neurons. These relative contributions uniquely changed in an experience-dependent manner, suggesting that the identity and the specific modulation of neural communication routes dictate each of the specific memory types. For example, the AWA neurons contributed the most to the modulated activity of AIY neurons in the appetitive paradigms, while AWC, ASER, ASG, and AWB neurons dominated in dictating AIY activity in naive animals and following aversive training (Figure 6E). In that respect, the AWA neurons are associated with attractive stimuli (Bargmann et al., 1993), while the sensory neurons required for aversive conditioning are mostly associated with reversals and avoidance (Gray et al., 2005; Suzuki et al., 2008; Troemel et al., 1997).

Notably, the aim of the linear combination model was to identify modulated synaptic communication routes. The computed regression coefficients, which denote a change in the communication routes, are not a direct measure of the underlying synaptic weights. This is due to the limitations in data acquisition (i.e. frame rate, kinetics of GCaMP, and number of available data points, etc.) and the fact that we measure calcium levels which are only correlates of neural potential. Furthermore, the modulated communication routes may include, in addition to the classical chemical synapses, also electrical gap junctions that were demonstrated to be imperative to form memories in C. elegans (Choi et al., 2020). Nonetheless, the model reliably revealed specific communication routes (chemical and electrical synapses combined) that changed in an experience-dependent manner.

Short-term memories modulate the animals’ directionality towards the conditioned stimulus

Behavioral assays following short-term training revealed that positively trained animals were more directed towards the CS, while negatively trained animals were significantly less directed (Figure 8C–D). Interestingly, aversive training also inflicted significant changes in sensory-specific responses of the RIA neurons (Figure 5G and H). As the RIA neurons dictate animals’ head position (Hendricks et al., 2012; Hendricks and Zhang, 2013; Ouellette et al., 2018), their modulated dynamics may explain the changes observed in movement directionality. Indeed, RIA neurons were shown to participate in formation and forgetting of aversive experiences, suggesting that past experiences may be converged onto RIA interneurons to shape behavioral outputs (Jin et al., 2016; Liu et al., 2022). As the animals’ reversal frequency and speed were not modulated (and no changes in AVA and AVE activity patterns were observed either), RIA is a possible candidate that could underlie the observed change in directionality. However, it is impossible to tell whether animals changed directionality due to RIA-induced head swing bias, or alternatively, due to reorientation mediated by command neurons (e.g. AVA, AVE) since we tracked animals as center mass points. Also, activity changes in RIA neurons were significant though small, thus raising the question whether these changes are large enough to mediate the observed trained phenotype. Moreover, additional interneurons that control turning rates (e.g. AIB, AIZ, and RIM) and speed (e.g. RIB, SIA, and RMG) may also play roles in these memory-induced behavioral modulations (Garrity et al., 2010; Iino and Yoshida, 2009; Lee et al., 2019; Li et al., 2014; Wakabayashi et al., 2004). In fact, some of these neurons had been shown to participate in either memory formation (AIB & RIM) or memory retrieval (AIY & RIA) (Jin et al., 2016). Thus, additional experiments are required to support the functional role of RIA plasticity in shaping the learning-dependent behavioral outputs.

As memories are encoded in a distributed manner, it is presumably the integrative activity of many neurons that gives rise to the altered choice of directionality. As such, the impact of a single neurons' activity on locomotion might be limited. The need to consider the integrated response of all neurons was also evident from analyses of freely behaving animals, where a population code, rather than the activity of individual neurons, was shown to be a better descriptor of locomotion (Hallinen et al., 2021).

In summary, the systematic cellular-resolution analysis presented herein revealed basic principles for how associative memories are encoded in a compact neural network. These principles may extend to memory formation processes taking place in higher organisms with more complex nervous systems.

Materials and methods

Worm cultures

Animals were grown at 20 °C on 9 cm nematode growth medium plates, seeded with 500 µL of confluent OP 50 bacterial suspension. For culturing and experiments, eggs were collected by dissolving the animals using standard bleaching protocols. The eggs were seeded at a density of 1000–1200 per plate. For training in short-term paradigms, bleaching and seeding were conducted 3 days before the experiment. Animals undergoing long-term training were seeded 48 hr before initiation of the training.

Worm strains

For functional imaging, worm strains driving the expression of calcium reporters in neurons of interest were used (Table 1). N2 wild-type worms were used for behavioral assays.

Table 1. Worm strains used in this study.

Designation Phenotype/Purpose Genotype/Expression (Source/Ref)
N2 WT N2 wild-type (CGC)
Pgcy-37::YX2.60 URX reporter line [Pgcy-37::YX2.60] Gross et al., 2014
PS6250 CEPD reporter line Ex[Pdat-1::GCaMP3] Zaslaver et al., 2015
PS6374 AWCON reporter line Ex[Pstr-2::GCaMP3] Zaslaver et al., 2015
PS6253 AWCOFF reporter line Ex[Psrsx-3::GCaMP3] Zaslaver et al., 2015
PS6498 AWCOFF and AWCON reporter line Ex[Pstr-2::ChR2-cherry,Pstr-2::GCaMP3,srsx-3::GCaMP3; pha-1 rescue; lite-1 bkg]
ZAS96 AWCON reporter line in unc-13 bkg Ex[Pstr-2::GCaMP3] in unc-13(e51) - This study
ZAS76 AWCON reporter line in unc-31 bkg Ex[Pstr-2::GCaMP3] in unc-31(e928) - This study
ZAS280 Sensory neurons reporter line azrIs347[Posm-6::GCaMP3,Posm-6::NLS-mCherry-2xNLS  + PHA-1] Iwanir et al., 2019
ZAS323 Sensory and command neuron reporter line azrIs347[Posm-6::GCaMP3,Posm-6::NLS-mCherry-2xNLS  + PHA-1] x goeIs5[Pnmr-1::SL1::GCaMP3.35::SL2::unc-54 3’UTR +unc-119(+)], crossing of ZAS280 x HBR191, Schwarz and Bringmann, 2013
PS6510 RIA reporter line Ex[Pglr-3::GCaMP; pha-1 rescue] - This study
ZAS256 AIY reporter line Ex[Pgpa-6::GCaMP3, Pmod-1::GCaMP3; Ppha-1::PHA-1]; pha-1; lite-1 Itskovits et al., 2018
CX16561 AIA reporter line [Pgcy28d::GCaMP D381Y coel::dsRed, Podr-7::Chrimson::SL2::mCherry,Pelt-2::mCherry 2] Larsch et al., 2015
HBR191 command neurons reporter Int[nmr-1p::SL1::GCaMP3.35::SL2::unc-54 3'UTR +UNC-119(+)] Schwarz and Bringmann, 2013

Training procedures

To induce olfactory associative memories, BUT was presented to the animals in combination with food (appetitive, positive conditioning) or in the absence of food (starvation, aversive conditioning). Associated mock-trained control groups underwent the same treatment without BUT presentation. Naive control animals were of the same age but not treated at all.

Short-term appetitive training

Animals were washed three times in M9 and then starved for one hour in 1 mL of M9 in a 15 mL centrifuge tube with an open lid. Worms were then trained on high-food NGM plates (seeded with 500 µL of confluent OP 50 culture) in the presence of 20x5 µL droplets of 10% (v/v in DDW) BUT applied to the inside face of the plate lid. The mock-trained group received 20x5 µL droplets of DDW. Training duration was 1 h (modified after Kauffman et al., 2010⁠).

Short-term aversive training

As previously described (Bargmann et al., 1993; Colbert and Bargmann, 1995), worms were washed three times in an M9 buffer and transferred onto chemotaxis plates (1.7% (w/v) Agar, 25 mM KH2PO4, 1 mM CaCl2, 1 mM MgSO4, pH 6.0, no food). The trained group was incubated for 90 min with 20x5 µL droplets of 10% (v/v in DDW) BUT, while the mock-trained group was incubated with an equivalent amount of DDW. Note that short-term paradigms differed by overall incubation time, plates used for incubation and one transfer step.

Long-term appetitive training

This training consisted of seven cycles in which BUT was paired with food, as described in Kauffman et al., 2010. Each repetition consisted of a 30-min starvation in M9 buffer and a 30-min food-BUT pairings, except for the first cycle, in which starvation lasted 1 hr. In contrast to all other training regimes, 5x2 µL droplets of 10% (v/v) were used in long-term appetitive training since initial calibration assays showed that higher levels of BUT led to an aversive choice behavior. Animals were imaged 14 hr post-training.

Long-term aversive training

Worms were washed three times in an M9 buffer and transferred to chemotaxis plates. The trained group was starved with 20x5 µL droplets of 10% (v/v) BUT on the lid for 10 hr, with one exchange of the BUT droplets after 5 hr. The mock-trained groups were starved in the presence of DDW droplets. Animals were imaged 14 hr post-training.

Behavioral assays

Worms were washed three times with a chemotaxis buffer, and 100–200 animals were transferred onto the center point of a chemotaxis plate, 3.5 cm from the target endpoints. Four-pole and 2-pole layouts were used as depicted in Figure 1—figure supplement 1A. Endpoints were loaded with BUT (BUT dissolved either in water or EtOH) or the alternative choice (DA in water or pure ethanol, see Figure 1—figure supplement 1A). Note that different concentrations of BUT were used for animals with appetitive and aversive training because of the valence-specific shift in choice behavior (Figure 1—figure supplement 2). Positively trained animals were tested with 10-fold diluted BUT (10–1) and negatively trained animals were tested with 1000-fold diluted BUT (10–3). Worms were immobilized once reaching the endpoints by applying 1 µL of 1 M NaN3 to those endpoint regions. Animals in each region were subsequently scored to provide the choice index. Learning index was calculated based on these choice indices as a measure of learning-induced behavioral changes (Kauffman et al., 2011).

To obtain locomotion parameters during chemotaxis, worms were imaged using a Micropublisher 5 RTV CCD camera (QImaging, Canada) equipped with a ZOOM 7000 Navitar macro objective (Navitar, New York, USA). Animal tracks were extracted using a multi-worm tracker (Itskovits et al., 2017)⁠, from which we quantified deviation angles, speed, and reversal frequencies. To control for BUT evaporation and to ensure behavioral consistency, only the first 10 min of the movies were analyzed. To provide higher accuracy of local deviation angles and speed, tracks were segmented into 24-frames segments. The deviation angle is defined as the angle between the vector pointing from the animal towards the endpoint and the average vector of the worm track segment (Figure 9B). Due to the use of the center-mass-tracking, reversals were defined as any perceptible form of backward movement (Gray et al., 2005).

Calcium imaging and data analyses

In preparation for live imaging, animals were starved for 20 min on empty NGM plates. For imaging multiple neurons, worms were also paralyzed using 10 mM levamisole dissolved in chemotaxis medium. The worms were then loaded into the microfluidic ‘olfactory chip’ (Chronis et al., 2007) and allowed to habituate for 10 min.

Neural responses to BUT (Figures 2 and 3) were recorded for 90 s: 30 s after the initiation of imaging, animals were presented with 33.5 mM BUT (diluted in chemotaxis medium, 3x10–3 dilution factor), and then imaged for an additional 60 s. After the animals were acclimated to the presence of BUT for 5 min, we re-initiated imaging, and after 30 s of imaging we switched the stimulus (BUT) off, and continued imaging for an additional 60 s. For imaging neurites of single interneurons, worms were not paralyzed. The stimulus exchange interval was 20 s and responses were recorded for 3 min without interruption (Figure 2B). Each BUT presentation/removal is referred to as a ‘trial’.

To record responses to alternating BUT (3.35 mM, 3x10–4 dilution factor) and DA (11.6 μM, 10–6 dilution factor) in Figures 4 and 5, animals were exposed to one minute of DA followed by six exchanges of BUT/DA, each step lasting 30 s. The exchange of BUT and DA was meant to mimic the conditions that the animals encountered during the two-choice assay. Note that in Figures 47, the BUT/DA exchanges are referred to as trials.

A Nikon A1R+confocal laser scanning microscope (Nikon, Japan) equipped with a 40x1.15 NA water immersion objective was used for fast live imaging. Z-series of the head region of the animal were recorded at 0.9–2 volumes per second. Individual z-stacks were scanned at 0.4–0.8 µm intervals (sampling rate 2–5 Hz) in the sensory-reporter lines (ZAS280 and ZAS323). Single sensory neurons were imaged with an IX 83 epifluorescence microscope (Olympus, Japan) and ahttps://www.olympus-lifescience.com/en/objectives/detail/0-DIRECTORY%3A%3ADirFrontend-itemId.511706522.html40x0.95 NA objective. The image acquisition was controlled by μManager (Edelstein et al., 2010).

To identify individual neurons in multi-neuron z-stack time series, neuronal somas were segmented using a Gaussian fitting and a tracking algorithm (Toyoshima et al., 2016) targeting nuclear mCherry tags. GCaMP intensities in target neurons were extracted from segmented neurons by a custom-built analysis pipeline (Pritz, 2022, GitHub) in Matlab (Mathworks, USA) reading voxels within a 70% radius of the initial segmentation radius. Image stacks from neurites were projected by summing all images using imageJ. Projected micrographs were analyzed using custom imageJ and Matlab scripts utilizing Fiji’s trackMate plugin (Tinevez et al., 2017)⁠. Since data were acquired with varying frame rates, neuronal activation plots were linearly interpolated to the highest frame rate in the dataset (2 Hz sampling rate for neurons read at the soma and 3 Hz (Figure 5) and 5 Hz (Figure 2B) for the neurite datasets).

Neural activation levels in sensory neurons were normalized by their ground state (F/FG), unless stated otherwise. In short recordings during BUT exposure (Figures 2 and 3), the ground state was extracted from the last 10 frames of the imaging after the neuron resumed its pre-exposure ground state. For interneurons, a 10-frame ground state was visually identified due to possible spontaneous activity (Figure 2B). For longer recordings in BUT/DA exchange experiments (Figures 4 and 5), the ground state was determined as the mean of intensity values lower than the 10% percent-quantile after smoothing activation vector by a 20-frame kernel size. Automatic and visual determination of ground states were found to be in good agreement.

Identification of individual neurons

Individual neurons within the pan-sensory reporter strain (Posm-6::GCaMP, ZAS280) were unambiguously identified using custom-built Matlab 3D visualization tools based on available anatomic maps (Durbin, 1987; White et al., 1986). Identification of AWCON, AWCOFF, and URX neurons was verified by comparing to activity profiles of these neurons as imaged from reporter strains with known cell identities (see Figure 2—figure supplements 3 and 4). Signals from the AFD neurons were too dim to provide reliable measurements, and hence, were discarded from all analyses.

Statistical analysis

Hypothesis testing of neuronal activation and behavior was carried out using MatLab and Python. For statistical comparisons, intensities following stimulus exchange were summed. Only neuronal intensity measurements within a 95% confidence interval were used for statistics. Integration times were neuron-specific since neuronal dynamics strongly varied among neurons. Data were tested for normal distribution by Shapiro-Wilk test (small sample number) or Kolmogorov-Smirnov test (larger sample number). ANOVA or ANOVA on ranks followed by pairwise comparisons based on t-tests or Wilcoxon rank-sum test/signed rank test, depending on the underlying distribution, were used to test for differences. Multiple comparisons were adjusted using false discovery rates (pFDR Storey, 2002). For comparing neuronal activation between the different learning paradigms within the BUT-exposure dataset, neurons with reliable activity responses were included in the analysis (namely, AWA, ASH, AWCON, AWCOFF, AWB, ASJ, ASI, ASK, RIAnrD, RIAnrV, RIAnrS, and AIA). Other neurons (ASE, ADL, ASG, and ADF) were excluded because of insufficient reads or cross-read artifacts. For each of these neurons, twelve pairwise comparisons of activity post-stimulus exchange were conducted as stated in Table 2, yielding 324 comparisons in total.

Table 2. pairwise comparisons of the different training conditions.

Comparisons design
Group 1 Group 2
STAP-T STAV-T
STAPM STAVM
STAP-T STAP-M
STAV-T STAV-M
STAPM NAIVE
STAVM NAIVE
STAP-T NAIVE
STAV-T NAIVE
STAPT LTAP-T
STAVT LTAV-T
LTAP-T LTAV-T
LTAPM LTAVM
LTAP-T LTAP-M
LTAV-T LTAV-M
LTAP-T NAIVE
LTAV-T NAIVE
LTAP-M NAIVE
LTAV-M NAIVE

STAP, Short-term appetitive. STAV, Short-term aversive. LTAP, Long-term appetitive, LTAV, Long-term aversive. T, Trained. M, Mock.

For comparing neuronal activation within the BUT/DA exchange dataset, 16 neuron classes were included (AWA, AWCON, AWCOFF, AWB, ASER, ASEL, ASJ, ASK, URX, ASH, ASI, AIY, AIA, RIAnrD/nrV/nrS, AVA, and AVE) applying the first eight comparisons in Table 2 yielding 248 comparisons. Significant experience-dependent changes in choice behavior were detected by one-sample t-tests (paired test) against zero.

Analyzing variability in sensory neuron responses

Neural activities in sensory neurons were categorized into ‘responding’ and ‘non-responding’ groups by applying a neuron-specific activity threshold. For the trial-to-trial variability, the neural activity had to cross the threshold once to be categorized as ‘responding’. For animal-to-animal variability, the neural activity had to cross the threshold twice during the six consecutive trials (BUT/DA exchanges).

Classification of memory conditions

Single or concatenated neural activities were binned into a 20-frame kernel and subsequently z-normalized. To perform classification based on trials, activities of all neurons for each animal and trial were concatenated and 60% of the data was used to train the algorithms, while the remaining 40% of the data was used to test the classification algorithms. To perform classification based on splitting trials within individuals, trials of each neuron were random-sampled into test and training, and then averaged to obtain one vector per animal as shown in Figure 4—figure supplement 7A. When cross-validating the results after splitting the data into training and test data based on animal repeats, we obtained similar results, although with higher classification error. Thus, classification accuracy could benefit from adding more animals per training group (see ‘between individuals’, Figure 4—figure supplement 7F). Classifications were performed using the scikit-learn package in Python using, if not stated otherwise, k-means nearest-neighbor based on distance to the next two data points. Random forest classification consisted of 500 trees and a neural net (MLPC) consisted of 2 layers, with 50 and 100 neurons each. The average macro F1 score out of 10 rounds of cross-validation has been used to measure the performance of the classification procedures on the tested data.

Regression analysis

AWA activities in a 15 s interval following stimulus exchange were regressed against AIY activity in the corresponding time interval using ordinary least squares (OLS) method to explain AIY activity by AWA activity within the same animal. As Generalized Least Squares with autoregressive models produced a less accurate fit, we used a simple OLS model to fit regression coefficients. To explain AIY activities by activities of sensory neurons, we used a multivariate regression model based on normalized activities within the 15 s following stimulus exchange. For the multivariate model, all neuronal activities were averaged across animals for each trial to make activities originating from different reporter strains comparable (Figure 6—figure supplement 1I). The resulting six averaged vectors for each neuron were used as inputs for the multivariate OLS models. Models were cross-validated for overfitting using a 50/50 data split and the variation of regression coefficient values across the different conditions was verified (see Figure 6—figure supplement 1F and G). Multivariate regression analysis could not be extended to AIA and RIA neurons because there were too many input neurons (regressors) opposed to too few data points.

PCA-based filtering of activity deltas

Neural activities were averaged across individuals for each trial. Activity deltas of averaged activities (see Figure 1—figure supplement 3) were calculated for the CS, US, and valence differences. All activity deltas for each comparison and trial were aligned in a single vector and subjected to PCA. Using the PC scores and loads from principal components 1, 2, 3, and 5 (out of 35 principal components), we reconstructed the original activity deltas while filtering out 39.1% of the unrelated variance (Figure 7C, see Figure 7—figure supplement 1A–C). The filtered activity deltas were then summed and normalized by the mean amplitude of the neuron (contributions of neurons with higher response amplitudes are weighted more). The mean of the six trials for each neuron was used to indicate increase or decrease in the activity, and the standard deviation to provide an estimate of the variance (Figure 7C). To validate the method, we simulated the data and subjected it to PCA-based filtering (Figure 7—figure supplement 1E–M), allowing us to differentiate between significant and insignificant changes using k-means-based thresholding of the activity changes (Figure 7—figure supplement 1N).

Acknowledgements

We thank the reviewers and the editors for the very helpful suggestions which eventually greatly improved the final version of this manuscript. We also thank Paul Sternberg in which lab we generated several of the strains used herein, and Cori Bargmann and Einav Gross for sharing strains. Some strains were provided by the CGC, which is funded by the NIH Office of Research Infrastructure Programs (P40 OD010440). Research in the AZ lab was supported by ERC (336803), ICORE (1902/12), and ISF (1300/17). COP postdoctoral fellowship was also supported by the David-Herzog-Funds at Styrian Universities. EB, RR, and EI were supported by the Jerusalem Brain Center. AZ is the Greenfield chair in Neurobiology.

Funding Statement

The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.

Contributor Information

Alon Zaslaver, Email: alonzas@mail.huji.ac.il.

Yuichi Iino, University of Tokyo, Japan.

Timothy E Behrens, University of Oxford, United Kingdom.

Funding Information

This paper was supported by the following grants:

  • European Research Council 336803 to Alon Zaslaver.

  • Israel Science Foundation 1300/17 to Alon Zaslaver.

  • Israeli Centers for Research Excellence 1902/12 to Alon Zaslaver.

  • David-Herzog-Funds at Styrian Universities to Christian Pritz.

Additional information

Competing interests

No competing interests declared.

No competing interests declared.

Author contributions

Conceptualization, Resources, Data curation, Software, Formal analysis, Validation, Investigation, Visualization, Methodology, Writing – original draft, Writing – review and editing.

Resources, Data curation, Software, Formal analysis, Validation, Investigation, Visualization, Methodology.

Resources, Data curation, Formal analysis, Investigation, Methodology, Writing – review and editing.

Resources, Data curation, Software, Formal analysis, Validation, Investigation, Methodology.

Validation, Investigation, Methodology.

Data curation, Formal analysis, Investigation.

Resources, Investigation, Methodology.

Conceptualization.

Conceptualization, Resources, Data curation, Supervision, Funding acquisition, Investigation, Visualization, Methodology, Writing – original draft, Project administration, Writing – review and editing.

Additional files

Transparent reporting form

Data availability

All neuronal activities and behavioral data sets together with the associated analyses scripts are available in https://osf.io/5v4qu/ and https://github.com/ChristianPritz/Principles-for-coding-associative-memories-in-a-compact-neural-network (copy archived at Pritz, 2022) respectively.

The following dataset was generated:

Pritz CO, Itskovits E, Bokman E, Ruach R, Gritsenko V, ‎Nelken T, Menasherof M, Azulay A, Zaslaver A. 2020. Principles for coding associative memories in a compact neural network. Open Science Framework. 5v4qu

References

  1. Adachi T, Kunitomo H, Tomioka M, Ohno H, Okochi Y, Mori I, Iino Y. Reversal of salt preference is directed by the insulin/PI3K and Gq/PKC signaling in Caenorhabditis elegans. Genetics. 2010;186:1309–1319. doi: 10.1534/genetics.110.119768. [DOI] [PMC free article] [PubMed] [Google Scholar]
  2. Åhs F, Miller SS, Gordon AR, Lundström JN. Aversive learning increases sensory detection sensitivity. Biological Psychology. 2013;92:135–141. doi: 10.1016/j.biopsycho.2012.11.004. [DOI] [PubMed] [Google Scholar]
  3. Amano H, Maruyama IN. Aversive olfactory learning and associative long-term memory in Caenorhabditis elegans. Learning & Memory. 2011;18:654–665. doi: 10.1101/lm.2224411. [DOI] [PMC free article] [PubMed] [Google Scholar]
  4. Appleby PA. A model of chemotaxis and associative learning in C. elegans. Biol Cybern. 2012;106:373–387. doi: 10.1007/s00422-012-0504-8. [DOI] [PubMed] [Google Scholar]
  5. Ardiel EL, Rankin CH. An elegant mind: Learning and memory in Caenorhabditis elegans. Learning & Memory. 2010;17:191–201. doi: 10.1101/lm.960510. [DOI] [PubMed] [Google Scholar]
  6. Asok A, Leroy F, Rayman JB, Kandel ER. Molecular mechanisms of the memory trace. Trends in Neurosciences. 2019;42:14–22. doi: 10.1016/j.tins.2018.10.005. [DOI] [PMC free article] [PubMed] [Google Scholar]
  7. Bargmann CI, Hartwieg E, Horvitz HR. Odorant-selective genes and neurons mediate olfaction in C. elegans. Cell. 1993;74:515–527. doi: 10.1016/0092-8674(93)80053-h. [DOI] [PubMed] [Google Scholar]
  8. Bilz F, Geurten BRH, Hancock CE, Widmann A, Fiala A. Visualization of a distributed synaptic memory code in the Drosophila brain. Neuron. 2020;106:963–976. doi: 10.1016/j.neuron.2020.03.010. [DOI] [PubMed] [Google Scholar]
  9. Chalasani SH, Kato S, Albrecht DR, Nakagawa T, Abbott LF, Bargmann CI. Neuropeptide feedback modifies odor-evoked dynamics in Caenorhabditis elegans olfactory neurons. Nature Neuroscience. 2010;13:615–621. doi: 10.1038/nn.2526. [DOI] [PMC free article] [PubMed] [Google Scholar]
  10. Chandra R, Farah F, Muñoz-Lobato F, Bokka A, Benedetti KL, Brueggemann C, Saifuddin F, Miller JM, Li J, Chang E, Varshney A, Jimenez V, Baradwaj A, Nassif C, Alladin S, Andersen K, Garcia AJ, Bi V, Nordquist SK, Dunn RL, Tokalenko K, Soohoo E, Garcia V, Kaur S, Harris M, Briseno F, Fung B, Bykov A, Guillen H, Byrd D, Odisho E, Tsujimoto B, Tran A, Duong A, Daigle KC, Paisner R, Zuazo CE, Churgin MA, Fang-Yen C, Bremer M, Kato S, L’Étoile ND, VanHoven MK. Sleep is required for odor exposure to consolidate memory and remodel olfactory synapses. bioRxiv. 2022 doi: 10.1101/2020.11.24.395228. [DOI] [PMC free article] [PubMed]
  11. Cho CE, Brueggemann C, L’Etoile ND, Bargmann CI. Parallel encoding of sensory history and behavioral preference during Caenorhabditis elegans olfactory learning. eLife. 2016;5:e14000. doi: 10.7554/eLife.14000. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Choi MK, Liu H, Wu T, Yang W, Zhang Y. NMDAR-mediated modulation of gap junction circuit regulates olfactory learning in C. elegans. Nature Communications. 2020;11:3467. doi: 10.1038/s41467-020-17218-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
  13. Chronis N, Zimmer M, Bargmann CI. Microfluidics for in vivo imaging of neuronal and behavioral activity in Caenorhabditis elegans. Nature Methods. 2007;4:727–731. doi: 10.1038/nmeth1075. [DOI] [PubMed] [Google Scholar]
  14. Colbert HA, Bargmann CI. Odorant-specific adaptation pathways generate olfactory plasticity in C. elegans. Neuron. 1995;14:803–812. doi: 10.1016/0896-6273(95)90224-4. [DOI] [PubMed] [Google Scholar]
  15. Cook SJ, Jarrell TA, Brittin CA, Wang Y, Bloniarz AE, Yakovlev MA, Nguyen KCQ, Tang LTH, Bayer EA, Duerr JS, Bülow HE, Hobert O, Hall DH, Emmons SW. Whole-animal connectomes of both Caenorhabditis elegans sexes. Nature. 2019;571:63–71. doi: 10.1038/s41586-019-1352-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
  16. Durbin RM. Studies on the development and organisation of the nervous system of Caenorhabditis elegans. Cambridge: King’s College; 1987. [Google Scholar]
  17. Edelstein A, Amodaj N, Hoover K, Vale R, Stuurman N. Computer control of microscopes using µmanager. Current Protocols in Molecular Biology. 2010;92:mb1420s92. doi: 10.1002/0471142727.mb1420s92. [DOI] [PMC free article] [PubMed] [Google Scholar]
  18. Eliezer Y, Deshe N, Hoch L, Iwanir S, Pritz CO, Zaslaver A. A memory circuit for coping with impending adversity. Current Biology. 2019;29:1573–1583. doi: 10.1016/j.cub.2019.03.059. [DOI] [PMC free article] [PubMed] [Google Scholar]
  19. Freytag V, Probst S, Hadziselimovic N, Boglari C, Hauser Y, Peter F, Gabor Fenyves B, Milnik A, Demougin P, Vukojevic V, de Quervain DJ-F, Papassotiropoulos A, Stetak A. Genome-wide temporal expression profiling in Caenorhabditis elegans identifies a core gene set related to long-term memory. The Journal of Neuroscience. 2017;37:6661–6672. doi: 10.1523/JNEUROSCI.3298-16.2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
  20. Gallagher T, Kim J, Oldenbroek M, Kerr R, You YJ. ASI regulates satiety quiescence in C. elegans. The Journal of Neuroscience. 2013;33:9716–9724. doi: 10.1523/JNEUROSCI.4493-12.2013. [DOI] [PMC free article] [PubMed] [Google Scholar]
  21. Garrity PA, Goodman MB, Samuel AD, Sengupta P. Running hot and cold: Behavioral strategies, neural circuits, and the molecular machinery for thermotaxis in C. elegans and Drosophila. Genes & Development. 2010;24:2365–2382. doi: 10.1101/gad.1953710. [DOI] [PMC free article] [PubMed] [Google Scholar]
  22. Gordus A, Pokala N, Levy S, Flavell SW, Bargmann CI. Feedback from network states generates variability in a probabilistic olfactory circuit. Cell. 2015;161:215–227. doi: 10.1016/j.cell.2015.02.018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  23. Gray JM, Hill JJ, Bargmann CI. A circuit for navigation in Caenorhabditis elegans. PNAS. 2005;102:3184–3191. doi: 10.1073/pnas.0409009101. [DOI] [PMC free article] [PubMed] [Google Scholar]
  24. Gross E, Soltesz Z, Oda S, Zelmanovich V, Abergel Z, de Bono M. GLOBIN-5-dependent O2 responses are regulated by PDL-1/prbp that targets prenylated soluble guanylate cyclases to dendritic endings. The Journal of Neuroscience. 2014;34:16726–16738. doi: 10.1523/JNEUROSCI.5368-13.2014. [DOI] [PMC free article] [PubMed] [Google Scholar]
  25. Hallinen KM, Dempsey R, Scholz M, Yu X, Linder A, Randi F, Sharma AK, Shaevitz JW, Leifer AM. Decoding locomotion from population neural activity in moving C. elegans. eLife. 2021;10:e66135. doi: 10.7554/eLife.66135. [DOI] [PMC free article] [PubMed] [Google Scholar]
  26. Hapiak V, Summers P, Ortega A, Law WJ, Stein A, Komuniecki R. Neuropeptides amplify and focus the monoaminergic inhibition of nociception in Caenorhabditis elegans. The Journal of Neuroscience. 2013;33:14107–14116. doi: 10.1523/JNEUROSCI.1324-13.2013. [DOI] [PMC free article] [PubMed] [Google Scholar]
  27. Hendricks M, Ha H, Maffey N, Zhang Y. Compartmentalized calcium dynamics in a C. elegans interneuron encode head movement. Nature. 2012;487:99–103. doi: 10.1038/nature11081. [DOI] [PMC free article] [PubMed] [Google Scholar]
  28. Hendricks M, Zhang Y. Complex RIA calcium dynamics and its function in navigational behavior. Worm. 2013;2:e25546. doi: 10.4161/worm.25546. [DOI] [PMC free article] [PubMed] [Google Scholar]
  29. Iino Y, Yoshida K. Parallel use of two behavioral mechanisms for chemotaxis in Caenorhabditis elegans. The Journal of Neuroscience. 2009;29:5370–5380. doi: 10.1523/JNEUROSCI.3633-08.2009. [DOI] [PMC free article] [PubMed] [Google Scholar]
  30. Itskovits E, Levine A, Cohen E, Zaslaver A. A multi-animal tracker for studying complex behaviors. BMC Biology. 2017;15:29. doi: 10.1186/s12915-017-0363-9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  31. Itskovits E, Ruach R, Kazakov A, Zaslaver A. Concerted pulsatile and graded neural dynamics enables efficient chemotaxis in C. elegans. Nature Communications. 2018;9:2866. doi: 10.1038/s41467-018-05151-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  32. Iwanir S, Ruach R, Itskovits E, Pritz CO, Bokman E, Zaslaver A. Irrational behavior in C. elegans arises from asymmetric modulatory effects within single sensory neurons. Nature Communications. 2019;10:3202. doi: 10.1038/s41467-019-11163-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  33. Jang MS, Toyoshima Y, Tomioka M, Kunitomo H, Iino Y. Multiple sensory neurons mediate starvation-dependent aversive navigation in Caenorhabditis elegans. PNAS. 2019;116:18673–18683. doi: 10.1073/pnas.1821716116. [DOI] [PMC free article] [PubMed] [Google Scholar]
  34. Jin X, Pokala N, Bargmann CI. Distinct circuits for the formation and retrieval of an imprinted olfactory memory. Cell. 2016;164:632–643. doi: 10.1016/j.cell.2016.01.007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  35. Jones SV, Choi DC, Davis M, Ressler KJ. Learning-Dependent structural plasticity in the adult olfactory pathway. The Journal of Neuroscience. 2008;28:13106–13111. doi: 10.1523/JNEUROSCI.4465-08.2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
  36. Josselyn SA, Tonegawa S. Memory engrams: Recalling the past and imagining the future. Science. 2020;367:eaaw4325. doi: 10.1126/science.aaw4325. [DOI] [PMC free article] [PubMed] [Google Scholar]
  37. Juang B-T, Gu C, Starnes L, Palladino F, Goga A, Kennedy S, L’Etoile ND. Endogenous nuclear RNAi mediates behavioral adaptation to odor. Cell. 2013;154:1010–1022. doi: 10.1016/j.cell.2013.08.006. [DOI] [PMC free article] [PubMed] [Google Scholar]
  38. Kato S, Xu Y, Cho CE, Abbott LF, Bargmann CI. Temporal responses of C. elegans chemosensory neurons are preserved in behavioral dynamics. Neuron. 2014;81:616–628. doi: 10.1016/j.neuron.2013.11.020. [DOI] [PMC free article] [PubMed] [Google Scholar]
  39. Kato S, Kaplan HS, Schrödel T, Skora S, Lindsay TH, Yemini E, Lockery S, Zimmer M. Global brain dynamics embed the motor command sequence of Caenorhabditis elegans. Cell. 2015;163:656–669. doi: 10.1016/j.cell.2015.09.034. [DOI] [PubMed] [Google Scholar]
  40. Kauffman AL, Ashraf JM, Corces-Zimmerman MR, Landis JN, Murphy CT, Dubnau J. Insulin signaling and dietary restriction differentially influence the decline of learning and memory with age. PLOS Biology. 2010;8:e1000372. doi: 10.1371/journal.pbio.1000372. [DOI] [PMC free article] [PubMed] [Google Scholar]
  41. Kauffman A, Parsons L, Stein G, Wills A, Kaletsky R, Murphy C. C. elegans positive butanone learning, short-term, and long-term associative memory assays. Journal of Visualized Experiments. 2011;11:2490. doi: 10.3791/2490. [DOI] [PMC free article] [PubMed] [Google Scholar]
  42. Lakhina V, Arey RN, Kaletsky R, Kauffman A, Stein G, Keyes W, Xu D, Murphy CT. Genome-Wide functional analysis of CREB/long-term memory-dependent transcription reveals distinct basal and memory gene expression programs. Neuron. 2015;85:330–345. doi: 10.1016/j.neuron.2014.12.029. [DOI] [PMC free article] [PubMed] [Google Scholar]
  43. Larsch J, Ventimiglia D, Bargmann CI, Albrecht DR. High-throughput imaging of neuronal activity in Caenorhabditis elegans. PNAS. 2013;110:E4266–E4273. doi: 10.1073/pnas.1318325110. [DOI] [PMC free article] [PubMed] [Google Scholar]
  44. Larsch J, Flavell SW, Liu Q, Gordus A, Albrecht DR, Bargmann CI. A circuit for gradient climbing in C. elegans chemotaxis. Cell Reports. 2015;12:1748–1760. doi: 10.1016/j.celrep.2015.08.032. [DOI] [PMC free article] [PubMed] [Google Scholar]
  45. Lee JB, Yonar A, Hallacy T, Shen CH, Milloz J, Srinivasan J, Kocabas A, Ramanathan S. A compressed sensing framework for efficient dissection of neural circuits. Nature Methods. 2019;16:126–133. doi: 10.1038/s41592-018-0233-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  46. Lemieux GA, Cunningham KA, Lin L, Mayer F, Werb Z, Ashrafi K. Kynurenic acid is a nutritional cue that enables behavioral plasticity. Cell. 2015;160:119–131. doi: 10.1016/j.cell.2014.12.028. [DOI] [PMC free article] [PubMed] [Google Scholar]
  47. Li Z, Liu J, Zheng M, Xu XZS. Encoding of both analog- and digital-like behavioral outputs by one C. elegans interneuron. Cell. 2014;159:751–765. doi: 10.1016/j.cell.2014.09.056. [DOI] [PMC free article] [PubMed] [Google Scholar]
  48. Liu X, Ramirez S, Pang PT, Puryear CB, Govindarajan A, Deisseroth K, Tonegawa S. Optogenetic stimulation of a hippocampal engram activates fear memory recall. Nature. 2012;484:381–385. doi: 10.1038/nature11028. [DOI] [PMC free article] [PubMed] [Google Scholar]
  49. Liu H, Wu T, Canales XG, Wu M, Choi MK, Duan F, Calarco JA, Zhang Y. Forgetting generates a novel state that is reactivatable. Science Advances. 2022;8:eabi9071. doi: 10.1126/sciadv.abi9071. [DOI] [PMC free article] [PubMed] [Google Scholar]
  50. Loy I, Carnero-Sierra S, Acebes F, Muñiz-Moreno J, Muñiz-Diez C, Sánchez-González JC. Where association ends A review of associative learning in invertebrates, plants and protista, and A reflection on its limits. Journal of Experimental Psychology. Animal Learning and Cognition. 2021;47:234–251. doi: 10.1037/xan0000306. [DOI] [PubMed] [Google Scholar]
  51. McGann JP. Associative learning and sensory neuroplasticity: How does it happen and what is it good for? Learning & Memory. 2015;22:567–576. doi: 10.1101/lm.039636.115. [DOI] [PMC free article] [PubMed] [Google Scholar]
  52. Morris JS, Friston KJ, Dolan RJ. Experience-dependent modulation of tonotopic neural responses in human auditory cortex. Proceedings. Biological Sciences. 1998;265:649–657. doi: 10.1098/rspb.1998.0343. [DOI] [PMC free article] [PubMed] [Google Scholar]
  53. Nguyen JP, Shipley FB, Linder AN, Plummer GS, Liu M, Setru SU, Shaevitz JW, Leifer AM. Whole-brain calcium imaging with cellular resolution in freely behaving Caenorhabditis elegans. PNAS. 2016;113:E1074–E1081. doi: 10.1073/pnas.1507110112. [DOI] [PMC free article] [PubMed] [Google Scholar]
  54. Oda S, Tomioka M, Iino Y. Neuronal plasticity regulated by the insulin-like signaling pathway underlies salt chemotaxis learning in Caenorhabditis elegans. Journal of Neurophysiology. 2011;106:301–308. doi: 10.1152/jn.01029.2010. [DOI] [PubMed] [Google Scholar]
  55. Ohl FW, Scheich H. Learning-Induced plasticity in animal and human auditory cortex. Current Opinion in Neurobiology. 2005;15:470–477. doi: 10.1016/j.conb.2005.07.002. [DOI] [PubMed] [Google Scholar]
  56. Ouellette MH, Desrochers MJ, Gheta I, Ramos R, Hendricks M. A gate-and-switch model for head orientation behaviors in Caenorhabditis elegans. ENeuro. 2018;5:ENEURO.0121-18.2018. doi: 10.1523/ENEURO.0121-18.2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  57. Pavlov IP. The work of the digestive glands. C. Griffin; 1910. [Google Scholar]
  58. Piggott BJ, Liu J, Feng Z, Wescott SA, Xu XZS. The neural circuits and synaptic mechanisms underlying motor initiation in C. elegans. Cell. 2011;147:922–933. doi: 10.1016/j.cell.2011.08.053. [DOI] [PMC free article] [PubMed] [Google Scholar]
  59. Pritz CO. Principles-for-coding-associative-memories-in-a-compact-neural-network. swh:1:rev:b4424514b58b49eb3efd9e02b600c1d3e045a779Software Heritage. 2022 doi: 10.7554/eLife.74434. https://archive.softwareheritage.org/swh:1:dir:d63d15f03d5b8671e4f1465fc38419359774b7f6;origin=https://github.com/ChristianPritz/Principles-for-coding-associative-memories-in-a-compact-neural-network;visit=swh:1:snp:4486c2dc49d73d5a52409815412e6668dc9075c5;anchor=swh:1:rev:b4424514b58b49eb3efd9e02b600c1d3e045a779 [DOI] [PMC free article] [PubMed]
  60. Rankin CH. Context conditioning in habituation in the nematode Caenorhabditis elegans. Behavioral Neuroscience. 2000;114:496–505. [PubMed] [Google Scholar]
  61. Roselli C, Ramaswami M, Boto T, Cervantes-Sandoval I. The making of long-lasting memories: a fruit fly perspective. Frontiers in Behavioral Neuroscience. 2021;15:662129. doi: 10.3389/fnbeh.2021.662129. [DOI] [PMC free article] [PubMed] [Google Scholar]
  62. Rothschild G. The transformation of multi-sensory experiences into memories during sleep. Neurobiology of Learning and Memory. 2019;160:58–66. doi: 10.1016/j.nlm.2018.03.019. [DOI] [PubMed] [Google Scholar]
  63. Sacco T, Sacchetti B. Role of secondary sensory cortices in emotional memory storage and retrieval in rats. Science. 2010;329:649–656. doi: 10.1126/science.1183165. [DOI] [PubMed] [Google Scholar]
  64. Sasakura H, Mori I. Behavioral plasticity, learning, and memory in C. elegans. Current Opinion in Neurobiology. 2013;23:92–99. doi: 10.1016/j.conb.2012.09.005. [DOI] [PubMed] [Google Scholar]
  65. Sato H, Kunitomo H, Fei X, Hashimoto K, Iino Y. Glutamate signaling from a single sensory neuron mediates experience-dependent bidirectional behavior in Caenorhabditis elegans. Cell Reports. 2021;35:109177. doi: 10.1016/j.celrep.2021.109177. [DOI] [PubMed] [Google Scholar]
  66. Schrödel T, Prevedel R, Aumayr K, Zimmer M, Vaziri A. Brain-Wide 3D imaging of neuronal activity in Caenorhabditis elegans with sculpted light. Nature Methods. 2013;10:1013–1020. doi: 10.1038/nmeth.2637. [DOI] [PubMed] [Google Scholar]
  67. Schwarz J, Bringmann H. Reduced sleep-like quiescence in both hyperactive and hypoactive mutants of the Galphaq gene egl-30 during lethargus in Caenorhabditis elegans. PLOS ONE. 2013;8:e75853. doi: 10.1371/journal.pone.0075853. [DOI] [PMC free article] [PubMed] [Google Scholar]
  68. Singh M, Lujan B, Renden R. Presynaptic gcamp expression decreases vesicle release probability at the calyx of held. Synapse. 2018;72:e22040. doi: 10.1002/syn.22040. [DOI] [PMC free article] [PubMed] [Google Scholar]
  69. Skora S, Mende F, Zimmer M. Energy scarcity promotes a brain-wide sleep state modulated by insulin signaling in C. elegans. Cell Reports. 2018;22:953–966. doi: 10.1016/j.celrep.2017.12.091. [DOI] [PMC free article] [PubMed] [Google Scholar]
  70. Steinmetz NA, Buetfering C, Lecoq J, Lee CR, Peters AJ, Jacobs EAK, Coen P, Ollerenshaw DR, Valley MT, de Vries SEJ, Garrett M, Zhuang J, Groblewski PA, Manavi S, Miles J, White C, Lee E, Griffin F, Larkin JD, Roll K, Cross S, Nguyen TV, Larsen R, Pendergraft J, Daigle T, Tasic B, Thompson CL, Waters J, Olsen S, Margolis DJ, Zeng H, Hausser M, Carandini M, Harris KD. Aberrant cortical activity in multiple gcamp6-expressing transgenic mouse lines. ENeuro. 2017;4:ENEURO.0207-17.2017. doi: 10.1523/ENEURO.0207-17.2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
  71. Storey JD. A direct approach to false discovery rates. Journal of the Royal Statistical Society. 2002;64:479–498. doi: 10.1111/1467-9868.00346. [DOI] [Google Scholar]
  72. Suzuki H, Thiele TR, Faumont S, Ezcurra M, Lockery SR, Schafer WR. Functional asymmetry in Caenorhabditis elegans taste neurons and its computational role in chemotaxis. Nature. 2008;454:114–117. doi: 10.1038/nature06927. [DOI] [PMC free article] [PubMed] [Google Scholar]
  73. Tinevez JY, Perry N, Schindelin J, Hoopes GM, Reynolds GD, Laplantine E, Bednarek SY, Shorte SL, Eliceiri KW. TrackMate: an open and extensible platform for single-particle tracking. Methods. 2017;115:80–90. doi: 10.1016/j.ymeth.2016.09.016. [DOI] [PubMed] [Google Scholar]
  74. Torayama I, Ishihara T, Katsura I. Caenorhabditis elegans integrates the signals of butanone and food to enhance chemotaxis to butanone. The Journal of Neuroscience. 2007;27:741–750. doi: 10.1523/JNEUROSCI.4312-06.2007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  75. Toyoshima Yu, Tokunaga T, Hirose O, Kanamori M, Teramoto T, Jang MS, Kuge S, Ishihara T, Yoshida R, Iino Y, Packer A. Accurate automatic detection of densely distributed cell nuclei in 3D space. PLOS Computational Biology. 2016;12:e1004970. doi: 10.1371/journal.pcbi.1004970. [DOI] [PMC free article] [PubMed] [Google Scholar]
  76. Toyoshima Y, Wu S, Kanamori M, Sato H, Jang MS, Oe S, Murakami Y, Teramoto T, Park C, Iwasaki Y, Ishihara T, Yoshida R, Iino Y. Neuron ID dataset facilitates neuronal annotation for whole-brain activity imaging of C. elegans. BMC Biology. 2020;18:30. doi: 10.1186/s12915-020-0745-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  77. Troemel ER, Kimmel BE, Bargmann CI. Reprogramming chemotaxis responses: sensory neurons define olfactory preferences in C. elegans. Cell. 1997;91:161–169. doi: 10.1016/s0092-8674(00)80399-2. [DOI] [PubMed] [Google Scholar]
  78. Venkatachalam V, Ji N, Wang X, Clark C, Mitchell JK, Klein M, Tabone CJ, Florman J, Ji H, Greenwood J, Chisholm AD, Srinivasan J, Alkema M, Zhen M, Samuel ADT. Pan-neuronal imaging in roaming Caenorhabditis elegans. PNAS. 2016;113:E1082–E1088. doi: 10.1073/pnas.1507109113. [DOI] [PMC free article] [PubMed] [Google Scholar]
  79. Wakabayashi T, Kitagawa I, Shingai R. Neurons regulating the duration of forward locomotion in Caenorhabditis elegans. Neuroscience Research. 2004;50:103–111. doi: 10.1016/j.neures.2004.06.005. [DOI] [PubMed] [Google Scholar]
  80. Watteyne J, Peymen K, Van der Auwera P, Borghgraef C, Vandewyer E, Van Damme S, Rutten I, Lammertyn J, Jelier R, Schoofs L, Beets I. Neuromedin U signaling regulates retrieval of learned salt avoidance in a C. elegans gustatory circuit. Nature Communications. 2020;11:2076. doi: 10.1038/s41467-020-15964-9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  81. Wen JYM, Kumar N, Morrison G, Rambaldini G, Runciman S, Rousseau J, van der Kooy D. Mutations that prevent associative learning in C. elegans. Behavioral Neuroscience. 1997;111:354–368. doi: 10.1037/0735-7044.111.2.354. [DOI] [PubMed] [Google Scholar]
  82. White JG, Southgate E, Thomson JN, Brenner S. The structure of the nervous system of the nematode Caenorhabditis elegans. Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences. 1986;314:1–340. doi: 10.1098/rstb.1986.0056. [DOI] [PubMed] [Google Scholar]
  83. Widmann A, Eichler K, Selcho M, Thum AS, Pauls D. Odor-taste learning in Drosophila larvae. Journal of Insect Physiology. 2018;106:47–54. doi: 10.1016/j.jinsphys.2017.08.004. [DOI] [PubMed] [Google Scholar]
  84. Witvliet D, Mulcahy B, Mitchell JK, Meirovitch Y, Berger DR, Wu Y, Liu Y, Koh WX, Parvathala R, Holmyard D, Schalek RL, Shavit N, Chisholm AD, Lichtman JW, Samuel ADT, Zhen M. Connectomes across development reveal principles of brain maturation. Nature. 2021;596:257–261. doi: 10.1038/s41586-021-03778-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  85. Yemini E, Lin A, Nejatbakhsh A, Varol E, Sun R, Mena GE, Samuel ADT, Paninski L, Venkatachalam V, Hobert O. NeuroPAL: a multicolor atlas for whole-brain neuronal identification in C. elegans. Cell. 2021;184:272–288. doi: 10.1016/j.cell.2020.12.012. [DOI] [PMC free article] [PubMed] [Google Scholar]
  86. Zaslaver A, Liani I, Shtangel O, Ginzburg S, Yee L, Sternberg PW. Hierarchical sparse coding in the sensory system of Caenorhabditis elegans. PNAS. 2015;112:1185–1189. doi: 10.1073/pnas.1423656112. [DOI] [PMC free article] [PubMed] [Google Scholar]

Editor's evaluation

Yuichi Iino 1

In this study, the authors established paradigms for appetitive and aversive short-term and long-term olfactory learning. They then produced a large collection of activity recordings in a handful of sensory neurons and interneurons, produced a linear model to describe sensory-evoked interneuron activities, and observed changes in the activities caused by learning. Although more work is needed to explain how these activity patterns relate to behavior, the collection of data provides hypotheses for future studies on the function of the neurons implicated in the learning paradigms and provides useful references for similar studies in the field.

Decision letter

Editor: Yuichi Iino1

In the interests of transparency, eLife publishes the most substantive revision requests and the accompanying author responses.

Decision letter after peer review:

[Editors’ note: the authors submitted for reconsideration following the decision after peer review. What follows is the decision letter after the first round of review.]

Thank you for submitting your work entitled "Principles for coding associative memories in a compact neural network" for consideration by eLife. Your article has been reviewed by 2 peer reviewers, and the evaluation has been overseen by a Reviewing Editor and a Senior Editor. The reviewers have opted to remain anonymous.

Our decision has been reached after consultation between the reviewers. Based on these discussions and the individual reviews below, we regret to inform you that your work will not be considered further for publication in eLife.

We appreciate the newly developed paradigm of associative learning which can assess both appetitive and aversive learning as well as both short and long-term memory. Authors further went on to perform calcium imaging of multiple neurons simultaneously, and determined the odor response of these neurons before and after each of the four combinations of conditioning. This is a tremendous work, which is truly admirable. However, unfortunately, many of the results are not readily interpretable and there are multitude of apparent inconsistency in view of the authors' conclusions as described in the reviewers' comments. Although we cannot continue the review process further at this time so that authors can submit their results to another journal, if authors decide in the future that above concerns are eliminated with additional experiments, we will be happy to receive a new submission.

Reviewer #1 (General assessment and major comments (Required)):

In this study Pritz et al., expand the behavioral paradigm for of short- and long-term memory of appetitive and aversive odorant responses. This assay alone is a nice contribution to the field of learning and memory in C. elegans, as these four degrees of freedom can be specifically switched, while leaving other conditions constant. The authors then underwent a calcium imaging tour de force applying multi-neuron imaging to search for underlying memory traces in neuronal activity. They examine how the responses of neurons are modulated by the memory conditions, at different stages of sensory-motor flow, i.e. including the primary sensory neurons, interneurons and motor-command neurons. They find that the short-term memory conditions mainly modulate the response of the sensory neurons, while long term memory modulates the response of interneurons. A basic claim of this paper, therefore is that short- and long-term memory segregate at the circuit level, which is a very interesting result. Finally, the authors analyze how behavioral parameters such as turning, and reversal rates are modulated by the different memory paradigms.

Comments:

1. Unfortunately, while the authors indeed find memory traces in neuronal activity of some neurons, these results do not fall into place to allow for a clear comprehensive model how these changes in neuronal activity relate to the underlying changes in behavior.

I) AWC-ON neurons seem sensitized to odor-off stimulus both upon STAP and STAV, this is interesting but cannot explain any of the changes in behavior.

II) AWA activity to odor-on is not significantly different to the respective MOCK conditions, so I don't think one should conclude anything from the small effect sizes reported here only for STAP vs STAV and STAV vs naïve. I am not convinced of the authors' statement AWA would encode valence.

III) ASH is sensitized to odor-off specifically upon STAV. This is also interesting on its own. However, ASH is a well characterized nociceptive neuron, but odor-off upon STAV should be a favorable condition.

IV) AIA activity has been assigned to attractive odorant responses (Larsch, 2015; Dobosiewicz, 2019), which is inconsistent with enhanced responses upon STAV/LTAV. According to Figure S13 its baseline seems up-regulated rather than the response. I don't see reason for the authors' interpretation that AIA activity encodes valence.

V) Also RIA imaging seems not to reveal a clear picture what its role might be. The individual traces contain very variable interesting fluctuations making interpretation of mean traces difficult. To correctly interpret activity in RIA nrV or nrV one would need to know the head-bending position or head motor neuron activity (Hendricks, 2012 and Liu, 2018).

VI) Moreover, it is unclear from which neurons AIA and the RIAnrS domain receive their respective inputs under the various conditions. There is no consistent picture emerging, when comparting to the sensory neuron responses. Which sensory-to-interneuron communications change in the various conditions?

VII) Why were AIY and AIZ not imaged, which are major targets of AWC and AWA? Despite the comprehensive sensory neuron imaging, there are obvious gaps with respect to interneurons.

Altogether, this is very confusing, and it is questionable whether any of the significant activity changes allow interpretation of how stimulus, conditioning, valence, behavioral response LTM or STM are separately encoded. Although I highly appreciate the authors' efforts in comprehensive imaging, at the current state the study presents scattered results that don't fit into an intuitively understandable circuit model.

2. One possible source for the difficulty to assemble a coherent picture may stem from the different exposures to butanone used in the different assays used in this study. For example, the inability of the multiworm tracker assay (Figure 4) to recapitulate the appetitive memory shown in the chemotaxis assays (Figure 1) may stem from the absence of diacetyl as a competitor odor (or ethanol background), or from the difference in the concentration of the butanone. The authors acknowledge the different results from the two behavioral assays (Page 17), but they do not provide an explanation the different outcomes. Similarly, the calcium imaging experiments were also conducted without diacetyl, and with higher concentration of butanone. It is possible that the response of AWA to diacetyl is modulated by the butanone learning paradigm (perhaps as part of the requirement of AWA to the butanone memory, Figure S12). I therefore wonder whether calcium imaging experiments should have been performed for switches between butanone and diacetyl; same for the behavioral analyses in Figure 4, this would have been more informative had the authors included diacetyl.

3. Regarding the interpretation of the AWC-ablation results (Page 10 and Figure S12A-B). The AWC neurons (and specifically AWC-ON neurons) are required for chemotaxis towards butanone (Bargmann 1993, Wes 2001, Tsunozak, 2008) and are commonly cited as such in the literature. One therefore cannot easily untangle the role of the AWC neurons in butanone memory from their more basic role in butanone sensation (and chemotaxis). As also seen in Figure S12, the AWC ablated animals do not show chemotaxis towards butanone (while they do show some surprising aversion). Therefore, the claim that the AWC neurons are required for appetitive memory cannot be easily justified. In addition, Torayama et al., (2007, dio:doi.org/10.1523/JNEUROSCI.4312-06.2007) demonstrated that the AWC-OFF neuron is sufficient for chemotaxis towards butanone and that the AWC-ON neuron is also required for appetite memory of butanone. This work should be cited and the claims for the requirement for AWC neurons for memory should be clarified. The finding that the AWC-OFF neuron can also react to butanone, corroborates the behavioral data from Torayama, et al., J Neuroscience (2007) and can be discussed in text.

4. All interneuron imaging data lack the essential buffer-buffer switch controls.

5. The AVA activity (Figure S14), which can be assigned to fictive reversal behaviors, shows reduction upon both odor ON and OFF, in all conditions. Data in Figure 4E-F suggest that reversal modulation is implicated in STAV and LTAV. I therefore conclude that this cannot be recapitulated in chip imaging conditions. Did the authors perform enough repetitions? I fear that AVA just responds to switches in the microfluidic chip, but the essential buffer-buffer switch control is missing.

6. Regarding Figure 4E, the number of reversals per cm is calculated instead of the probability reversal per worm at this area. The former calculation should be made to normalize to the number of worms reaching this area in the agar plate.

Reviewer #2 (General assessment and major comments (Required)):

The manuscript reports the experiments and the results that aim to identify the principles used by C. elegans nervous system to encode associative memories. The study analyzes 4 types of associative learning, namely S/LTAV and S/LTAP, side-by-side in behavioral strategies and neural activities. The experimental design helps to identify unique behavioral and activity patterns associated with each type of memories. The results from this systematic analysis provide a large dataset that is informative for understanding sensory encoding and plasticity. Based on these results, the authors propose that sensory neurons have central roles in memory formation. The manuscript will benefit from addressing several questions in results, data analysis and interpretation.

1. In methods for imaging, the authors describe that "the animals were starved for 20 minutes on empty NGM plates. For imaging multiple neurons, worms were also paralyzed using 10 mM levamisole dissolved in chemotaxis medium. The worms were habituated to the restraint and paralysis for additional 10 minutes within the chip." The worms were starved 20-30 minutes before the imaging experiments. This treatment is important for interpreting imaging results because worms change reversal rates after being on an empty plate for 30 minutes, likely due to changes in the activity of the neurons that regulate reversals. The authors should describe this condition in "Results" and integrate this condition when interpreting and discussing the results.

2. The imaging experiments on sensory neurons and interneurons are done mostly using worms that express calcium indicators in many neurons. The validation of the cell identities needs to be shown.

3. The authors report increased activity in AWC for STAV and STAP. Because STAV and STAP generate opposite effects on chemotaxis to Butanone, the function of these AWC results on chemotaxis behavior need to be better clarified.

4. In addition, Cho et al. ELife 2016 reports that conditioning worms similarly as STAV in this paper decreases AWC activity. The difference in this result and the one reported in the manuscript warrants some discussion.

5. The author tested the function of AWC and AWA in learning using cell ablation. Because loss of sensory neurons can impair both sensing and learning, the interpretation of the results need to include these possibilities.

6. ASH shows increased activity after STAV. But ablating ASH does not change STAV learning ability. These results suggest that the increased ASH activity does not regulate STAV. The possibility needs to be included in the discussion of these results.

7. Figure 4 reports significant changes in speed and reversal rates after STAV and LTAV. However, none of the interneurons that are known to regulate speed or reversals shows any significant activity change. These results need to be carefully discussed.

8. Increased activity in AIA after LTAV predicts decreased reversals (Larsch et al. Cell Rep 2015). It does not explain increased reversal rate observed in chemotaxis observed in LTAV. In addition, increased RIAnrs predicts increased curving towards an attractant (Liu et al. Neuron 2018). It does not explain increased reversal rate and increased deviation in LTAV. One possibility is that S/LTAV generate changes in interneurons that regulate reversals (AIY, AIB, AVA, RIM etc) in a distributed manner. Although none of these interneurons shows a detectable change, their collective activity changes produce increased reversal rate. In addition, after LTAV, reversal rate increases for about 2 fold, but deviation only increases a fraction of the mock level. It is likely that increased reversal contributes to the increased deviation in chemotaxis. The author should include these possibilities in discussion.

9. Lemieux et al. Cell 2015 reports an increase in AVA activity after 1-2 hour starvation. The difference in this result and the results on AVA in this study warrants some discussion.

[Editors’ note: further revisions were suggested prior to acceptance, as described below.]

Thank you for submitting your article "Principles for coding associative memories in a compact neural network" for consideration by eLife. Your article has been reviewed by 3 peer reviewers, and the evaluation has been overseen by a Reviewing Editor and Ronald Calabrese as the Senior Editor. The reviewers have opted to remain anonymous.

The reviewers have discussed their reviews with one another, and the Reviewing Editor has drafted this to help you prepare a revised submission.

The resubmitted manuscript was assessed by three reviewers, whose review comments follow. All reviewers appreciate the large amount of efforts put to obtain additional data. On the other hand, each reviewer points out interpretation and presentation problems. Considering this, I need to call for a revision of the manuscript, including additional data analysis and statistical tests. If authors decide to revise the manuscript as recommended, the revised manuscript will be re-assessed by the reviewers. Please note that reviewer#1 is identical to reviewer#2 in the previous submission, and reviewer #4 is identical to reviewer#1 in the previous submission, while reviwer#3 was newly recruited.

As described by authors in Figure 1 and Supplementary figures 3, behavioral and neuronal activity changes caused by learning paradigms could be categorized to stimulus-specific (caused by CS), treatment-specific (caused by US) and training-specific (caused by CS and US), and each of these changes could occur in either of appetitive training, aversive training or both, in the same of opposite directions. On the other hand, in describing neuronal activities, only "stimulus code" and "valence code" are evaluated. This is causing considerable confusion and need to be amended.

Also, presentation and evaluation of regression analysis and methods for evaluation of RIA activities need to be reconsidered. In these and other aspects pointed out by the reviewers, authors need to improve the presentation to efficiently and thoroughly convey the results, because the whole dataset is valuable to the readers in the field.

Reviewer #1 (Recommendations for the authors):

The revised manuscript has improved significantly.

First, the newly added calcium imaging experiments on sensory neurons and interneurons in response to BUT and DA helped to interrogate neural activities in a condition more comparable to the chemotaxis assay conditions. These analyses help to interpret potential function of the observed neural activities under the naive and training conditions.

Second, they found that a linear combination of presynaptic sensory activities explained the postsynaptic interneuron activities to various degrees. This analysis helped with a coherent understanding of a large amount of imaging results by showing potential flows of neural signaling.

Finally, they also performed detailed behavioral analysis on chemotaxis. The results examined multiple parameters (speed, reversal, direction) and the authors aimed to make a connection between the behavioral results and the imaging results. This is an informative addition. However, some clarifications are needed for their interpretation of the results "We did not observe behaviorally relevant differences in the animal's speed nor in t heir reversal frequency (though p values indicated significance, Figure 7E-H)." If they did not use the statistical test results to interpret the data, it will be useful to clarify how they drew the conclusions.

The revised manuscript has improved significantly.

First, the newly added calcium imaging experiments on sensory neurons and interneurons in response to BUT and DA helped to interrogate neural activities in a condition more comparable to the chemotaxis assay conditions. These analyses help to interpret potential function of the observed neural activities under the naive and training conditions.

Second, they found that a linear combination of presynaptic sensory activities explained the postsynaptic interneuron activities to various degrees. This analysis helped with a coherent understanding of a large amount of imaging results by showing potential flows of neural signaling.

Finally, they also performed detailed behavioral analysis on chemotaxis. The results examined multiple parameters (speed, reversal, direction) and the authors aimed to make a connection between the behavioral results and the imaging results. This is an informative addition.

However, some clarifications are needed for their interpretation of the results "We did not observe behaviorally relevant differences in the animal's speed nor in their reversal frequency (though p values indicated significance, Figure 7E-H)." If they did not use the statistical test results to interpret the data, it will be useful to clarify how they drew the conclusions.

Also, RIA synchronized calcium events were calculated as events in which both axon domains have time derivatives that were positive (influx) or negative (eflux) (Jin et al. 2016; Hendricks et al. 2012). In Jin et al., the authors used > 0.005 (% per second) or < – 0.005 (% per second) as a threshold. As the authors showed in Figure S6, it is not clear whether the shaded areas were synchronized events.

Reviewer #3 (Recommendations for the authors):

In this manuscript, authors established learning paradigm that realizes both appetitive and aversive learning and both short-term and long-term memory using the same CS, butanone. By using this type of learning, they made systematic analyses of learning-dependent changes in neuronal activity including many sensory neurons and several core interneurons. Upon revision, they added buffer control and added AIY interneurons. Also, addition of switching between butanone and another odorant diacetyl, as a control odorant, causes the results more interpretable. Now it has a total of 30 supplementary figures, which is remarkable. The relationship between the neuronal activity and behavior is still unclear, and authors claim that attraction and aversion behaviors may be regulated by polulation coding, which might be true. The major contribution of the study is a comprehensive analysis of sensory neuron responses to odorant which clearly changed by short-term training, and a set of interneurons, whose activities change by both short and long-term training. These data are informative for the community. Upon revision, authors also show that activity of interneurons can be explained by linear combination of sensory neuron activities.

However, in Figure 6 and other parts of the manuscript, authors use the word "trial-averaged activities". This is misleading because this word is commonly used for averaging across trials rather than averaging across animals for each trial (repeat of stimulus according to authors' definition of "trial"). It needs to be reworded. The averaging treatment is explained in Figure S27F, but this figure is not easy to understand, partly because only trial 1 is labelled even though two trials are shown in the drawings.

Reviewer #4 (Recommendations for the authors):

The authors made extensive efforts in addressing all my previous comments. The present manuscript is a tour de force through an impressive amount of non-trivial experiments. The new paper better highlights some very interesting aspects of their findings, like the distributed nature of memory components and of how sensory information is passed to the first layer of sensory interneurons. Still, I have some troubles in following the authors' heuristics in how they interpret the various experimental conditions. Further, the paper needs some improvements in the applied statistics.

1) Comparing trained animals with their respective matched MOCK conditions is a crucial control for a specific memory trace in a neuronal activity pattern. However, across other conditions the authors applied very different procedures to the worms where many experimental variables were changed, like repeated wash and transfer cycles, etc. In many cases these procedures caused strong effects on neuronal activity i.e. significant differences in MOCK-trained vs naïve (e.g., Figure 4F), hence the neuronal responses are modulated by starvation or procedure associated stress. When various MOCK conditions give different results, one cannot conclude from differences in the respective training conditions that the neuron is encoding valence. For example Figure 4I,J,K: the most obvious difference in AWCon between STAV and STAP is coming from the differences in MOCK vs MOCK, while STAV and STAP cause tiny and equal changes relative to their MOCK traces, hence AWCon is mainly modulated by the US (procedure) but does not represent valence.

Altogether, the resulting picture is still vastly confusing; the authors frequently conclude that certain neuronal activity changes "code" for various task parameters, but this is not really shown i.e., simply showing correlates of memory traces is not sufficient to make these statements. Moreover, It will be extremely challenging for the reader to navigate through the forest of > 30 Figures. I find it unsatisfactory that the authors main response to this is, in other words, – memory components are encoded in a distributed but in a somewhat unexplainable way-. The authors should make an effort to address this. I would suggest to revise Figure 4 (and Figure 3) to include all MOCK vs MOCK and MOCK vs naïve, also the sign of the δ values should be depicted, as well the significance levels of each matrix entry should be depicted on top of each square (not just labeling the neurons yellow). This would give a better overview. Then use this data matrix to train a classifier and test whether the task parameters, CS, US ( = the 2-4 different procedures), positive- and negative valence can be indeed decoded, and along which dimensions the major coding axes reside.

2) There are many instances where the authors applied repeated stimulus sequences leading to an inflation of datapoints, which are treated by the respective statistical tests as independent measures. This is incorrect and I fear many of the seemingly statistically significant results could fade-away when properly tested for. In all cases where the authors applied repeated stimuli mean responses per animal should be calculated so that each datapoint corresponds to one animal. In all figure captions n numbers must be indicated.

3) I find the results of the regression analysis quite interesting but unfortunately the authors did not control for overfitting, a frequent pitfall in regression procedures particularly when multi-parameter models are used. The authors should devise a cross-validation procedure and report R2 values for held-out test data.

4) AWCon and AWCoff in the multi-neuron recordings were classified based on high/low responses in MOCK, a classifier that was empirically inferred from imaging experiments performed in a marker line. This classifier seems unambiguous in STAP MOCK only, but how were AWCon and AWCoff classified in the multi-neuron experiments in all other conditions"?

5) AWC and AWA (Figure S21, S7E-L) show different results in different imaging lines. I think the authors do not provide a convincing explanation for this.

[Editors’ note: further revisions were suggested prior to acceptance, as described below.]

Thank you for resubmitting your work entitled "Principles for coding associative memories in a compact neural network" for further consideration by eLife. Your revised article has been evaluated by Timothy Behrens (Senior Editor) and a Reviewing Editor.

The manuscript has been improved and all reviewers are very enthusiastic about having the revised paper published in eLife, but there are some remaining issues that need to be addressed, as outlined below:

Please consider suggestions by Reviewer #1 on AIY activity and similar changes in AP and AV paradigms. Also, please consider suggestions (1) – (4) by Reviewer #3. We look forward to the revised version rather soon.

Reviewer #1 (Recommendations for the authors):

The revised manuscript has further improved by addressing concerns raised in previous reviews.

More specifically, the authors have further analyzed their data by focusing on paradigm-specific activity of sensory neurons in response to BUT – DA stimulation patterns. This focus allowed them to see more robust effects generated by different types of experience to better support the data interpretation. Their interpretation also improved and are now more supported by the results.

Their focus on using the linear combination of presynaptic sensory activities to explain AIY activity is appropriate given the sample size and variabilities of their imaging results across animals and across trials. It is informative to see that AIY activity can be explained by those of anatomically connected sensory neurons. It is worth noting that AIY activity is best explained by the activities of sensory neurons under mock conditions. This might suggest the role of these neurons in responding to the US experience, not necessarily the association of CS with US.

The principal component analysis in Figure 7 and supplementary figures is an improvement on data analysis and useful in dissecting complex neural responses in a large number of different imaging conditions implemented in this study.

Another clear feature of the neurons characterized here is that they seem to show similar patterns of activity changes in AP and AV paradigms (for example, as shown in Figure 5 for sensory neurons AWA, interneuron AIY and AIA; for AWC in Figure 3; for RIA in response to DA-BUT stimulation pattern). Although AP and AV paradigms showed different effects on RIA in response to control-BUT stimulation, it is not clear how the changes relate to chemotaxis behavior. The authors speculate this feature as one indicator for combinatorial effects. This is possible but remains to be tested in future studies.

When analyzing locomotion in chemotaxis, the revised study removed the results on long-term training and focused on short-term training. The results are easier to be understood than before. The short-term training paradigms modulated the directionality toward the CS, but not the speed and reversal frequency.

As a whole, the study produced a large collection of activity recordings in a handful of sensory neurons and a few interneurons with the goal to explain chemotaxis behaviors under 4 learning paradigms. Although more work is needed to explain how these activity patterns relate to behavior, the collection of data provides hypotheses for future studies on function of the neurons implicated in the learning paradigms based on calcium imaging results and provide useful references for similar studies in the field.

Reviewer #3 (Recommendations for the authors):

Upon revision, authors made a good job to improve the quality and readability of the manuscript. Additional evaluation of data was performed such as cross validation of linear regression and classification models, which adequately evaluates authors' assertions and strengthen them.

The concern by reviewer #3 was appropriately addressed, with the exception of the following.

This reviewer recommends publication of the paper because it is a comprehensive analysis which adds precious information to the research community, provided that the presentation flaws as listed below are corrected.

1) As previously pointed out, definition of "trials" needs to be explicitly provided. It is understandable that reflecting the revision history, there are several different protocols for the imaging experiments. For this reason, authors need to carefully try to avoid confusion for the readers. In the current version, the figure depicting "trials" appear in Figure 6—figure supplement 1I, while the word first appears in the text in line 255 where authors say "most animals (or trials) showed homogeneous responses", and here, readers may be puzzled. In Methods, there is also no such word, though it is described that repeated stimuli were applied in experiments in Figure 2B and Figures4-5.

2) p23, page 581: related to the previous comment by reviewer #1 (third in Major point), there is not enough basis provided in this paper that leads to the conclusion that head swing control (klinotaxis which RIA has been implicated) is the major mechanism that causes learning-dependent modulation of chemotaxis. The other major mechanism known, klinokinesis, involves changes in the turning frequency DEPENDING ON chemical concentration changes, where animals backup and turn more frequently when facing away from the odor source and odor concentration decreases upon its locomotion. It would also cause the deviation angle smaller.

3) p19, line466 and later: It is convincing that AIY changes its activity after LTAV training in DA-BUT imaging experiments. On the other hand, changes in RIA are not convincing. Figure 5G,H, RIA response is suggested to be increased, but it looks like the conclusion is based on two outlier animals. Also in Figure 3—figure supplement 4K/L, RIA activity looks increased even without BUT stimulus. Therefore, long-term changes in RIA activity needs to be toned down, at least in the discussion (where RIA is so heavily discussed in the current version). As authors depicted in Figure 9B, it is clear through the extensive data by the authors on sensory neurons that there are virtually no changes in the sensory neuron responses after long-term memory, but the behaviors change. As a logical consequence, interneuron activities need to be changing. However, observed changes are limited to AIY LTAV so far, and therefore hitherto unobserved changes may underlie the behavioral changes, for example that of AIB or any other neurons in the circuit.

4) p18 line 450: It is misleading to suggest sensory neurons are not involved in long-term memory. Authors only looked at calcium level in sensory neurons. However, there are multiple cases known in C. elegans and other animals where synaptic output machinery is modulated by learning, which is not reflected in calcium imaging of the sensory neurons; rather, it will be reflected in the response of downstream interneurons.

5) It is a bit of a concern that in cross validation in Figure 4—figure supplement 7A, authors used all individual animals for training the model, especially given that any single neuron can be a predictor, which suggests overfitting. However, revisions are not requested on this as per the principle of the journal.

eLife. 2023 May 4;12:e74434. doi: 10.7554/eLife.74434.sa2

Author response


[Editors’ note: the authors resubmitted a revised version of the paper for consideration. What follows is the authors’ response to the first round of review.]

We appreciate the newly developed paradigm of associative learning which can assess both appetitive and aversive learning as well as both short and long-term memory. Authors further went on to perform calcium imaging of multiple neurons simultaneously, and determined the odor response of these neurons before and after each of the four combinations of conditioning. This is a tremendous work, which is truly admirable. However, unfortunately, many of the results are not readily interpretable and there are multitude of apparent inconsistency in view of the authors' conclusions as described in the reviewers' comments. Although we cannot continue the review process further at this time so that authors can submit their results to another journal, if authors decide in the future that above concerns are eliminated with additional experiments, we will be happy to receive a new submission.

  • We have added experimental data for the AIY neuron which is a major interneuron downstream of the chemosensory neurons, and added the missing buffer controls for the inter- and command-neurons (per the reviewer’s request).

  • The first version of the MS highlighted only ASI as a variable neuron. With the extended newly added dataset, we now provide a comprehensive analysis for all chemosensory neurons.

  • The newly collected data also allowed us to introduce new analyses where we show that interneurons' activity can be explained using a linear combination of the distributed memory coded in the sensory neurons. Moreover, we show that the relative contribution of the sensory neurons is modulated in an experience-dependent manner.

Overall, we have now added 4 new figures to the main text and 15 supplementary figures. In the following, we address each of the points raised and specify the changes made in the manuscript.

Reviewer #1 (General assessment and major comments (Required)):

In this study Pritz et al., expand the behavioral paradigm for of short- and long-term memory of appetitive and aversive odorant responses. This assay alone is a nice contribution to the field of learning and memory in C. elegans, as these four degrees of freedom can be specifically switched, while leaving other conditions constant. The authors then underwent a calcium imaging tour de force applying multi-neuron imaging to search for underlying memory traces in neuronal activity. They examine how the responses of neurons are modulated by the memory conditions, at different stages of sensory-motor flow, i.e. including the primary sensory neurons, interneurons and motor-command neurons. They find that the short-term memory conditions mainly modulate the response of the sensory neurons, while long term memory modulates the response of interneurons. A basic claim of this paper, therefore is that short- and long-term memory segregate at the circuit level, which is a very interesting result. Finally, the authors analyze how behavioral parameters such as turning, and reversal rates are modulated by the different memory paradigms.

Comments:

1. Unfortunately, while the authors indeed find memory traces in neuronal activity of some neurons, these results do not fall into place to allow for a clear comprehensive model how these changes in neuronal activity relate to the underlying changes in behavior.

We followed the suggestions provided below which greatly helped us to better understand the plasticity within individual neurons and their collective impact on behavioral changes. For this, we have now added a substantial amount of new data to match the behavioral assays with imaging conditions. These included re-imaging all neurons and repeating the behavioral assays (in short-term paradigms) while adding diacetyl as an alternative choice and using a higher concentration of butanone. Herein, we list the major changes to the manuscript which are relevant to all comments. We also provide a detailed answer for each of the points that follow.

  • Based on the original and the newly-added data we conclude that short-term memory components are distributed across the sensory neurons, and that it is virtually impossible to relate a modulated activity of a single sensory neuron to a concrete behavioral output. Short-term experiences change the sensitivity of many sensory neurons, and some neurons code both the experienced valence and the stimulus components of the memory together. It is therefore the integrative activity of the sensory neurons that expresses the adaptive response. Based on this strong experimental evidence, we now formulate these statements as part the new MS version conclusions.

  • Regarding the activity of interneurons, we now show in detail how the modulated activity in sensory neurons can explain the activity of the downstream interneurons (AIY and AIA, RIA). In fact, interneuron activity is a linear combination of the sensory neurons activities, which intriguingly, change across the different training paradigms.

  • Concerning locomotion parameters, we now observe behaviorally meaningful differences in the deviation angle (weathervaning behavior) which can be related to the changes observed in the RIA neurons. We no longer observe changes in reversals freq. and locomotion speed which were inconsistent with neuronal activities.

  • Concerning long-term training paradigms, we refrain from making behavioral interpretations based on interneuron activities, as these, indeed, don't allow such inferences. We now only state how training-specific paradigms modulate the activity of individual interneurons, and that it is presumably their complex integrative activity that gives rise to the behavioral outputs.

Below we provide a detailed point-by-point response for each neuron in light of the new data.

I) AWC-ON neurons seem sensitized to odor-off stimulus both upon STAP and STAV, this is interesting but cannot explain any of the changes in behavior.

We agree. As explained in the general remarks above, behavior is difficult to explain when considering a single neuron (e.g., AWC ON) activity alone. Our newly acquired data show that the activity of many chemosensory neurons is modulated in an experience-dependent manner (see Figure 4 A, B), and changes in individual sensory neurons cannot readily explain the overall behavior. It is presumably the integration of multiple sensory neurons that expresses the adaptive behavior. This interpretation is supported by evidence from freely moving animals (Hallinen et al., 2021 eLife), in which a population coding of motor neurons was by far a superior predictor of locomotion behavior than any single command or motor neurons. Given that this paradigm is true for motor neurons (direct effectors of locomotion behavior), it is conceivably true also for individual sensory neurons which are positioned more distantly from the locomotion actuators and hence are presumably less reliable in predicting modulated behavior.

Moreover, our current understanding of the role of individual sensory neurons in features of locomotion behavior largely stems from experiments with non-physiological interventions (overstimulation by optogenetics, ablations etc.) that might overemphasize their contribution to natural behavioral metrics. We, therefore, refrain from trying to infer behavioral outputs directly based on the m odulated activity of the AWC ON neuron.

We added a new section to the discussion titled “Memory components are widely distributed across sensory- and interneurons”, that details that short-term memory components are distributed across the sensory neurons. This section can be found on pages 28-30 lines 592-626.

In the Discussion section dealing with the integration of sensory neurons in interneurons, we also note that the activity of many sensory neurons are required to properly describe the activity of AIA interneurons pages 31-32 lines 668-676:

“An emerging paradigm is that memory components are distributed in multiple individual neurons, suggesting that it is the integration of sensory neurons’ activities that underlies interneuron activity, and hence, downstream behavioral outputs. For example, to explain activity of the AIA interneurons, the most significant contributors were the AWA neurons, which explained only ~23% of the overall activity, followed by the AWC neurons which explained ~13% (Figure 6 H,J). Many additional sensory neurons, with lower percentage-contributions were required to explain up to 60 % of AIA activity. It is therefore challenging to predict behavioral outputs based on activities of a single (or few) sensory- or interneurons.”

Finally, we explicitly state that is hard to infer behavior from a single neurons’ activity when discussing the behavior in relation to neural activity, page 34 line 726-729 :

“Moreover, as memories were encoded in a distributed manner, encompassing several chemosensory and at least three interneurons, it is presumably the integration of all their activities that gives rise to the modulated behavioral responses. As such, it may be very difficult to relate a modulated activity of a single neuron to a specific locomotion feature.“

II) AWA activity to odor-on is not significantly different to the respective MOCK conditions, so I don't think one should conclude anything from the small effect sizes reported here only for STAP vs STAV and STAV vs naïve. I am not convinced of the authors' statement AWA would encode valence.

We agree. According to the original data the changes in AWA neurons are small and may not seem convincing. We, therefore, imaged the activity of the AWA neurons in two new and independent experiments using two different stains (now appear in figure 4C-E and supplemental Figure S21). These assays included many more repeats which revealed substantial changes in AWA activity, particularly between STAV and STAP and their corresponding mock-trained cohorts. Thus, we believe the changes in the AWA neurons are genuine. Nevertheless, we explicitly state that it is the combination of several small changes within several neurons that are likely to give rise to the observed behavioral changes. We consequently refrained from any statement that AWA alone is responsible for the observed behavior.

We now note that the AWA neurons are only one type of neuron and that there are additional ones that encode the valence component (see Figure 8 D). This is also highlighted in our conclusion statements as reflected in the summary to figure 8, and we a lso explicitly stated on page 28, lines 594 to 599:

“For example, activities of the neurons AWB, ASJ, and ASI were modulated only when comparing positive and negative experiences, indicating that they code the valence component of the memory. Activities of AWA, ASER neurons, and AWC neurons (at a lower concentration of the CS) were modulated both in a stimulus- and a valence- specific manner, suggesting that these neurons code for both components.”

And we go on to conclude on pages 2 8-29 lines 600 to 602:

“These findings support the notion that valence and stimulus components of the memory are distributed across multiple individual neurons, rather than being stored in a single or a few neurons.”

III) ASH is sensitized to odor-off specifically upon STAV. This is also interesting on its own. However, ASH is a well characterized nociceptive neuron, but odor-off upon STAV should be a favorable condition.

We have now explicitly re-assayed this point. The new data is consistent with the original one showing small amplitude changes in ASH. Again, we conclude from these extensive experiments that it is difficult to infer behavioral outputs based on the small changes observed in the ASH activity (~10%). Indeed, the relative contribution of ASH to the overall activity of the interneuron AIA was ~1.6 (±0.66)% (figure 6H).

In addition, in our newly-added experiments, we assayed a strain in which both ASH and AVA were expressing an integrated GCaMP reporter. While we observed minute changes in ASH activity following training (supplementary figure S18A-F), this change was not followed by a significant change in the AVA neurons after any stimulus exchange at all (Supplementary Figure S26).

Our overall conclusion is, therefore, that these small changes in the ASH cannot explain the observable behavioral changes. This is again reflected as a main premise of the revised version of the manuscript.

IV) AIA activity has been assigned to attractive odorant responses (Larsch, 2015; Dobosiewicz, 2019), which is inconsistent with enhanced responses upon STAV/LTAV. According to Figure S13 its baseline seems up-regulated rather than the response. I don't see reason for the authors' interpretation that AIA activity encodes valence.

We agree, and our newly-added data indeed supports the notion that AIA activity does not code valence in the short-term paradigms (Figure 5 E,F). In particular, these new data consist of many more experimental repeats using a 10- fold lower CS concentration and the addition of an alternative choice (diacetyl). Thus, we believe these data better reflect the choice paradigm that we observe in the initial behavioral experiments (Figure 1). According to these data AIA codes the stimulus and not the valence (Figure 5E,F).

In the new version of the manuscript, we omitted any claims regarding AIA coding valence in the short-term paradigms.

Regarding the long-term paradigms, we re-analyzed the data and we still observe significant changes in AIA activity between LTAV and LTAP paradigms (Suppl. Figure S14B).

When comparing the appetitive (upper right panel) with the aversive (lower right panel) there is a clear significant difference in AIA activity.

We have now combined the two curves into a single graph to show this (Author response image 1, right):

Author response image 1.

Author response image 1.

We also considered the interesting base shift and noticed that after correcting for this shift (Author response image 1, left panel), we do not observe a difference between LTAV and the associated mock group.In the revised version, we therefore only note this finding in the Results section (page 11, lines 234 to 236).

“…while the AIA neurons showed significantly elevated responses following the long-term aversive training paradigm (supplementary Figure S14A-C).”

We also highlighted the fact that the change in long-term aversively trained animals might stem from the baseline shift (see legend to supplementary figure S14 page 21 lines 334 to 337):

“The activity of AIA following LTAV training is higher compared to its activity following LTAP training or naive controls. Note that the difference between LTAV and the associated mock controls might be due to a baseline shift.”

V) Also RIA imaging seems not to reveal a clear picture what its role might be. The individual traces contain very variable interesting fluctuations making interpretation of mean traces difficult. To correctly interpret activity in RIA nrV or nrV one would need to know the head-bending position or head motor neuron activity (Hendricks, 2012 and Liu, 2018).

We agree. The new data, which is much less noisy, showed a clearer picture. We observed a stimulus-specific change in the aversive experience (figure 5 G,H). Interestingly, aversively trained worms also showed a significant increased deviation angles (weathervaning locomotion) during chemotaxis. Thus, this correlation between RIA activity and its associated behavioral output may explain how a change in RIA activity affects behavior. However, more experiments showing a direct causal effect will be needed for that.

We now state all these findings on page 33, lines 700 to 710:

“Behavioral assays following short-term training revealed that positively-trained animals were more directed towards the CS, while negatively-trained animals were significantly less directed (Figure 7 C-D). Interestingly, aversive training also inflicted significant changes in sensory-specific responses of the RIA neurons (Figure 5G,H, supplementary Figure S29). As the RIA neurons dictate animals’ head position (Hendricks et al., 2012; Hendricks and Zhang, 2013; Ouellette et al., 2018), their modulated dynamics may explain the changes observed in movement directionality. Moreover, RIA neurons were previously shown to participate in the formation of aversive imprinting (Jin et al., 2016), further highlighting how past experiences may be converged onto RIA interneurons to shape behavioral outputs. However, while correlated changes in behavior and RIA activity may suggest a functional link, additional experiments are needed to establish a causal role.”

In addition, since we cannot account for the head position in our microfluidic chamber, we have now removed any interpretation based on the dorsal or the ventral sides of the neurites. We present the nrV and nrD activities in supplementary figures since these dynamics are important to deconstruct RIAnrS signal. Moreover, while precise correlation of head timing and neuronal activity is not possible, calcium dynamics from dorsal and ventral compartments in restrained and paralyzed animals have been used to infer implications in learning in memory previously by Jin et al., 2016, Cell. Some readers will find those dynamics informative.

VI) Moreover, it is unclear from which neurons AIA and the RIAnrS domain receive their respective inputs under the various conditions. There is no consistent picture emerging, when comparting to the sensory neuron responses. Which sensory-to-interneuron communications change in the various conditions?

We have now comprehensively addressed this point to provide a clear understanding of which sensory-to-interneurons communication routes are at play following each of the training paradigms.

The activity of AIY neurons, in most conditions, mirrors the activity of AWA neurons (compare Figure 5 A to C), with the exception that in aversively trained animals there is an additional activity that cannot be explained by AWA alone. This suggests that different sets of sensory neurons modulate AIY activity i n an experience-dependent manner.

To further investigate this intriguing possibility, we constructed a mathematical model where the activity of each of the interneurons may be represented by a linear combination of all the upstream sensory neurons. This analysis resulted in a new figure that we now added to the main text (figure 6) and three new supplementary figures (S27-S29).

Specifically:

When considering AIY activity, a linear combination of the AWA and ASER sensory neurons alone could explain up to ~80% of the AIY activity (Figure 6A-C). Interestingly, the relative contribution of each of these sensory neurons significantly differed across the different paradigms, including a switch from positive to negative values for ASER. These analyses indicate that sensory-to-interneurons communication routes are modified in an experience-dependent manner (figure 6A-C, supplementary figure S27).

  1. When considering AIY activity, a linear combination of the AWA and ASER sensory neurons alone could explain up to ~80% of the AIY activity (Figure 6A-C). Interestingly, the relative contribution of each of these sensory neurons significantly differed across the different paradigms, including a switch from positive to negative values for ASER. These analyses indicate that sensory-to-interneurons communication routes are modified in an experience-dependent manner (figure 6A-C, supplementary figure S27).

A similar analysis for the AIA neurons revealed that many more neurons are needed to be considered to explain AIA activity. In particular, activities of AWA, ASK, and ASI neurons were differently weighted depending on the training paradigm, again, indicating an experience-dependent modulation of the relative weights (figure 6D-F, supplementary figure S28).

1. For the sensory-evoked signal in RIA neurons, a similar analysis resulted in poor overall fit, indicating that additional neurons, probably ones that we did not measure herein, are required to faithfully explain RIA activity. Indeed, according to the wiring diagram (supplementary figure S29G) RIA receives multiple inputs including other motor neurons which presumably dominate its overall activity.

  1. For the sensory-evoked signal in RIA neurons, a similar analysis resulted in poor overall fit, indicating that additional neurons, probably ones that we did not measure herein, are required to faithfully explain RIA activity. Indeed, according to the wiring diagram (supplementary figure S29G) RIA receives multiple inputs including other motor neurons which presumably dominate its overall activity.

Nevertheless, despite the overall low fit, we could explain ~65% of RIA activity following aversive conditioning. This indicates an interesting possibility where the aversive training shifts the weights modulating RIA activity towards the sensory neurons that we studied herein, particularly, the URX, AIY, ASH and AWC ON neurons.

All these new analyses are now provided in a dedicated whole section in the results: ‘The activity of interneurons can be explained by a linear combination of the sensory neuron’s activities. ’, pages 19-21, 403-450:

“AWA and ASER neurons, which showed the greatest modulated responses following the short-term experiences (Figure 4C-H and supplementary Figure S19A), directly innervate the AIY and AIA interneurons (Cook et al., 2019; White et al., 1986; Witvliet et al., 2021). However, measuring dynamics of AWA and AIY neurons simultaneously from the same animal revealed a surprisingly low correlation between the two synaptic partners (Supplementary Figure S27A-C, Pearson correlations range between ~0.25-0.5 for the different training conditions), suggesting that additional neurons, and possibly spontaneous activities, contribute to the overall AIY dynamics.

To study how the modulated activity of the sensory neurons impacts the activity of the interneurons, we considered a simple mathematical model where interneuron dynamics is dictated by a linear combination of the sensory neuron activities. When considering AWA activity alone, only 4-44% (depending on the specific training paradigm) of the activity observed in the AIY neurons could be explained, even if AWA and AIY activities were simultaneously extracted from the same animal (supplementary Figure S27D,E).

We therefore added to the linear combination model activities of other sensory neurons, obtained by the pan-chemosensory reporter strain (P osm-6 ::GCaMP3, supplementary Figure S27F), by using trial-averaged activities of the neurons in the model. Interestingly, a linear combination of two neurons only, AWA and ASER, sufficed to explain 55-83% of AIY activities across the different training paradigms (Figure 6A-C). Adding more sensory neurons to the linear model only marginally improved these predictions (Figure 6G,I and supplementary Figure S27G-L).

The weights (denoted by the regression coefficients) of the AWA and ASER neurons considerably varied across the different training paradigms and spanned negative and positive values (Figure 6C). This suggests that synaptic outputs, reflected by the relative weights in the linear model (βi), were differentially modulated in a training-specific manner.

To explain activity of the AIA interneurons, additional sensory neurons needed to be considered (Figure 6D-F,H,J and supplementary Figure S28). In fact, the two neurons that mostly contributed to AIA activity (AWC ON and AWA) explained only ~30% of its activity, and considering five neurons (AWC ON, AWA, URX, ASK, and ASI) explained 48-78% of the AIA activity (across the different training paradigms). Similar to AIY, several sensory neurons switched from positive to negative weight values in a paradigm-specific manner, indicating training-specific synaptic modulations (Figure 6E-F).

In contrast, characterizing sensory-evoked signals in the RIA neurites using a linear combination of the sensory neurons was generally poor, explaining only 20-39% of the activity variance (supplementary Figure S29). The fact that RIA neurons receive many more inputs, many of which are not covered by our model, may explain the low fit when relying on signals from a few sensory neurons only (supplementary Figure S29G). Nevertheless, in aversively-trained animals, 65 % of RIA activity could be explained by a linear combination of nine sensory neurons together with the activity of the AIY interneuron. In this paradigm, the sensory neurons AWC ON, URX, ASK and ASI as well as the AIY interneurons were the major contributors to RIA activity, suggesting that in aversive conditions, RIA neurons are increasingly tuned to these neurons.”

And in the discussion, p ages 31-33, 648-697:

“A detailed quantitative analysis of the downstream interneurons, AIY, AIA, and RIA, revealed that their activity can be explained via a simple linear combination of the sensory neurons. It is striking that the relative contribution of each sensory neuron greatly varied across the different paradigms. For example, the ASER neuron coded both the valence and the stimulus components of the memory, and its activity positively, or negatively, correlated with AIY activity following aversive or appetitive experiences, respectively (Figure 6 A-C). Likewise, ASER activity significantly affected AIY activity in aversively-trained animals while its activity did not affect AIY activity in the associated mock-trained animal. These results demonstrate how learning-specific paradigms finely modulate the communication routes between neurons within the network.

While two sensory neurons sufficed to explain most of the dynamics in the AIY neurons, at least five neurons were required to describe the activity of the AIA neurons. For the RIA neurons, even 9 neurons only poorly explained their activity. The reason for these differences may be explained once considering the connectome (Cook et al., 2019; White et al., 1986; Witvliet et al., 2021). AIY neurons are postsynaptic primarily to chemosensory neurons, while AIA neurons are postsynaptic to many more neurons. The RIA neurons also receive multiple inputs, including several interneuron inputs, not accounted for in our model. Thus, the more complex the presynaptic input, the more neurons are required to faithfully describe the activity of the postsynaptic neuron.

An emerging paradigm is that memory components are distributed in multiple individual neurons, suggesting that it is the integration of sensory neurons’ activities that underlies interneuron activity, and hence, downstream behavioral outputs. For example, to explain activity of the AIA interneurons, the most significant contributors were the AWA neurons, which explained only ~23% of the overall activity, followed by the AWC neurons which explained ~13% (Figure 6H,J). Many additional sensory neurons, with lower percentage-contributions were required to explain up to 60 % of AIA activity. It is therefore challenging to predict behavioral outputs based on activities of a single (or few) sensory- or interneurons.

The prime purpose of the regression analysis was to reveal if and how sensory activities are modulated in an experience-dependent manner to control the activity of the downstream interneurons, rather than to provide an accurate fit prediction for interneuron activity. The modulated sensory contributions to interneuron activity, denoted by the regression coefficients (Figure 6 C,F and supplementary Figures S27-S29), may be viewed as a proxy to synaptic strengths. As such, it is compelling to speculate that our analyses may point to specific synaptic modulations that underlie the memory storage, though additional synaptic in-situ evidence for that is needed. Moreover, in addition to modulating responses to the CS butanone, the plasticity of individual neurons (and possibly synapses) also modulated the responses to the alternative choice diacetyl (Figure 4C-E), and presumably to other stimuli as well. This global plasticity highlights how a distributed code broadly affects network dynamics culminating in modulated chemosensory preference.

Of note, we considered GCaMP signals when analyzing the relative contribution of the sensory neurons to the overall activity of the interneurons. However, the slow GCaMP dynamics (compared to the rapid intracellular Calcium/voltage changes) may introduce correlative biases that increase the dependencies between the neurons. Nevertheless, we observed large differences between the regression coefficients across the various training paradigms (Figure 6C-F and supplementary Figures S27I, S28B, S29C), including a switch from positive to negative values. This demonstrates that the synaptic weights were significantly modulated, well above the possible correlative biases, thereby reflecting genuine experience-dependent changes.“

VII) Why were AIY and AIZ not imaged, which are major targets of AWC and AWA? Despite the comprehensive sensory neuron imaging, there are obvious gaps with respect to interneurons.

This is a very good suggestion. We have now analyzed activity of the AIY neurons across all the different experiments and conditions performed for the other neurons. We chose to focus on this neuron since it is not as densely connected in the network as AIZ, thus increasing the possibility to infer meaningful insights into how an interneuron processes sensory information in an experience-dependent manner.

Moreover, in all experiments, we coupled AIY imaging with AWA neurons, which is its key upstream sensory neuron. This positioned AWA as a cross-reference neuron since we could compare its activity in the pan-sensory reporter strain (osm-6) to its activity in the AIY/AWA reporter strain, and by this, relate the activity of all sensory neurons to AIY.

As stated above, these experiments demonstrated that AIY activity can be explained, for the most part, by the activities of two sensory neurons only: AWA and ASER.

A detailed description of AIY activity across the different training paradigms is provided in the previous comment (VI). We have now added to the main text all the data (figure 6 A-C and supplementary Figure 27). In Results section, we state on page 17 lines 370 to 377:

“Neural responses in the AIY neurons largely recapitulated the responses observed in the AWA neurons (Figure 5A-D and supplementary Figure S25M-P). This suggests that the AIY neurons, similarly to AWA neurons, encode both the stimulus and the valence components of the memory. In contrast, the AIA neurons showed differential responses between STAP-trained and the associated mock-trained animals, suggesting that this neuron type codes the stimulus component of the memory. STAP- and STAV- trained animals had similar responses, indicating that the AIA neurons do not encode the experience (valence) component of the memory (Figure 5E-F and supplementary Figure S24E-H).”

Altogether, this is very confusing, and it is questionable whether any of the significant activity changes allow interpretation of how stimulus, conditioning, valence, behavioral response LTM or STM are separately encoded. Although I highly appreciate the authors' efforts in comprehensive imaging, at the current state the study presents scattered results that don't fit into an intuitively understandable circuit model.

We appreciate that the original data provided an incomplete, and in part, inconsistent picture of the experience-dependent activity changes. But after repeating all imaging experiments and automated behavioral experiments for the short-term paradigms, with the modified conditions as suggested, we could provide much more complete, consistent, and definite results. We also significantly increased the number of experimental repeats per neuron, which ultimately allowed us to make stronger statements with higher confidence. Also, adding the analyses of the AIY neurons helped us to fill a crucial gap in our previous observations. From these new data a clearer picture of the circuit plasticity emerges:

  • Short-term experience broadly affects sensitivity of sensory neurons to the CS (butanone) and diacetyl (see points 1 I-III and 2).

  • Short-term memory exists as distributed code in sensory neurons, in which the valence component and the stimulus component of the memory are distributed over many neurons (see points 1 I-III).

  • Immediate downstream neurons (AIY, AIA) receive modulated input from sensory neurons (see point 1 IV, point 1 VIII).

  • Activity of the downstream interneurons can be described as a linear combination of sensory activities. Experience modulates how sensory inputs are weighted.

  • Ultimately all outputs converge onto RIA neurons that show differential activation in aversive conditions (point 1 VIII).

  • Consistently with RIA observations, the directionality (weathervaning) during choice behavior in aversively trained animals shows large differences (see point 1 VI).

2. One possible source for the difficulty to assemble a coherent picture may stem from the different exposures to butanone used in the different assays used in this study. For example, the inability of the multiworm tracker assay (Figure 4) to recapitulate the appetitive memory shown in the chemotaxis assays (Figure 1) may stem from the absence of diacetyl as a competitor odor (or ethanol background), or from the difference in the concentration of the butanone. The authors acknowledge the different results from the two behavioral assays (Page 17), but they do not provide an explanation the different outcomes. Similarly, the calcium imaging experiments were also conducted without diacetyl, and with higher concentration of butanone. It is possible that the response of AWA to diacetyl is modulated by the butanone learning paradigm (perhaps as part of the requirement of AWA to the butanone memory, Figure S12). I therefore wonder whether calcium imaging experiments should have been performed for switches between butanone and diacetyl; same for the behavioral analyses in Figure 4, this would have been more informative had the authors included diacetyl.

Indeed, and we have now followed these important suggestions.

(I) We have now used a 10-fold lower concentration of butanone in the imaging experiments. This concentration is closer to the concentration used in the behavioral assays (though it is very difficult to match between the sensed concentration in airborne gradients to the exact concentration flown in the microfluidic device). Initial attempts to use a 100-fold lower concentration yielded poor sensory responses. Of note, in the original experiments, we tried to match butanone concentrations to the concentrations used during training. Thus, we have now covered a wide range of conditions which together provide a much more revealing picture (Figures3-5).

(II) We also included diacetyl as a second choice in both the imaging and the behavioral experiments (Figure 7).

Applying both of these changes provided a clearer view of the data with a better match between the behavioral results shown (figure 1), the imaging data (Figures2-5) and the locomotion parameters (Figure 7). Moreover, these new conditions now portrayed a clear difference between positive and negative experiences in both neural imaging and locomotion experiments.

Specifically, concerning the AWA responses, adding diacetyl as an alternative choice and reducing butanone concentration yielded clear differences across the different training paradigms. These experiments also indicated that AWA responses were modulated to both butanone and diacetyl (see Figure 4 C-E and supplemental figure S19A-C). These findings suggested that olfactory learning not only modulated responses to the CS (butanone) but also to diacetyl. Thus, olfactory experiences might broadly shift the animals’ chemosensory preference towards the CS depending on the valence of the preceding experience, such that the sensitivity to other stimuli are affected as well. We now state this in the discussion, page 32 lines 684 to 687:

“Moreover, in addition to modulating responses to the CS butanone, the plasticity of individual neurons (and possibly synapses) also modulated the responses to the alternative choice diacetyl (Figure 4C-E), and presumably to other stimuli as well.”

3. Regarding the interpretation of the AWC-ablation results (Page 10 and Figure S12A-B). The AWC neurons (and specifically AWC-ON neurons) are required for chemotaxis towards butanone (Bargmann 1993, Wes 2001, Tsunozak, 2008) and are commonly cited as such in the literature. One therefore cannot easily untangle the role of the AWC neurons in butanone memory from their more basic role in butanone sensation (and chemotaxis). As also seen in Figure S12, the AWC ablated animals do not show chemotaxis towards butanone (while they do show some surprising aversion). Therefore, the claim that the AWC neurons are required for appetitive memory cannot be easily justified. In addition, Torayama et al., (2007, dio:doi.org/10.1523/JNEUROSCI.4312-06.2007) demonstrated that the AWC-OFF neuron is sufficient for chemotaxis towards butanone and that the AWC-ON neuron is also required for appetite memory of butanone. This work should be cited and the claims for the requirement for AWC neurons for memory should be clarified. The finding that the AWC-OFF neuron can also react to butanone, corroborates the behavioral data from Torayama, et al., J Neuroscience (2007) and can be discussed in text.

We agree, and the same comment was raised by reviewer #2 (point num 5). For convenience, we include that response here as well.

It is absolutely true that by using mutants, we cannot differentiate whether the missing neurons are responsible for sensing or learning, or both. Since use of mutants is not really indicative, we removed all the data concerning the mutants and refrained from making any conclusion based on mutants use.

We also made sure to cite the indicated paper Torayama, et al., 2007 J Neuroscience, now appears as a citation in the supplementary discussion of naive neuronal responses, in the caption of supplementary Figure S9, page 15 line 241-244:

“AWC OFF neurons responded upon butanone removal in naive animals (see supplementary Figure S11 and supplementary Figure S7), thereby corroborating their roles in chemotaxis as previously described (Torayama et al., 2007).”

4. All interneuron imaging data lack the essential buffer-buffer switch controls.

We have now performed all these important controls and added the data to the manuscript (shown in supplementary Figure S9). It is evident that the activity due to flow changes between the buffers alone are significantly lower than those observed in response to the CS.

5. The AVA activity (Figure S14), which can be assigned to fictive reversal behaviors, shows reduction upon both odor ON and OFF, in all conditions. Data in Figure 4E-F suggest that reversal modulation is implicated in STAV and LTAV. I therefore conclude that this cannot be recapitulated in chip imaging conditions. Did the authors perform enough repetitions? I fear that AVA just responds to switches in the microfluidic chip, but the essential buffer-buffer switch control is missing.

We agree. We have now added the missing buffer-buffer controls showing that the command neurons did not respond to buffer-buffer switches (Supplementary figure S9). In the original data, we could perform only one stimulus presentation and removal, while in the newly added data we performed six stimulus exchanges. When retesting AVA in the new experimental conditions, AVA neurons did not show strong responses to stimulus exchanges (neither to butanone-to-diacetyl nor vice versa). Nor did we observe experience-dependent changes in AVA activity, except for baseline shifts. Likewise, in the new behavioral data, we did not observe changes in reversals. The effects of memory on AVA activities are stated in the Results section, page 18 lines 383 to 387:

“Downstream to the aforementioned interneurons are the command neurons that directly regulate animal behavior. We studied activity changes in two major command neurons, AVE and AVA, whose activity instructs a backward motion (Gray et al., 2005; Piggott et al., 2011). These neurons exhibited mostly baseline-level activity shifts that were unrelated to the switches between butanone and diacetyl (Supplementary Figure S26).”

Furthermore, we assayed AVA activity with and w/o levamisole and did not observe fundamental differences (Supplementary figures S26 C-H vs I-N). This suggests that the mechanical chip restraint, rather than the levamisole-induced paralysis, may underlie the fictive reversal behavior.

Together, we believe that interpretation of these results are yet difficult due to possible fictive behavior in the chip. In the new version of the MS, we only state that the behavior and imaging results are consistent, and acknowledge the limitation in drawing strong conclusions regarding AVA. P ages 33-34 lines 711 to 721:

“Quantifying reversal frequencies did not reveal a significant difference between the trained and the associated control animals (Figure 7G,H). The stable reversals frequency was also supported by the lack of activity responses in the backward-inducing command neurons (AVA and AVE, supplementary Figure S26). However, calcium imaging of command neurons in restrained animals is prone to artificial activity that may arise from fictive behavior (Hallinen et al., 2021), possibly rendering these neurons unresponsive to stimulation. Nevertheless, when using a higher concentration of butanone, similar to the concentration used during training (and in the absence of diacetyl), then the aversively-trained animals exhibited a significant increase in reversal frequency (Supplementary Figure S30F-G), which was also accompanied by stimulus-evoked calcium transients in the AVA and AVE neurons (Supplementary Figure S16).”

6. Regarding Figure 4E, the number of reversals per cm is calculated instead of the probability reversal per worm at this area. The former calculation should be made to normalize to the number of worms reaching this area in the agar plate.

Indeed, it was our mistake in labeling the units which actually denote reversals per cm wormtrack at this area (and not the non-normalize reversal frequency at this area). We changed the axis caption and explicitly explained it in the figure legend (Figure 7G-H for the new data and supplementary Figure S30F which is related to the original data), in the manuscript page 26, lines 533 to 535:

“(G) Plots of the reversal frequencies as a function of the distance from the target butanone. The units are given as reversals per centimeter worm track at the distance from the endpoint specified by the x-axis.”

As well as in the supplementary Figure S30, page 50, lines 718-720:

“(F) Mean reversal rates as a function of the distance from the target point for each of the four training paradigms. The units are given as reversals per centimeter worm track at the distance from the endpoint specified by the x-axis”

Reviewer #2 (General assessment and major comments (Required)):

The manuscript reports the experiments and the results that aim to identify the principles used by C. elegans nervous system to encode associative memories. The study analyzes 4 types of associative learning, namely S/LTAV and S/LTAP, side-by-side in behavioral strategies and neural activities. The experimental design helps to identify unique behavioral and activity patterns associated with each type of memories. The results from this systematic analysis provide a large dataset that is informative for understanding sensory encoding and plasticity. Based on these results, the authors propose that sensory neurons have central roles in memory formation. The manuscript will benefit from addressing several questions in results, data analysis and interpretation.

1. In methods for imaging, the authors describe that "the animals were starved for 20 minutes on empty NGM plates. For imaging multiple neurons, worms were also paralyzed using 10 mM levamisole dissolved in chemotaxis medium. The worms were habituated to the restraint and paralysis for additional 10 minutes within the chip." The worms were starved 20-30 minutes before the imaging experiments. This treatment is important for interpreting imaging results because worms change reversal rates after being on an empty plate for 30 minutes, likely due to changes in the activity of the neurons that regulate reversals. The authors should describe this condition in "Results" and integrate this condition when interpreting and discussing the results.

We agree, and we now state in the ‘Methods’ section that the worms are allowed to habituate in the microfluidic device with a reference to the fact that ~30 minutes of starvation can modulate AVA activity. I n the Material and Methods section, page 39, line 827-836:

“In preparation for live imaging and prior to loading the animals onto the microfluidic chips (Chronis et al., 2007), the animals were starved for 20 minutes on empty NGM plates. For imaging multiple neurons, worms were also paralyzed using 10 mM levamisole dissolved in chemotaxis medium. The worms were then allowed to habituate to chamber restraint and paralysis for an additional 10 minutes within the chip. The overall ~30 minutes starvation could in principle modulate activity of neurons associated with local search behavior, like for example AVA and others (Gray et al., 2005; Lemieux et al., 2015; Skora et al., 2018). We therefore may capture such starvation-induced changes, however, since we always compare trained and mock trained group animals which undergo exactly the same preparatory treatments, we essentially filter out these physiological effects.”

We also explain this when presenting the data regarding AVA, in supplementary Figure S16 page 23, lines 372-374:

“In general, preparations for imaging involved a ~30 minute starvation period. However, since we always compare trained and mock-trained group animals, which undergo exactly the same preparatory t reatments, we essentially filter out these physiological effects.”

And also in the legend o f supplementary Figure S26, page 41, lines 591-593:

“A general remark to all panels, imaging procedures required a 30 minute starvation period. However, since we always compare trained and mock trained group animals, which undergo exactly the same preparatory treatments, we essentially filter out these physiological effects.”

In the discussion, we discuss all these points together. Pa ge 33 lines 711 to 716:

“Quantifying reversal frequencies did not reveal a significant difference between the trained and the associated control animals (Figure 7G,H). The stable reversals frequency was also supported by the lack of activity responses in the backward-inducing command neurons (AVA and AVE, supplementary Figure S26). However, calcium imaging of command neurons in restrained animals is prone to artificial activity that may arise from fictive behavior (Hallinen et al., 2021), possibly rendering these neurons unresponsive to stimulation.”

2. The imaging experiments on sensory neurons and interneurons are done mostly using worms that express calcium indicators in many neurons. The validation of the cell identities needs to be shown.

We now provide a validation for the cell identities. A new supplementary figure S5 shows how we unequivocally identified each of the neurons. The caption to the legend explains the identification process. Briefly, we identified the neurons primarily based on anatomy, but also by functional activity that matched previous reports and knowledge. In cases where we could not verify a neuron identity (e.g URX, supplementary figure S8), we used neural-specific calcium-reporter lines. To resolve between AWC ON and AWC OFF, we used an additional line that differentially tags them (appears in a supplementary information and Supplementary figure S7 and detailed in Methods).

3. The authors report increased activity in AWC for STAV and STAP. Because STAV and STAP generate opposite effects on chemotaxis to Butanone, the function of these AWC results on chemotaxis behavior need to be better clarified.

Indeed, and this comment was also raised by reviewer #1. Our findings show that the modulated activity in the AWC neurons alone cannot explain the overall behavioral change. It is presumably the integration with other sensory neurons (and interneurons) that collectively affect behavior, and this is now one of the manuscript premises.

In the Discussion section dealing with the integration of sensory neurons in interneurons, we, therefore, note that the activity of many sensory neurons are required to properly describe the activity of AIA interneurons pages 31-32 lines 668-676:

“An emerging paradigm is that memory components are distributed in multiple individual neurons, suggesting that it is the integration of sensory neurons’ activities that underlies interneuron activity, and hence, downstream behavioral outputs. For example, to explain activity of the AIA interneurons, the most significant contributors were the AWA neurons, which explained only ~23% of the overall activity, followed by the AWC neurons which explained ~13% (Figure 6H,J). Many additional sensory neurons, with lower percentage-contributions were required to explain up to 60% of AIA activity. It is therefore challenging to predict behavioral outputs based on activities of a single (or few) sensory- or interneurons.”

We also explicitly state that is hard to infer behavior from a single neurons’ activity when discussing the behavior in relation to neural activity, page 34 line 726-729 :

“Moreover, as memories were encoded in a distributed manner, encompassing several chemosensory and at least three interneurons, it is presumably the integration of all their activities that gives rise to the modulated behavioral responses. As such, it may be very difficult to relate a modulated activity of a single neuron to a specific locomotion feature.“

Concerning the peculiar AWC activity modulations, our results suggest that AWC neurons code both STAV and STAP, thus the stimulus component of the memory (figure 3C-E). We find that this modulated activity is concentration-specific: In the original dataset, we observed changes in AWC activity when using a high butanone concentration, which was more similar to the training concentration. In the newly collected data, we used a 10-fold lower concentration of butanone (and added diacetyl as a choice). Still, we find the stimulus-specific differences in AWC activity attenuated (differences only between naive and trained groups figure 4 I-K for). This is also in line with results reported by the Bargmann group (Cho et al., 2016 eLife), where the AWC ON neuron displayed sensitization to stimulus removal at concentrations similar to the training concentration (1 mM) but not to lower concentrations.

We now explicitly discuss this premise in the Discussion, page 28-29, lines 593-602:

“We identified individual sensory neurons that code either the experience valence, or the conditioned stimulus, or both, components of the memory (Figure 8 C-D). For example, activities of the neurons AWB, ASJ, and ASI were modulated only when comparing positive and negative experiences, indicating that they code the valence component of the memory. Activities of AWA, ASER neurons, and AWC neurons (at a lower concentration of the CS) were modulated both in a stimulus- and a valence- specific manner, suggesting that these neurons code for both components. Interneurons generally coded both memory components (Figure 8C-D and supplementary Figures S24-S25). These findings support the notion that valence and stimulus components of the memory are distributed across multiple individual neurons, rather than being stored in a single or a few neurons.”

4. In addition, Cho et al. ELife 2016 reports that conditioning worms similarly as STAV in this paper decreases AWC activity. The difference in this result and the one reported in the manuscript warrants some discussion.

Indeed, Cho et al. demonstrated that AWC activity is decreased following training. However, this was observed at the lower concentration of butanone (e.g. 111 nM) as shown in that paper in figure 4 panel B (for aversive) and figure 5G (for appetitive). We note that for a higher concentration (1 mM), which was also used as the conditioning concentration, AWC actually increased (rightmost dynamics in these panels). A higher activity was also noted in the 10-fold lower concentration 111 μM. Thus, there is a full agreement between our results and the results reported by Cho et al.

We now added these comparisons to the Discussion section, page 29 lines 603 to 616:

“Of note, these coding schemes are sensitive to the concentrations and conditions used during memory formation and retrieval. For example, when using the same CS concentrations for training and for memory retrieval, then the AWA neurons exhibited valence-specific responses only (Supplementary Figure S11A-C). However, using lower CS concentrations during retrieval reveals that the AWA neurons show stimulus- as well as valence-specific responses (Figure 3C-E and supplementary Figure S19A-C). Similarly, the activity of the AWC ON neuron was modulated in a stimulus-specific manner only when evoking the memory using concentrations similar to the concentrations used during training (compare Figure 3C-E and Figure 4I-K). The high dependence of the AWC ON responses on the specific concentrations of the CS was also evident in a previous study where responses were observed only when stimulating the animals with the trained concentration, and regardless of the positive or the negative associating experience (Cho et al., 2016). Thus, the expression of the valence or the stimulus components of the memory greatly depends on the match between CS concentrations used during training and memory retrieval.

5. The author tested the function of AWC and AWA in learning using cell ablation. Because loss of sensory neurons can impair both sensing and learning, the interpretation of the results need to include these possibilities.

We totally agree, and the same comment was raised by reviewer #1 (point num 3). For convenience, we provide the same reply in both places:

It is absolutely true that by using mutants, we cannot differentiate whether the missing neurons are responsible for sensing or learning, or both. Since use of mutants is not really indicative, we removed all the data concerning the mutants and refrained from making any conclusion based on mutants use.

6. ASH shows increased activity after STAV. But ablating ASH does not change STAV learning ability. These results suggest that the increased ASH activity does not regulate STAV. The possibility needs to be included in the discussion of these results.

We agree. Since the ablation experiments are obsolete, we do not raise this possibility anymore. Moreover, we now added a mathematical model that analyzed the relative contribution of each of the sensory neurons and indeed found that ASH neurons play a minor role. We observed only small changes in ASH activity (~10%), and the relative contribution of ASH to the overall activity of the interneuron AIA was ~1.6(±0.66)% (figure 6 H-J and supplementary figure S28).

7. Figure 4 reports significant changes in speed and reversal rates after STAV and LTAV. However, none of the interneurons that are known to regulate speed or reversals shows any significant activity change. These results need to be carefully discussed.

Indeed. In the original data, we observed changes in the locomotion speed, while in the newly-added data, which better mimics the conditions in the imaging and chemotaxis assays (Figure 1, due to addition of diacetyl as a choice ad lower butanone concentration), the reduction in locomotion speed was minute. In fact there was no difference between trained and mock-trained animals. Hence, we no longer state that reduction in locomotion speed is a result of training essential to explain the choice behavior displayed in figure 1. The new data now appears in the new Figure 7, and the original data is now provided in supplementary figure S30. We therefore conclude that the speed feature is sensitive to the CS concentration and the specific chemotaxis conditions, on pages 33-34 line 711 to 725:

“Quantifying reversal frequencies did not reveal a significant difference between the trained and the associated control animals (Figure 7 G,H). The stable reversals frequency was also supported by the lack of activity responses in the backward-inducing command neurons (AVA and AVE, supplementary Figure S26). However, calcium imaging of command neurons in restrained animals is prone to artificial activity that may arise from fictive behavior (Hallinen et al., 2021), possibly rendering these neurons unresponsive to stimulation. Nevertheless, when using a higher concentration of butanone, similar to the concentration used during training (and in the absence of diacetyl), then the aversively-trained animals exhibited a significant increase in reversal frequency (Supplementary Figure S30F-G), which was also accompanied by stimulus-evoked calcium transients in the AVA and AVE neurons (Supplementary Figure S16). Similarly, while the speed of trained animals was not behaviorally significantly different from control animals, a significantly reduced speed was observed when using a higher CS concentration and in the absence of the alternative choice, diacetyl (Supplementary Figure S30D-E). These findings indicate that training induces a fine-tuned neural and behavioral plasticity that is sensitive to the exact experimental conditions.”

8. Increased activity in AIA after LTAV predicts decreased reversals (Larsch et al. Cell Rep 2015). It does not explain increased reversal rate observed in chemotaxis observed in LTAV. In addition, increased RIAnrs predicts increased curving towards an attractant (Liu et al. Neuron 2018). It does not explain increased reversal rate and increased deviation in LTAV. One possibility is that S/LTAV generate changes in interneurons that regulate reversals (AIY, AIB, AVA, RIM etc) in a distributed manner. Although none of these interneurons shows a detectable change, their collective activity changes produce increased reversal rate. In addition, after LTAV, reversal rate increases for about 2 fold, but deviation only increases a fraction of the mock level. It is likely that increased reversal contributes to the increased deviation in chemotaxis. The author should include these possibilities in discussion.

We agree. In our newly-added experiments, we imaged neural activity (including that of AIA neurons) and assayed locomotion parameters while presenting the animal with butanone together with diacetyl. This condition was more comparable to the conditions in which we characterized the choice behavior (figure 1). In these new settings, we did not observe a behaviorally meaningful change in the reversals (see figures 7 G-H), nor did we observe an increase in AIA activity in STAV (see figure 5 E,F). We therefore speculate that these differences arise due to the specific test conditions which included an alternative choice. Thus, we now refrained from relating AIA activity to behavioral outputs and limited our conclusion to the observation that interneuron activity is modulated following short and long term training paradigms. On page 28 lines 581 to 583 of the Discussion section:

“Interneurons showed activity changes following the formation of both short and long-term training paradigms, though, activity changes following long-term experiences were more prominent (Figure 8B-D, and supplementary Figure S14).”

9. Lemieux et al. Cell 2015 reports an increase in AVA activity after 1-2 hour starvation. The difference in this result and the results on AVA in this study warrants some discussion.

We actually observed the increase in AVA basal activity in our data as well.

In Lemieux et al. 2015, starvation alone (without stimulating the animals) increased AVA spontaneous activity. Interestingly, we observed a heightened basal AVA activity (and most prominently when imaging in the absence of levamisole, supplementary Figure S26 J and M), analogous to what Lemieux et al. reported. In fact, both trained- and mock-trained animals (in both positive and negative paradigms) showed consistently higher baseline activities than naive animals (Supplementary Figure S26).

However, in our study, we aimed to reveal whether the encounter with (or removal of) the conditioned stimulus butanone affects AVA activity following training, but we did not observe prominent state transition or activity changes between trained and mock trained animals (Supplementary Figure S26). Thus, the short starvation prior to imaging may have increased AVA basal activity, but the training itself did not affect AVA responsiveness to the conditioned stimulus.

We now state these observations in the legend of supplementary Figure S26 page 41, lines 566-571:

To exclude the possibility that levamisole affects activity, AVA neurons were imaged in the absence of levamisole. Again, no differences were observed in the response dynamics following the stimulus switch. The only significant changes were the shifts in the baseline activity (see mean activity graphs J and M, n=12-16 animals). These baseline shifts in aversively and appetitively trained animals could be due to starvation-induced increase in AVA activity as previously reported (Lemieux et al., 2015).

[Editors’ note: further revisions were suggested prior to acceptance, as described below.]

The reviewers have discussed their reviews with one another, and the Reviewing Editor has drafted this to help you prepare a revised submission.

The resubmitted manuscript was assessed by three reviewers, whose review comments follow. All reviewers appreciate the large amount of efforts put to obtain additional data. On the other hand, each reviewer points out interpretation and presentation problems. Considering this, I need to call for a revision of the manuscript, including additional data analysis and statistical tests. If authors decide to revise the manuscript as recommended, the revised manuscript will be re-assessed by the reviewers. Please note that reviewer#1 is identical to reviewer#2 in the previous submission, and reviewer #4 is identical to reviewer#1 in the previous submission, while reviwer#3 was newly recruited.

As described by authors in Figure 1 and Supplementary figures 3, behavioral and neuronal activity changes caused by learning paradigms could be categorized to stimulus-specific (caused by CS), treatment-specific (caused by US) and training-specific (caused by CS and US), and each of these changes could occur in either of appetitive training, aversive training or both, in the same of opposite directions. On the other hand, in describing neuronal activities, only "stimulus code" and "valence code" are evaluated. This is causing considerable confusion and need to be amended.

We have now extensively revised the manuscript and added comprehensive analyses of CS and US neural encoding. Specifically, we have identified the neurons that code for the US, and denoted in Figure 3A,B and 4A the impact of the US on neural activities. In the newly added Figure 7, we also identify the neurons that specifically encode the US+ and US-. Moreover, we extended Figure 1-supplement 3 to fully denote how the CS and the US can be inferred from the experimental groups together with terminology used throughout the manuscript. Finally, all coding neurons are summarized in Figure 9. Together, these additions provide a much more accurate analysis of the encoding logic. It also allows to better relate differences found in behavioral assays with those stemming from neural functional imaging.

Also, presentation and evaluation of regression analysis and methods for evaluation of RIA activities need to be reconsidered. In these and other aspects pointed out by the reviewers, authors need to improve the presentation to efficiently and thoroughly convey the results, because the whole dataset is valuable to the readers in the field.

We have now revised the analysis of RIA activities according to the reviewer’s comments. We present and analyze the RIA’s synchronous neurite signal as the time derivative of the activity rather than the raw activities. As for the regression analysis regarding RIA and AIA neurons, our new analysis indicated that the model consists of too many regressors and a limited number of data points. We therefore present the full valuable data without the regression analysis of these neurons.

Concerning the AIY neurons, our new analyses indicated that the data is well suited to reliably infer the experience-dependent changes in the regression coefficients, and by this, to support our conclusions regarding the changes in the synaptic communication routes (this analysis was added to Figure 6). We have now improved and simplified the data presentation of the results and made them more accessible to the reader (see Figure 3 AandB, Figure 4 A, Figure 6E). We also clearly stated the limitations of the regression method as to avoid any confusion in the interpretation of the results.

Reviewer #1 (Recommendations for the authors):

The revised manuscript has improved significantly.

First, the newly added calcium imaging experiments on sensory neurons and interneurons in response to BUT and DA helped to interrogate neural activities in a condition more comparable to the chemotaxis assay conditions. These analyses help to interpret potential function of the observed neural activities under the naive and training conditions.

Second, they found that a linear combination of presynaptic sensory activities explained the postsynaptic interneuron activities to various degrees. This analysis helped with a coherent understanding of a large amount of imaging results by showing potential flows of neural signaling.

Finally, they also performed detailed behavioral analysis on chemotaxis. The results examined multiple parameters (speed, reversal, direction) and the authors aimed to make a connection between the behavioral results and the imaging results. This is an informative addition. However, some clarifications are needed for their interpretation of the results "We did not observe behaviorally relevant differences in the animal's speed nor in t heir reversal frequency (though p values indicated significance, Figure 7E-H)." If they did not use the statistical test results to interpret the data, it will be useful to clarify how they drew the conclusions.

Indeed, we find that animal directionality (deviation angle) is the significant behavioral feature that is being modulated. As for speed and reversal frequencies, while statistical analyses show significant p values, their magnitude was low, close to borderline. We believe that these p values become significant due to the large sample size (e.g. thousands of track segments with speed values). Thus, while statistically significant, the relevant biological/behavioral significance is not obvious.

We now demonstrate this point by performing a detailed analysis, in which we simulated chemotaxis behavior by randomly choosing locomotion parameters (speed, reversal frequency, and deviation angles) drawn from a distribution constructed based on the experimental data (shown in the new panels of Figure 8 I-N). These simulations allow us to test the extent by which each locomotion feature shifts naive animal behavior towards the trained behavioral phenotype. For this, we sampled for two features from the naive group and one parameter was sampled from the trained group. By measuring the differences between locomotion this hybrid-type simulated behavior and that of real trained animals, we can infer the significance of the parameters that were sampled from the trained animals. These simulations indicated that the contribution of speed and reversal frequency to the observed changes in chemotaxis is negligible. In contrast, deviation angles significantly contributed to the experimentally observed behavioral changes (See figure 8 legend, Figure 8-supplement 1, and Methods for exact details of the simulation). This indeed corroborated our initial estimations.

We now provide a detailed explanation of these analyses and the considerations that led us to the above conclusions (pages 16-17, lines 407 to 421):

“Positively-trained animals were significantly more directed towards the CS target, while the negatively-trained animals were the least directed towards the target (each paradigm compared to its naive and matched mock-trained animals, Figure 8C-D). Notably, animals that underwent aversive training with BUT showed a high deviation angle with low variance towards the alternative choice DA (Figure 8C, arrow), suggesting that the negative training increased aversion from BUT, and concomitantly, enhanced attraction to DA. Animal’s speed and reversal frequency showed mild though significant changes (Figure 8E-H). To test the contribution of these changes to the overall behavior, we simulated animal chemotaxis based on experimental locomotion parameters (Figure 8I-N, and see Figure 8—figure supplement 1 for explanation). These simulations indicated that animal directionality (the deviation angle from the target) accounted for most of the behavioral changes, while the contribution of the speed and the reversal frequency to the overall change in the locomotive behavior was negligible (Figure 8—figure supplement 1). These analyses suggest that training mainly affected animals’ directionality features: more directed following positive training and less directed following an aversive training.”

Also, RIA synchronized calcium events were calculated as events in which both axon domains have time derivatives that were positive (influx) or negative (eflux) (Jin et al. 2016; Hendricks et al. 2012). In Jin et al., the authors used > 0.005 (% per second) or < – 0.005 (% per second) as a threshold. As the authors showed in Figure S6, it is not clear whether the shaded areas were synchronized events.

We have implemented this suggestion and used the coinciding time derivative of the dorsal and ventral compartment to describe RIA sensory-evoked signals (as described by Hendricks et al. and Jin et al). Since the accuracy of the derivative is noise sensitive, and noise levels markedly vary across experimental setups (e.g., different noise from the detector), we used different thresholds (±0.015) that we estimated from pressure controls inside the microfluidic device. We now modified Figure 5 and Figure 3-supplement 4 and 5, and Figure 5—figure supplement 2.

Reviewer #3 (Recommendations for the authors):

In this manuscript, authors established learning paradigm that realizes both appetitive and aversive learning and both short-term and long-term memory using the same CS, butanone. By using this type of learning, they made systematic analyses of learning-dependent changes in neuronal activity including many sensory neurons and several core interneurons. Upon revision, they added buffer control and added AIY interneurons. Also, addition of switching between butanone and another odorant diacetyl, as a control odorant, causes the results more interpretable. Now it has a total of 30 supplementary figures, which is remarkable. The relationship between the neuronal activity and behavior is still unclear, and authors claim that attraction and aversion behaviors may be regulated by polulation coding, which might be true. The major contribution of the study is a comprehensive analysis of sensory neuron responses to odorant which clearly changed by short-term training, and a set of interneurons, whose activities change by both short and long-term training. These data are informative for the community. Upon revision, authors also show that activity of interneurons can be explained by linear combination of sensory neuron activities.

However, in Figure 6 and other parts of the manuscript, authors use the word "trial-averaged activities". This is misleading because this word is commonly used for averaging across trials rather than averaging across animals for each trial (repeat of stimulus according to authors' definition of "trial"). It needs to be reworded. The averaging treatment is explained in Figure S27F, but this figure is not easy to understand, partly because only trial 1 is labelled even though two trials are shown in the drawings.

Indeed, we have incorrectly used the term 'trial-averaged’. We have now corrected all instances where this term appears and replaced it by ‘averaged each trial across all animals’. Moreover, we modified the explanatory scheme (now Figure 6—figure supplement 1I) to properly explain the repeated stimulus presentations, where each repeat was averaged across the different animals. This is now explicitly explained in supplementary material page 72, lines 2077 to 2084:

“(I) Our approach for relating activities from the pan-sensory reporter strain (osm-6::GCaMP) with activities extracted from a reporter strain expressing GCaMP in both the AWA and the AIY neurons. Data points from simultaneous recordings of AWA and AIY activities within the same animal (blue field) are synched. To accurately relate the neural activity of AIY neurons to activities of sensory neurons measured in different animals (i.e. ASER activities originating from the pan-chemosensory strain, red field), we averaged each trial across all animals (gray arrows). This minimized animal-to-animal variation and allowed the use of activities originating from different animals within the same regression model (black arrow).”

Reviewer #4 (Recommendations for the authors):

The authors made extensive efforts in addressing all my previous comments. The present manuscript is a tour de force through an impressive amount of non-trivial experiments. The new paper better highlights some very interesting aspects of their findings, like the distributed nature of memory components and of how sensory information is passed to the first layer of sensory interneurons. Still, I have some troubles in following the authors' heuristics in how they interpret the various experimental conditions. Further, the paper needs some improvements in the applied statistics.

1) Comparing trained animals with their respective matched MOCK conditions is a crucial control for a specific memory trace in a neuronal activity pattern. However, across other conditions the authors applied very different procedures to the worms where many experimental variables were changed, like repeated wash and transfer cycles, etc. In many cases these procedures caused strong effects on neuronal activity i.e. significant differences in MOCK-trained vs naïve (e.g., Figure 4F), hence the neuronal responses are modulated by starvation or procedure associated stress. When various MOCK conditions give different results, one cannot conclude from differences in the respective training conditions that the neuron is encoding valence. For example Figure 4I,J,K: the most obvious difference in AWCon between STAV and STAP is coming from the differences in MOCK vs MOCK, while STAV and STAP cause tiny and equal changes relative to their MOCK traces, hence AWCon is mainly modulated by the US (procedure) but does not represent valence.

Indeed, there are some differences in the training procedures. However, when training for the short-term paradigms, there is a small difference in the training procedures where the appetitive paradigm consists of only one extra transfer of the worms onto plates with food. While this extra handling may have some limited effects on the neural activity, we believe that the salient features are the presence or the absence of food, and as such, comparing the mock-trained animals to naive animals truly reflects the US.

Nevertheless, we now tone down our conclusions regarding the valence, acknowledging the above concern. We now mainly discuss such differences as US coding, that is, that the difference may be attributed to the entire training procedure (e.g., +/-food and differences in experimental procedures). For example, in the case of the ASER, we originally stated that it codes the valence, but we have now toned it down to say that there are differences depending on the presence or absence of food in the training paradigm (page 10, line 239 to 243):

“The ASER neuron displayed marked activity responses in naive animals upon the switch from DA to BUT. This response was completely lost in STAP-trained and all mock-trained animals, but not in STAV-trained animals (Figure 4E-G). This suggests that the ASER neuron may be coding the stimulus component of the memory as well as the positive (US+) and the negative (US-) experiences of the training paradigms.”

For other neurons, we state that the observed differences are mostly between aversive and appetitive training regimes, but refrain from stating that these neurons code the valence (page 10, lines 246 to 248):

“Activity changes of other sensory neurons were more subtle: for example, ASI, AWB, and ASJ neurons appeared to be related to the differences between aversive and appetitive experience (Figure 4-supplement 2,3).”

As for the AWCON neurons in the short term paradigms, we now state (pages 10 lines 243 to 246):

“Activity changes in the AWCON neurons were hallmarked by a large increase in all treated groups (when compared to the naive group), which is indicative of coding both the aversive and appetitive US (Figure 4H-J, Figure 2-supplement 3 E-H).”

As for the long-term paradigms, there are indeed marked procedural differences, and hence, we completely refrained from making any statements regarding the valence in these paradigms. In the discussion, we now acknowledge the limitations in assigning valence to neurons (page 20 lines 491 to 499):

“Assigning valence-coding neurons was somewhat limited due to the procedural differences in aversive and appetitive training paradigms. This was particularly evident when training for the long-term paradigms which involved several key procedural differences. Nevertheless, the procedural differences between positive and negative training in the short-term paradigms were minimal (see Methods), so valence-coding neurons could be extracted with higher certainty. These analyses indicated that the ASJ and ASI neurons may be the strongest candidates for coding valence (Figure 4A, Figure 7C). Indeed, the ASI neurons were shown to integrate information regarding food availability (Gallagher et al., 2013; Hapiak et al., 2013).”

Altogether, the resulting picture is still vastly confusing; the authors frequently conclude that certain neuronal activity changes "code" for various task parameters, but this is not really shown i.e., simply showing correlates of memory traces is not sufficient to make these statements. Moreover, It will be extremely challenging for the reader to navigate through the forest of > 30 Figures. I find it unsatisfactory that the authors main response to this is, in other words, – memory components are encoded in a distributed but in a somewhat unexplainable way-. The authors should make an effort to address this. I would suggest to revise Figure 4 (and Figure 3) to include all MOCK vs MOCK and MOCK vs naïve, also the sign of the δ values should be depicted, as well the significance levels of each matrix entry should be depicted on top of each square (not just labeling the neurons yellow). This would give a better overview. Then use this data matrix to train a classifier and test whether the task parameters, CS, US ( = the 2-4 different procedures), positive- and negative valence can be indeed decoded, and along which dimensions the major coding axes reside.

We have now closely followed all these suggestions. We revised Figures 3 and 4 to include all MOCK vs MOCK and MOCK vs naïve comparisons, and we provide the sign of the δ values (figure 3A-B and Figure 4A) together with the significance levels of each matrix entry (per comment number 10). This indeed provides a much better graphical view of the data.

We attempted to train a classifier on a fraction of the activity δ matrix and then to test against the held-out data, but this resulted in overfitting and poor accuracy due to the low number of repetitions. Instead, we performed a principal component analysis on the data (provided in the new figure 7), which clearly decoded between the different task parameters (CS, US etc.). In fact, the first two components sufficed to distinguish between these task parameters (Figure 7 A-B). Consequently, this PC analysis allowed us to assign coding roles to the different neurons (Figure 7C). We now explain this in detail in the Results section, pages 14-16 lines 354 to 392:

“Next, we performed a principal component analysis (PCA) on this difference Matrix. Interestingly, the first two components of the PCA already generated distinct clusters, each cluster representing an experience component (Figure 7A). For example, both CS components (bluish colors, denoted by the difference between trained and the corresponding mock-trained animals, Figure 1—figure supplement 3) are clearly distinct from the US components (green/red colors, denoted by the activity difference between naive and mock-trained animals). Furthermore, even within the experience components, each condition is distinctly clustered…

…Together, these analyses show that experience components are distributed across various neurons that collectively form a unique population code for each of the training paradigms.”

The applied PC analysis is detailed in the methods section (page 35, lines 789 to 802) and Figure 7—figure supplement 1.

“PCA-based filtering of activity deltas Neural activities were averaged across individuals for each trial. Activity deltas of averaged activities (see Figure 1—figure supplement 3) were calculated for the CS, US, and valence differences. All activity deltas for each comparison and trial were aligned in a single vector and subjected to PCA. Using the PC scores and loads from principal components 1, 2, 3, and 5 (out of 35 principal components), we reconstructed the original activity deltas while filtering out 39.1 % of the unrelated variance (Figure 7 C, see Figure 7—figure supplement 1A-C). The filtered activity deltas were then summed and normalized by the mean amplitude of the neuron (contributions of neurons with higher response amplitudes are weighted more). The mean of the six trials for each neuron was used to indicate increase or decrease in the activity, and the standard deviation to provide an estimate of the variance (Figure 7C). To validate the method, we simulated the data and subjected it to PCA-based filtering (Figure 7—figure supplement 1 E-M), allowing us to differentiate between significant and insignificant changes using k-means-based thresholding of the activity changes (Figure 7—figure supplement 1 N).”

Moreover, the possibility that the memory is distributed throughout the chemosensory neurons is further supported by the observation that classifiers trained on portions of the sensory raw activities could confidently classify the underlying memory conditions on the held-out portion of sensory activities (Figure 4K-M, Figure 4—figure supplement 7). In particular, the fact that combining the activities of different sensory neurons increased the prediction accuracy over single sensory neurons (an observation which is not replicated in the scrambled label controls) suggests that information is distributed across the sensory neurons.

We now explain this on page 11, lines 258 to 270:

“As multiple chemosensory neurons changed activity following training in each of the paradigms, we next asked how many neurons need to be considered to accurately describe each of the training-associated states such that their combined activity can distinguish between these training paradigms. We trained several classifiers (including k-means, random-forest, and a neural net) on a fraction of the data, after which we tested the model accuracy on the remaining data (see Methods). All classifiers provided similar results (Figure 4L-M and Figure 4-supplement 7E,F): When considering single neurons only, classification accuracy (measured as F1 scores) was rather low for all sensory neurons (up to 50%), though the scores were significantly higher than randomly expected (Figure 4K and Figure 4-supplement 7). When considering sets of sensory neurons, the decoding of the underlying training paradigm was better the more neurons were added to the model. Combining activities of all chemosensory neurons together resulted in 90% decoding efficiency, irrespective of the classification algorithm used (Figure 4L-M and Figure 4-supplement 7E-F).”

We also toned down the statements in the results part relating to figures 3 and 4, and we state that activity differences may suggest the encoding of certain memory components, rather than directly claiming that they encode the US or CS.

For example, on page 10 lines 229 to 231:

“However, in trained animals (positive and negative), the AWA neurons showed no

responses, suggesting that these changes code the stimulus component.”

On page 10 lines 241 to 243:

“This suggests that the ASER neuron may be coding the stimulus component of the memory as well as the positive (US+) and the negative (US-) experiences of the training paradigms.”

And on page 12 lines 291 to 293:

“This suggests that the AIY neurons, similarly to the AWA neurons, might encode the

stimulus component of the memory.”

We also changed the discussion of the distributed code to better explain its function. We now state that for short-term memories, the sensory neurons participate in population coding, where we can also assign certain coding roles. This sensory population code is then integrated in the interneurons. We address the population code on pages 19 and 20, line 480 to 509:

“Activities of sensory neurons were broadly modulated by short-term experiences (Figure 4A and Figure 7C). The widely-distributed changes in the chemosensory layer suggest that the sensory neurons encode the experience as a population code. Considering modulation of individual neurons only precludes accurate distinction between the training paradigms. But when considering all the chemosensory inputs, the underlying experience could be decoded with sufficient accuracy (Figure 4K-M), further highlighting the notion that the experience code is distributed among the sensory neurons. Within the distributed code of the experience components (Figure 7A,B), the PC-based analysis revealed how activity changes of individual neurons contributed to encoding the CS, the US, or both (Figure 7C and Figure 9C-D). […] The observed activity changes were generally consistent with the experience logic (positive or negative). For instance, in aversively trained animals, switching from DA to BUT leads to ASER activation (Figure 4 E-G), an activation that triggers a reversal behavior (Appleby, 2012; Suzuki et al., 2008) which prevents the animals from moving towards BUT. Changes in other neurons were harder to reconcile. For example, in both negatively and positively trained animals, activity in the AWA neurons was strongly reduced in response to BUT (Figure 4 B-D). Thus, it is presumably the combined modulated activity of all sensory neurons that is being integrated into the downstream interneuron layer to express the adaptive behavioral responses.”

We describe the integration of the sensory outputs on the RIA neurons and how it may underlie the differential choice of direction in trained animals, which is consistent with the lack of changes in command neurons’ activity and reversals. We also further highlight the limitations of our approach including the bias of this study towards certain neurons (pages 23-24, lines 575 to 596):

“Indeed, RIA neurons were shown to participate in formation and forgetting of aversive experiences, suggesting that past experiences may be converged onto RIA interneurons to shape behavioral outputs (Jin et al., 2016; Liu et al., 2022). By contrast, reversal frequency and speed were not modulated. Together with the lack of changes in AVA and AVE activity patterns, these results further support the notion that animal directionality towards the target underlies the enhanced attraction following positive training. Nevertheless, while the correlated changes in behavior and RIA activity hint to a functional link, additional experiments are needed to establish a causal role.

As memories are encoded in a distributed manner, it is presumably the integrative activity of many neurons that gives rise to the modulated RIA activity and the altered choice of directionality. As an integrated code, the impact of a single neurons' activity on locomotion might be limited. The need to consider the integrated response of all components was also evident from analyses of freely-behaving animals, where a population coding, rather the activity of any of the individual neurons, was shown to be a better descriptor of locomotion (Hallinen et al., 2021). Clearly, additional interneurons which control turning rates (e.g. AIB, AIZ, and RIM) and speed (e.g., RIB, SIA, and RMG) (Garrity et al., 2010; Iino and Yoshida, 2009; Lee et al., 2019; Li et al., 2014; Wakabayashi et al., 2004), may also play roles in these memory-induced behavioral modulations, and in fact, some of these neurons had been shown to participate in either memory formation (AIB and RIM) or memory retrieval (AIY and RIA) (Jin et al., 2016). In addition, while we exclusively focused on neurons whose activity was modulated upon memory retrieval, these and other neurons may also contribute to memory formation via transcriptional changes (Freytag et al., 2017; Lakhina et al., 2015).”

2) There are many instances where the authors applied repeated stimulus sequences leading to an inflation of datapoints, which are treated by the respective statistical tests as independent measures. This is incorrect and I fear many of the seemingly statistically significant results could fade-away when properly tested for. In all cases where the authors applied repeated stimuli mean responses per animal should be calculated so that each datapoint corresponds to one animal. In all figure captions n numbers must be indicated.

We have now changed the statistical comparisons so that all of the comparisons are based on individuals rather than on trials. Consequently, some of the comparisons turned out to be insignificant, yet, our main premises remained supported: Sensory neurons still show significant changes following short-term, but not following long-term, training paradigms. In addition, both short and long-term changes are still significantly observed in the interneurons.

Animal numbers are now denoted in every figure caption. Moreover, each animal is represented by a single line in heatmaps or a single dot in the scatter plots. Thus, variance, effect size, and population size, can be unambiguously estimated from the graphs. Consequently, the statistics, heat maps and scatter plots in Figures 3-5 and Figure 2—figure supplement 3-5. Figure 3—figure supplement 1-5, Figure 4—figure supplement 1-4, Figure 5—figure supplement 1-3 had been changed accordingly.

The only exceptions are Figure 4—figure supplement 2V,W; Figure 4—figure supplement 6; Figure 5—figure supplement 3O-T; and Figure 7 —figure supplement 1GandH. These figures address properties that are related to trial-to-trial variance or activity features visible in trials only.

3) I find the results of the regression analysis quite interesting but unfortunately the authors did not control for overfitting, a frequent pitfall in regression procedures particularly when multi-parameter models are used. The authors should devise a cross-validation procedure and report R2 values for held-out test data.

We have now performed the suggested overfitting tests on all of the regression models. These analyses indicated that our conclusions regarding changes in the connections between the sensory neurons and AIY remain valid with slight differences (see details below and Figure 6 and Figure 6—figure supplement 1). In contrast, the resulting R2 values for AIA and RIA were too low, possibly due to the large number of regressors (as these neurons have many more inputs) and the limited number of trials. We therefore removed the regression analysis for AIA and RIA neurons from the manuscript.

More specifically, the R2 scores for AIY (see Figure 6—figure supplement 1 F) were low only for the STAP-Trained and STAV-Trained training paradigms. For all other tested paradigms, R2 values increased as more regressors were included. This prompted us to further test whether our main claim, the change in the regression coefficients, is still supported. Therefore, we plotted individual regression coefficients following re-testing in cross-validation to check if the variation in regression coefficients between conditions persists even if restricted data is used (Figure 6—figure supplement 1G). In this case, the numerical values of the regression coefficients of individual repeats were consistently clustered and their means were not far from the regression coefficient calculated using the full data. More importantly, variation of regression coefficients between memory conditions is still clearly evident when these restricted re-trials of the cross-validation are considered (Figure 6—figure supplement 1G). This supports our notion that these regression coefficients genuinely vary between the different memory paradigms. In the revised version, we raise the limitations of our model and state that the model mainly serves to identify the coefficients, reflecting synaptic communication routes, that are clearly modulated following training. Moreover, we caution that these regression coefficients are no direct metrics for synaptic weights.

We state the new results for AIY neurons, emphasizing that only the identity of the modulated connections can be inferred (page 13-14, lines 320 to 340):

“To study how the modulated activity of the sensory neurons impacts the activity of the interneurons, we considered a simple mathematical model where interneuron dynamics is dictated by a linear combination of the sensory neuron activities. For this, we averaged activities of each trial for each of the sensory neurons across all animals in the different paradigms (Figure 6—figure supplement 1I), and used a multivariate regression analysis to extract the weights that would best fit the activity of the AIY neurons (see Methods). As expected, the more sensory neurons added to the model, the better was the overall prediction of the AIY activity (Figure 6A,D). When considering the combined activity of five sensory neurons types (namely, AWA, AWC, ASE, AWB, and ASG), up to 88% of the variance in the AIY neurons activity could be explained (Figure 6A-D). However, this improved accuracy was detected for the naive and the aversively-trained animals (Figure 6A, pink arrows), while no improvement (compared to when considering AWA alone) was detected for the positively trained animals and the associated mock controls. This lack of improvement suggests that ASER, AWC, ASG, and AWB neurons contribute more to encoding the aversive experiences, while the AWA neurons were the prime contributors to the downstream AIY activity in appetitive experiences (Figure 6C,D). Model evaluation using F-statistics and cross validations indicated that different combinations of sensory neurons should be used to best explain the AIY activity in each of the training paradigms (Figure 6figure supplement 1H). Together, these analyses indicate specific and distinct synaptic routes between the chemosensory neurons and the postsynaptic AIY interneuron are modulated in a paradigm-specific manner (Figure 6E).”

And in the discussion, we highlight the limitations of the our model (page 21-22, lines 542 to 565):

“Population coding requires integration of the coding sensory neurons into downstream neurons, such as the AIY interneuron. A regression analysis revealed that AIY activity can be explained via a simple linear combination of the sensory neurons (Figure 6). This analysis provided a quantitative measure for the relative contribution of the sensory neurons to the overall activity of the AIY neurons. These relative contributions uniquely changed in an experience-dependent manner, suggesting that the identity and the specific modulation of neural communication routes dictate each of the specific memory types. For example, the AWA neurons contributed the most to the modulated activity of AIY neurons in the appetitive paradigms, while AWC, ASER, ASG, and AWB neurons dominated in dictating AIY activity in naive animals and following aversive training (Figure 6E). In that respect, the AWA neurons are associated with attractive stimuli (Bargmann et al., 1993), while the sensory neurons required for aversive conditioning are mostly associated with reversals and avoidance (Gray et al., 2005; Suzuki et al., 2008; Troemel et al., 1997).

Notably, the aim of the linear combination model was to identify modulated synaptic communication routes. The computed regression coefficients, which denote a change in the communication routes, are not a direct measure of the underlying synaptic weights. This is due to the limitations in data acquisition (i.e. frame rate, kinetics of GCaMP, and number of available data points, etc.) and the fact that we measure calcium levels which are only correlates of neural potential. Furthermore, the modulated communication routes may include, in addition to the classical chemical synapses, also electrical gap junctions that were demonstrated to be imperative to form memories in C. elegans (Choi et al., 2020).

Nonetheless, the model reliably revealed specific communication routes (chemical and electrical synapses combined) that changed in an experience-dependent manner.”

In the Supplement, we provide the detailed results concerning the overfitting tests and the verification of the regression coefficient scattering (page 71, lines 2055 to 2071):

“(F) Cross-validation of the multivariate regression model shown in Figure 6. Data for training and testing were randomly split 50/50. Regression coefficients were calculated on half of the data. Then R2 was calculated using these coefficients on the set-aside portion of the data. This procedure was repeated 10 times. Each field denotes the mean of R2. Note that in NAIVE and MOCK conditions the R2 values increase the more neurons are added to the model. In STAP, R2 decreases due to insignificant regressors (ASE, AWC, ASG, and AWB are not significantly contributing to AIY in STAP, see pane I and Figure 6C, and the AWA neurons account for most of the variance).

(G) Cross validation yields low R2 values for STAP and STAV. However, the regression coefficients show robust variation throughout conditions during re-testing. Scatter plots show regression coefficients of the AWA, ASER, ASG, and AWCON neurons as calculated based on the cross-validation shown in panel F. Single dots are regression coefficients of individual retrials. Colored bar represents the cross-validation mean and the black bar denotes the regression coefficient when using the entire data. Despite the low R2 values in cross-validation (F), the regression coefficients are consistently different across the various training paradigms, suggesting that the changes in the regression coefficients are genuine and generalizable.”

In the Methods section, we explained why regression analysis could not be extended to AIA and RIA neurons (page 34, line 785 to 787):

“Multivariate regression analysis could not be extended to AIA and RIA neurons because

there were too many input neurons (regressors) opposed to too few data points.”

4) AWCon and AWCoff in the multi-neuron recordings were classified based on high/low responses in MOCK, a classifier that was empirically inferred from imaging experiments performed in a marker line. This classifier seems unambiguous in STAP MOCK only, but how were AWCon and AWCoff classified in the multi-neuron experiments in all other conditions"?

There were two types of experiments, one consisting of butanone only, and the other involving butanone/diacetyl exchange.

In the latter case of butanone/diacetyl exchange, there was no ambiguity in assigning the individual AWC neurons. In all animals of the pan-sensory neuron strain, the two AWC neurons responded differently to each of the stimuli: One of the AWC neurons responded following diacetyl removal (butanone presentation) while the other neuron responded during butanone removal (diacetyl presentation). The activation dynamics in the latter case followed precisely the dynamics observed in the AWCON-specific marker line, exhibiting a slow rise in activity across all conditions (compare panels F and J in Figure 2—figure supplement 3, and also evident in the heatmap shown below). Consequently, the neuron responding during butanone removal was assigned as AWCON. The other AWC neuron showed a fast activation following diacetyl removal (butanone presentation). While this was not fully reproduced by the AWCOFF-specific marker line (Figure 2—figure supplement 3 L and H), by elimination, we designated this AWC neuron as AWCOFF. This issue also constitutes the activity discrepancy which we address in comment number 5 below.

When classifying the AWC neurons in the butanone only experiments, both neurons respond to butanone removal (Figure 3). While there might be ambiguity in our identification and neural assignment, we note that in our marker strains with known AWC identities, the AWCOFF neuron consistently showed a stronger transient activation with a fast rise time and high amplitude followed by a slow decline towards baseline (see Figure 2—figure supplement 3 C upper line). In contrast, AWCON activation showed lower amplitudes and a slower rise time. We therefore designated the neuron with the lower response amplitude (during the 15 seconds post stimulus exchange) as AWCON and the neuron with the higher response amplitude as AWCOFF(compare Figure 2—figure supplement 3 A vs C).

Thus, in the majority of the response traces, the two neurons show marked differences in their activation patterns. We also agree that in a few instances, we may have wrongly assigned traces to neurons as ambiguity arises when both neurons respond with similar magnitudes (which really concerns only a few cases). However, when averaging over all traces to get the population mean, such possible erroneous assignments cancel out and the mean activity provides a good depiction for each neuron.

To corroborate this, we trained a k-means classifier on the response activities from the known reporter line (traces shown in Figure 2—figure supplement 3C). We then used this classifier to assign traces to neurons in the pan-sensory reporter line. We found almost identical assignments across all conditions, except for STAVT animals in which the AWCON neuron showed slightly higher activation. The results are provided in Author response image 2.

Author response image 2. Classifying AWC neurons based on simple activity thresholds and on k-means classification yields almost identical population mean activities.

Author response image 2.

In image rows labeled as ‘k-means’, AWC neurons were classified by k-means trained on activation features (such as, amplitudes,steepest ascend/descend, minimum, maximum etc) of AWC activities of known identities (data shown in Figure 2—figure supplement 3). In image rows labeled as ‘Threshold’, AWC neurons are classified by the overall activity within a 15 second window. (A) shows comparisons of neurons classified as the weakly activated AWC neuron (AWCS which correspond to AWCON). (B) shows comparisons of neurons classified as the weakly activated AWC neuron (AWCS which correspond to AWCON). When comparing ‘Threshold’ and ‘k-means’ graphs, note that the population means are extremely similar (identical in most cases). The only evident differences occurred in aversively-trained animals in short-term memory (light red curves). In some of the groups individual neurons have been classified differently by the two methods. This demonstrates that differentially classifying ambiguous cases has very little impact on the overall mean. In both classification methods, the conclusion that AWCON neurons increase activity in Short-term but not long-term is supported. Given that k-means performed with only ~88 % accuracy on the training data, we feel more confident with the activity threshold method as it is also more in line with the experimenter's experience after visually reviewing the data.

Nevertheless, we have now revised the manuscript and refer to these neurons as AWCW, for the weakly activated neuron, and AWCS for the strongly activated neuron (Figure 3 and Figure 2—figure supplement 3, Figure 3—figure supplement 2 and 3). However, when referring to the population means we refer to these neurons as AWCON and AWCOFF, respectively.

We now explain how we assigned the neurons in the legend of Figure 2—figure supplement 3, page 55-56, lines 1595 to 1620:

“AWC neural activities in the pan-sensory strain were classified into strongly responding (AWCS) and weakly responding (AWCW) AWC neurons as in each animal the two AWC neurons showed marked differences in response amplitude. This classification is consistent with the activation pattern observed in the reporter strain with known AWC identities:

(A,B) When using the pan-sensory reporter strain (Posm-6::GCaMP), the two AWC neurons exhibited distinct activities in response to butanone removal. One neuron showed high magnitude responses in trained and mock-trained animals for both short-term positive (STAP) and short-term aversive (STAV) training paradigms (denoted as AWCS). The second neuron exhibited weak responses in mock-trained animals (designated as AWCW), but robust strong responses following STAV and STAP training. Note the differences in mean activity between the conditions in the AWCW neuron (line graphs, n=9-15).

(C,D) Imaging activity of both AWC neurons where the identity of AWCON and AWCOFF is known. Here, the AWCOFF neuron showed strong responses to butanone removal in both trained and mock-trained animals. These dynamics correspond to the AWC high neuron shown in panel A. Accordingly, AWCON matches the dynamics corresponding to AWC low

(compare line graphs below, n=6-16).

Note that in naive and mock-trained conditions, one of the AWC neurons is inactive (or very weakly active). Hence, we termed this neuron as AWCw (weak) while the other active neuron we termed AWCS (strong). In the trained conditions, both neurons are activated, though there is a clear distinction between their amplitudes.

Based on the activation patterns obtained from the known AWC-identity reporter strains, activation of the AWCOFF neurons is usually faster and higher than that of AWCON. Hence, at the neural population dynamics of the weakly activated AWC (AWCW) and the stronger

activated AWC (AWCS), it is plausible to identify them as AWCON and AWCOFF, respectively.”

In the result section of the main text, where we first address AWC neurons, we reference these observations by directing the reader towards Figure 2—figure supplement 3 and introducing the AWCW neuron, page 8 line 181 to 187:

“For example, while the AWCW neuron (identified as AWCON, see Figure 2—figure supplement 3) shows mild innate responses to BUT in naive and mock-trained animals, its response activity was significantly heightened following short-term appetitive (STAP) and short-term aversive (STAV) training paradigms (Figure 3C-F). Since the sole difference between the trained and the corresponding mock-trained animals was the presence of the CS (BUT) during the training period, the differential activity suggests that the AWCW neuron may be coding the stimulus component of the memory.”

5) AWC and AWA (Figure S21, S7E-L) show different results in different imaging lines. I think the authors do not provide a convincing explanation for this.

We believe the variable response is due to the transgenic lines where over-expression of reporter proteins, and presumably more so of a calcium indicator, may affect and divert responses of specific neurons under specific conditions. Specifically, GCaMP expression is associated with modulated synaptic and circuit properties (Singh et al. 2018; Steinmetz et al. 2017). Consequently, in some cases, reporter strains with different expression levels may show variable activities. In particular, such cases may appear when assaying multiple neurons across many different conditions. We note that the vast majority of the data shows high consistency. For example, at high butanone concentrations, responses of the AWC neurons in the multisensory line are consistent with the neuron-specific marker line (Figure 2—figure supplement 3A-D). Similarly, at higher butanone concentrations, there is no difference in the responses of the AWA neurons between the multi-sensory reporter line and the neuron-specific line.

Furthermore, we note that for the AWA neurons, both reporter lines encode the memory yielding the same valence logic: in the pan-sensory line, aversively-trained animals showed an increased response upon switching from butanone to DA. In the AWA reporter line, appetitively-trained animals showed a heightened response upon switching from diacetyl to butanone (Figure 4—figure supplement 4 M-N). Thus, in these opposite-valence trained animals, the outputs maintain the same functional logic.

Also, to verify that the multi-sensory reporter line is not defective, we analyzed its training-induced behavioral outputs and found that they were consistent with the behavioral outputs of WT animals (Figure 4—figure supplement 5).

In the revised version, we raise the variable activity and suggest that this difference might be due to variable GCaMP expression loads.

In the caption of Figure 2—figure supplement 3 and Figure 4—figure supplement 4, pages 54 and 64, respectively:

Page 56, lines 1630-1635:

“Note that AWCOFF presumably got sensitized to diacetyl removal while in the naive state still maintaining vestiges of butanone sensitivity (see H). As the two reporter strains have vastly different degrees of GCaMP expression and GCaMP expression has been shown to alter synaptic transmission and firing properties of neural networks (Singh et al., 2018; Steinmetz et al., 2017), it is likely that these variable activities are due to differences in GCaMP expression.”

Page 66, lines 1877 to 1879:

“We believe these variable activity patterns to be the result of variable GCaMP3-expression load in our reporter lines.“

[Editors’ note: what follows is the authors’ response to the third round of review.]

The manuscript has been improved and all reviewers are very enthusiastic about having the revised paper published in eLife, but there are some remaining issues that need to be addressed, as outlined below:

Please consider suggestions by Reviewer #1 on AIY activity and similar changes in AP and AV paradigms. Also, please consider suggestions (1) – (4) by Reviewer #3. We look forward to the revised version rather soon.

Reviewer #1 (Recommendations for the authors):

The revised manuscript has further improved by addressing concerns raised in previous reviews.

More specifically, the authors have further analyzed their data by focusing on paradigm-specific activity of sensory neurons in response to BUT – DA stimulation patterns. This focus allowed them to see more robust effects generated by different types of experience to better support the data interpretation. Their interpretation also improved and are now more supported by the results.

Their focus on using the linear combination of presynaptic sensory activities to explain AIY activity is appropriate given the sample size and variabilities of their imaging results across animals and across trials. It is informative to see that AIY activity can be explained by those of anatomically connected sensory neurons. It is worth noting that AIY activity is best explained by the activities of sensory neurons under mock conditions. This might suggest the role of these neurons in responding to the US experience, not necessarily the association of CS with US.

Agreed, and in the results part, where we address AIY regression, we have now included this observation (Page 14, lines 337-342):

“Overall, the highest portion of variance that explains AIY activity was obtained in the mock-trained animals, suggesting that the US experience alone may dominate the sensory-to-AIY input weights. This is particularly evident for the appetitive conditioning where the presence of food alone yielded a better fit to AIY activity than the training regime consisting of food and BUT combined.”

The principal component analysis in Figure 7 and supplementary figures is an improvement on data analysis and useful in dissecting complex neural responses in a large number of different imaging conditions implemented in this study.

Another clear feature of the neurons characterized here is that they seem to show similar patterns of activity changes in AP and AV paradigms (for example, as shown in Figure 5 for sensory neurons AWA, interneuron AIY and AIA; for AWC in Figure 3; for RIA in response to DA-BUT stimulation pattern). Although AP and AV paradigms showed different effects on RIA in response to control-BUT stimulation, it is not clear how the changes relate to chemotaxis behavior. The authors speculate this feature as one indicator for combinatorial effects. This is possible but remains to be tested in future studies.

We agree and we now restate that RIA is one of several possible neurons that mediate the sensory changes to the observed modulated behavior (pages 23-24, lines 593-607).

“As the animals’ reversal frequency and speed were not modulated (and no changes in AVA and AVE activity patterns were observed either), RIA is a possible candidate that could underlie the observed change in directionality. However, it is impossible to tell whether animals changed directionality due to RIA-induced head swing bias, or alternatively, due to reorientation mediated by command neurons (e.g., AVA, AVE) since we tracked animals as center mass points. Also, activity changes in RIA neurons were significant though small, thus raising the question whether these changes are large enough to mediate the observed trained phenotype. Moreover, additional interneurons that control turning rates (e.g. AIB, AIZ, and RIM) and speed (e.g., RIB, SIA, and RMG) may also play roles in these memory-induced behavioral modulations (Garrity et al., 2010; Iino and Yoshida, 2009; Lee et al., 2019; Li et al., 2014; Wakabayashi et al., 2004). In fact, some of these neurons had been shown to participate in either memory formation (AIB and RIM) or memory retrieval (AIY and RIA) (Jin et al., 2016). Thus, additional experiments are required to support the functional role of RIA plasticity in shaping the learning-dependent behavioral outputs.”

When analyzing locomotion in chemotaxis, the revised study removed the results on long-term training and focused on short-term training. The results are easier to be understood than before. The short-term training paradigms modulated the directionality toward the CS, but not the speed and reversal frequency.

As a whole, the study produced a large collection of activity recordings in a handful of sensory neurons and a few interneurons with the goal to explain chemotaxis behaviors under 4 learning paradigms. Although more work is needed to explain how these activity patterns relate to behavior, the collection of data provides hypotheses for future studies on function of the neurons implicated in the learning paradigms based on calcium imaging results and provide useful references for similar studies in the field.

Reviewer #3 (Recommendations for the authors):

Upon revision, authors made a good job to improve the quality and readability of the manuscript. Additional evaluation of data was performed such as cross validation of linear regression and classification models, which adequately evaluates authors' assertions and strengthen them.

The concern by reviewer #3 was appropriately addressed, with the exception of the following.

This reviewer recommends publication of the paper because it is a comprehensive analysis which adds precious information to the research community, provided that the presentation flaws as listed below are corrected.

1) As previously pointed out, definition of "trials" needs to be explicitly provided. It is understandable that reflecting the revision history, there are several different protocols for the imaging experiments. For this reason, authors need to carefully try to avoid confusion for the readers. In the current version, the figure depicting "trials" appear in Figure 6—figure supplement 1I, while the word first appears in the text in line 255 where authors say "most animals (or trials) showed homogeneous responses", and here, readers may be puzzled. In Methods, there is also no such word, though it is described that repeated stimuli were applied in experiments in Figure 2B and Figures4-5.

Indeed, and to avoid possible confusions, we now explicitly explain what we mean by ‘trial’ early on in the in Results section (Page 11, lines 253-255):

“(in the following, the term ‘trial’ refers to individual BUT/DA exchanges, where animals underwent six cycles of such trials (exchanges), Figure 4-supplement 6A).”

We also added the definition of ‘trials’ to the Methods section (Page 29, lines 704-705):

“Each BUT presentation/removal is referred to as a ‘trial’.”

And on line 710:

“Note that in Figures 4-7, the BUT/DA exchanges are referred to as trials.”

2) p23, page 581: related to the previous comment by reviewer #1 (third in Major point), there is not enough basis provided in this paper that leads to the conclusion that head swing control (klinotaxis which RIA has been implicated) is the major mechanism that causes learning-dependent modulation of chemotaxis. The other major mechanism known, klinokinesis, involves changes in the turning frequency DEPENDING ON chemical concentration changes, where animals backup and turn more frequently when facing away from the odor source and odor concentration decreases upon its locomotion. It would also cause the deviation angle smaller.

Indeed, and as also explained above in response to reviewer #1, we have now restated and toned down our conclusion regarding RIA (Pages 23-24, lines 596-607):

“However, it is impossible to tell whether animals changed directionality due to RIA-induced head swing bias, or alternatively, due to reorientation mediated by command neurons (e.g., AVA, AVE) since we tracked animals as center mass points. Also, activity changes in RIA neurons were significant though small, thus raising the question whether these changes are large enough to mediate the observed trained phenotype. Moreover, additional interneurons that control turning rates (e.g. AIB, AIZ, and RIM) and speed (e.g., RIB, SIA, and RMG) may also play roles in these memory-induced behavioral modulations (Garrity et al., 2010; Iino and Yoshida, 2009; Lee et al., 2019; Li et al., 2014; Wakabayashi et al., 2004). In fact, some of these neurons had been shown to participate in either memory formation (AIB and RIM) or memory retrieval (AIY and RIA) (Jin et al., 2016). Thus, additional experiments are required to support the functional role of RIA plasticity in shaping the learning-dependent behavioral outputs.”

3) p19, line466 and later: It is convincing that AIY changes its activity after LTAV training in DA-BUT imaging experiments. On the other hand, changes in RIA are not convincing. Figure 5G,H, RIA response is suggested to be increased, but it looks like the conclusion is based on two outlier animals. Also in Figure 3—figure supplement 4K/L, RIA activity looks increased even without BUT stimulus. Therefore, long-term changes in RIA activity needs to be toned down, at least in the discussion (where RIA is so heavily discussed in the current version). As authors depicted in Figure 9B, it is clear through the extensive data by the authors on sensory neurons that there are virtually no changes in the sensory neuron responses after long-term memory, but the behaviors change. As a logical consequence, interneuron activities need to be changing. However, observed changes are limited to AIY LTAV so far, and therefore hitherto unobserved changes may underlie the behavioral changes, for example that of AIB or any other neurons in the circuit.

We agree, and we have now toned down our conclusions for RIA. We refrain from presenting RIA as the functional link between modulated sensory activities and the modulated behavioural output, and instead, we state that RIA is one of possible interneurons (not included in this study) that could exert this function (see point above).

Also in the discussion, we note that we refer to the short term memory only (and not the long term) and how it is reflected in the AIY and RIA activities (page 23, lines 585-588):

“Behavioral assays following short-term training revealed that positively-trained animals were more directed towards the CS, while negatively-trained animals were significantly less directed (Figure 8C-D). Interestingly, aversive training also inflicted significant changes in sensory-specific responses of the RIA neurons (Figure 5G,H). As the RIA neurons …”

And following this paragraph, we state that it is probably the integrative activity that underlies the directionality bias (lines 608-609):

“As memories are encoded in a distributed manner, it is presumably the integrative activity of many neurons that gives rise to the altered choice of directionality.”

4) p18 line 450: It is misleading to suggest sensory neurons are not involved in long-term memory. Authors only looked at calcium level in sensory neurons. However, there are multiple cases known in C. elegans and other animals where synaptic output machinery is modulated by learning, which is not reflected in calcium imaging of the sensory neurons; rather, it will be reflected in the response of downstream interneurons.

We agree and we have now stated accordingly that sensory neurons can still code long-term memory via synapses (Page 18 lines 462-464):

Moreover, sensory neurons may still be coding long-term memories via modulation of the synaptic output, which is not reflected by soma calcium activity (Oda et al., 2011).

To avoid confusion in that section between these separate neural functions we also replaced the term “sensory neurons” by the more explicit “sensory neuron’s activity”.

5) It is a bit of a concern that in cross validation in Figure 4—figure supplement 7A, authors used all individual animals for training the model, especially given that any single neuron can be a predictor, which suggests overfitting. However, revisions are not requested on this as per the principle of the journal.

We agree and we have now repeated the analysis when splitting by animals rather than by trials. We have now added this analysis to the supplementary figure (Figure 4 and Figure4-supplement 7F):

“(F) When trials per animal are averaged and animals are partitioned in training and test data using 80/20 split, the classification error increases. All classifiers still perform better than scrambled label controls. In particular, the neural net performs three times better than expectation and clearly shows an increase in accuracy as neurons are added to the model. The neural net was composed of three layers with 50, 40, and 70 neurons, respectively. K-means nearest-neighbor used the distances to the next nine data points. The random forest consisted of 350 decision trees.”

We also added to the methods section a paragraph that describes this newly added analysis (page 34lines 786-790):

“When cross-validating the results after splitting the data into training and test data based on animal repeats, we obtained similar results, though with higher classification error.

Thus, classification accuracy could benefit from adding more animals per training group (see ‘between individuals’, Figure 4-supplement 7F).”

Associated Data

    This section collects any data citations, data availability statements, or supplementary materials included in this article.

    Data Citations

    1. Pritz CO, Itskovits E, Bokman E, Ruach R, Gritsenko V, ‎Nelken T, Menasherof M, Azulay A, Zaslaver A. 2020. Principles for coding associative memories in a compact neural network. Open Science Framework. 5v4qu [DOI] [PMC free article] [PubMed]

    Supplementary Materials

    Transparent reporting form

    Data Availability Statement

    All neuronal activities and behavioral data sets together with the associated analyses scripts are available in https://osf.io/5v4qu/ and https://github.com/ChristianPritz/Principles-for-coding-associative-memories-in-a-compact-neural-network (copy archived at Pritz, 2022) respectively.

    The following dataset was generated:

    Pritz CO, Itskovits E, Bokman E, Ruach R, Gritsenko V, ‎Nelken T, Menasherof M, Azulay A, Zaslaver A. 2020. Principles for coding associative memories in a compact neural network. Open Science Framework. 5v4qu


    Articles from eLife are provided here courtesy of eLife Sciences Publications, Ltd

    RESOURCES