To measure both aspects of these bidirectional behavioural responses within the same set-up, we used fruitflies (Drosophila melanogaster) that had undergone odour-discrimination learning reinforced by electric shock4 (Fig. 1a). All experimental groups received the same amount of odour–shock training. The only variable was the interstimulus interval (ISI), which was the interval between the onset times of exposure to the odour for association (the ‘trained’ odour) and to the shock (Fig. 1a). Training sessions were repeated four times and were separated by a 20-minute rest in a food vial.

Figure 1: Bidirectional behavioural plasticity in associative learning.
figure 1

a, Experimental procedure. Odour stimuli for conditioning: benzaldehyde and 3-octanol (ref. 11; presented for 15 s each; green boxes); unconditioned stimulus: electric shock (90 volts, 4 pulses within 16 s; pink lines). The odours are aversive to naive flies. The interstimulus interval (ISI) between the onset of the trained odour B and the shock is varied between groups, whereas the interval between the control odour A and shock is the same for all groups (−150 s). Relative preferences for odours A and B were compared between reciprocally trained groups (that is, the ones for which benzaldehyde was the trained odour were compared with the ones for which 3-octanol was the trained odour); the learning index was calculated as the difference between these preferences divided by two, to yield values between 100 and −100. b, Systematic analysis of conditioned behaviour (learning index, mean±s.e.m.) as a function of the ISI. Pink shading indicates duration of the electric shock. Conditioned behaviour was significant for the groups with ISI of −23 s, +3 s, +32 s and +42 s (P<0.005; one-sample t-test against zero). The significance level of each test was adjusted to 0.005 with a Bonferroni correction to avoid false positives by multiple tests.

The conditioned behaviour was tested 15 min after training in a forced-choice situation, by counting how many animals chose either a control or the trained odour (odour A or B, respectively; Fig. 1a). Positive learning indices indicate conditioned avoidance of the trained odour, whereas negative scores indicate conditioned approach to it.

During testing, flies showed opposite responses to the trained odour (either conditioned avoidance or approach), depending on the temporal sequence of odour and shock that they had experienced during training (Fig. 1b). If the odour preceded the shock, flies showed conditioned avoidance (for ISIs of −23 s and −3 s; P<0.005; Fig. 1b). However, when the shock preceded the odour, flies showed conditioned approach (for ISIs of +32 s and +42s; P<0.005; Fig. 1b). We conclude that flies were able to associate the same odour with either danger or safety. Control groups trained using very long ISIs gave no evidence of learning (for example, for ISIs of −83 s or +187 s, P>0.005 for forward or backward control, respectively; Fig. 1b).

We found that the effect of shock turns from punishing to rewarding in a time window around shock application (pink shading in Fig. 1b). This indicates that odours can act as predictors of danger when they precede shock during training but, owing to a long-lasting after-effect of shock, they can also be used to predict safety when they follow shock during training. Conditioned avoidance was stronger than conditioned approach (P<0.05, t-test: ISI, −23 s compared with +32 s). This quantitative comparison is possible because the two aspects of timing-dependent behavioural plasticity were directly measured within the same set-up, rather than indirectly2,5.

Bidirectional synaptic plasticity has a comparable dependence on timing: the sequence of two inputs determines whether synapses are potentiated or depressed6,7,8. This characteristic would lead to bidirectional associative learning if it occurred during association formation at the neuronal convergence site of odour and shock. Alternatively, the dual and opposing behavioural effects of shock could reflect a bidirectional modulation of internal reinforcement signalling, as found in mammalian dopaminergic neurons9,10. It will be interesting to investigate whether the appetitive effect of shock in flies shares a common neuronal circuitry with reward processing4. The detailed characterization of the rewarding after-effect of negative reinforcement should advance our understanding of the behavioural consequences of traumatic experience.