(a) We recorded the behavior of larvae expressing CsChrimson in one or two pairs of MBONs and classified their responses to a 15 s red light stimulation as approach-like (blue larva), avoidance-like (red larva), or neutral by comparing them to controls. Approach-like responses are characterized by significantly decreased turning and/or increased crawling speed in response to an increase (at the onset of optogenetic activation), and/or increased turning and decreased crawling in response to a decrease in MBON activity (at the offset of optogenetic activation). Avoidance-like responses are characterized by the reverse responses. We classified MBONs whose activation suppresses turning and promotes approach as positive-valence MBONs (blue in b–i), and those whose activation promotes turning and promoted avoidance as negative-valence MBONs (red in b–i). (b–g) Behavioral response to optogenetic activation of MBONs (GAL4 lines indicated in italic; see Figure 2—figure supplement 1 for expression patterns). Turn angle (deg) is the absolute value of the distance from the least-squares line fit of the posterior 2/3 of the animal’s spine points to the point in the anterior 1/5 of the animal’s spine most distant from that line. Left, schematics depicting compartments innervated by MBONs, colored according to memory induced when odor is paired with DAN activation in that compartment: appetitive (blue), aversive (red), or unknown (gray, Eschbach et al., 2020). Middle, time series of mean (+/− s.e.m) turn angle (top) and crawling speed (normalized to baseline prior to stimulation, bottom). Shading indicates the period of optogenetic activation. Right, the difference between the experimental (red or blue dots with error bars) and control (dotted line at 0) turn angle (top) and crawling speed (bottom) averaged over a time window after the onset (0–5 s, normalized to baseline before light) and offset (2–7 s. after light off, normalized to baseline during light) of optogenetic stimulation. Note that the control animals (black curve in b–g) display a slightly aversive response to the onset of red light used for optogenetic activation. The control is the empty GAL4 line y w;attP40;attP2 crossed to UAS-CsChrimson (Nexp = 343, Nlarvae >10,000) for all lines except for MBON-e1 (g) for which the control line is yw;;attP2 crossed to UAS-CsChrimson; tsh-GAL80. Plots are mean +/− s.e.m. *: p < 0.05, **: p < 0.01, ***: p < 0.001 (Welch’s Z test). (b) Activating the two calyx-MBONs induced opposite responses: approach and avoidance, for MBON-a1 (Nexp = 7, Nlarvae = 250) and MBON-a2 (Nexp = 7, Nlarvae = 280), respectively. (c) Activating peduncle-MBONs, MBON-b1/b2 together (Nexp = 8, Nlarvae = 340) induced approach. MBON-c1 activation had no significant effect (Figure 2—figure supplement 2). (d) Activating medial lobe MBONs induced avoidance: MBON-h1/h2 (Nexp = 10, Nlarvae = 450), MBON-i1 (Nexp = 6, Nlarvae = 240), and MBON-k1 (Nexp = 6, Nlarvae = 210). MBON-j1 activation had no significant effect (Figure 2—figure supplement 2). (e) Activating the lateral appendix-MBON-d1 (Nexp = 9, Nlarvae = 250) induced approach. MBON-d2 and -d3 activation did not have a significant effect (Figure 2—figure supplement 2). (f) Activating the vertical lobe-MBONs induced approach: MBON-g1/g2 (Nexp = 6, Nlarvae = 210) and MBON-m1 (Nexp = 9, Nlarvae = 450). (g) Activating the two MBONs in the tip of vertical lobe had opposite effects: MBON-e2 (Nexp = 5, Nlarvae = 140) and -e1 (Nexp = 6, Nlarvae = 250, using tsh-GAL80 to eliminate nerve cord expression) induced avoidance- and approach-like responses, respectively. Note that most negative-valence MBONs innervate appetitive-memory com- partments (3/5), and the remainder innervate compartment with unknown roles. By contrast, most positive-valence MBONs (4/6) innervate aversive-memory compartment, and the remainder innervate compartments with unknown roles. (h) Schematic showing a naive state (left) and two main mechanisms (right) potentially enabling the MB network to switch from encoding positive or neutral to negative valence after aversive learning. Left, In a naive state KC-connections to positive- and negative-valence MBONs is similar. Right, (i) aversive learning depresses the synapse between the conditioned odor-KCs and positive-valence MBONs (Hige et al., 2015b), skewing the balance towards negative-valence MBONs. (ii) Decreased conditioned odor drive to inhibitory positive-valence MBONs can disinhibit the negative-valence MBONs. (i) Synaptic-resolution circuit diagram from Eichler et al., 2017 overlaid with MBON neurotransmitter profiles also from Eichler et al., 2017 and valence (b–g), reveals lateral inhibition between MBONs that encode opposite valence. Blue rim, positive-valence; red rim, negative-valence; grey rim, no behavioral effect; purple; not tested. Arrows, excitatory cholinergic; bars, inhibitory GABAergic; squares, glutamatergic, likely inhibitory (Liu and Wilson, 2013) connections; circles, unknown neurotransmitter. Vertical and horizontal bars, source (i.e. emitting projections), sink (i.e. receiving projections), or transfer MBONs (i.e. emitting and receiving projections).