Introduction

Affect sharing, or emotional contagion, is a fundamental capacity that enables individuals to share others’ emotional states, forming the basis of empathy1,2,3. This phenomenon occurs when the perception of others’ emotional states automatically activates the same neural networks responsible for the first-hand experience, leading to elicitation of corresponding emotions and behaviors in the observer4. Observational fear, in which an observer witnesses a demonstrator receiving painful stimuli and responds with fear behaviors, is a basic feature of affect sharing5,6. In rodents, this socially evoked vicarious freezing behavior is considered a measure of empathy-like traits1,7. The anterior cingulate cortex (ACC), a key brain region involved in pain perception, negative affect, and social cognition, is activated both during direct pain experience and when observing others in pain8,9. Similarly, ACC activity in mice is enhanced under conditions of observational fear10,11 and plays an essential role in the acquisition of vicarious freezing6. However, despite evidence supporting the involvement of affective pain systems in observational fear6,12,13, it remains uncertain whether pain-responsive neurons in the ACC represent vicarious freezing behavior.

Empathizing with the pain of others aids in the immediate perception and avoidance of threats to oneself14. A recent study using an observational fear paradigm with auditory cue-predicted shocks demonstrated that the dorsomedial prefrontal cortex (PFC) mediates the social observation-based association of threat signals with discrete environmental cues15. Likewise, the ventromedial PFC neurons represent escape behaviors through observation of a demonstrator’s distress responses16. However, despite the integral role of affect sharing in shaping these socially learned fear or avoidance behaviors in observers17,18, the nature of vicarious freezing triggered by others’ distress encoded in the ACC remains elusive. While previous studies have attempted to define observational fear by recording individual ACC neuron activities in shock-experienced animals using tone-based fear conditioning19,20, the ACC is not essential in mediating the acquisition of observational freezing in shock-experienced observers21. Therefore, it is crucial to elucidate how ACC neural ensembles encode empathic freezing responses in naïve observers with no prior exposure, as this closely reflects emotional contagion, unaffected by previous aversive experiences6,10,22,23,24.

In this study, we explored the ensemble dynamics of ACC neurons encoding observational fear in freely moving naïve animals using fluorescent calcium (Ca2+) imaging. To elucidate the nature of the shared information responsible for vicarious freezing, we systematically compared ACC activity patterns associated with an observer’s freezing induced by various aversive conditions, including witnessing others’ pain, experiencing direct pain, and observing a threatening object. By imaging the same neurons across multiple behavioral sessions, we demonstrated that stable ACC population dynamics representing pain-induced negative affect constitute vicarious freezing over time. Using activity-dependent labeling with targeted recombination in active populations (TRAP), circuit-specific Ca2+ imaging, and optogenetic manipulation, we further determined that periaqueductal gray (PAG)-projecting ACC neurons distinctly encode emotional pain information, and play a role in regulating both observational fear and affective-motivational pain behaviors. Overall, we propose that the neural signature of vicarious freezing in the ACC embodies the affective capacity to experience the pain of others by observation rather than the neural correlates of fear emotion transfer.

Results

ACC pyramidal neurons encode observational fear

To explore how neuronal ensembles in the ACC encode observational fear (Fig. 1a), we performed in vivo miniature endomicroscopic Ca2+ imaging during observational fear conditioning (OFC). To optically record from ACC excitatory pyramidal cells, an adeno-associated virus (AAV) expressing the fluorescent Ca2+ indicator GCaMP6f, under the control of the Ca2+/calmodulin-dependent protein kinase IIα promotor (AAV-CaMKIIα-GCaMP6f), was injected into the right hemisphere of the ACC, and a gradient refractive index (GRIN) relay lens was implanted above the injection site (Fig. 1b). Histological confirmation was performed to verify GCaMP6f expression and lens placement (Fig. 1c). Relative fluorescence signal changes (dF/F) in putative cell bodies (Fig. 1d, f) were extracted by processing recorded images using MIN1PIPE25, resulting in recordings from a total of 724 neurons from 12 mice.

Fig. 1: Identification of ACC pyramidal neurons encoding observational fear.
figure 1

a Schematic of observational fear conditioning (OFC). During habituation, the observer (OB) and demonstrator (DM) mice were individually placed in separate chambers and allowed to explore for 5 min. During conditioning, the OB mouse observed the DM mouse receiving foot shocks through a transparent partition for 4 min. b Illustration of microendoscopic Ca2+ imaging in the right hemisphere of ACC. c Representative image showing GCaMP6f expression in individual cell bodies and the GRIN lens tract above the ACC. Green, GCaMP6f; blue, DAPI. Scale bar, 50 μm. d Example field of view image showing raw Ca2+ fluorescence signals. e Schematic of three behaviors – OB-freezing, DM-reaction, and DM-freezing – during OFC. f Example denoised Ca2+ traces from cells responsive to OB-freezing (pink), DM-reaction (blue), and DM-freezing (yellow) in d. g Receiver operating characteristic (ROC) curves from example neurons for OB-freezing that are excited (auROC = 0.79), inhibited (auROC = 0.28), and non-responsive (auROC = 0.50). h Venn diagrams illustrating neurons responding to OB-freezing, DM-reaction, and DM-freezing. i Example field of view from d depicting the spatial distribution of cells encoding the three behaviors during OFC. j Pairwise distances among different subsets of cells (Data) were compared to those from randomly shuffled behavior labels (Shuffled). Sample size of OB-freezing = 2,933; DM-reaction = 955; DM-freezing = 1,715. The pairwise distance among cells encoding DM-reaction was significantly reduced compared to the shuffled data (Two-sided unpaired t-test with Welch’s correction, t = 3.437, df = 1008, p = 0.0006). k Heatmap of example neurons and trial-averaged responses from OB-freezing, DM-reaction, and DM-freezing cells around behavioral onsets. l Proportions of excited and inhibited cells corresponding to each of the three behaviors. n = 12 mice. m Example Ca2+ traces of excited and inhibited individual neurons selectively responding to OB-freezing (pink), DM-reaction (blue), or DM-freezing (yellow) behaviors. Colored blocks indicate each behavior bout. Source data are provided as a Source Data file. P-values in the graphs are indicated as follows, *** p < 0.0001. All data are presented as means ± S.E.M.

During OFC, the demonstrator experiences pain during the shocks, which can be observed through pain-squeaks (a distress vocalization in the audible range) and immediate nocifensive movements such as jumping or running, and fear between the shocks, which is conveyed through freezing6,20. These demonstrator’s pain and fear serve as distress signals that can be transmitted to and alter the observer’s affective states and, manifesting as in freezing behaviors. This emotional transmission from the demonstrator to the observer suggests that a defensive emotional state is triggered in the observer. Notably, the observer’s ‘vicarious freezing’ is considered a reliable behavioral index of emotional contagion1,7,26. Thus, to investigate the neural basis of affect sharing, we specifically aimed to determine whether individual pyramidal neurons in the ACC selectively represent the observer’s vicarious freezing (referred to as OB-freezing) (Fig. 1e). Observing others in pain activates both emotional and sensory components of the pain matrix27. Intriguingly, a previous study demonstrated that the ACC in shock-experienced rats contains emotional mirror neurons that respond both when the observer experiences pain and when it witnesses a demonstrator receiving shock, but not while experiencing fear emotion20. To investigate whether ACC neural activity in naïve observers witnessing specific emotional states (fear or pain) in demonstrators shows similarities and differences compared to the observer’s first-hand emotional experiences, and to determine if it is associated with (1) OB-freezing behavior, we measured ACC neuronal activity corresponding to two other behavioral states of the observers (Fig. 1e): (2) when witnessing the demonstrator showing reflexive responses to electric shocks (DM-reaction), and (3) when witnessing the demonstrator exhibiting freezing behavior (DM-freezing). DM-reaction behaviors, such as pain-induced squeaks, jumping, or running, encompass the demonstrator’s immediate reflexive reactions to nociceptive stimuli, which we interpreted as a sensory-discriminative aspect of shock pain28,29,30. DM-freezing reflects the affective aspect of pain experienced by the demonstrator after receiving shocks31,32.

To identify Ca2+ activities of neurons tuned to each of these behavioral states, we employed a receiver operating characteristic (ROC) analysis that quantifies event detection strength by comparing the behavior mask with a range of binarized signals (Fig. 1g; Methods)33. Our findings revealed that a substantial fraction (58%) of ACC pyramidal neurons showed significant responses during OFC (Fig. 1h). Among the observed neurons, 34% encoded OB-freezing, 19% represented DM-reaction, and 24% were associated with DM-freezing. The spatial distribution of OB-freezing and DM-freezing cells was not discernibly different from a randomized distribution, indicating that these neurons are spatially scattered and intermingled. Intriguingly, the pairwise distance of DM-reaction cells was significantly reduced compared with a random distribution, suggesting that these neurons are spatially clustered in the ACC (Fig. 1i, j). Given that the ACC receives inputs from various brain areas representing diverse sensory stimuli34,35, it is conceivable that DM-reaction–responsive pyramidal neurons are anatomically organized in close proximity and engage in processing multisensory information during OFC. The behavior-encoding neurons displayed either excited or inhibited activity patterns that aligned with specific behavioral epochs (Fig. 1k, m), and the ratio of excited to inhibited neurons was approximately balanced across different groups of behavior-encoding cells (Fig. 1l and Supplementary Fig. 1a–c). Taken together, these results demonstrate that individual pyramidal neurons in the ACC are distinctly recruited to different behavioral states of the observer during OFC.

Mixed selectivity of single ACC neurons across repeated OFCs

Next, we investigated whether the encoding of these behavioral states remains stable or is reconfigured in individual ACC neurons, specifically for the vicarious freezing response reflecting affect sharing in mice. Notably, observer mice subjected to a second OFC session (OFC2) with stranger demonstrators presented in a different chamber displayed vicarious freezing levels comparable to those observed in OFC1 (Supplementary Fig. 2a, b). To determine whether neurons encoding specific behaviors were consistently represented, we performed in vivo Ca2+ imaging in repeated OFC tasks (Fig. 2a). In the OFC2 session, 53% of the recorded neurons responded to at least one behavior, including 30% of OB-freezing cells, 19% of DM-reaction cells and 19% of DM-freezing cells, proportions similar to those observed in OFC1 (Fig. 2b and Supplementary Fig. 3a, b; chi-square test, p > 0.05). An examination of neurons encoding each behavioral event across repeated OFC tasks revealed that approximately 23% of OB-freezing cells and 15% of DM-freezing cells overlapped between the two sessions, percentages that were not statistically significant (Fig. 2c and Supplementary Fig. 4a; shuffle test, p > 0.05)36. Intriguingly, 18% of overlapping cells encoded DM-reaction, a percentage that was greater than that expected due to chance level (shuffle test, * p = 0.02), implying that DM-reaction–responsive neurons are consistently involved in processing multisensory information while observing a demonstrator experiencing foot shocks. During repeated OFC tasks, we observed neurons that remained stable, lost responsiveness, gained responsiveness, or changed their responsiveness from being activated to being inhibited or vice versa (Fig. 2d, e and Supplementary Fig. 5a–d). Overall, neuronal responses in the ACC were highly dynamic, and the majority of identified neurons displayed mixed selectivity. Only a small subset of cells overlapped across repeated OFC tasks, indicating substantial reconfiguration of individual neurons specifically tuned to behavioral events during observational fear. Our data strongly suggest that behavior-relevant information is encoded by a collective ensemble of neurons rather than individual neurons.

Fig. 2: Stable representation of vicarious freezing shared with affective pain experience.
figure 2

a Schematic of behavior sessions for Ca2+ imaging. The experiment was conducted in the order of OFC1, OFC2, and Direct-shock sessions. b Venn diagrams illustrating neurons responsive to OB-freezing, DM-reaction, and DM-freezing during OFC2. c Relative proportion of overlapping cells across behavior pairs, showing neurons exclusive to one session (OFC1 or OFC2) or to both. See also Supplementary Fig. 3. d, e Alluvial plots of OB-freezing cell responses across OFC1 and OFC2. d Proportions of cells exclusive to OB-freezing (‘Only’) or shared with other behaviors (‘Mixed’). e Ratios of excited and inhibited cells responsive to OB-freezing across sessions. See also Supplementary Fig. 4. f, l Schematic illustrating the procedure for training OFC datasets and testing LDA classifiers to decode neuronal activity in OFC2 f or Direct-shock l. g LDA decoder performance predicting three behaviors during OFC2 using OFC1 data (left) and mean decoding accuracy matrix between OFC1 and OFC2 (right). (n = 6 mice; Two-sided multiple t-test with Holm-Šídák post hoc test, t = 4.239, p = 0.0081). h Schematic of Shock-freezing and Shock-reaction behaviors in Direct-shock. i Venn diagrams of neurons responsive to these behaviors during Direct-shock. j Relative proportion of overlapping cells across behavior pairs, showing neurons exclusive to one session (OFC1 or Direct-shock), or to both. k Alluvial plot illustrating changes in neuronal responsiveness from OB-freezing cells to Shock-freezing or Shock-reaction cells across OFC1 and Direct-shock sessions. m LDA decoder performance predicting Shock-freezing or Shock-reaction behaviors during Direct-shock session using OFC1 data (left) and mean decoding accuracy matrix between OFC1 and Direct-shock (right). (n = 12 mice; Two-sided multiple t-test with Holm-Šídák post hoc test: OB-freezing vs. Shock-freezing, t = 3.647, p = 0.0038; OB-freezing vs. Shock-reaction, t = 3.202, p = 0.0084. OB-fz: OB-freezing, DM-fz: DM-freezing. Source data are provided as a Source Data file. ** p < 0.01. All data are presented as means ± S.E.M.

We then investigated whether ACC neurons establish consistent activity patterns that encode observational fear at the population level. To this end, we constructed classifiers using Linear Discriminant Analysis (LDA) population decoding33, which allowed us to examine whether mouse behavior in OFC2 could be predicted using the Ca2+ activity pattern of ACC neurons from OFC1 (Fig. 2f). Before assessing the predictive performance between OFC1 and OFC2, we confirmed successful intra-OFC1 session decoding of individual behaviors — OB-freezing, DM-reaction, and DM-freezing. However, high performance of this decoder in predicting one behavior did not extend to prediction of the remaining two behaviors, implying that each behavior is distinctly encoded at the population level within a single session (Supplementary Fig. 6a, b). We next evaluated the decoder’s performance by quantifying the degree of similarity between the predicted behaviors and the actual behaviors observed in OFC2. Remarkably, the ACC population ensemble specifically tuned to OB-freezing in OFC1 achieved significantly higher performance compared to randomly shuffled data (Fig. 2g). Furthermore, the OB-freezing ensemble in OFC1 significantly predicted OB-freezing in OFC3 (Supplementary Fig. 6d–g), demonstrating the stability of this neural representation across multiple sessions. However, the decoding accuracy for the other two behavioral events (DM-reaction and DM-freezing) did not reach statistical significance. Additionally, we found no significant correlations between inter-individual behavioral differences and the LDA performance in either observers or demonstrators. These findings strongly support the notion that specialized neural ensembles are consistently recruited to encode vicarious freezing behavior across consecutive OFC sessions.

Shared ACC neural ensembles for vicarious freezing and affective pain experience

Neural representations of an observer’s direct pain experience in the ACC are reactivated during the perception of pain in others8,37,38. However, the role of ACC neural activity involved in direct pain experiences in the context of observational fear remain unknown. To address this, we investigated whether ACC neurons, specifically those tuned to vicarious freezing, were consistently represented when an observer mouse experienced direct pain. During a Direct-shock session, the observer’s behavioral response to shocks, including jumping, running, or distress vocalization, were classified as a sensory-discriminative aspect of shock pain (referred to as Shock-reaction)28,29,30, while freezing behavior following foot shocks was defined as an affective pain experience (Shock-freezing)31,32 (Fig. 2h). Approximately 70% of recorded pyramidal cells in the ACC participated during the Direct-shock session, with 30% engaged exclusively in Shock-freezing, 25% involved in Shock-reaction behavior, and the remaining 45% participating in both behaviors (Fig. 2i). Analysis of overlapping neurons encoding behaviors for OFC1 and Direct-shock session revealed re-engagement across sessions of approximately 19% of responsive cells between OB-freezing and Shock-freezing, 16% between DM-reaction and Shock-reaction, and 23% between OB-freezing and Shock-reaction (Fig. 2j, k and Supplementary Fig. 5e, f). However, these percentages did not reach statistical significance (Supplementary Fig. 4b). We next investigated whether the population activity encoding OB-freezing could represent any behavioral states during a Direct-shock session. Remarkably, the OB-freezing classifier, trained on data from OFC1 (Fig. 2l), was a significant predictor of emotional pain (Shock-freezing) response, but not sensory pain (Shock-reaction) behaviors, during the Direct-shock session. By contrast, classifiers for DM-reaction and DM-freezing from OFC1 failed to decode any behavioral states during Direct-shock session (Fig. 2m). Collectively, these results indicate that, whereas direct pain experience and observational fear activate distinct single-cell ensembles in the ACC, neural population dynamics encoding the observer’s vicarious freezing remains robust during affective pain responses after experiencing foot shocks.

Non-social stimuli elicit observer freezing but evoke distinct ACC population dynamics

To investigate whether the shared activity pattern between vicarious freezing in OFC and Shock-freezing in the direct-shock sessions was a consequence of similar freezing behavior mediated by emotional arousal or perceptual salience, we designed an Object-threat conditioning task using a programmable wireless spherical robot as a non-social stimulus. During the 5-minute habituation period, the robot was controlled to move slowly using custom-written code. In the conditioning period, the object rapidly rolled around and stopped 20 times, providing non-social visual and auditory stimuli analogous to those experienced by a demonstrator mouse receiving electrical shocks in the OFC protocol (Fig. 3a; Supplementary Movie 1). Intriguingly, the observer’s freezing response elicited by the Object-threat stimulation was comparable to that induced by a conspecific demonstrator (Fig. 3b).

Fig. 3: Encoding of behaviors induced by the threatening object.
figure 3

a Schematic of Object-threat test. During habituation, the OB and the object were individually placed in each chamber. The OB was allowed to explore freely, while the object was controlled remotely via Bluetooth to move in random directions for 5 min. During conditioning, the OB mouse observed the object moving rapidly and occasionally bumping into the walls for 4 min. b Freezing levels (%) in OBs during Object-threat test were compared to those during OFC with conspecific DMs (right). Freezing levels during the day-2 24-hour memory retrieval, where OBs were placed alone in the same chamber, without the object or DMs (left). Demonstrator: n = 17, Object: n = 11 c Top: Schematic of Object-threat followed by OFC1 for Ca2+ imaging. The experimental chamber was changed to a striped context, the same context used in OFC2. Bottom: Three annotated behaviors during the Object-threat test: Threat-freezing, Obj-moving, and Obj-stationary. d Venn diagrams showing proportions of cells encoding Threat-freezing, Obj-moving, and Obj-stationary during the Object-threat session. e Schematic illustrating the procedure for training OFC datasets and test LDA classifiers to decode neuronal activity during the Object-threat session. f LDA decoder performance (n = 6 mice) predicting Threat-freezing, Obj-moving or Obj-stationary during the Object-threat session using OFC1 data (left) and mean decoding accuracy matrix between OFC1 and Object-threat test (right). Source data are provided as a Source Data file. All data are presented as means ± S.E.M.

To determine whether ACC neural dynamics encode the observer’s freezing during Object-threat conditioning, we analyzed different behavioral events — when the observer exhibited freezing in response to the object’s threatening movement (Threat-freezing), when the moving object displayed rapid movements or bumping (Obj-moving), and the object’s motionless state (Obj-stationary) (Fig. 3c) — mirroring the approach used in the OFC. Notably, the proportions of recruited ACC neurons significantly differed from those observed in OFC1 sessions with a conspecific demonstrator (Fig. 3d and Supplementary Fig. 3d). Although a subset of neurons responded to both vicarious freezing and Threat-freezing, the number of overlapping cells between the two sessions did not reach statistical significance. Furthermore, the LDA population classifier trained to decode vicarious freezing did not significantly predict any behavioral states in the Object-threat session (Fig. 3e, f), indicating that ACC neural representations of Object-threat responses differ from those observed in OFC, despite the absence of discernable differences in the observer’s freezing behavior between the two tasks. These findings suggest that ACC activity responsive to socially evoked vicarious freezing in the observer may encode neural representations for pain-induced negative affect that are distinct from those for arousal or fear saliency per se.

Highly unstable encoding of ACC inhibitory neurons across multiple behaviors

Cortical inhibitory neurons display distinct modulation patterns in response to sensory stimuli, motor behaviors, brain states, and neuromodulatory inputs39,40,41. In our previous work, we demonstrated that somatostatin (SST)-expressing interneurons in the ACC bi-directionally regulates observational fear, with optogenetic silencing of SST neurons enhancing vicarious freezing and activation of SST neurons reducing this behavior42. Moreover, our recent Ca2+ photometry experiments revealed a decrease in SST neuronal activity concurrent with the onset of the observer’s vicarious freezing behavior22. Based on these findings, we hypothesize that ACC inhibitory neurons encode specialized representations of distinct behavioral modalities during OFC. To test this, we investigated the contribution of GABAergic inhibitory neurons in the ACC to the encoding of observational fear. We injected an AAV expressing Cre-dependent GCaMP8f into the right ACC of VGAT (vesicular GABA transporter/ Slc32a1)-Cre mice43 and recorded Ca2+ activity (Fig. 4a, b). In total, we recorded Ca2+ activity from 368 VGAT-positive interneurons during the series of behavioral tasks, similar to our recordings of ACC pyramidal cells (Fig. 4c). Single-neuron responses analysis revealed that the GABAergic population also contained a substantial fraction of cells encoding observational fear. In OFC1, 36%, 29%, and 28% of all monitored neurons exhibited responses to OB-freezing, DM-reaction, and DM-freezing, respectively (Fig. 4d), proportions not significantly different from those observed in pyramidal neurons (Supplementary Fig. 3e). GABAergic neurons coding for observational fear behaviors were spatially intermixed in the ACC (Fig. 4e, f), and the ratio of excited to inhibited interneurons tuned to individual behaviors was approximately balanced across different types of behaviors, similar to the results observed in pyramidal cells (Supplementary Fig. 1). Notably, a subset of interneurons responsive to OB-freezing was significant across repeated OFC tasks (Fig. 4g and Supplementary Fig. 4c; shuffle test, ** p = 0.002). However, a population-level analysis showed that LDA classifier performances failed to differentiate neuronal responses from those of shuffled data across all behavioral states in repeated OFC tasks (Fig. 4h), despite successful intra-OFC1 session decoding of each behavior (Supplementary Fig. 6c).

Fig. 4: Unstable representations of ACC interneuron across multiple behaviors.
figure 4

a, b Schematic of GABAergic interneuron imaging in the ACC of the VGAT-Cre mice during OFC. Example image showing GCaMP8f expression and the GRIN implantation tract in individual interneurons, and raw image of the field of view showing raw Ca2+ fluorescence. Green, GCaMP8f; blue, DAPI. Scale bar, 200 μm. c Schematic of behavior sessions for Ca2+ imaging in ACC interneurons. The experiment was conducted in the order of OFC1, OFC2, and Direct- shock sessions. d Venn diagrams illustrating proportions of OB-freezing, DM-reaction, and DM-freezing cells in OFC1 and OFC2. e Example image showing the spatial distribution of cells responding to three behaviors. f Pairwise distributions of each behavior-encoding cells compared with shuffled data where trial labels were randomized. g Venn diagrams showing the proportion of overlapping cells between OFC1 and OFC2. The ratio was calculated by comparing the sum of behavior-encoding cells in OFC1 and OFC2. See also Supplementary Fig. 3c. h, k, n Left: Performance of LDA decoders trained to predict behaviors in OFC2 (n = 5 mice; h, Direct-shock (n = 11 mice; k, and Object-threat (n = 6 mice; n using OFC1 data, compared to models constructed using shuffled class labels. Right: Mean decoding accuracy matrix for comparisons among behaviors in OFC1 and OFC2 h, OFC1 and Direct-shock k, and OFC1 and Object-threat n. OB-fz: OB-freezing, DM-fz: DM-freezing. i Venn diagrams showing proportions of Shock-freezing and Shock-reaction neurons in the Direct-shock session. j Venn diagrams illustrating the proportion of overlapping cells between OFC1 and Direct-shock. l Schematic of behavior sessions for Ca2+ imaging in ACC interneurons. The experiment was conducted in the order of OFC1 and Object-threat sessions. m Venn diagrams showing proportions of Threat-freezing, Obj-moving, and Obj-stationary cells in Object-threat. Source data are provided as a Source Data file. All data are presented as means ± S.E.M.

In a subsequent direct-shock session, approximately 70% of recorded ACC interneurons were responsive, with 41% specifically responding to Shock-freezing and 49% responding to Shock-reaction behaviors (Fig. 4i). Although a subset of GABAergic neurons displayed overlapping responsiveness between OFC1 and direct-shock sessions (Fig. 4j), none of these showed a statistically significant increase (Supplementary Fig. 4d). Furthermore, a population decoder trained on data from OFC1 failed to significantly predict any categorized behavioral states during direct-shock sessions (Fig. 4k). When observer mice were subjected to the Object-threat task, 41%, 33%, and 38% of cells were responsive to Threat- freezing, Obj-moving, and Obj-stationary, respectively (Fig. 4l, m). Similar to pyramidal neuronal responses, the LDA population decoder trained on data from OFC1 failed to predict any categorized behavioral states during Object-threat sessions (Fig. 4n). Collectively, our data suggest that the population activity of GABAergic neurons in the ACC does not consistently represent the shared neural information encoding observational fear.

PAG-projecting ACC neurons encoding vicarious freezing and affective pain response

Given the diverse functional responses exhibited by individual ACC neurons, we next investigated the information flows from the ACC to downstream subcortical regions during observational fear. Utilizing a reporter line generated by crossing FosCreERT2 mice with the Ai14-tdTomato reporter strain44, we conducted c-Fos tagging experiments to identify neurons activated during OFC (Fig. 5a). One hour after OFC, 4-hydroxytamoxifen (4-OHT) was administrated to observers paired with demonstrators experiencing foot shocks (OF-experienced group) and those paired with demonstrators receiving no shocks (Control group). The brain regions were purposefully selected based on their relevance to the affective pain network45,46, with a focus on downstream targets connected to the ACC, including the basolateral amygdala (BLA), periaqueductal gray (PAG), nucleus accumbens (NAC), and three midline thalamic nuclei (MD: mediodorsal thalamus; CL, centrolateral thalamus; PF, parafascicular thalamus). We observed a significant increase in the number of Fos-positive (activated) neurons in the ACC, basolateral amygdala (BLA), and the periaqueductal gray (PAG) of OF-experienced observer mice compared to control mice (Fig. 5b, c). Based on these findings, we focused on ACC neurons projecting to the PAG or BLA, as these regions are known to mediate emotional valence, social aversive learning, pain modulation, defensive behavior, and observational fear learning6,15,19,23,47,48.

Fig. 5: PAG-projecting ACC neurons encode vicarious freezing and affective pain experience.
figure 5

a Schematic of FosTRAP and experimental timeline. b Representative TdTomato-positive cells in the ACC, PAG, and BLA of the control and OFC-experienced mice. In the control group, OB mice were exposed to non-shocked DM. c Quantification of Ai14-positive TRAPed cells across seven brain regions (ACC, anterior cingulate cortex; PAG, periaqueductal gray; BLA, basolateral amygdala; NAC, nucleus accumbens; MD, mediodorsal thalamus; CL, centrolateral nucleus of the thalamus; PF, parafascicular nucleus of the thalamus; n = 5 (control) and n = 7 (OFC-experienced); two-sided unpaired t-test with Welch’s correction, Holm-Šídák post hoc test: ACC, t = 2.235, p = 0.049; PAG, t = 2.865, p = 0.025; BLA, t = 3.926, p = 0.002). d, f Left: Schematic of virus injections into the ACC, PAG d, and BLA f. AAV-DIO-GCaMP8f was infused into the right ACC, and retrograde AAV-Cre was infused into the right PAG d or the right BLA (f). Right: Example images of injection site showing GCaMP8f expression and raw images of the field of view with individual cell bodies. Green, GCaMP8f; blue, DAPI. e, g Venn diagrams showing behavior-encoding cells in PAG- projecting e and BLA-projecting g ACC neurons during OFC and Direct-shock. Scale bars: white, 200 μm; yellow, 50 μm. h - k Histograms showing the likelihood of any LDA decoder performance level compared with 0.5 (chance level; dotted line) in the ACC neurons projecting to the PAG h, i and the BLA j, k. The OB-freezing classifier based on OFC1 showed higher performance in predicting OB-freezing in OFC2 h, two-sided shuffle test, p = 0.004) and Shock-freezing during Direct-shock i, two-sided shuffle test, p = 0.04) in PAG-projecting cells, but not in BLA-projecting cells j, k. Source data are provided as a Source Data file. * p < 0.05, ** p < 0.01, All data are presented as means ± S.E.M.

To explore how observational fear information is represented in ACC → PAG and ACC → BLA populations, we monitored Ca2+ dynamics using dual-viral tracing approach. Retrogradely traveling virus carrying Cre-recombinase was injected into the PAG or BLA and virus mediating Cre-dependent expression of GCaMP8f was injected into the ACC, respectively. A GRIN relay lens was implanted into the right ACC (Fig. 5d, f). We observed a total of 312 ACC neurons projecting to the PAG and 280 cells projecting to the BLA. The proportions of neurons tuned to OB-freezing, DM-reaction, and DM-freezing behaviors in the OFCs were comparable between ACC → PAG and ACC → BLA pathways (Fig. 5e, g and Supplementary Fig. 7; chi-square test, p > 0.05), and the fractions of excited and inhibited neurons responsive during OFC1 were similar between the two populations. To extend the population analysis to the circuit-specific ACC subpopulation, we concatenated all recorded neurons within each group of mice (Fig. 5h; Methods). Notably, during repeated OFC sessions, the LDA decoder showed significantly greater performance towards the ACC → PAG neural population specifically responsive to OB-freezing behavior compared to shuffled data (Fig. 5i). Moreover, in a subsequent direct-shock session, the ACC → PAG population encoding OB-freezing behavior in OFC1 demonstrated significantly higher fidelity in predicting Shock-freezing behavior, although it did not exhibit the same accuracy in predicting Shock-reaction sensory responses (Fig. 5j). The decoding accuracy for all these behavioral states in the Object-threat task did not exceed chance levels (Supplementary Fig. 8), consistent with our imaging data from the entire ACC pyramidal neuron population (Fig. 2). In contrast, the LDA decoder performance was not significant for ACC → BLA populations across multiple behavioral sessions (Fig. 5k, l). Taken together, these findings suggest that the PAG-projecting ACC subpopulation is stably recruited to represent vicarious freezing in OFC and encodes shared information of emotional pain responses after experiencing aversive stimuli.

The ACC-to-PAG circuit controls observational fear and affective pain processing

Given the selective and robust neural representation of vicarious freezing and emotional pain responses in ACC neurons projecting to the PAG, we hypothesized that the ACC → PAG top-down neural pathway conveys pain-induced negative affect information to modulate observational fear. To test this, we examined the behavioral effect of silencing ACC → PAG or ACC → BLA circuits using optogenetic approaches. Specifically, AAV-CaMKIIa-NpHR-eYFP was injected into the right ACC, followed by bilateral implantation of optic fibers above the BLA or PAG (Fig. 6a, b). Notably, optogenetic silencing of the ACC → PAG circuit markedly decreased vicarious freezing behaviors in observer mice (Fig. 6c, d). Consistent with a previous study23, mice expressing NpHR in the ACC → BLA circuit also exhibited a significant decrease in observational fear response compared to eYFP-expressing control mice (Fig. 6e). Suppression of ACC → PAG or ACC → BLA neurons had no impact on freezing behavior in response to the threatening movement of the non-social object (Supplementary Fig. 9a–c) or during classical fear conditioning (Supplementary Fig. 9d–f). Collectively, these results indicate that both ACC → PAG and ACC → BLA pathways are selectively required for the acquisition of observational fear.

Fig. 6: ACC-to-PAG circuit regulates observational fear and affective pain behaviors.
figure 6

a, b Injection and implantation strategy for optogenetic inhibition of the ACC terminals projecting to the PAG a, d, g; n = 18 (eGFP); n = 24 (NpHR)) or BLA b, e, h; n = 18 (eGFP); n = 25 (NpHR)). Representative confocal images showing virus expression in the right ACC and bilateral placement of optic fibers in the PAG or BLA. Scale bar, 200 μm. Green, eGFP; Blue, DAPI. c Experimental paradigm for optogenetic inhibition during OFC. A yellow laser was delivered bilaterally during the 4-minute conditioning period. d Optogenetic silencing of the ACC → PAG circuit significantly impaired the acquisition of vicarious freezing (%) in observer mice during the conditioning period of OFC (two-way repeated measures ANOVA, Bonferroni’s post hoc test, F(1, 40) = 5.130, p = 0.0290). e Optogenetic inhibition of the ACC → BLA pathway significantly reduced vicarious freezing response (two-way repeated measures ANOVA, Bonferroni’s post hoc test, F(1, 41) = 13.11, p = 0.0008). See also Supplementary Table. 1. f Schematic of the experimental paradigm for optogenetic inhibition in the PEAP. A yellow laser was delivered bilaterally for 30 minutes. Mice received noxious mechanical stimulus (pin prick) on the dark side and innocuous stimulation on the light side. g, h The mean time (%) spent on the light side for the optogenetic inhibition of the ACC → PAG circuit (g) and the ACC → BLA circuit (h). g Optogenetic inhibition of the ACC → PAG circuit significantly reduced the time spent on the light side compared to the control group (two-way repeated measures ANOVA, Bonferroni’s post hoc test, F(1, 40) = 21.21, p < 0.0001). h Optogenetic suppression of the ACC → BLA circuit did not result in significant alterations in the time spent on the light side. Source data are provided as a Source Data file. * p < 0.05, ** p < 0.01, *** p < 0.001. All data are presented as means ± S.E.M.

To assess the contribution of ACC → PAG and ACC → BLA circuits to affective dimension of pain behavior, we employed the place escape/avoidance paradigm (PEAP), which quantifies the level of unpleasantness evoked by a painful stimulus by assessing the willingness of a subject to escape/avoid a preferred area when it is associated with noxious stimulation49,50. During the 30-minute testing session, we measured the percentage of time spent by the mouse on the light side of the testing chamber, designated for mechanically innocuous stimuli, as opposed to the dark side, where painful pin-prick stimuli were administered (Fig. 6f). We observed that control, eYFP-expressing animals exhibited a shift in preference from the preferred dark side of the chamber to the non-preferred light side, spending 60–80% of their time in the light side of the chamber. However, inhibition of the ACC → PAG circuit significantly attenuated escape/avoidance behavior, as demonstrated by a reduction in the duration of time spent on the light side of the chamber (Fig. 6g). In contrast, optogenetic silencing of the ACC → BLA circuit did not affect escape/avoidance behaviors (Fig. 6h). Given that the OB-freezing classifier trained on data from OFC1 significantly predicted Shock-freezing during the Direct shock session (Fig. 2o), we applied optogenetic inhibition specifically during the inter-shock interval, where Shock-freezing is primarily induced. Remarkably, inhibition of the ACC → PAG circuit, but not the ACC → BLA circuit, significantly reduced Shock-freezing behavior in the observers who received direct shocks (Supplementary Fig. 9g–i). Collectively, these results suggest that neural ensembles in the ACC modulate observational fear through their projections to distinct downstream targets. Specifically, the ACC → PAG circuit plays a pivotal role in regulating both vicarious freezing behavior and affective pain response.

Discussion

The neural mechanisms underlying how the perception of others’ distress is encoded and represented in the ACC are poorly understood. Although the observer’s vicarious freezing serves as a proxy measure of affect sharing1,7, the precise mechanism by which ACC neural representations encode observational fear remains elusive. In this study, using endoscopic Ca2+ imaging, we discovered that the neural representation of the affective dimensions of pain in the ACC constitutes the basis for processing of distress signals that ultimately lead to vicarious freezing behavior. Notably, we further established that a subpopulation of ACC neurons projecting to the PAG form distinct ensembles dedicated to encoding affective pain processing, possibly play a pivotal role in driving vicarious freezing as an expression of emotional contagion in observer mice. Taken together, these results demonstrate a functional role for the neural representation of emotional pain in shaping observational fear and present a neural mechanism for cortical control of affect sharing.

Our findings reveal that individual ACC neurons were dynamically reconfigured during repeated OFC tasks, aligning with prior studies that highlighted cortical instability associated with behavioral flexibility15,16,51,52,53. Intriguingly, despite this neuronal reconfiguration, our population-decoding analysis revealed a stable representation of vicarious freezing in ACC pyramidal neurons across multiple behavioral tasks. Notably, this population activity pattern was specifically associated with emotional responses after experiencing direct pain. However, these shared ACC activities do not extend to the sensory qualities of pain28,29,30 or conditioned fear startle responses to electric shock54, or fear emotions induced by a non-painful threatening object. Although we cannot entirely rule out the potential involvement of fear contagion mediated by other brain regions24,55,56, our findings strongly suggest that the neural representation of vicarious freezing in the ACC is intimately linked to the affective experience of pain. Furthermore, our results are consistent with human neuroimaging studies that have provided evidence for the selective activation of the affective-motivational dimension of the pain matrix, but not the sensory-discriminative component of pain, when observing others’ pain8,38. This selective activation is considered as the neural basis of affective empathy. Similarly, our findings of shared activity patterns between empathic freezing and affective pain responses suggest that observational fear may represent the behavioral manifestation of socially evoked, pain-induced negative affect processing in the ACC1,7,9.

In observational fear, the demonstrator’s expressions of pain and freezing behaviors in response to aversive painful shocks serve as social cues, eliciting vicarious freezing in the observer6,57. A previous study showed that ACC neurons exhibit mirror-like activity, encoding the observation of a demonstrator’s pain using a neural code shared with first-hand sensory pain experiences20. In a tone-based observational fear paradigm using shock-experienced rats, most of ACC neurons did not respond to a freezing-conditioned sound, but exhibited increased firing rates in response to distressed vocalizations and jumping behaviors of demonstrators experiencing foot shocks. However, we found no significant overlap between ACC neurons responsive to the observation of demonstrator’s sensory pain states (DM-reaction) during OFC and those responsive to the observer’s own Shock-reaction behaviors. During OFC, the timing of the demonstrator’s freezing does not tightly synchronize with that of the observer, and observers do not copy the demonstrator’s jumping behavior during shocks10,20,58. This suggests that the observer flexibly triggers responses adequate to its own affective states rather than stereotypically mimicking the demonstrator. In accordance with these findings, our current study shows that the ACC neural activity of observers witnessing demonstrators’ fear or pain does not mirror the observer’s first-hand emotions. The majority of ACC neurons that respond to DM-reaction or DM-freezing show differential activity and population-wide instability during repeated OFC and Direct-shock sessions. Although the precise mechanism remains unclear, this discrepancy is likely due to prior shock experiences. The OFC paradigm with naïve observers measures emotional contagion behaviors in response to witnessing foot-shock experience in others without the influence of prior shock experience6,10,22,23,24. In contrast, the OFC task utilizing previously shocked observers primarily assesses freezing behaviors that are significantly potentiated by the observer’s own memory recall, triggered by witnessing distress responses in demonstrators11,19,20,21,59,60,61. Despite similarities in behavioral outcomes, it is crucial to acknowledge the significant distinctions in the underlying neural mechanisms regulating OFC in naïve observers compared to mice with previous shock experience7,62. Notably, the ACC, which plays an integral role in affective empathy in humans8, is not essential for mediating the acquisition of observational fear in shock-experienced observers. Instead, hippocampal-amygdala fear conditioning circuits are crucial for mediating observational freezing in these animals21. In the current study, we sought to elucidate the nature of the observer’s vicarious freezing encoded in the ACC. To ensure that the observed vicarious freezing behavior more closely mirrors emotional contagion, unaffected by previous aversive experiences, we employed naïve observers with no prior shock exposure7,22,23,24.

Cortical interneurons exhibit heterogeneity in their functional roles, contributing to local computational processes and differentially modulating the excitatory output63. We observed that, although a subset of inhibitory neurons displayed overlapping responsiveness, the population dynamics of ACC interneurons were not stably recruited to encode observational fear and affective pain responses across multiple behavioral sessions. These findings highlight the neural heterogeneity of the GABAergic interneurons involved in encoding observational fear, potentially reflecting differential retuning mechanisms in inhibitory neuronal subpopulations53,64. Our prior work has shown that SST interneurons in the ACC gate the degree of observational fear response. Notably, the reduced Ca2+ activity of SST interneurons directly correlates with the observer’s vicarious freezing behavior, and inhibitory synaptic transmission in SST neurons in the ACC bi-directionally controls observational fear response22,42. SST neurons are known for their heterogeneous functions, each characterized by distinct molecular genetic profiles and specialized functional connectivity65,66, enabling them to send inhibitory outputs to both pyramidal neurons and other interneuron types. Future studies employing a Cre- and Flp-dependent intersectional approach to directly compare activity changes across different interneuron populations will help elucidate the ACC inhibitory microcircuit dynamics mediating observational fear.

The ACC is a key affect-sharing node that plays a role in mediating the emotional aspects of pain as well as encoding information about the affective state of others by interacting with distinct downstream targets9,60,67,68. OFC results in increased activity in the ACC and several of its downstream targets, notably the PAG and BLA — key nodes of the circuitry involved in a range of affective and motivated behaviors45,46. We found that the activity of PAG-projecting ACC neurons selectively represented shared population information encoding both vicarious freezing and the emotional pain response. Echoing this, we have established a critical role for ACC → PAG communication, demonstrating that manipulation of activity in ACC → PAG inputs regulates both observational fear and affective pain avoidance behaviors. Inhibition of either the ACC → BLA or the ACC → PAG circuit significantly reduced the observer’s vicarious freezing. Interestingly, however, circuit-specific optogenetic silencing showed a distinct alteration in PEAP-affective pain avoidance behavior. Suppression of the ACC → PAG circuit during the PEAP test impaired the ability to associate the painful aversive stimulus with a negative emotional state, an effect that was not observed following inhibition of the ACC → BLA circuit.

During observational fear, multisensory information may appear to be processed in the ACC and transmitted to the BLA and PAG, where it substitutes for the representation of the social unconditioned stimulus to express fear. The BLA is considered one of the fundamental neural structures for encoding negative and positive affective valences69,70. BLA neurons are responsible for encoding the negative affect of pain perception and play a role in processing socially derived aversive memory information during cue-dependent observational fear learning19,71. Importantly, interactive communication within the reciprocal ACC-BLA circuitry through synchronized hippocampal theta oscillations is necessary for the expression of observational fear23. The PAG coordinates emotion-related sensorimotor functions and serves as a hub for descending pain control, suggesting its involvement in negative affective processes48,72,73. Blocking endogenous opioid circuits increased observational fear in humans by altering activity in several brain areas, including the PAG12. Moreover, neuroimaging studies demonstrates that observing others’ pain selectively activates the affective pain network, and activation of the PAG correlates with the level of empathic response, further highlighting the PAG’s significant role in emotion-related cognitive processes38,74. Therefore, our current study extends previous research showing that an observer’s vicarious pain experience may mobilize the affective pain matrix12,13,45, with activation of the ACC → PAG pathway feeding into the emotion of fear. However, given that the ACC is critical for integrating negative affect, pain, and cognitive control, future studies will need to further examine the differential roles played by BLA or PAG neurons in processing aversive distress signals during observational fear.

In summary, our study provides functional evidence for the neural representation of affective pain in shaping observational fear and highlights distinct neural circuit mechanisms involved in encoding and processing unique information for affect sharing. These findings advance our understanding of the neural basis of affective empathy in humans.

Methods

Animals

All experiments were approved by the Institutional Animal Care and Use Committee of the Institute for Basic Science (IBS, IBS-2023-042). Male C57BL/6 J mice were housed 2–5 animals per cage and were maintained in a controlled vivarium under a 12/12-hour light/dark cycle (light on: 08:00 AM, light off: 08:00 PM), at 23–25 °C, and 50% humidity. The mice used in the experiments were 12 to 15 weeks old. Food and water were available ad libitum. The following Cre-driver lines were used for microendoscopy or activity tagging experiments: B6J.129S6(FVB)-Slc32a1tm2(cre)Lowl/MwarJ (Vgat-Cre; JAX strain 028862) mice expressing Cre recombinase directed to inhibitory GABAergic neuron cell bodies, STOCK Fostm2.1(icre/ERT2)Luo/J (FosCreERT; JAX strain 030323) mice expressing a tamoxifen-inducible, improved Cre recombinase (icre/ERT2) from the Fos promoter/enhancer elements, B6.Cg-Gt(ROSA)26Sortm14(CAG-tdTomato)Hze/J (Ai14; JAX strain 007914) mice expressing robust tdTomato fluorescence following Cre-mediated recombination. FosCreERT and Ai14 mice were crossed and used for activity-dependent c-Fos tagging with tdTomato.

Behavioral assays

All behavioral assays were performed using male mice aged 12–14 during the light phase. Each type of behavior testing chamber was placed within a custom-made soundproof cubicle with dim lighting (8 lx). Digital cameras (c922 pro, Logitech) were mounted on the ceiling of the cubicle directly above the behavioral chamber to capture the recordings, which were then manually analyzed by experimenters using Adobe Premiere Pro software.

Observational fear

Observational fear conditioning (OFC) was performed as previously described6. The apparatus for the observational fear task comprised two identical chambers (18.5 X 18.5 X 25.5 cm each) with a transparent Plexiglas partition in the middle and a stainless steel grid floor (Coulbourn Instruments). Sounds and odors could be transmitted between the chambers through the holes in the partition and under the grid floor. The mice (observer and demonstrator) were individually placed in separate apparatus chambers for 5 min (habituation phase), and subsequently a foot shock (2 s, 1 mA) was delivered every 10 s for 4 min (conditioning phase) to the demonstrator mouse via a computer-controlled animal shocker (Coulbourn Instruments). Observer and demonstrator mice were non-siblings and non-cagemates but were matched by age, sex, and strain in all experiments. In the repeated OFC session (OFC2), all OFC protocols were identical, but the experimental context was changed with striped walls and a different stainless steel grid floor. In the OFC3 session, a new context was introduced using a chamber shaped like two connected cylinders (32 ×8 x 30 cm), with one half painted white and the other half dark. The time durations of observers’ vicarious freezing (OB-freezing), demonstrators’ sensory pain responses such as pain-squeaks, jumping, and running (DM-reaction), and demonstrators’ freezing behavior (DM-freezing) were manually measured frame by frame to match the calcium signal data. Motionless bouts lasting more than 1 s were considered freezing events.

Object-threat

The behavior chamber for Object-threat test was same with OFC test. If this test was conducted after the OFC1 session for the microendoscope recoding, a chamber with identical striped walls as OFC2 was used instead (Fig. 3c). We employed programmable compact robot (Sphero mini blue, Sphero Inc.), measuring about the same size as a ping pong ball (4 ×4 X 4 cm), for experimental object instead of the conspecific demonstrator. This object could be controlled using a custom-written code through a mobile phone app with the Bluetooth communication. During the 5-min habituation phase, the observer mice were allowed to freely explore the chamber, while the object moved in random directions. In the conditioning phase, the object rolled rapidly with intermittent bumping in a clockwise or counterclockwise direction randomly every 10 s for 4 min. During the inter-moving interval, the object paused for an average of about 5 s before the next movement, mimicking the freezing behavior of demonstrator. The time durations of observers’ freezing triggered by the object (Threat-freezing), object’s moving and bumping (Obj-moving), and object’s motionless (Obj-stationary) were manually measured frame by frame to align with the calcium signal data.

Direct-shock

The apparatus for the Direct-shock session was a cylindrical-shaped chamber with a black walls and a stainless steel grid floor (Ø8 X 30 cm). After a 100-s habituation phase, the observer mice were subjected to 10 direct foot shocks (0.5 mA) lasting 5 s each, delivered at 20-s intervals. There was a 100-s inter-stimulus interval before the next set of 10 foot shocks. A total of 20 electrical shocks, matching the frequency of demonstrator’s stimuli in OFC session, were delivered to the observer mice. The Direct-shock sessions were followed by OFC1 and OFC2, or OFC1 and the Object-threat test. Each animal underwent all sessions (OFC1-OFC2-Direct-shock or OFC1-OFC2-Object-threat) sequentially within a single experimental day, with an approximate time delay of 10 to 15 minutes between sessions. The time durations of observers’ freezing by direct shocks (Shock-freezing) and observer’s sensory pain responses (Shock-reaction) were manually measured frame by frame.

Contextual classical fear conditioning

The context fear conditioning was performed as previously described with minor modifications6. On conditioning day, mice were placed in the fear conditioning chamber (18.5 ×18.5 ×28 cm; Coulbourn Instruments). After a 5 min exploration period, animals were subjected to three foot-shocks (1-s shocks, 0.5 mA, 1-min interval). Electrical shocks co-terminated with a 30-second tone (3 kHz, 85 dB). Freezing behavior, which is defined as a complete lack of movement (except for respiration) for longer than 1 s. freezing behavior of the mice was recorded and analyzed with FreezeFrame software (Coulbourn Instruments).

Place escape/avoidance paradigm

Place escae/avoidance paradigm (PEAP) was performed as previously described with minor modifications49,50. Animals were placed in a chamber shaped like two connected cylinders (32 X 8 X 30 cm; Fig. 6g), with one half in white and the other half in dark. As rectangular-shaped chambers were used in the OFC, fear conditioning, and Object-threat tests, we chose to modify the chamber for PEAP into cylinder shapes to introduce diversity in the experimental context. The chamber was positioned on a wire mesh stand, elevated 30 cm above the table surface to allow access to the animal’s hind paws. During the 30-minute testing session, animals were given unrestricted access to both sides of the chamber. Testing began immediately after the animal was placed in the chamber by applying pin-prick (26 G hypodermic needle) or innocuous mechanical stimulation (0.07 g von Frey monofilament; EXACTA Precision & Performance monofilaments, Stoelting) applied to the plantar surface of the hindpaws every 15 s. If the animal was on the preferred dark side of the chamber at the 15-s interval, the left hind paw was stimulated with the needle; if the animal was on the non-preferred light side of the chamber, the right hind paw was stimulated with innocuous filament. The experimenter analyzed the mean percentage of time spent on each side of the chamber.

Stereotactic surgery

For all surgeries, mice were anesthetized using 5% isoflurane mixed with oxygen and maintained at 1.0–1.5% isoflurane maintenance for the duration of the surgery. Mice were secured on a small-animal stereotactic instrument (Kopf Instruments). A temperature controller (TCAT-2, Physitemp) ensured the maintenance of core body temperature at 36°C. Antiseptics and lidocaine were applied before making an incision on the skin. Single or multiple cranial openings were made with dental drills.

Viral injections

For calcium signal imaging using microendoscope, approximately 500 nl of GCaMP6f (AAV9-CAMKIIα--GCaMP6f-WPRE-SV40, Penn Viral Vector Core, Titer 4.3 X 1012) was injected for ACC pyramidal neuron. Similarly, about 500 nl of GCaMP8f (AAV-CAG-FLEX-jGCamp8f-WPRE, IBS virus facility, Titer 6.2 X 1012) was injected for ACC interneuron and circuit-specific ACC pyramidal neurons. These injections were targeted to the right ACC (AP/MD/DV, 1.0/0.3/-1.75 mm). All experiments, including calcium imaging and optogenetic manipulation, were performed unilaterally in the right ACC based on evidence that the right ACC, but not the left, is functionally specialized for modulating observational fear in mice23,75. For retrograde labeling of ACC neurons projecting to the BLA or the PAG, about 100 nl of retro-Cre (pAAV-hSyn-Cre-WPRE-hGH, IBS virus facility, Titer 3.8 X 1012) was injected into the BLA (AP/MD/DV, -1.2/2.9/-4.5 mm) or the PAG (AP/MD/DV, -4.24/1.25/-3.0 mm, tilted by 15 degrees). For optogenetic inhibition, AAV5-CAMKIIα---eNpHR3.0-EYFP (IBS virus facility, Titer 2.3 ×1012) was injected into the right ACC. Control mice were injected with AAV5- CAMKIIα--EYFP (IBS virus facility, Titer 4.0 X 1012). All virus solutions were injected using pressure (Picospritzer III, Parker Hannifin Corp.) through a custom-made glass pipette. Subsequently, the glass pipette was then slowly removed after 10 min to allow for diffusion.

Lens/optic cannula implantation

After 3 weeks of viral injection, a Twist-on imaging cannula (2.5 mm length, 0.5 mm diameter, eTICL_D_500, Doric) or optic cannula (FOC-C-B-200-1.25-0.50-2.5, Newdoon) was lowered 0.1-0.2 mm directly above the viral injection site at the right ACC. Prior to the cannula implantation, for robust fixation, the 2–4 skull screws were placed right above the olfactory bulb and behind the lambdoid suture at a depth that did not penetrate the skull. After skull screw placement, a craniotomy of about 0.5 – 1.0 mm for imaging cannula or 0.3 mm for optic cannula in size created above the right ACC. The twist-on imaging cannula was lowered steadily until the D/V approached -1.65 mm. The lens was cured with dental acrylic and light-curing bond (Charisma‑Diamond, Heraeus Kulzer). Animals were intramuscularly injected with a mixture of ketoprofen (2 mg/kg), dexamethasone (0.5 mg/kg), and amoxicillin (10 mg/kg) as post-surgery analgesia. Animals were monitored daily for 7 days.

Microendoscopic calcium imaging and extraction

Imaging experiments were carried out at least 4 weeks after the Twist-on imaging cannula was placed. Mice were habituated to the efocus microscope body (Doric Lenses Inc.) for at least 3 days before imaging experiments. Calcium fluorescence and behavior videos were simultaneously recorded online with Doric Neuroscience studio through a microendoscope driver (Doric Lenses Inc.) and a Doric behavior camera, respectively. The efocus microbody were connected to an electrical rotary joint (AHRJ-OE_PT_400-0.48_FC_SM3_24_HDMI) through a flexible efocus electrical cable (EC3_UFGJ) and mono fiber-optic patch cord. The Ca2+ videos were captured at a rate of 20 frames per second, an optimal LED power was chosen individually for every mouse to enhance the dynamic range of pixel values within the field. Identical LED configurations were maintained for each mouse across the series of the imaging sessions.

Processing of calcium signals

The initial step involved processing the raw videos from each imaging session utilizing the NoRMCorre algorithm76 to rectify any motion-induced artifact throughout frames. Subsequently, each video was manually cropped to the field of view to alleviate the computational demand for motion correction and cell segmentation. The preprocessed movies were then processed using MIN1PIPE25 to extract the calcium transients. The automatically suggested cells were then carefully manually selected. The calcium trace (dF/F) of each cell was de-trended and transformed into a z-score for further analysis. All calcium traces are presented in units of standard deviation (s.d.).

Analysis of single cell responses

The activity of individual neurons during behavior events such as OB-freezing, DM-reaction, and DM-freezing was quantified using a receiver operating characteristic (ROC) analysis, which was performed as previously described33. To convert the dF/F signal into binarized, a range of binary thresholds, spanning the minimum and maximum values of the neural signal, were applied to preprocessed signals and compared with a binary event vector denoting behavior bouts. By applying these thresholds, we evaluated how effectively the neural signal detected behavior events by measuring the true positive rate (TPR) and false positive rate (FPR) across all time points. The area under the ROC curve (auROC), which plots the TPR against the FPR depending on thresholds, served as a metric for the degree of modulation of neurons by each behavior. To determine statistical significance, observed auROC values were compared to a null distribution of 1000 auROC values generated from randomly permuting calcium signals. Neurons were considered significantly responsive (α = 0.05) if their auROC values exceeded the 95th percentile of the null distribution. The term “non-responsive cells” denotes neurons that did not exhibit responsiveness during each of the annotated behaviors.

Population decoding analysis

To assess how ACC neurons encode observational fear at the population level, we constructed classifiers to predict behavior events based on population activity. We employed linear discriminant analysis (LDA) classifiers, for classification of individual behaviors. Training sets for all classifiers were generated using population vectors during behavior bouts and negative training data from frames devoid of behavior. In order to measure the performance within an OFC session, we divided the data into training and one test set and performed leave-one-out validation. For inter-OFC sessions, we used all dataset from OFC1 to train the classifiers and tested them on the prediction of OFC2 datasets. The performance of model was evaluated by projecting the test data onto the linear discriminant and measuring the area under the ROC curve (auROC), as described in the previous report33. Overall model performance was quantified using the average of auROC values over all mice and was compared with null models constructed using training data with randomly shuffled class labels. The same method was applied to compare datasets from OFC3 with those from OFC1 and OFC2.

In the population analysis of ACC cells projecting to specific circuits (PAG or BLA), as the number of neurons recorded in individual mice was relatively small compared to the entire ACC recording, all neurons across all mice were collected for LDA analysis. We developed models based on pseudo-trials, which was performed as previously described with minor modification77. Pseudo-trials were created by randomly selecting a fixed number (n = 500) of frames for behavior bouts and non-behavior bouts from each mouse in OFC1 session, and then concatenated across neurons. Each pseudo-trials was served as a training set for LDA classifier and was tested in OFC2 session, repeated 500 times. This process allowed us to establish the distribution of LDA performance for each behavior, from which we subsequently computed p-values by comparing against the chance level (0.5) using a normal distribution with mean and standard deviation derived from the LDA performance distribution.

Optogenetic inhibition

At least 1 week after the optic cannula was placed, optogenetic inhibition was conducted. The optic cannula was connected to a diode-pumped solid state yellow laser (DPSSL driver, 561 nm) via a fiber patch cable (Newdoon, MM200/220). For inhibition, approximately 4 - 5 mW of light intensity was used at the fiber tip in all behavioral tasks. A pulse train was generated using the pulse generator (OTPG_8, Doric). In the OFC, Object-threat, and contextual fear conditioning tasks, yellow light was delivered during the conditioning period, while in the PEAP test, light was delivered throughout the entire 30-minute session. For the Direct-shock session, a yellow laser was delivered bilaterally during each of the 15-second inter-shock intervals following the 100-second habituation period.

Histology and immunohistochemistry

Mice underwent transcardial perfusion with 4% paraformaldehyde (PFA) in 0.1 M phosphate-buffered saline (PBS) for post-hoc analysis. Extracted brains were fixed overnight in a 4% PFA solution and then coronally sectioned to a thickness of 30 μm using either a vibratome (VT1200S, Leica) or a cryostat (CM3050S, Leica). The sections were then incubated with PBS and mounted onto glass slides with VectorShield (Vector Laboratories) medium. Imaging was conducted using a slide imaging system (Axio Scan.Z1, Zeiss) with 10× objectives or con-focal laser microscopy (LSM900, Zeiss) with 20× objectives. Post-processing of the images was performed using the ZEN software (Zeiss).

Statistical analysis

Two-way repeated measure ANOVA with Bonferroni test, Welch’s t-test, multiple t-test with Holm-Šídák test, and shuffle test were used when appropriate. Graphpad Prism 10 software was used to calculate p values for statistical analyses. The null hypothesis was rejected at the p <  0.05 level. The shuffle test was employed to assess whether there was a significant overlap in the number of neurons across the analyses of two behavior sessions, as described in the referenced method from a previous report36. We randomly shuffled annotated behavior label within each population and counted the number of overlapped cells in the tracked population (number of simulation = 500). Subsequently, the actual number of overlapping cells was compared with the simulated population to determine whether they were significantly more or less than expected by chance. We subsequently computed p-values by comparing the actual data to a normal distribution with mean and standard deviation computed from the shuffled distribution using MATLAB (MathWorks).

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.