Introduction

Adaptive behavior requires the brain to rapidly associate sensory stimuli with appropriate motor responses. While learning-related changes across sensory modalities have been extensively investigated, most studies rely on training paradigms extending over days or weeks, leaving the dynamics of the formation of the initial association unresolved (Kato et al., 2015; Poort et al., 2015; Sachidhanandam et al., 2013). It remains unclear whether sensory representations in cortex reorganize on the timescale at which behavioral changes first emerge or whether cortical plasticity reflects a slower process requiring days of offline consolidation (Drieu et al., 2025; McClelland et al., 1995).

A candidate mechanism for rapid representational change is the spontaneous reactivation of stimulus-evoked ensemble patterns during inter-trial periods. In sensory cortex, such reactivations have been shown to predict the direction of change of future representations during passive stimulus viewing, suggesting that they act as an upstream selection process rather than a faithful replay of past activity (Miller et al., 2014; Nguyen et al., 2024). Moreover, reactivations during learning have also been linked to bidirectional changes in network connectivity (Sugden et al., 2020). However, whether reactivations operate on the rapid timescale of the formation of the initial association and whether reward gates which neurons they engage remain untested.

Here, we developed a whisker-based detection task in which mice form a novel sensorimotor association within a single behavioral session. Combining longitudinal two-photon calcium imaging of layer 2/3 neurons in the primary whisker-related somatosensory barrel cortex (wS1) (Woolsey and Van der Loos, 1970; Diamond et al., 2008; Petersen, 2019) with trial-by-trial population decoding, we show that reward drives rapid reorganization of population representations tracking behavior, and that neurons recruited by learning are preferentially engaged in spontaneous reactivations, pointing to an online, reward-gated selection mechanism operating on the timescale of minutes.

Results

Mice rapidly learn to detect a novel tactile stimulus within a single session

To study rapid sensorimotor learning, head-fixed, water-restricted mice were trained on a whisker detection task designed to capture the formation of a novel sensorimotor association in the course of a single behavioral session (Figure 1A). Mice first went through an initial auditory pre-training phase during which they were rewarded with a drop of water for licking a spout in response to a brief auditory tone. Auditory pre-training continued for 5–7 days until stable expert performance was reached for at least two days (Days -2 and -1). On Day 0, a brief deflection of the C2 whisker was introduced as a novel stimulus, and whisker training continued for two additional days (Days +1 and +2). To establish that behavioral and neuronal changes were driven by reward, mice were randomly assigned to one of two groups: rewarded mice (R+, n = 19 mice, during functional imaging, described later) for which licking in response to whisker stimulation was rewarded, and non-rewarded mice (R-, n = 16 mice, during functional imaging, described later) for which licking in response to whisker stimulation was not rewarded. Auditory trials were interleaved throughout training and remained rewarded in both groups, providing an internal control for task engagement. Catch trials without sensory stimulation were pseudo-randomly interleaved to assess spontaneous lick rates and licking in catch trials was never rewarded.

Mice can learn to lick for reward in response to a novel tactile whisker stimulus in a single session.

(A) Water-restricted mice were first trained to lick a water reward spout in response to a brief auditory pure tone (Days -2 and -1 correspond to the final two days of the auditory pre-training phase). On Day 0, the whisker stimulus (brief deflection of the C2 whisker) was introduced for the first time as an interleaved active (rewarded / unrewarded) trial type, and whisker training continued for two additional days (Day +1 and Day +2). Rewarded mice (R+, green) received a water reward if they licked in response to the whisker stimulus (whisker hit trials), whereas non-rewarded mice (R-, magenta) did not. Auditory hits (blue) were rewarded for both groups, and catch trials (black, no stimulus) were always unrewarded. At the end of each active behavioral session, a block of 50 consecutive passive whisker trials was presented. (B) Example probability of licking in blocks of 20 trials for one whisker rewarded (R+) and one whisker non-rewarded (R-) mouse across the five training days. Blue data points show licking probability on auditory trials; green (R+) and magenta (R-) data points show licking probability on whisker trials; and black data points show licking probability in no-stimulus trials. (C) Behavioral performance across days (n = 19 R+ mice and n = 16 R- mice, during functional imaging described later; dark blue, auditory lick probability in R+ mice; light blue, auditory lick probability in R-mice; green, whisker lick probability in R+ mice; magenta, whisker lick probability in R- mice; black, catch trial lick probability in R+ mice; grey, catch trial lick probability in R- mice). Thin lines indicate single-mouse trajectories and thick lines indicate averages across reward groups (left, mean ± 95% confidence interval). Bar plot quantifying whisker performance across days, comparing the two reward groups (right, mean ± 95% confidence interval; p-values from Mann-Whitney U test). (D) Whisker performance dynamics during Day 0. The top shaded bar indicates the p-value obtained from Mann-Whitney U tests comparing reward groups at each whisker trial, corrected for multiple testing with the Benjamini-Hochberg procedure. Data points show the mean Bayesian lick probability per trial ± 95% confidence interval. Divergence between the two groups first became significant after 22 whisker trials.

Whisker-rewarded mice, but not whisker-unrewarded mice, learned to lick in response to whisker stimulation within a single session (Figures 1B and 1C), with the first whisker hit occurring on average within 5 whisker trials (Figure 1 – figure supplement 1). The Day 0 whisker performance was significantly higher in R+ than R-mice (Mann-Whitney U test, p = 2×10-5) and continued to diverge over the following two days (Figure 1C). Auditory performance remained stable across days in both groups, ruling out general task disengagement as an explanation for the divergent whisker learning trajectories. Within Day 0, whisker hit rate progressively increased in R+ mice, while R- mice rapidly learned to suppress licking to the non-rewarded whisker stimulus, with the two groups significantly diverging after 22 whisker trials, 14 ± 4 min into the session (Mann-Whitney U test with Benjamini-Hochberg correction) (Figure 1D and Figure 1 – figure supplement 1). Together, these results demonstrate that mice can rapidly acquire a novel sensorimotor association driven by reward within a single behavioral session, providing a tractable framework for investigating the neural mechanisms underlying fast goal-directed learning.

Pharmacological and optogenetic inactivation of barrel cortex prevents learning

Having established that mice rapidly acquire the whisker association within a single session, we next asked whether barrel cortex activity causally contributes to learning. We therefore carried out inactivation experiments in two different cohorts of whisker-rewarded mice, which were not functionally-imaged.

We first carried out pharmacological inactivation experiments. Muscimol, a GABA-A receptor agonist, was injected into the C2 column of the contralateral barrel cortex (wS1) or, as a control, into the forepaw primary somatosensory cortex (fpS1, located ∼1.5 mm anterior to wS1) (Figure 2A). Inactivation was performed over the first three days of whisker-rewarded learning (Days 0, +1, +2), followed by three recovery days without injection (Days +3, +4, +5). Learning was abolished during muscimol inactivation in wS1, but mice acquired the task in the subsequent recovery days (n = 13 mice) (Figure 2B). In contrast, fpS1 inactivation did not prevent learning (n = 8 mice) (Figure 2B). Whisker-evoked licking probabilities on Day 0 were significantly higher in mice with fpS1 inactivation compared to mice with wS1 inactivation (Mann-Whitney U test, p = 0.012, Day 0) (Figure 2C).

Pharmacological and optogenetic inactivation of barrel cortex prevent learning.

(A) Schematic illustrating muscimol inactivation of the barrel cortex (wS1) or the forepaw primary somatosensory cortex (fpS1). (B) Behavioral performance across days during wS1 muscimol inactivation (left; n = 13 R+ mice) and fpS1 muscimol inactivation (right; n = 8 R+ mice). Inactivation days, Days 0, +1, +2, are indicated in red; recovery on Days +3, +4, +5. (C) Statistical comparison of whisker performance during muscimol inactivation for wS1 and fpS1 (Mann-Whitney U test). (D) Schematic illustrating spatiotemporally-specific inactivation through optogenetic activation of local inhibitory neurons. (E) Behavioral performance across days during optogenetic inactivation of wS1 (left; n = 6 R+ mice) and fpS1 (right; n = 6 R+ mice) on Day 0 and recovery on Day +1. (F) Statistical comparison of whisker performance during optogenetic inactivation for wS1 and fpS1 (Mann-Whitney U test).

To further test these findings with a spatiotemporally more precise approach, optogenetic inactivation was performed on Day 0 in VGAT-ChR2 mice (Zhao et al., 2011), in which blue light illumination of the cortical surface activates ChR2-expressing GABAergic interneurons to locally silence excitatory neurons (Guo et al., 2014) (Figure 2D). Optogenetic inactivation was carried out in all auditory, whisker and catch trials, beginning 0.1 s before stimulus onset and lasting throughout the 1-s reporting period. Licking in auditory and whisker trials was rewarded, but not in catch trials. Consistent with the pharmacological results, optogenetic suppression of wS1 activity on Day 0 prevented learning, whereas mice learned to lick in response to whisker stimulation when fpS1 was optogenetically inactivated (n = 6 R+ wS1-inactivated mice and n = 6 R+ fpS1-inactivated mice; Mann-Whitney U test, p = 2×10-3, Day 0) (Figures 2E and 2F). Together, these results demonstrate that barrel cortex activity contributes to the rapid acquisition of the association.

Learning induces a rapid reorganization of barrel cortex population activity

To examine how barrel cortex representations evolve across learning, we performed longitudinal two-photon calcium imaging of the same layer 2/3 neurons expressing GCaMP6f from Day -2 to Day +2 (R+ mice: 3,210 neurons across 19 mice, 169 ± 49 mean neurons per mouse ± SD; R- mice: 2,846 neurons across 16 mice, 177 ± 48 mean neurons per mouse ± SD) (Figure 3 and Figure 3 – figure supplement 1). At the end of each session, including auditory pre-training days (i.e. Days -2 and -1), a block of 50 passive whisker stimulations was delivered after task disengagement, to map sensory responses independently from reward and motor output. A striking divergence in the grand-average response emerged where the whisker-evoked responses progressively increased across days in R+ mice but decreased in R- mice (Figures 3A-C). Comparing response amplitudes between pre-learning (Days -2 and -1) and post-learning (Days +1 and +2) periods confirmed a significant enhancement of whisker-evoked responses in R+ mice (n = 19 mice, Wilcoxon signed-rank test, p = 2×10-3) (Figure 3D) and a significant suppression of whisker-evoked responses in R- mice (n = 16 mice, Wilcoxon signed-rank test, p = 1.6×10-3) (Figure 3E), revealing a reward-dependent bidirectional reshaping of the C2 whisker representation.

Learning induces a rapid reorganization of barrel cortex population activity.

(A) Two-photon calcium imaging of layer 2/3 neurons expressing GCaMP6f in the barrel cortex of Rasgrf2-Cre × Ai148 mice. Top: example field of view with individual cell ROIs color-coded by their learning modulation index (LMI: red, positive; blue, negative). Bottom: calcium traces in response to passive whisker trials for example cells. Orange vertical bars indicate whisker stimulus onset. (B) Heatmap of the trial- averaged whisker-evoked responses in the post-behavior passive epoch across the five imaging days (Day -2 to Day +2) for cells significantly modulated by learning (same example mouse as panel A) ordered by their LMI. (C) Population PSTHs over passive whisker trials across the five imaging days for R+ (green) and R- (magenta) mice. Thick lines show grand averages across mice (n = 19 R+ mice; n = 16 R- mice) and shading indicates 95% confidence interval. (D) Comparison of population whisker response amplitude (ΔF/F₀, averaged over 0-300 ms from stimulus onset) before (Days -2 and -1; pre) and after (Days +1 and +2; post) learning in R+ mice (n = 19 mice). Left: population PSTHs for pre- (grey) and post- (green) learning. Right: bar plot quantification of individual mouse averages over the same time window (Wilcoxon signed-rank test). (E) As in panel D, but for R- mice (n = 16 mice). (F) Distribution of LMI across all imaged neurons for R+ mice (green; n = 3,210 neurons) and R- mice (magenta; n = 2,846 neurons) (Kolmogorov–Smirnov test). (G) Proportion of neurons with a significant positive LMI (left) and significant negative LMI (right), compared between R+ and R- mice (Mann–Whitney U test). (H) Trial-by-trial population similarity matrices averaged across R+ (left) and R- (right) mice. Each entry represents the mean cosine similarity between neural population activity vectors from the indicated pair of days, computed using responses to passive whisker trials averaged over 0-300 ms from stimulus onset. (I) Average cosine similarity between trials from the same day compared between R+ and R- mice (Mann–Whitney U test). Thin lines indicate individual mice, thick lines average ± 95% confidence interval. (J) Network reorganization index quantifying the difference in cosine similarity between pre-learning (Days -2 and -1) and post-learning (Days +1 and +2) population representations for R+ and R- mice. Points indicate individual mice, bar graph shows mean ± 95% confidence interval. (K) Schematic of the linear decoding approach. A logistic regression classifier was trained to discriminate pre-learning (Days -2, -1) from post-learning (Days +1, +2) passive whisker trial population activity. (L) Pre- vs post-learning decoding accuracy for R+ and R- mice, with 10-fold stratified cross-validation. Dashed line indicates chance level (50%). Points indicate individual mice, bar graph shows mean ± 95% confidence interval (Mann–Whitney U test). (M) Pairwise day decoding accuracy matrices using the fixed pre- vs post-learning decoder, for R+ (left) and R- (right) mice. Each entry shows the mean decoding accuracy when the classifier is applied to classify trials from the indicated pair of days. (N) Decoding accuracy comparing pre-learning days (Days -2, -1) vs Day 0 (Pre) and post-learning days (Days +1, +2) vs Day 0 (Post) for R+ and R- mice. Dashed line indicates chance level (50%). Points indicate individual mice, bar graph shows mean ± 95% confidence interval (Wilcoxon signed-rank test).

We then identified neurons responsible for this population effect by computing a learning modulation index (LMI) for each cell using ROC analysis between pre-learning (Days -2 and -1) and post-learning days (Days +1 and +2). Rather than driven by few outliers, the entire LMI distribution was shifted toward positive values in R+ mice relative to R- mice (two-sample Kolmogorov–Smirnov test, p = 4×10-54) (Figure 3F), and a significantly larger fraction of neurons acquired a positive LMI in R+ mice across learning (n = 19 mice, Mann–Whitney U test, p = 8×10-6) (Figure 3G), while a larger fraction acquired a negative LMI in R- mice (n = 16 mice, Mann–Whitney U test, p = 0.02) (Figure 3G). These modulations were heterogeneous at the single-cell level spanning recruitment, enhancement of pre-existing responses, and suppression (Figure 3 – figure supplement 1B). In a subset of mice, we retrogradely labelled wS1 neurons projecting to wM1 or wS2, finding that whisker-evoked responses were enhanced in wS2-projecting neurons of R+ mice but decreased in R- mice, whereas wM1-projecting neurons showed no overall significant change (Figure 3 – figure supplement 2).

We next examined how the population representation changed upon learning. We computed trial-by-trial cosine similarity matrices between population activity vectors across all pairs of passive whisker stimulations (Figure 3H). In R+ mice, the within-day similarity increased, reflecting a progressive stabilization of the representation, while it tended to decrease in R- mice (Mann–Whitney U test R+ vs R-mice, p = 0.08 Day 0, p = 3×10-4 Day +1 and p = 6×10-4 Day +2) (Figure 3I). Across days, R- mice showed a uniform pattern with low similarity, whereas for R+ mice, the average cosine similarity matrix increased with learning. We quantified a network reorganization index, computed as the difference between within-period and between-period cosine similarities, which was significantly larger in R+ than R- mice (Mann–Whitney U test, p = 1.2×10-3) (Figure 3J). To test whether this reorganization carried information at the single trial level, we trained a logistic regression classifier to discriminate pre-learning (Days -2 and -1) from post-learning (Days +1 and +2) population activity patterns (Figure 3K). Cross-validated decoding accuracy was significantly higher in R+ than R- mice (Mann–Whitney U test, p = 1.6×10-3) (Figure 3L). Critically, this decoding approach allowed us to ask whether the transition had already begun on Day 0 by testing the unseen trials from that day with the fixed weights of the pre- versus post-learning decoder (Figure 3M). In both groups, Day 0 could be significantly distinguished from pre-learning and from post-learning days (Wilcoxon signed-rank test, p = 2×10-4 for R+ Day 0 vs pre-learning, p = 1×10-4 for R+ Day 0 vs post-learning, p = 3×10-5 for R- Day 0 vs pre-learning, p = 8×10-4 for R- Day 0 vs post-learning). Moreover, decoding tended to be more accurate at distinguishing Day 0 from pre-learning than from post-learning (Wilcoxon signed-rank test, p = 0.2 for R+, p = 0.016 for R-; Figure 3N). Together, these results establish that reward-driven learning is rapidly accompanied by a new representational state that transitions in the first whisker learning session.

Neuronal representation shift correlates with learning and is accompanied by online reactivations

Having established that population representations are already partially shifting on Day 0, we next asked whether this transition could be tracked online trial-by-trial during active behavior. To do so, we projected whisker-evoked population activity from Day 0 onto the decoding axis of the pre- versus post-learning decoder, trained exclusively on passive whisker trials, excluding Day 0, yielding a continuous readout of the shift from naïve to expert representational states (Figure 4A). R+ mice exhibited a progressive increase in both lick probability and projection on this learning dimension across Day 0 trials, whereas R- mice showed decreasing lick probability and a flat projection trajectory (Figures 4B and 4C). The linear slope of the projection on the learning dimension over Day 0 trials was significantly positive in R+ mice (Wilcoxon one-sample test against zero, p = 0.03) but not in R- mice (Wilcoxon one-sample test, p = 0.33) (Figure 4D). Furthermore, there was significant correlation between the trajectory on the learning dimension and the behavioral learning curve in R+ mice (Wilcoxon one-sample test, p = 0.02) but not in R- mice (Wilcoxon one-sample test, p = 0.9) (Figure 4E). These results demonstrate that barrel cortex population activity progressively realigns from naïve to expert-like representations during learning, tracking behavioral performance trial-by-trial.

Progressive realignment of barrel cortex representations and online reactivations.

(A) Schematic of the Day 0 decoding approach. The pre- vs post-learning classifier (trained on passive whisker trials from Days -2 and -1 vs Days +1 and +2) was applied to active whisker trials during Day 0 to compute a trial-by-trial projection on the learning axis. (B) Example Day 0 trajectories for one R+ mouse (left, green) and one R- mouse (right, magenta). Top: whisker hit probability, estimated by a Bayesian state-space model fitted to binary hit/miss outcomes. Bottom: projection on learning axis applied to the same whisker trials. (C) Average Day 0 trajectories across all mice for R+ (left, green) and R- (right, magenta) groups. Top: licking performance across whisker trials. Bottom: projection on the learning axis across whisker trials. Thick lines report averages across mice with shading indicating the 95% confidence interval. (D) Linear slope of the projection on the learning axis over Day 0 whisker trials, between R+ and R- mice. Small data points show individual mice, and big points show mean ± 95% confidence interval (Wilcoxon one-sample test). (E) Pearson correlation between the projection on the learning axis and whisker performance across Day 0, between R+ and R- mice. Small data points show individual mice, and big points show mean ± 95% confidence interval (Wilcoxon one-sample test). (F) Example reactivation heatmap for a R+ mouse on Day 0. Left strips: Learning modulation index (LMI); average response to passive whisker trials (reactivation template); and reactivation participation rate, for the top 20 cells ranked by participation rate. Right: neural activity heatmap of 180 seconds of concatenated catch trial data. Top: template correlation trace with detection threshold of 0.25 (horizontal dashed line); red vertical lines indicate detected reactivation events. (G) Example template correlation traces across all five training days for the same R+ mouse as in panel F. Red vertical lines indicate detected reactivation events and grey dotted lines indicate 0 correlation. (H) Reactivation frequency across training days for R+ (green) and R- (magenta) mice. Bar graph shows mean ± 95% confidence interval (Mann–Whitney U test). (I) Scatter plots of Day 0 reactivation participation rate versus LMI for individual neurons, shown separately for R+ (left, green) and R- (right, magenta) mice. Each point represents one neuron. Linear regression line is overlaid (Pearson correlation). (J) Participation rate across training days for LMI-positive (red) and LMI-negative (blue) neurons, shown separately for R+ (left) and R- (right) mice. Bar graph shows mean ± 95% confidence interval (Kruskal–Wallis test).

Spontaneous cortical reactivations of stimulus-evoked ensemble patterns have been shown to occur during inter-trial periods and to predict future changes in sensory representations rather than merely replaying past activity (Miller et al., 2014; Nguyen et al., 2024; Sugden et al., 2020). Such reactivations could therefore play a role in selecting which neurons undergo experience-dependent plasticity across learning. To address this, we examined spontaneous reactivations of the whisker-evoked activity pattern during catch trials (Figures 4F and 4G). Comparing the reactivation rates of R+ and R- mice, we found that reward triggered significantly higher reactivation rates across days (Mann–Whitney U test, p = 0.014, Day 0) (Figure 4H). We next computed how much each cell took part in these reactivations to test whether learning-modulated neurons preferentially contributed. In R+ mice, a significant positive correlation was observed between the learning modulation index (LMI) and the participation rate during Day 0, showing that neurons gaining stimulus responsiveness through learning were more likely to participate in reactivations, whereas in R- mice the correlation was weakly negative (R+: r = 0.239, p = 1×10-41; R-: r = -0.067, p = 3×10-4) (Figure 4I). Across training days, and already on Day 0, significant LMI-positive neurons in R+ mice showed a progressive increase in participation rate (Kruskal–Wallis test, p = 5×10-4), while significant LMI-negative neurons did not (Kruskal–Wallis test, p = 0.05) (Figure 4J). Neither LMI-positive nor LMI-negative neurons showed significant changes in participation across days in R- mice (Kruskal–Wallis tests, p = 0.13 and p = 0.2). This relationship still held after controlling for baseline spontaneous activity levels (Figure 4 – figure supplement 1). Together, these results indicate that neurons whose sensory responses were strengthened by reward-driven learning were preferentially engaged in spontaneous reactivation events, consistent with online reactivations potentially acting as a mechanism for inducing learning-related plasticity.

Discussion

Here, we developed a task in which mice formed a novel sensorimotor association within a single behavioral session (Figure 1). Pharmacological and optogenetic inactivation suggested a causal role for sensory cortex in task learning (Figure 2). Neuronal activity in sensory cortex exhibited a rapid reorganization of sensory representations (Figure 3) concomitant with single session task learning (Figures 4A-D). Finally, we found that neurons whose stimulus responsiveness was strengthened by learning were preferentially engaged in spontaneous reactivation events, suggesting that online reactivation might drive learning-induced plasticity (Figures 4F-J).

By designing a task that could be learned in a single session, we could track the representational transition as it unfolded trial-by-trial. This goes beyond prior work correlating neural selectivity with performance across days (Banerjee et al., 2020; Chéreau et al., 2020; Goltstein et al., 2013; Henschke et al., 2020; Kato et al., 2015; Makino and Komiyama, 2015; Peron et al., 2015; Poort et al., 2015; Sachidhanandam et al., 2013) and shows that representational changes are concurrent with behavioral acquisition, rather than a delayed consequence. Importantly, the non-rewarded control group rules out passive representational drift driven by repeated stimulus exposure as an explanation (Ahmed et al., 2024; Bauer et al., 2024; Marks and Goard, 2021; Wang et al., 2022). A recent study in the auditory cortex also found that sensory cortex drives rapid acquisition of task contingencies within tens of trials and becomes dispensable at expert performance (Drieu et al., 2025). However, learning in that study did not enhance stimulus representations, which instead habituated as in passively exposed animals. In contrast, our passive whisker trials revealed that stimulus representations in barrel cortex are restructured by reward-driven learning. This divergence likely reflects a difference in sensory demand: unlike the pure tones easily discriminable at the perceptual level used by Drieu et al. (Drieu et al., 2025), near perceptual threshold whisker deflection might require the enhancement of cortical representations. Interestingly, this reorganization was heterogeneous across projection subtypes: neurons projecting to secondary somatosensory cortex showed large learning-related changes while those projecting to motor cortex were unaffected (Figure 3 – figure supplement 2), consistent with the preferential routing of task-relevant information through the wS1-to-wS2 pathway reported previously in expert mice performing closely-related whisker detection tasks (Chen et al., 2015; Vavladeli et al., 2020; Yamashita and Petersen, 2016).

Strikingly, neurons gaining stimulus responsiveness through learning were preferentially engaged in spontaneous reactivations already on Day 0 (Figures 4I–J). Recent work established that cortical reactivations during passive viewing predict the direction of future plastic changes (Nguyen et al., 2024), suggesting an upstream selection mechanism, and that reactivations during reward-based learning are linked to bidirectional network changes (Lensjø et al., 2025; Sugden et al., 2020). Two aspects of our findings elaborate on this framework. First, reward gated both the rate and cellular identity of reactivations: R+ mice showed higher reactivation frequencies than R− mice (Figure 4H), and a significant positive correlation between LMI and participation rate was only found in R+ mice (Figures 4I and Figure 4 – figure supplement 1). Second, the process operated on the timescale of minutes, concurrent with the initial formation of the association, rather than during post-session offline consolidation as described in prior work. Together, these observations are consistent with online reactivations acting as a reward-gated selection mechanism that biases which neurons undergo experience-dependent plasticity.

One limitation is that our current data do not establish a causal role for reactivations. Closed-loop optogenetic experiments disrupting reactivation events during learning could be used to test necessity, which we predict would impair representational enhancement as well as behavioral performance during Day 0. Our study is also restricted to layer 2/3 excitatory neurons in a single cortical area. Deeper layer neurons (Lacefield et al., 2019; Oryshchuk et al., 2024; Takahashi et al., 2020), inhibitory neurons (Deister et al., 2024; Park et al., 2025; Ramamurthy et al., 2023; Sachidhanandam et al., 2016) and neuromodulators (Constantinople and Bruno, 2011; Muñoz et al., 2017; Gasselin et al., 2021) likely play important roles in shaping the network reorganization we observed. Finally, extending this approach to downstream regions such as the secondary somatosensory cortex (Han and Helmchen, 2025; Kwon et al., 2016) and the striatum (Sippy et al., 2021, 2015) would help clarify how rapid cortical reorganization is propagated to drive behavioral change.

Methods

Animals

All procedures were approved by the Swiss Federal Veterinary Office (License numbers VD-1628 and VD-3753) and were conducted in accordance with the Swiss guidelines for the use of research animals. We used both male and female adult C57BL/6 mice of at least 5 weeks at the time of surgery. For calcium imaging experiments we used Rasgrf2-dCre mice [B6;129S-Rasgrf2 <tm1(cre/folA)Hze>/J, JAX: 022864] (Harris et al., 2014) crossed with Ai148 mice [B6;Ai148(TIT2L-GC6f-ICL-tTA2)-D, JAX: 030328] (Daigle et al., 2018), which express the green fluorescent calcium indicator GCaMP6f in layer 2/3 neurons. For optogenetic stimulation of inhibitory neurons, we used VGAT-ChR2 mice [B6.Cg-Tg(Slc32a1-COP4*H134R/EYFP)8Gfng/J, JAX: 014548] (Zhao et al., 2011). For pharmacological inactivation experiments we used wild-type mice.

Head plate surgery and intrinsic optical imaging

Mice were first implanted with a metal head-post under anesthesia (1.5-2.5 % isoflurane). Before the start of surgery, carprofen was injected (7.5 mg/kg at 1.5 mg/ml, subcutaneous) for general analgesia, and a mix of lidocaine and bupivacaine below the scalp as local analgesic. An ocular ointment (Vita-Pos, Pharma Medica AG, Switzerland) applied over the eyes prevented drying during the surgery. A solution of povidone-iodine (Betadine, Mundipharma Medical Company, Bermuda) was applied for skin disinfection before incision. We monitored body temperature throughout the surgery and it was maintained at 37°C with a heating pad (ThermoStar, Intellibio, France). After excising the scalp with surgical scissors, the exposed skull was cleaned with cotton buds and a scalpel blade to remove the periosteal tissue. After further disinfection with Betadine, the skull was dried with cotton buds and made optically clear using a thin layer of super glue applied over the dorsal part of the skull (Loctite super glue 401, Henkel, Germany). We then glued a custom-made head fixation plate above the right hemisphere, and further secured it with self-curing denture acrylic (Paladur, Kulzer, Germany or Ortho-Jet, Lang, USA). Finally, a second thin layer of the glue was applied homogeneously on the left hemisphere to ensure a smooth and equally transparent field of view. This transparent skull preparation was used to perform intrinsic optical signal (IOS) imaging. Mice were returned to their home cages and ibuprofen (Algifor Dolo Junior, Verfora SA, Switzerland) was added to the drinking water for three days after surgery.

Following head plate implantation, IOS imaging was performed on the left hemisphere in order to localize the right C2 whisker representation in wS1 and wS2, as well as the location of fpS1. Animals were lightly anesthetized (isoflurane at 1%) and head-fixed under a CMOS camera coupled to a stereomicroscope (Leica MZ9.5). We acquired a reference image of the surface vasculature under green light (525 nm, Thorlabs LED). Subsequently, under red light (630 nm, Thorlabs LED), the right C2 whisker or the right paw was stimulated by a capillary glass glued to a piezoelectric actuator (PICMA, PI Ceramic). Each trial consisted of 4 s of rectangular deflections at a 10 Hz frequency. We interleaved stimulation with no-stimulation trials and the average activation map was computed using a custom MATLAB-based software. The resulting map was then overlaid on the anatomical image to locate the region of interest relative to surrounding blood vessels.

Cranial window surgery for two-photon imaging and retrograde labelling

For mice used for two-photon calcium imaging, a circular craniotomy with a 4 mm diameter was performed over the C2 column of the primary whisker somatosensory cortex wS1 identified with intrinsic optical signal imaging. After the bone had been removed, the surface of the cortex was rinsed with Ringer solution and the dura was removed using a 27G sharp needle bent as a hook. To retrogradely label wS1 neurons projecting to wS2 and wM1, cholera toxin subunit-B (CTB) conjugated with two different Alexa-Fluor dyes (Molecular Probes, Invitrogen; 100 nL, 0.5%, wt/vol) were injected in these areas. A thin glass pipette (PCR Micropipettes 1–10 mL, Drummond Scientific Company, USA) was first pulled and then the tip was broken using a tissue to obtain a 21–27 µm inner tip diameter. The pipette was filled with mineral oil and then tip-filled with the CTB solution. Two injections in the cortex at depth 300 and 500 μm below the pia were performed of 50 nL at each depth for wS2 and 100 nL for wM1 (at stereotaxic coordinates 1 mm anterior and 1 mm lateral from bregma). Injections were performed using a single-axis oil hydraulic micromanipulator (Narishige, Japan) at 20 nL per minute with 5 min of waiting time after injection. A 4 mm glass window was then fixed over wS1 using super glue and self-curing denture acrylic.

Behavioral task and training

We trained head-fixed, water-restricted mice to perform a sensory detection task. During the behavioral experiments, all right whiskers were trimmed except for the C2 whisker, and the mice were water restricted to 0.9-1.2 mL of water/day (depending on initial body weight). Mice were trained daily with one session per day; their weight and general health status were carefully monitored using score sheets. Mice were habituated to be head-fixed to a metal post with their head held at a 30-degree angle. During the first session, mice were also habituated to licking from a water spout positioned on their right side which delivered 5 µL of water in response to some licks. Next, we trained them in an auditory detection task for 5–7 days during which licking in a 1-s response window after the auditory cue (10 ms, 10 kHz tone of 74 dB embedded in the continuous background white noise of 80 dB) was rewarded. Inter-trial interval was uniformly sampled between 6 s and 10 s including a final 2 s to 5 s no-lick window during which mice were required not to lick for the trial to be initiated. When two consecutive days of stable expert performance (hit rate ≤ 80% and false alarm rate ≥ 30%) in the auditory detection task was reached (Days -2 and -1), whisker detection training was introduced for the next three days (Days 0, +1 and +2). Whisker deflection was achieved with a 30 mT magnetic pulse driven by a 3 ms cosine impulse sent to an electromagnetic coil positioned under the mouse and acting on a small iron particle placed on the C2 whisker. Trials in auditory and whisker training days were presented pseudo-randomly in blocks of 20 trials. Blocks consisted of 10 auditory and 10 catch (no stimulus) trials on auditory training days and 7 whisker, 3 auditory and 10 catch on whisker training days. If mice licked the reward spout within the reward time window of 1 s from stimulus onset, it was considered a hit trial, and they obtained a 5 µL drop of water. If they did not lick within the reward window, it was considered a miss trial, and no reward was delivered. Each mouse was randomly assigned to the rewarded (R+) or non-rewarded (R-) group at the start of the training protocol. While auditory trials were rewarded for both groups throughout training, only R+ mice obtained a water reward in whisker trials, whereas R- mice did not obtain a water reward if they licked in response to whisker stimulation. Catch trials were never rewarded. In every two-photon imaging session (Days -2 to +2), we additionally presented 50 passive whisker stimulations at the end of the session after the mouse was disengaged from the task (i.e. stopped licking in all trial types). No licking occurred during passive stimulation.

Optogenetic inactivation

Optogenetic inactivation of cortical excitatory neurons was achieved indirectly by activating ChR2-expressing GABAergic interneurons in VGAT-ChR2 mice (Zhao et al., 2011). Blue light (470 nm; MBL-F473/200 mW, Changchun New Industries Optoelectronics Technology, China) was delivered through a 200 µm, 0.22 NA patch cable (M84L01, Thorlabs, USA) fitted with a ceramic ferrule cannula (CFMXA05, Thorlabs, USA). The target area, wS1 or fpS1, was identified by IOS imaging and the skull was thinned above the site to facilitate light penetration. The remainder of the exposed skull was covered with Kwik-Cast to prevent off-target illumination of adjacent cortical areas. A blue masking light (M490L4, Thorlabs, USA) was placed in the animal’s visual field throughout inactivation sessions to prevent the light stimulus from serving as a visual cue. Light stimulation consisted of a 100 Hz pulse train with a 50% duty cycle, delivered on 100% of trials (whisker, auditory and catch). Stimulation onset was 100 ms before stimulus presentation and lasted 1 s to cover the full reward window, followed by a 100 ms linear ramp-down to prevent rebound excitation. Light power was measured at 10 mW at the fiber tip. Inactivation was performed on Day 0, during initial whisker learning, and mice were trained for one additional session without light stimulation on Day +1.

Pharmacological inactivation

Cortical inactivation was achieved by injection of the GABA-A receptor agonist muscimol (5 mM in Ringer solution; Biotrend, USA). A small craniotomy was drilled above the C2 barrel column of wS1 or above fpS1 identified by IOS imaging. Muscimol was injected through a glass pipette of 21–27 µm in diameter at a rate of 20 nL/min, to a total volume of 400 nL distributed across four depths ranging from 200 to 800 µm below the pia. Injections were performed 45–60 min before the start of the behavioral session. Inactivation was performed during the three days of whisker training (Days 0, +1, +2); mice were then trained for three additional recovery days without injection (Days +3, +4, +5).

Two-photon imaging

A custom made two-photon microscope was used to perform calcium imaging experiments described in this paper. The microscope was equipped with a galvo-resonant mirror pair (8 kHz CRS, Cambridge Technology, USA), allowing a frame rate of 30 Hz for a resolution of 512 × 512 pixels. A femtosecond tunable infrared laser (Mai Tai or InSight DeepSee, Spectra Physics—Newport, USA) was fed into the light path at a wavelength of 940 nm to excite the genetically-encoded calcium indicator GCaMP6f. Light emission was detected with a GaAsP photosensor module (H10770PA-40, Hamamatsu, Japan), and signal acquisition was performed with National Instruments hardware (NI PXIe-1073, NI PXIe-6341, National Instruments, USA). The microscope head was movable and controlled in three dimensions by motors (Luigs and Neumann, Germany). A 16x immersion objective (16x Nikon CFI LWD, Japan) was used for all the imaging. The system was operated by the Matlab-based software ScanImage(Pologruto et al., 2003) (Vidrio Technologies, USA). For each mouse, the same field of view was imaged for five consecutive days (Days -2 to +2).

Quantification and data analysis

Behavioral performance

To obtain a continuous trial-by-trial estimate of behavioral performance rather than averaging binary hit/miss outcomes across mice, lick probability was estimated trial-by-trial using a Bayesian state-space model implemented with PyMC (Smith et al., 2004). For each session and stimulus type, binary hit/miss outcomes were modelled as Bernoulli observations with a latent lick probability that evolved as a Gaussian random walk in logit space. The logit-transformed lick probability at each trial t was modelled as logit(p_t) = x_t, where x_t followed a Gaussian random walk. Posterior inference was performed by MCMC sampling, the posterior mean of p_t was taken as the estimated lick probability at each trial, and the 80% credible interval was used to characterize uncertainty.

Two-photon calcium imaging preprocessing

To extract time-varying somatic calcium signals, we used the Suite2p toolbox (Pachitariu et al., 2017). Neuropil contamination was corrected by subtracting the fluorescent signal from a surrounding ring Fneuropil(t) from somatic fluorescence: F(t) = Fsoma(t) - 0.7 × Fneuropil(t). Neuropil-corrected fluorescence signals F(t) were then normalized to the moment-to-moment F0(t) computed from a maximin filter (first lowpass filter at 1 Hz, then applying a rolling minimum followed by a rolling maximum with a rolling window of 2 min) to give ΔF/F0(t). Labelling of the wS2- and wM1-projecting neurons were performed by registering the mean red and far red CTB images with the mean GCaMP6f image with the Python-based SimpleElastix toolbox (https://simpleelastix.github.io/). Every ROI was then classified by visual inspection of its average fluorescence into wS2-projection, wM1-projection or non-labelled with a custom-based Python GUI.

Learning modulation index

To quantify learning-induced changes in whisker-evoked responses at the single-cell level, a learning modulation index (LMI) was computed for each neuron using receiver operating characteristic (ROC) analysis. For each cell, the whisker-evoked response amplitude (ΔF/F0) was averaged over 0–300 ms from stimulus onset for each passive whisker trial. ROC analysis was then performed by treating pre-learning trials (Days -2 and -1 pooled) as class 0 and post-learning trials (Days +1 and +2 pooled) as class 1, with the response amplitude serving as the predictor variable. The area under the ROC curve (AUC) was computed and transformed to the LMI using LMI = (AUC − 0.5) × 2. To assess the statistical significance of each LMI, a permutation test was performed by shuffling the class labels (pre- versus post-learning) 1,000 times and recomputing the AUC for each shuffle. The p-value for each cell was defined as the percentile of the observed AUC within the shuffled distribution. Cells with p ≥ 0.975 were classified as having a significantly positive LMI, while cells with p ≤ 0.025 were classified as having a significantly negative LMI.

Similarity matrices and network reorganization index

Trial-by-trial similarity matrices were computed for each mouse using passive whisker trials. For each session (Days -2 to +2), the last 40 passive whisker trials were selected and the whisker-evoked response amplitude was averaged over 0–300 ms from stimulus onset for each trial. Cosine similarity was computed between all pairs of trials across the five imaging days, resulting in a 200 × 200 similarity matrix (5 days × 40 trials per day) for each mouse. Matrix entries were computed as the normalized dot product between trial pairs: for population activity vectors x and y, similarity = (x · y) / (||x|| × ||y||). A cosine similarity matrix was computed for each mouse and then averaged across mice.

To quantify the decorrelation between pre- and post-learning representations, a network reorganization index was defined for each mouse as the difference between the average within-period similarity and the average between-period similarity. Within-period similarity was calculated as the average similarity among all pre-learning trial pairs (Days -2 and -1) and the average similarity among all post-learning trial pairs (Days +1 and +2). Between-period similarity was calculated as the average similarity between all pre-learning and post-learning trial pairs. The network reorganization index was computed as: [((Within-pre-similarity + Within-post-similarity) / 2) − Between-pre-post-similarity].

Decoding of pre- and post-learning and projection on learning dimension

To test whether population activity patterns could discriminate pre- from post-learning representations, a logistic regression classifier was trained on passive whisker trials for each mouse. The whisker-evoked response amplitude (ΔF/F₀) was averaged over 0–300 ms from stimulus onset for each trial. Pre-learning trials (Days -2 and -1 pooled) were labelled as class 0 while post-learning trials (Days +1 and +2 pooled) were labelled as class 1. Population activity vectors (neurons × trials) were transposed to form a feature matrix (trials × neurons). Features were z-scored across trials and a logistic regression classifier with L2 regularization was trained using 10-fold stratified cross-validation. Decoding accuracy was computed as the mean accuracy across folds.

To evaluate whether Day 0 activity patterns resembled pre- or post-learning representations, the trained pre- versus post-learning decoder was applied to all pairwise combinations of days (Days -2, -1, 0, +1, +2) using held-out test folds. For each mouse, data were split into 10 folds per day. At each fold iteration, a decoder was trained exclusively on pre-learning (Days -2, -1) versus post-learning (Days +1, +2) trials from the training folds, then tested on all pairwise day combinations using the corresponding test folds. For each day pair (day_i, day_j), trials from day_i were assigned to class 0 and trials from day_j were assigned to class 1, and classification accuracy was computed.

To track the progressive realignment of population representations during learning, whisker-evoked activity from active Day 0 trials was projected onto the learning axis defined by the pre- versus post-learning decoder. For each mouse, a fixed logistic regression decoder was trained on passive whisker trials from Days -2 and -1 (pooled) versus Days +1 and +2 (pooled), excluding Day 0. The decoder weights and scaler were saved and subsequently applied to population activity from Day 0 active whisker trials. For each Day 0 whisker trial, the response amplitude was averaged over 0–300 ms from stimulus onset, scaled using the fitted scaler, and projected onto the decision axis using the trained classifier’s decision function. The resulting trial-by-trial projection values quantified the shift from naïve to expert-like representations during Day 0 learning.

Detection of reactivations and participation rate

To detect spontaneous reactivations of whisker-evoked activity patterns during inter-trial periods, a template-matching approach was applied to catch trial data (trials without auditory or whisker stimuli). For each mouse and day, a whisker response template was first constructed from passive whisker trials. The template was defined as the trial-averaged whisker-evoked population activity vector, computed by averaging the response amplitude of each neuron over 0–300 ms from stimulus onset across the last 40 passive trials of each session. This template captured the day-specific ensemble activity pattern evoked by the whisker stimulus.

For each day, neural activity during catch trials was then continuously compared to the corresponding template by computing the Pearson correlation between the template vector and the population activity vector at each imaging frame. The resulting correlation time series quantified the moment-by-moment similarity between spontaneous activity and the stimulus-evoked template. A Savitzky-Golay filter (window length = 5 frames, polynomial order = 2) was applied to the correlation time series to reduce jitter from frame-to-frame noise.

Reactivation events were identified as peaks in the correlation timeseries exceeding a threshold. To ensure that detected events were unlikely to arise from chance fluctuations, a detection threshold was determined for each mouse by randomly shifting activity in time independently for all cells: for each mouse, catch trial data were circularly shuffled 1,000 times along the time axis, the correlation timeseries was recomputed for each shuffle and the 99th percentile was computed for each timeseries. The detection threshold was set to the median of that percentile distribution. Peak detection was performed using scipy.signal.find_peaks with a minimum inter-peak distance of 150 ms and a minimum prominence of 0.15.

To quantify each neuron’s engagement in reactivation events, a participation rate was computed for each cell. For each detected reactivation event, the average response amplitude of each neuron was calculated over a ±150 ms window centered on the event time. A neuron was classified as participating in a given event if its average response within this window exceeded 10% ΔF/F0. The participation rate for each neuron was defined as the proportion of detected reactivation events in which the neuron participated, computed separately for each day.

To assess whether the relationship between LMI and reactivation participation was robust to baseline spontaneous activity, we computed a binary measure of significant participation for each neuron using a circular-shift control. For each cell, the catch trial data were circularly shuffled 1,000 times along the time axis. For each shuffle, the participation rate was computed, yielding a null distribution of 1,000 participation rate values per cell. A neuron was classified as significantly participating on a given day if its observed participation rate exceeded the 95th percentile of its corresponding null distribution. The proportion of significantly participating neurons was then computed separately for LMI-positive and LMI-negative cells for each mouse and day. The effect of day on the proportion of participating cells was assessed with a Kruskal–Wallis test, applied independently to each combination of reward group (R+, R−) and LMI category.

Statistics

We used non-parametric tests and corrected for multiple testing with the Benjamini-Hochberg procedure. Error bars indicate 95% confidence interval throughout.

Data availability

Imaging data, behavioral data, and calcium traces were combined into a single NWB file for each behavioral session. NWB offers a common format for sharing and analyzing neurophysiology data (Rübel et al., 2022). Subsequently, we developed open-source Python scripts to analyze data in the NWB format. The full dataset will be available via Zenodo.

Code for data acquisition and behavior control is available on Github (https://github.com/LSENS-BMI-EPFL/behavior_control). The code used to preprocess and convert the data into NWB format is available on Github (https://github.com/LSENS-BMI-EPFL/NWB_converter). The code used for data analysis is available on Github (https://github.com/LSENS-BMI-EPFL/renard_foustoukos). The Python code used for analyses will also be available via Zenodo.

Figure supplements

Behavioral quantification of rapid whisker detection learning.

(A) Trial number of the first whisker hit on Day 0 for R+ and R- mice. Points indicate individual mice. Bar graph shows mean ± 95% confidence interval (Mann-Whitney U test). (B) Whisker performance on Day 0. Points indicate individual mice. Bar graph shows mean ± 95% confidence interval (Mann-Whitney U test). (C) Stimulation particle off control performed on Day +3 for a subset of 14 R+ mice where the particle is removed from the C2 whisker to control for potential stimulus artefacts. First particle-on block (ON₁), particle-off block (OFF), and second particle-on block (ON₂). Left: whisker hit rate across the three epochs. Middle: catch trial false alarm rate across the three epochs. Right: comparison of whisker hit rate and false alarm rate during the OFF epoch alone. Grey lines show individual mice. Bar graph shows mean ± 95% confidence interval (Mann-Whitney U test). (D) Single-trial whisker binary hit/miss outcomes averaged across mice during Day 0 for R+ (green) and R-(magenta) mice. Top grey-scale bar indicates statistical significance comparing R+ and R- for each day (Mann-Whitney U test). (E) As in panel D with lick probability estimated by a Bayesian state-space model fitted to binary hit/miss outcomes and with whisker trials realigned to the first whisker hit. (F) Lick probability for whisker, auditory, and no-stimulus trial types across time on Day 0, interpolated onto a common time grid. (G) Mean reaction time per stimulus type (auditory, whisker, catch) across training days for R+ and R- mice, computed from lick trials. Points indicate individual mice. Bar graphs show mean ± 95% confidence interval (Mann-Whitney U test). (H) Mean reaction time ± 95% confidence interval across lick trials within Day 0 for each stimulus type, for R+ and R- mice.

Relationship between single-cell learning modulation and population decoding.

(A) Stability of the field of view across imaging days for an example mouse. Images are obtained by averaging the first 1,000 frames of the movement corrected data. (B) Responses to passive whisker stimulations of three example learning modulated cells during the five imaging days: a cell with a strong positive LMI that did not respond before learning (top), a cell with a strong positive LMI with an enhanced response (middle) and a cell with a strong negative LMI with an abolished response (bottom). Individual trials are shown in grey; the trial-averaged trace is shown in black. Orange line indicates whisker stimulus onset. (C) Scatter plot of logistic regression classifier weight versus LMI for all imaged neurons, color-coded by mouse. Black line indicates linear regression line. (D) Pre- vs post-learning decoding accuracy as a function of the proportion of most-modulated cells removed from the population. Cells are ranked by |LMI| in descending order and progressively excluded; at each step, decoding accuracy is computed by 10-fold stratified cross-validated logistic regression.

Pathway-specific reorganization of barrel cortex representations.

(A) Example two-photon calcium imaging field of view (top) and labelling of projecting neuron subtypes (bottom). Green: GCaMP6f-expressing neurons; yellow: CTB retrogradely labelled neurons projecting to the secondary somatosensory cortex (wS2p); blue: CTB retrogradely labelled neurons projecting to the primary motor cortex (wM1p). (B) Population PSTHs over passive whisker trials across the five imaging days for wS2p (top) and wM1p (bottom) neurons, shown separately for R+ mice (green) and R- mice (magenta) (wS2p: n = 17 R+ mice, n = 17 R- mice; wM1p: n = 12 R+ mice, n = 11 R- mice). Orange line indicates whisker stimulus onset. (C) Comparison of whisker-evoked response amplitude (ΔF/F₀, averaged over 0–300 ms from stimulus onset) before (Days -2 and -1; Pre) and after (Days +1 and +2; Post) learning in R+ mice, for wS2p neurons (n = 17 mice). Left: population PSTHs for pre- (grey) and post- (green) learning. Right: bar plot quantification of individual mouse averages over the same time window. Points indicate individual mice. Bar graphs show mean ± 95% confidence interval (Wilcoxon signed-rank test). (D) As in panel C, but for R- mice (n = 17 mice). (E) Distribution of the LMI across wS2p neurons for R+ mice (green; n = 328 neurons from 17 mice with 19 ± 10 neurons per mouse) and R- mice (magenta; n = 254 neurons from 17 mice with 21 ± 12 neurons per mouse). (F) Proportion of wS2p neurons with a significant positive LMI (left) and significant negative LMI (right), compared between R+ and R-mice. Points indicate individual mice. Bar graphs show mean ± 95% confidence interval (Mann-Whitney U test). (G) As in panel C, but for wM1p neurons (n = 12 mice). (H) As in panel D, but for wM1p neurons (n = 11 mice). (I) As in panel E, but for wM1p neurons (green, R+ mice: n = 304 neurons from 12 mice with 18 ± 10 neurons per mouse; magenta, R- mice: n = 182 neurons from 11 mice with 17 ± 12 neurons per mouse). (J) As in panel F, but for wM1p neurons. (K) Contribution of projection subtypes to LMI values. Cumulative distribution of LMI values for wS2p (orange) and wM1p (blue) neurons, shown separately for positive and negative LMI populations and for R+ and R- groups. (L) As in panel K, but for logistic regression classifier weights. (M) Pairwise Pearson correlation between wS2p neuron pairs (wS2p–wS2p) and wM1p neuron pairs (wM1p–wM1p) during the 2-second pre-stimulus quiet window, compared between pre- (Days -2, -1) and post- (Days +1, +2) learning for R+ and R-groups. Bar graphs show mean ± 95% confidence interval (Wilcoxon signed-rank test).

Spontaneous activity does not account for the LMI–reactivation relationship.

(A) Scatter plot of reactivation participation rate versus spontaneous calcium transient frequency on Day 0 for individual neurons, shown separately for R+ (left) and R- (right) mice. Each point represents one neuron, color-coded by LMI value. The black lines indicate the Pearson correlation. (B) Correlation between residuals of LMI and reactivation participation rate obtained from regressing out spontaneous frequency, shown separately for R+ mice (left) and R- mice (right). This analysis tests whether the LMI–participation relationship holds independently of baseline spontaneous activity. Dots indicate individual neurons. The black lines indicate the Pearson correlation. (C) Proportion of neurons classified as significantly participating in reactivation events across training days for LMI-positive (red) and LMI-negative (blue) neurons, shown separately for R+ mice (left) and R- mice (right). Each cell was classified as significantly participating if its observed participation rate exceeded the 95th percentile of a null distribution built from 1,000 circular shifts of the neuronal data. The effect of days on the proportion of reactivations was tested with a Kruskal–Wallis test. This analysis tests whether the LMI-participation relationship holds for a binary measure of significant reactivation independent of the magnitude of the participation rate and accounts for cells that would take part in reactivation by chance due to high spontaneous activity.

Acknowledgements

We thank James Priestley and the members of the Petersen laboratory for helpful discussions. This work was supported by grants 310030_219343 and TMAG-3_209271 from the Swiss National Science Foundation.

Additional information

Author contributions

A.R., G.F., S.C. and C.C.H.P. conceptualized the study; A.R., G.F., R.F.D., A.B. and P.B. wrote the data acquisition codes. A.R., G.F. and M.I. performed all animal experiments and constructed the database. A.R. and G.F. analyzed the data. A.R., S.C. and C.C.H.P. wrote and edited the manuscript, with comments from all authors; S.C. and C.C.H.P. acquired funding and provided overall supervision.

Funding

Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung (SNF) (310030_219343)

  • Carl CH Petersen

Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung (SNF) (TMAG-3_209271)

  • Carl CH Petersen