Introduction

Hippocampal ripples, brief bursts of ~70–150 Hz activity, contribute to the consolidation of hippocampally dependent memories. In rodents, specific hippocampal neuronal firing patterns during spatial navigation represent ongoing experience. During the wakeful rest and sleep that follow, these firing patterns are replayed in a temporally compressed format and coincide with hippocampal ripples1,2. Hippocampal ripple rate predicts subsequent performance and disrupting ripples during either offline state impairs performance, suggesting that ripple-related memory replay is a common mechanism of offline memory consolidation during both wake and sleep3,4,5.

Recent studies of humans also tie offline learning during wake to hippocampal function, even for a motor procedural task, which is not traditionally considered to be hippocampally dependent. When healthy young participants learn a motor procedural task (i.e., the finger tapping Motor Sequence Task, MST), most of the improvement in performance happens offline, during brief (10–30 s) rest periods between typing trials, and not during the actual typing. This phenomenon, labeled micro-offline gains, to distinguish it from the more macro-scale offline learning that occurs over hours of sleep6, is associated with neuroimaging measures of increased hippocampal activation and sequential memory replay during the rest breaks that predict the level of offline improvement7,8. In contrast, patients with dense amnesia due to severe bilateral hippocampal damage, despite intact overall learning of the MST, actually show negative micro-offline gains (i.e., losses), whereas their healthy, age-matched peers retain their learning over breaks9. Collectively, these findings suggest that the hippocampus is required to either improve (in young adults) or maintain (in older adults) motor memory over brief periods of wakeful rest. Here, we test the hypothesis that offline improvement of motor memory during these brief periods of wakeful rest depends specifically on hippocampal ripples. To do so, we studied patients with epilepsy undergoing invasive monitoring with hippocampal electrodes as part of a pre-surgical work-up. We divided the MST into its online (during typing) and offline (during interleaved rest breaks) components and examined ripples during each period and their relations with performance improvement (i.e., micro-online and -offline gains in speed).

Results

Motor Sequence Task (MST) performance

Seventeen epilepsy inpatients (age: 31 + /− 12; range: 17–56; 5 M,12 F) who met all inclusion and exclusion criteria trained on the MST and were included in the analyses. The MST involves repeatedly typing a five-digit sequence (e.g., 4-1-3-2-4) “as quickly and accurately as possible” for 12 30-s trials separated by 30-s rest periods (Fig. 1A). Participants typed with the hand contralateral to the hippocampus with implanted electrodes. Typing speed was quantified as the inverse of the average interval between adjacent key presses within each correctly typed sequence (i.e., key presses/s)6. Micro-online gains were defined as the difference in typing speed between the first and the last correct sequence of each 3 s trial. Micro-offline gains were defined as the difference in typing speed between the last correct sequence of one trial and the first correct sequence of the next. Total gains are the sum of micro-offline and micro-online gains. The micro-online gain from the last (12th) typing trial was excluded from analyses as it is not followed by a corresponding rest period. Family-wise error rate corrected probability levels are reported to control for multiple comparisons.

Fig. 1: Micro-online and -offline gains across MST trials.
figure 1

A Left: Participants (n = 17) rested four fingers on a key pad with keys labeled 1, 2, 3, 4. They were instructed to repeatedly type a five-digit sequence (e.g., 4-1-3-2-4) as quickly and accurately as possible. During the 30 s typing trials, the screen was green, and the sequence was displayed on top. After 30 s, the screen turned red and participants rested for 30 s. Training consisted of 12 typing trials and 11 rest breaks. Middle: Plot of mean online (blue solid line) and offline (dashed red line) gains over the 30 s of each typing and rest period across participants (x-axis), with the standard error (blue shading) of the typing speed. Right: Violin plots showing distribution of the sum of total gains, micro-online gains and micro-offline gains across 11 trials across participants. The black dots represent participants’ means, and horizontal lines represent group means. B Boxplots of micro-online and -offline gains by trial. Each circle is the gain for each of the 17 participants in a given trial. Boxes extend to the median and 25th and 75th percentiles of gains. Whisker lines extend to the maximum/minimum non-outlier values (less than 1.5 of the interquartile range from the upper or lower quartile). Horizontal lines represent trial medians. The rightmost boxplot pair represents the mean of micro-online and -offline gains across trials for each participant. Significant results from paired and one-sample two-tailed t tests are indicated with corrected p-values.

Participants showed significant learning over the course of MST training (Total gains: 0.5 ± 0.06; t(16) = 3.41, p = .004, d = 0.56, 95% CI: 0.04—0.92) and most of this improvement happened offline (Fig. 1). Participants showed significant micro-offline gains (2.32 + /− 2.60; t(16) = 3.68, p = 0.002, d = 0.89, 95% CI: 0.99—3.66) and lost speed online, while typing (i.e., negative micro-online gains: − 1.84 + /− 2.98; t(16) = −2.55, p = 0.021, d = −0.62, 95% CI: −3.37— −0.31). Across participants, summed micro-offline gains were significantly greater than micro-online gains (4.16 + /− 5.52; t(16) = 3.11, p = 0.007, d = 0.75, 95% CI: 1.32—7.00; Fig. 1A, right), and median micro-offline gains were numerically greater than micro-online gains on every trial (Fig. 1B). The finding of greater learning during offline (rest) than online (typing) periods is consistent with previous studies of healthy young adults6,7.

Hippocampal ripple rates during MST

We identified hippocampal ripples (70–150 Hz) during MST training using an automated ripple detector adapted from previous studies10,11,12. Ripples were detected in intracranial EEG recordings from the hippocampus contralateral to the hand that performed the MST. Detected ripples showed the characteristic sharp-wave and oscillatory ripple band activity in the wideband filtered signal (0.3–250 Hz) during both online and offline periods (Fig. 2A; see Supplementary Fig. S1 for additional examples of detected ripples)13. The mean frequency, amplitude, duration, and number of cycles of detected ripples did not significantly differ between online and offline periods (Fig. 2B). We calculated the ripple rate (ripples/s) for each participant during each online and offline period. Across participants and trials, the mean ripple rate was higher during offline than online periods (Fig. 3A; 0.17 ± 0.09 vs. 0.11 ± 0.04; t(16) = 2.29, p = .036, d = .56, 95% CI: 0.00—0.11). Median ripple rate was also numerically higher during offline than online periods on every trial.

Fig. 2: Oscillatory and spectral characteristics of detected ripples.
figure 2

A Wide-band filtered signal, 70–150 Hz filtered signal, and time- frequency spectrograms for a single ripple and averaged ripples across all 17 participants (highlighted in red) during online (typing) and offline (rest) periods. Ripple peaks were aligned before averaging. Time-frequency spectrograms are normalized to the mean across the entire MST run at each frequency. The white line indicates where 60 Hz signal was removed using a notch filter. Each plot is centered on maximum power in the 70–150 Hz filtered signal at the time of a detected ripple. B Online and offline ripple characteristics. Each dot represents the mean value of each of the 17 participants’ ripples’ peak frequency, peak amplitude, duration, and number of oscillatory cycles. Boxes extend to the median and the 25th and 75th percentiles. Whisker lines extend to the maximum/minimum non-outlier values (less than 1.5 of the interquartile range from the upper or lower quartile). Horizontal lines represent medians.

Fig. 3: Hippocampal ripple rates during online and offline periods and their relations to micro-online and -offline gains.
figure 3

A Boxplots of hippocampal ripples during online and offline periods for each trial. Each circle is an individual data point for each participant (n = 17). Boxes extend to the median and 25th and 75th percentiles of ripple rate across participants. Whisker lines extend to the maximum/minimum non-outlier values (less than 1.5 of the interquartile range from the upper or lower quartile). Horizontal lines represent medians. Mean online and offline ripple rates across trials per participant (far right). Significant results from the paired two-tailed t-test is indicated with the p-value. B Scatter plots of mean ripple rate and mean gains across trials. Each participant (n = 17) is a circle. The gray shading represents the standard error of the regression line. C Scatter plots of ripple rates and gains per trial for each participant (n = 17) for online and offline periods. The shading represents the standard error of the regression line.

Relations of ripple rates with MST speed gains

Participants with higher ripple rates during the rest breaks showed correspondingly greater offline gains (Fig. 3B right; r(15) = .65, p = .005, 95% CI: 0.24—0.86), consistent with our hypothesis that offline memory consolidation during wake depends on hippocampal ripples. In contrast, the ripple rate during typing did not correlate with total online gains (Fig. 3B left; r(15) = .04, p = .89, 95% CI: − 0.45—0.51). We then investigated whether ripple rate predicted gains on a trial-by-trial basis (see data in 1B and 3 A). Ripple rate significantly predicted individual trial gains (β est. = 2.38, p = .0009, η2 = .16, 95% CI: 1.13—3.63) and this relation differed for online vs. offline periods (β est. = − 3.04, p = .0003, η2 = .50, 95% CI: − 4.67— − 1.42). Post-hoc tests found a significant effect of offline ripple rate on offline gains (β est. = 2.26, p = .002, η2 = .46, 95% CI: 0.84—3.68) but no effect of online ripple rate on online gains (β est. = − 0.54, p = .52, η2 = .02, 95% CI: − 2.19—1.12; Fig. 3C).

Control analyses

The two participants’ mean offline ripple rates could be considered statistical outliers (2.4 and 2.3 standard deviations above the group mean). The data from these participants were retained for analyses since there is no other reason to suspect that they are not valid. In addition, their mean online ripple rates were not outliers (0.7 and 0.5 standard deviations). When their data are removed, the offline ripple rate is no longer significantly higher than the online ripple rate (t14 = 1.55, p = .14), but the correlations of offline ripples with offline gains across participants and trials remain significant.

In a set of analyses, we addressed the question of whether offline gains primarily reflect recovery from fatigue from the previous typing trial. If this were the case, one would expect more typing to be more fatiguing and to therefore result in greater online losses of speed (i.e., negative online gains). This was not what we found. The number of sequences typed did not correlate with online gains either across participants (r = −.17, p = .51, 95% CI: − 0.60—0.34) or across trials (β est. = − 0.01, p = .46, η2 = .025, 95% CI: − 0.04—0.02). We also compared typing speed on the screening task, which minimizes learning (2 30-s trials of typing 1-2-3-4 separated by a 30-s rest period), to the first two MST trials in the 7 participants for whom we had these data. Participants typed almost twice as fast on screening (4.1 ± 2.9 vs. 2.2 ± 1.3 keypresses/s; t(6) = 2.8, p = .03, d = 1.06, 95% CI: 0.24—3.56), but showed less than half the online losses (−0.08 ± 0.4 vs. − 0.22 ± 0.4 keypresses/s; t(6) = 2.3, p = .05, d = 0.87, 95% CI: − 0.01—0.29). These data are incompatible with micro-offline gains on the MST solely representing recovery from muscle fatigue, since the same subjects proved themselves capable of sustaining higher typing speeds on an over-learned sequence across 30 s trials.

We also used screening task data to evaluate whether the increased ripple rate during MST rest breaks was more likely to reflect learning or other processes related to motor performance. We compared the ripple rates during the first two typing periods and the first rest period of the MST with those of the screening task in the same 7 participants (Supplementary Fig. S3). Ripple rates were similar during typing periods of the MST and screening task (0.09 ± 0.04 vs. 0.08 ± 0.04). In contrast, only during the MST rest break did the ripple rate increase (by 67%), and it was more than double that of the screening task (0.15 ± 0.09 vs. 0.07 ± 0.02). Although not statistically significant in 7 participants, these findings support the hypothesis that ripples during MST rest breaks reflect motor sequence learning.

Discussion

Our primary findings are that patients with epilepsy undergoing invasive EEG monitoring of the hippocampus (i) have more hippocampal ripples during brief, 30-s breaks while learning a motor procedural task than while actually performing the task and (ii) that these offline ripple rates predict task improvement across these same offline periods, both on a subject-by-subject and a trial-by-trial basis. We did not observe these relationships between the online ripple rate and performance changes across typing periods. These findings are consistent with rodent studies showing ripple-related memory replay during the wakeful rest that follows spatial navigation14,15. Disrupting these ripples impairs memory, suggesting that they play a causal role3,4. Our findings also complement human neuroimaging findings of hippocampal activation and sequential memory replay during MST rest breaks that predict the level of offline improvement7,8. The absence of offline learning during both wake9 and sleep16 in patients with dense amnesia due to hippocampal damage, together with the present findings, suggests that the hippocampus is necessary for offline learning and that, at least during wake, this learning depends on ripples. These findings support the possibility that hippocampal ripples are a common mechanism of motor memory consolidation during wake and sleep in humans.

Procedural memory is classically thought not to involve the hippocampus, but instead to rely on the striatum, based on findings that motor procedural performance can improve despite bilateral hippocampal damage17,18,19. How the striatum and hippocampus might interact to mediate motor learning is unclear, with some evidence suggesting competitive interactions (e.g., refs. 20,21). More recently, distinctions between online and offline motor learning have emerged. Human neuroimaging studies show hippocampal activation while learning procedural motor tasks22,23, including the MST, and more so during rest than typing7,8. But neuroimaging studies cannot address questions of whether the hippocampus is simply engaged during offline motor learning or whether it contributes to that learning, and if the latter, by what mechanism? Our studies of people with amnesia due to hippocampal damage demonstrate that the hippocampus is necessary for the offline consolidation of motor procedural learning over both sleep16 and wake9. The present study supports a critical role for hippocampal ripples in the wakeful offline consolidation of motor procedural learning. The findings complement and provide a potential mechanistic explanation for a growing body of neuroimaging findings of hippocampal engagement during wakeful rest following motor learning (e.g., refs. 7,8,24,25). This body of work expands our understanding of the role of the hippocampus beyond declarative memory to include the formation of motor procedural memory.

There were significantly fewer ripples during typing than rest periods, and no correlation between online ripple rates and online gains. This likely reflects differences in hippocampal activity during active vs. offline learning, as is seen in rodent studies26. During spatial navigation, hippocampal place cells exhibit location-specific firing, primarily in the theta band, to provide a map of the environment (a similar phenomenon is seen in humans27). During the wakeful rest that follows, hippocampal neurons repeatedly reactivate recent experiences via the firing of place cells on a much faster time scale during ripples14,15. This ripple-related replay correlates with memory improvement28 and disrupting these ripples consistently impairs memory, consistent with a causal role3,4. Evidence from human neuroimaging studies also indirectly links hippocampal ripples to memory reactivation29 and hippocampal sequential memory replay to memory improvement during rest breaks of the MST8. Although the present study does not measure memory replay, given the rodent and human studies linking ripples to replay, we speculate that the increased ripple rate we observed during rest breaks and its correlation with performance improvement reflect the occurrence of ripple-related memory replay. Further, the loss of ripples and ripple-related memory replay may be the culprit in the losses of offline motor sequence consolidation during rest breaks and sleep in amnesia due to hippocampal loss9,16.

In the present study, as in previous studies of young adults, participants showed online losses of speed followed by marked offline improvements6. This pattern could reflect fatigue accumulating during typing and its dissipation during the rest break that follows30. If this were the case, any learning acquired during the previous typing period could only be fully expressed after rest. Our data, however, indicate that the motor slowing seen during typing periods is unlikely to be due solely to fatigue. If it were, one would expect typing more sequences to be more fatiguing and to therefore result in greater online losses of speed (i.e., negative online gains). This was not the case: the number of sequences typed did not correlate with online losses either across participants or across trials. In addition, on a screening task that minimizes learning, participants typed almost twice as fast as on the MST yet showed less than half the online losses. The findings of no correlations of the number of sequences typed with motor slowing and that the same participants were capable of sustaining higher typing speeds on an over-learned sequence than on the MST are incompatible with a purely fatigue explanation of the online motor slowing during the MST. Previous findings that micro-offline gains are similar in magnitude even when typing periods are reduced by half, which should reduce fatigue, are also incompatible with ‘recovery from fatigue’ as the sole explanation of micro-offline gains31. Alternatively, we propose that micro-offline gains reflect motor memory consolidation during rest. This hypothesis is consistent with findings that the motor memory becomes more resistant to interference from learning a new sequence if the new sequence is presented after a brief delay (10 s) rather than immediately after typing31. This suggests that the stabilization of motor memory traces can happen over seconds. Although we cannot exclude contributions from non-specific factors related to motor performance (e.g., fatigue due to mental or physical exertion), collectively, these behavioral findings support the hypothesis that micro-offline gains reflect a rapid form of motor memory consolidation.

The increased ripple rate during rest compared with typing periods, and its correlation with micro-offline gains, both across participants and across trials, argues for ripples as an important driver of this rapid offline learning. The present findings complement magnetoencephalography findings of hippocampal sequential memory replay during MST rest periods that predict the magnitude of offline gains8 and suggest ripples as the underlying mechanism. Importantly, there was no increase in ripple rate during rest compared with typing on a screening task that minimized learning. Although the MST and screening task had similar ripple rates during typing, during the rest break, only on the MST did the ripple rate increase, and it was more than double the ripple rate during rest on the screening task, despite participants having typed more than twice as fast on screening than the MST. This indicates that the increased ripples and their relationship to offline gains during MST rest breaks are unlikely to reflect recovery from fatigue. These findings instead support the hypothesis that ripples during MST rest breaks underlie motor sequence learning.

Several limitations of the present study are worth noting. Some prior studies of healthy young participants used shorter typing and rest periods (e.g., 10 s), which leave less time for fatigue to build6,8,31. We chose 30 s trials based on previous studies of clinical samples (including amnesia, schizophrenia, and children with epilepsy) and older healthy adults to account for slower typing speeds than young healthy subjects and to reduce set-switching demands9,32,33. Comparing participants in the present study with the young health adults (mean age 27) reported in Mylonas et al., 20249, our epilepsy inpatients typed only about half as fast (2.18 ± 0.88 vs. 4.49 ± 1.76 keypresses/s; t37 = 4.95, p = 1.6 × 10-5, d = 1.66, 95% CI: 1.37—3.25) and took much longer to begin typing at the start of each trial (1193 ± 810 vs. 695.4 ± 490 ms; t37 = 2.92, p = .006, d = 0.74, 95% CI: 152.3—842.9) suggesting larger set-switching costs. Regardless of whether previous studies used 5 s, 10 s6,8,31, or up to 30 s typing and rest periods7,9, performance improved significantly during offline periods while online performance either decreased or was not significantly greater than zero. In a functional MRI study that used 30-s trials, hippocampal activation during rest predicted micro-offline gains7. Since hippocampal activity is not known to correlate with fatigue, this finding is consistent with the interpretation that offline gains, even with 30 s trials, reflect motor memory consolidation. It would be useful to manipulate the duration of typing and rest periods and to have more trials of a non-learning control task to disentangle the potential contributions of recovery from fatigue, memory stabilization, memory enhancement, and other factors to micro-offline gains and their relations to ripples. Future studies might also establish whether the findings of rapid consolidation of motor sequence learning and its relation to hippocampal ripples generalize to other kinds of procedural learning (c.f.34,35, for differences in the role of rest breaks for statistical, rule, and implicit learning). There are also likely to be individual differences in the reliance on online vs. offline learning that the present study was underpowered to explore36, as well as differences among clinical populations that may reflect hippocampal function9,37,38,39.

In conclusion, the hippocampus is necessary for the offline consolidation of motor learning during both brief rest breaks and sleep and this offline learning during wake appears to be mediated by ripples.

Methods

The research protocol was approved by the Partners Institutional Review Board.

Participants

Inpatients with epilepsy undergoing continuous intracranial EEG monitoring of the hippocampus as part of their clinical care were evaluated for participation. Twenty-three participants who met the following inclusion criteria enrolled in the study: ≥12 years old; no prior cortical or subcortical resection; no prior neurosurgical procedure that was expected to interfere with sleep oscillations; estimated IQ ≥ 70 based on neuropsychological assessment and/or the single word reading subtest of the Wide Range Achievement Test-4 (WRAT-440); no history of marked developmental delay or marked motor impairment. Participation for three participants was discontinued after they failed to pass a motor screening test requiring them to correctly type the sequence “1,2,3,4” a total of 24 times during two 30 s trials separated by a 30 s rest period. Of the 20 remaining participants, two were excluded because invalid trials on the Motor Sequence Task (MST) affected the calculation of gains in ≥ 7 of the 22 online and offline periods (see Excluded MST Data below), and one participant was excluded due to excessive amounts of gamma noise in hippocampal recordings (see Signal Preprocessing below). The final sample was comprised of 17 participants (age: 31 + /− 12; range: 17–56; 5 M,12 F; see Supplementary Table S1 for additional participant information). All participants provided informed consent in accordance with the Partners Institutional Review Board and the Declaration of Helsinki. Participants were remunerated for participation and received a small monetary bonus ($0.05) for each correct sequence typed on the MST.

Motor sequence task (MST)

MST Hand selection

Participants performed the MST with the hand contralateral to the hippocampus with implanted electrodes (n = 9). If participants had bilateral hippocampal implants, they used the hand contralateral to the presumed healthier hippocampus (n = 8) based on review of medical records, MRI, and hippocampal electrophysiology by a board-certified epileptologist and neurophysiologist (CJC).

MST Warmup

To acclimate participants to the structure of the MST, they were administered a ‘warmup’ task prior to MST training. Participants rested the index and middle fingers of the hand that they were not using for the MST on the keypad buttons labeled 3 and 4. They were instructed to repeatedly type the sequence 3-4 as quickly and accurately as possible for three 10 s typing periods separated by 10 s rest breaks. The sequence remained on the screen for the duration of the task. During the typing periods, the screen remained green, and a dot appeared in a horizontal line under the sequence with each key press. After the line reached the right border, the dots disappeared one at a time, from right to left, with each additional key press. After 10 s, the screen turned red, and participants rested for 10 s. A countdown of the number of seconds until the screen turned green was displayed as spelled-out numbers. The last three numbers were replaced with tones to alert the participants to get ready to resume typing when the screen turned green again.

MST Administration

The MST had the same structure as the warmup with the following exceptions: the participant used four fingers on the keypad (index, middle, ring, pinkie) to type a 5-digit sequence (e.g., 4-1-3-2-4) and there were twelve 30 s typing trials separated by 30 s rest periods. If a participant did not follow task instructions (e.g., continuously used the incorrect finger for a key), they were corrected in real time by the experimenter.

MST outcome measures

The primary outcome measures were total gains, micro-online gains, and micro-offline gains in typing speed. Typing speed for each correctly typed sequence was quantified as the inverse of the interval between the first and last keypress of the sequence (i.e., key presses/s). Micro-online gains are defined as the difference in typing speed between the first and the last correct sequence of each typing trial6. Micro-offline gains are defined as the difference in typing speed between the last correct sequence of a trial and the first correct sequence of the next trial. Total gains are the sum of micro-offline and micro-online gains per trial and are equal to the difference in typing speed between the first correct sequence of one trial and the first correct sequence of the next. The micro-online gain from the last (12th) typing trial was not included in the calculations, as there is no subsequent rest period, leaving a total of 11 online and 11 offline gains per participant.

Excluded MST data

It is not possible to calculate online gains on trials with no correctly typed sequences, nor is it possible to calculate offline gains for the rest period before and after it. The same is true for trials that were rendered invalid for other reasons, including interruptions by clinical staff or a participant’s failure to follow task instructions (e.g., using the same finger on more than one key). The data from the two participants were excluded from analysis because invalid trials affected the calculation of gains for ≥7 of the 22 online and offline periods. In the included participants, the gains of an average of <1 period per participant could not be scored (4% of the periods).

Hippocampal ripple measurement

Electrode selection

All participants had intracranial recordings targeting the hippocampus. In two participants, foramen ovale electrodes were used. In four participants, a single stereotactically placed electroencephalography (SEEG) electrode was placed that targeted the hippocampal body, and this electrode was used for analysis. In the remaining 13 participants, an SEEG electrode targeting the hippocampal head was used for analysis. In each SEEG case, the three deepest contacts were bipolar referenced, creating two channels per subject for ripple detection.

Data acquisition

Data were acquired at 1024 or 2048 Hz with a Natus Quantum or EMU40 clinical system (Natus Medical Inc., Middleton, WI, USA). Data recorded at 2048 Hz were downsampled to 1024 Hz.

Signal preprocessing

Data were high-pass filtered above 0.1 Hz using a two-pass Finite Impulse Response (FIR) filter in Matlab using the Fieldtrip toolbox41. Sixty Hz line noise and its first harmonic were removed using a two-pass bandstop Butterworth filter. All signals were visually inspected, and high-amplitude artifacts were removed from four participants based on visually determined subject-specific thresholds. Epileptiform spikes were detected using the Reveal algorithm in Persyst 14 software with automatic thresholding (Persyst Development Corporation, Sand Diego, CA, USA)42. High-amplitude spikes missed by the algorithm were manually marked based on visually determined subject-specific thresholds, and all spikes (peak ± 35 ms), were ignored in analyses43. To avoid using channels with excessive high-frequency noise within the ripple band, we identified those that did not have the expected steep fall-off of power as a function of frequency44. In each selected channel, we computed the linear fit between the log power and the log frequency. If the slope of this fit was not lower than −2, we used the closest channel that met this criterion (2 participants). One participant’s data were excluded from analyses since none of the channels met this criterion.

Automated ripple detection

For each participant, ripples were detected across all online and offline periods using a common amplitude threshold. Hippocampal electrodes were bipolar referenced to adjacent electrodes on the same lead. The bipolar signal was bandpass filtered (70–150 Hz), and the envelope of the signal was calculated using the Hilbert transform. The root-mean-squared amplitude of the ripple band envelope was calculated for each electrode. The threshold for ripple detection was set to the upper 95th percentile, which is in the range of other studies11,12. (Note that the findings are qualitatively the same using the upper 99th percentile as a threshold (see Supplementary Fig. S2)). The threshold was calculated using the full signal with artifacts and spikes removed. Each detected ripple was required to exceed this threshold for >6 ms and to have at least 6 peaks, indicating 3 full cycles, in both the raw and the bandpass filtered signal45 and have a ripple-band envelope >3 SDs above the mean during the 200 ms window around the ripple peak. If a detected ripple was within 50 ms before or after the peak of a detected spike, or if it overlapped with detected artifacts, it was rejected. To confirm that the automated detector worked as expected, an expert (CJC) visually validated 20% of both the detected online and offline ripples. The false positive rate was 4.3% and 4.1% for online and offline ripples, respectively.

Statistical analyses

To determine whether online, offline, and total gains differed from zero, we used one-sample t tests. Paired t tests were used to compare offline vs. online gains and offline vs online ripples. We also used paired t tests to conduct control analyses of online and offline ripple characteristics (amplitude, frequency, duration, and number of cycles). To determine whether participants with higher ripple rates also had greater offline gains, we used Pearson correlations. These analyses were corrected for multiple comparisons (family-wise error rate) using non-parametric permutation testing46. For each permutation, we randomly swapped half the pair labels (t tests) or randomly shuffled the values of one variable (correlations). The null distribution for each test category was based on 10,000 permutations. In each permutation, we extracted the maximum absolute test statistic within each category. A two-tailed significance threshold of p < .05 was set at the 95th percentile of each resulting distribution (absolute value thresholds: paired t tests: t = 1.77; one-sample t tests: t = 2.12; correlation coefficients: r = .47). Corrected p-values were estimated from these distributions. To assess the relation of gains with ripples on a trial-by-trial basis within participants, we employed linear mixed effects models with Subject as a random effect to account for repeated measures. We used Ripple Rate, Period (Online, Offline) and their interaction as fixed effects to predict Gains, while allowing the Intercept and Ripple Rate to vary randomly within Subject (Subject Gains ~ Ripple Rate * Period + (1 + Ripple Rate | Subject)). To test our main hypothesis that offline ripples predict gains during offline periods, we investigated online and offline periods in separate linear models (e.g., Offline Gains ~ Offline Ripple Rate + (1 + Offline Ripple Rate | Subject)). P-values for the mixed effect model estimates were calculated using the Kenward-Roger method47. Confidence intervals of the estimates were calculated using a semiparametric bootstrap approach (5000 iterations) implemented in R using the lmeresampler package48.

In a control analyses, we examined whether ripple rates differed during the MST vs. screening task online and offline periods using paired t tests in the 7 participants who completed the screening.

We used a mixed effects model of the form OnlineGains ~ SequencesTyped + (1 + SequencesTyped | Subject) to evaluate whether the number of sequences typed was associated with online gains. If the observed online motor slowing were due to fatigue, we would expect more sequences typed to correlate with lower or more negative online gains.

All models and statistical inference methods were implemented in R using the lme449 and sjPlot50 packages. Given the small sample size, we were not powered to examine the effects of sex.

Reporting summary

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