Skip to main content
Nature Portfolio logoLink to Nature Portfolio
. 2026 Sep 3;29(10):2552–2565. doi: 10.1038/s41593-026-02409-7

Structured experience shapes strategy learning and neural dynamics in the medial entorhinal cortex

John C Bowler 1,2, Dua B Azhar 1,2, Cambria M Jensen 1,2, Hyun-Woo Lee 1,2, James G Heys 1,2,✉
PMCID: PMC13633125  NIHMSID: NIHMS2209578  PMID: 42693198

Abstract

Animals solve new, complex tasks by reusing and adapting prior knowledge. This flexibility depends not only on the content of experience but also on its structure. Early training curricula are especially important: poorly structured experiences can hinder abstraction and limit generalization. However, the neural mechanisms through which experience shapes future learning remain unclear. Here, we trained recurrent neural networks (RNNs) on an odor timing task used to study complex timing behavior in mice and then tested the model predictions with mouse behavior and medial entorhinal cortex recordings. Without structured early experience, both RNNs and mice developed rigid, error-prone strategies, whereas structured training promoted neural activity reflecting the task’s temporal structure. Using dynamical systems analysis, we examined how different training curricula shaped network dynamics and whether these dynamics supported abstraction and generalization as task complexity increased. These findings demonstrate that the structure of prior experience governs how flexible, generalizable knowledge emerges in biological systems and computational models.

Subject terms: Hippocampus, Dynamical systems


The authors use recurrent neural networks to predict how structured prior experience shapes neural dynamics as mice learn flexible timing strategies during complex context-dependent behavior.

Main

Learning enables animals to construct flexible knowledge structures, allowing them to adapt to new tasks by reconfiguring prior experiences into novel strategies. This compositional nature of learning suggests that the structure of prior experiences—the curriculum—is critical for future problem-solving. Poorly structured curricula, however, can cause animals to become ‘stuck’, perseverating on suboptimal solutions that only partially achieve their goals1. The neural mechanisms through which the organization of past experience shapes future learning remain poorly understood. Therefore, we asked: How does the structure of past experience shape both the cognitive strategies and the underlying neural circuit dynamics that support flexible task performance?

Past experience is often conceptualized as a library of atomic units of learned behaviors, called task primitives, each accomplishing a basic goal. Complex behaviors are thought to arise by compiling these primitives into behavioral programs2–5, making learning inherently compositional. In laboratory and real-world settings alike, simpler shaping tasks or experiences often break down complex behaviors into subunits that can later be assembled, or ‘composed’, into strategies capable of achieving broader goals6–9. However, it is often unclear how the structure of prior training alters cognition1. Moreover, shaping protocols—or the natural structure of experience—inevitably embed assumptions about how tasks should be solved, biasing the strategies that emerge. These challenges are amplified when animals must perform distinct actions in contexts with overlapping features, where no single observation reliably signals the correct behavior10–13.

Developing complex context-dependent behaviors requires mnemonic reasoning to link events to the problem space and produce reasonable approaches based on experience. Medial temporal lobe (MTL) structures support context-dependent, episodic learning14–23, and their activity correlates with selected cognitive strategy24–28. Within the MTL, the medial entorhinal cortex (MEC) is recurrently connected29–32, has grid-like tuning during navigation33 and exhibits context-dependent activity and timing-related activity34–39 and is necessary for learning complex and timing behaviors24,37. These properties have motivated attractor-based theories for how MEC generates spatially and temporally structured activity40,41; however, it remains unclear how prior experience shapes recurrent dynamics that traverse context-specific trajectories. MEC is, therefore, a candidate region where experience-dependent changes in neural dynamics could bias future strategy learning.

Notably, it has also been shown in silico that pretraining steps can bias dynamical systems to adopt similar strategies as those utilized by animals when solving complex problems6,42,43. Recurrent neural networks (RNNs) can also learn to perform relatively complex timing comparison tasks, recapitulating key features of the neural dynamics observed in animals44 using plausible network connectivity motifs45. Indeed, RNNs can be trained to learn and reuse task primitives, similar to animals46,47, and to perform multitask learning to investigate how multiple task representations can be composed to support different outcomes based on various learning strategies47–49. Therefore, modeling learning in artificial networks can give key insights into how strategies evolve across learning and which approaches animals implement to compose elements of past experience. Critically, much prior work relies on task primitives with strictly orthogonal input spaces4 or seeks to understand tasks with an explicit context identifying input47,48,50, which is not the case in most laboratory settings or real-world experiences.

To generate mechanistic predictions, we trained RNNs on an odor timing task, using constraints derived from behavioral shaping procedures in mice. This approach allowed us to test how the structure of early experience influences the emergence of learning-related dynamics and cognitive strategies. Analysis of RNN dynamics revealed that well-structured pretraining organizes network activity into distinct low-dimensional motifs that form the computational substrate for abstraction and flexible generalization. By contrast, poorly structured training failed to induce these motifs and impaired task performance. We then tested these predictions experimentally, using behavioral and electrophysiological recordings from mice trained with matched shaping sequences. Mice receiving well-structured early experience exhibited better generalization and MTL activity patterns resembling those observed in the models. Together, these findings demonstrate that it is not just the presence of prior experience but also its structure that governs how flexible and generalizable knowledge emerges in both biological and artificial neural systems.

Results

To study how dynamical systems learn to perform complex tasks, we developed an RNN implementation, similar to previous studies46–48,50, that could be trained on a complex cue timing task that was previously implemented in mice24. In this way, we could fully observe both the network dynamics and architecture to gain key insight into how dynamical systems, such as our model (or the mouse brain), develop task solutions. These networks provide insight into how prior experience alters the dynamical landscape, resulting in optimal (or suboptimal) strategies. To identify the effect of structured early experience, we incorporate a behavioral shaping process, similar to the steps used when training animals24.

The task is an odor timing task in which animals observe two consecutive olfactory stimuli, consisting of the same odorant but presented for distinct durations, with a fixed inter-stimulus interval (ISI). To perform the task correctly, mice identify trials of non-matching durations and respond to these trials by licking at a reward spout. The durations used were either 2 seconds (‘short’, S) or 5 seconds (‘long’, L), and three trial types were used in the experiments: one ‘match’ or ‘No-Go’ trial type (Short-Short (SS)) along with two ‘non-match’ or ‘Go’ trial types (Short-Long (SL) and Long-Short (LS)). Notably, to maintain parity with prior work using the same complex timing task, the Long-Long (LL) match trial type is omitted during training24. The response window follows the second cue offset–licking within this window on non-match trials triggers water reward delivery. Licking prior to the onset of the second stimulus during non-match trials, or at any time during a match/SS trial, is considered an error. The task is, therefore, a modified temporal variant of delayed non-match to sample (tDNMS). Trials are randomized in blocks of four with two match (SS) and two non-match (SL/LS) trials in each block. Trials are initialized with a 250-ms LED flash 3 seconds before odor onset.

For RNNs, the tDNMS task incorporates two inputs, a ‘start cue’ (akin to the LED flash) and a ‘timed cue’ (representing the timed odor stimuli), that are one-hot encoded for off versus on and then altered with Gaussian noise (μ = 0, σ = 0.15). The networks we train to perform this task have a fully connected recurrent layer of ‘leaky’ units, each receiving the two inputs and sending a feedforward connection to a single ‘response’ node (Fig. 1b and Supplementary Video 1). The networks are trained to identify the response windows on Go trials by manipulating the value of the output node and trained to minimize error between their output and a target function representing the response window (Fig. 1c).

Fig. 1. RNNs learn to solve a complex timing task.

Fig. 1

a, The tDNMS task comprises three trial types: two Go trial types (LS and SL) and one No-Go trial type (SS). Trials are presented in blocks of four with trial type shuffled within each block. Left: during shaping, only the Go trials are used, and the correct behavior is to withhold responses until the offset of the second cue. Right: during the full task, the match/No-Go trials are introduced, in which response must be withheld entirely. b, RNNs are constructed with a fully connected recurrent layer of ‘leaky’ units, each receiving feedforward inputs from the trial start cue and a timed cue and sending a feedforward connection to a single ‘response’ or output node. c, MSE comparison across each block of training for n = 12 S/FT RNNs and n = 12 NS RNNs mean (line) and standard deviation (shaded region). For the S/FT RNNs, the first 300 blocks of training omit the matched SS/No-Go trial type. d, Example unit activity of RNN after training without shaping task. e, Example unit activity on RNN after S/FT training. f, Tuning curves for all 128 units of an NS RNN. g, Tuning curves for all 128 units of an RNN trained using the S/FT protocol. h, Example response for an RNN without shaping (NS). Note the early response on LS trial (1.) and the relatively low amplitude response on SL (2.). i, Top, example response of an RNN after training on the shaping task for 300 blocks; bottom, response of the same model after training for an additional 700 blocks on the full task. j, S/FT models outperform NS models for increasing levels of input noise (n = 12 NS RNNs, n = 12 S/FT RNNs, significant effect of input noise, F10,242 = 180.10, P = 4.65 × 10−106, RNN shaping F1,242 = 215.31, P = 2.67 × 10−35 and the interaction between input noise and RNN shaping, F10,242 = 2.01, P = 0.0013, two-way mixed ANOVA). Data are presented as mean ± s.d. across independently initialized RNNs. *P < 0.05, **P < 0.01, ***P < 0.001. k, Example timed cue for two levels of input noise during an SL trial (gray boxes indicate the cue timing). Top, ξin=N0,0.3; bottom, ξin=N0,1.5. l, S/FT models outperform NS models for increasing levels of cue timing ‘jitter’ (n = 12 NS RNNs, n = 12 S/FT RNNs, significant effect of cue ‘jitter’, F8,198 = 207.83, P = 5.79 × 10−92, RNN shaping F1,198 = 245.24, P = 1.71 × 10−36 and the interaction between input noise and RNN shaping, F8,198 = 2.08, P = 0.0392, two-way mixed ANOVA). Data are presented as mean ± s.d. across independently initialized RNNs. *P < 0.05, **P < 0.01, ***P < 0.001. m, Example timed cue for two levels of temporal jitter applied to the input start/stop times during an LS trial (gray boxes indicate the standard cue timing). Top, timing jitter ~N0,0.5; bottom, timing jitter ~N0,2. MSE, mean squared error.

For mice to learn the tDNMS task, extensive behavioral shaping is necessary. Shaping familiarizes animals with the experimental setup while introducing them to the basic rules of the task. During the shaping phase, the match (SS) trial type is withheld from the mice until they reach proficiency on the non-match task (Methods). To isolate how past experience shapes future learning, we augmented the RNNs’ training with an analogous shaping, ‘no match’, task prior to exposing the networks to the full task (Fig. 1a). Furthermore, we compare networks that have undergone the shaping experience prior to learning the full task (S/FT) with networks that were never trained on the shaping task (NS). We train all networks for 1,000 blocks of four trials, at which point the behavior of the networks has converged (Fig. 1c). For S/FT networks, we replace the first 300 blocks with the ‘no match’ shaping task (networks trained on the shaping task but prior to training on the full task are labeled ‘Only Shaping’ RNNs). After training, and in agreement with observations of neural activity in mice24, we observe similar activation patterns in both NS and S/FT RNNs; many individual units exhibit sparsely active temporally tuned fields (Fig. 1d,e). Across the population, the activity of units in S/FT networks more uniformly tile the duration of the full task (Fig. 1f,g); however, this difference is somewhat subtle.

We find stereotypical errors in NS RNNs, particularly early responses after the Long cue on some LS trials, along with relatively low amplitude responses to both LS and SL trial types (Fig. 1h). This combination makes it difficult to define a cutoff threshold to discriminate between a Go and a No-Go trial type (Extended Data Fig. 1a). By contrast, the shaping phase guides S/FT RNNs to solve the task robustly and without error (Fig. 1i and Extended Data Fig. 1a). This discrepancy becomes especially pronounced with increasing levels of input noise. In particular, S/FT networks achieve significantly more successful trials than NS RNNs as the Gaussian noise applied to the input cue increases (significant interaction between input noise and RNN shaping experience; two-way mixed ANOVA, F10,242 = 2.01, P = 0.0013, n = 12 NS RNNs, n = 12 S/FT RNNs; Fig. 1j,k and Extended Data Fig. 1b−e). Furthermore, S/FT RNNs are robust to small deviations in cue timing, outperforming NS RNNs when the cue start and duration are ‘jittered’ by small amounts on each trial (significant interaction between the standard deviation of jitter magnitude and RNN shaping experience; two-way mixed ANOVA, F8,198 = 2.08, P = 0.0392, n = 12 NS RNNs, n = 12 S/FT RNNs, Fig. 1l,m and Extended Data Fig. 1f,g).

Extended Data Fig. 1. S/FT RNNs more robustly solve the tDNMS task compared to NS RNNs.

Extended Data Fig. 1

(a) Peak values inside the “Error” window compared to the “Response” window during tDNMS task for n = 12 NS and n = 12 S/FT networks. Following shaping, individual RNNs solve the task robustly for a range of thresholds on the value of the response node, with many RNNs showing an overlap in response magnitudes between the response window and other times throughout the trial (red boxes) or very narrow window of threshold values. (b) Example RNN behavior for input noise level used during training ξin~N0,0.15 for 1 NS RNN and 1 S/FT RNN. Left. Response of the output node (red) for 12 individual trials. Right. Comparison of peak activity inside the “Error” window compared to “Response” window for 100 trials. Horizontal line indicates threshold for maximal performance, separation performance indicated (99% NS, 100% S/FT). (c-e) Same as b except for increasing input noise (models still trained on N0,0.15) (f) Example RNN behavior for resilience to variable cue timing. Cue start and duration “jittered” on each trial ~N0,0.5s for 1 NS RNN and 1 S/FT RNN. Left. Response of the output node (red) for 4 individual trials, notice variable cue timing (shaded regions). Right. Comparison of peak activity inside the “Error” window compared to “Response” window for 100 trials. Horizontal line indicates threshold for maximal performance, separation performance indicated (83% NS, 95% S/FT). (g) Same as f, except for jitter ~N0,1.0s.

After shaping, a key abstraction about task structure is learned by the RNNs

NS networks show a very different task representation than the S/FT RNNs, as visualized by plotting the first three principal components (PCs) of the activations of the recurrent layer for each RNN type (Fig. 2a and Extended Data Fig. 2a,b). Particularly, NS networks exhibit a fairly tangled pattern of activity51 without easily interpretable structure. In Only Shaping networks, the first two PCs indicate that the RNNs traverse a very stereotypical circular subspace that is largely conserved among the three trial types (Fig. 2a and Extended Data Fig. 2b). The remarkably similar structure of the task representation among trial types is mainly distinguished around the response window in PC3. This deflection also occurs on the SS trial types prior to training on the full task. After incorporating the No-Go trials into training, we observe diminished variance in PC3 during the SS trial type, corresponding to the network learning to inhibit responses (Fig. 2a, dashed line). This means that only a small change is required to adjust behavior to learn the correct full task behavior. This change is mainly observed in the reduced variance in PC3 around the response window. Additionally, experiencing the shaping task causes RNNs to significantly restrict the variance of the network to the first three PCs compared to the NS network (Fig. 2b). In this way, the behavior constrains the dynamics to be lower dimensional and exhibit less tangled trajectories (NS tangling greater than S/FT, n = 12 NS and 12 S/FT RNNs, P = 0.02; Fig. 2c and Extended Data Fig. 2c). Low dimensionality can be enforced in RNNs during training and has been shown to lead to improved generalization during timing tasks52. Interestingly, subjecting the networks to a correctly designed behavioral shaping task enforces a similar constraint on the resulting fully trained RNN.

Fig. 2. Behavioral shaping results in learning an abstract representation of the trial structure.

Fig. 2

a, PCA representation of hidden layer state space from RNN without shaping (NS, left), after 300 blocks of training on the shaping task (OS, middle) and then after training on shaping followed by the full task (S/FT, right). Top, plot of PC1 and PC2; bottom, plot of PC1 and PC3. Dashed boxes indicate key difference between OS and S/FT networks near the response window. OS PCs are projected into the task PCA space of S/FT network. b, S/FT RNNs have more variance explained by fewer PCs, mean (solid line) and standard deviation (shaded area) of n = 12 S/FT RNNs and n = 12 NS RNNs, significant effect of shaping experience (P = 5.6 × 10−10), principal component number (# PC, P = 3.5 × 10−123) and the interaction (P = 4.5 × 10−53), two-way mixed ANOVA. Inset, S/FT networks also have a higher percentage of variance explained by the first three PCs (t = 4.3, P = 2.78 × 10−4, two-sided independent t-test). c, NS networks exhibit more tangled trajectories in state space than S/FT networks. Scatter of NS and S/FT networks trajectory tangling metric for matched input across 15 blocks of four trials of the full task. d, Example within and across context time decoding for an NS RNN. Left, LDA-based cross-validated decoders trained on LS trials and tested on held-out data; middle, the same LS-trained decoders tested on SL trials; right, LS-trained decoder tested on SS trials. e, Left/middle, summary of time decoding within and across trials for n = 12 NS and n = 12 S/FT RNNs; right, P values for NS compared to S/FT results, two-sided independent t-test with Bonferroni correction, *P < 0.05, **P < 0.01, ***P < 0.001. f, Same as d but for S/FT RNN. g, S/FT RNNs outperform NS RNNs at decoding trial time for both within-context and across-context decoding schemes (n = 12 NS RNNs, n = 12 S/FT RNNs, t = 3.9, P = 2.3 × 10−4 within-context decoding, t = 12.1, P = 1.3 × 10−23 across-context decoding, two-sided independent t-test). For box plots, center line indicates the median; box bounds indicate 25th and 75th percentiles; whiskers extend to the most extreme values within 1.5× the IQR; and points beyond whiskers indicate outliers. Pct., percent.

Extended Data Fig. 2. Shaping RNNs constrains network activity to follow smoother state space trajectories.

Extended Data Fig. 2

(a) PCA state space plots from n = 12 example NS RNNs independently initialized and trained. Top. PC1 and PC2. Bottom. PC1 and PC3. (b) Same as a but for 12 S/FT RNNs. (c) S/FT RNNs show significantly less tangling than NS networks. n = 12 NS RNNs, n = 12 S/FT RNNs, t = 2.5, p = 0.02, two-sided independent two-sample t-test. (d) Within- and across-context time decoding for an S/FT RNN from a decoder trained on SL trials. Left. LDA based cross-validated decoders trained on SL trials and tested on held out data. Middle. The same SL trained decoders tested on LS trials. Right. SL trained decoder tested on SS trials. See 2f for LS decoder example. Decoding performed independently and then results averaged across n = 10 SL/FT RNNs. (e) Same as d but for NS RNN. 2d for LS decoder example.

The distinct activity pattern developed during pretraining led us to the question: What do RNNs learn from the shaping task? The evident separation of trial timing (in the first two PCs) from response dynamics (in PC3) suggests that the RNNs had learned to time trials independently of the trial type. To test this, we trained a linear discriminant analysis (LDA)-based classifier to decode trial time, restricting training to either a specific trial type or all trials. Notably, S/FT models could decode the passage of time not only for within-context (trial type) temporal representations (two-sided t-test, n = 12 NS, 12 S/FT, P = 2.3 × 10−4) but also in the cross-context case, performing significantly better than NS RNNs (two-sided t-test, n = 12 NS, 12 S, P = 1.3 × 10−23; Fig. 2d−g and Extended Data Fig. 2d,e); cross-context decoding is thought to reflect concept generalization or abstract thinking53,54. Therefore, the previous shaping experience has not only enforced a lower-dimensional representation of the task into the RNNs but has also led to learning an abstraction between trial types, corresponding to a generalized concept of elapsed trial time.

Prior experience persistently alters network connectivity

Looking at the connection weights of the RNNs reveals how the shaping experience structurally modifies the networks and provides insights into differences between the NS and S/FT RNNs. Sorting the connectivity matrices by peak activation time during the tDNMS trials demonstrates the connectivity patterns present in NS and S/FT RNNs (Fig. 3a,b). Generally, in both the NS and S/FT RNNs, nearby units in the temporal sequence tend to have excitatory connections, whereas cells with more distant peaks show inhibitory connections (Fig. 3c). This nearby excitation, surround inhibition pattern is in agreement with attractor network models of how dynamical systems might engage in timing behaviors40,45. Although the connection pattern predicts that a bump of activity would propagate through the networks, it is unclear how the observed context-dependent and trial-type-specific activity patterns are generated from the observed pattern. S/FT networks also show alternating blocks of units with highly positive inputs from the timed cue, indicating heterogeneity in the tuning curves based on input state in S/FT networks as opposed to NS networks (Fig. 3a,b).

Fig. 3. What effect does the shaping task have on the eventual architecture of RNNs after learning?

Fig. 3

a, Sorting the connectivity matrix from an RNN that was trained without shaping by peak activation on LS trials. Average weight matrices from n = 12 No Shaping RNNs. Top, average of connection weights from feedforward ‘Start’ and ‘Timed Cue’; center, weights of the n = 128 recurrently connected nodes; right, feedforward weights to the output/response node. b, Same as a for a network that trained on the shaping task. Average weight matrices from n = 12 RNNs trained with shaping. c, Nearby units in the temporal sequence tend to have excitatory connections, whereas cells with more distant peaks show inhibitory connections. d, Example eigenspectrum of the connectivity matrices for the recurrent layer of two RNNs. Eigenvalue real, Re(λ), and imaginary, Im(λ), component shown for each network. Dashed black line represents the unity circle. Left, RNN trained with shaping (S/FT); right, RNN with no shaping (NS). e, S/FT RNNs exhibit a characteristic structure, dominated by two sets of conjugate pairs in the eigenspectra, not present in NS networks. Two-dimensional histograms show the percentage of RNNs with eigenvalues at each location. Left, 12 S/FT RNNs; right, 12 NS RNNs. Purple circles highlight the location of crucial eigenvalues in the S/FT networks. f, Decoding presence of structured shaping experience based only on connection weights matrices, cross-validated random forest classifier and empirical one-sided shuffle test; performance exceeded all 1,000 shuffled-label controls, P < 0.001. g, MSE comparison for n = 12 NS RNNs and n = 6 NS RNNs with interventions early in training to stretch recurrent connectivity matrices to match four largest values of the S/FT eigenspectra. Data are presented as mean (line) and standard deviation (shaded region). Intervention points are marked by dashed lines. RNNs with the interventions have lower MSE at the end of training than NS RNNs (t = 2.266, P = 0.0377, two-sided independent t-test on validation MSE after training for all RNNs). h, PCA state space plots for an NS RNN after weights interventions early in training. During tDNMS task, these RNNs’ activity appears more similar to S/FT networks than NS ones (Fig. 2a). i, Behavioral performance on tDNMS task from an NS RNN with the weights interventions early in training. Like S/FT RNNs, these networks have higher performance on the task.

Network activity in the RNNs emerges as a function of the directed connectivity of the units55,56. Therefore, we examined the recurrent weight matrix to identify the dominant dynamical modes–directions in state space along which network activity is amplified or sustained. The eigenvalue spectrum of the recurrent connectivity reveals a remarkably consistent structure for S/FT RNNs that is dominated by the first two conjugate pairs of complex values (Fig. 3d,e). Notably, this analysis provides a signature for the presence of the pretraining experience that is absent in NS networks. This insight permitted us to develop a classifier to detect the prior experience of the RNNs based purely on the connection weights (cross-validated, random forest classifier based on RNNs’ connectivity matrix, P < 0.001, compared to decoding on shuffled data; Fig. 3f). When we systematically modify the recurrent connectivity of naive networks early in training so that the structure incorporates these critical dynamical modes, RNNs subsequently learn to perform the tDNMS task in a manner similar to networks that underwent shaping prior to full task training (Fig. 3g−i). Therefore, understanding how experience modifies network structure is sufficient to extract key aspects of the connectivity that structured prior experience provides.

Prior shaping leaves a persistent structural imprint on the recurrent connectivity of the networks. Although the overall patterns of local excitation and distal inhibition appear similar across NS and S/FT models, the eigenspectra reveal a systematic and robust separation between them: shaped networks reliably develop a pair of dominant complex eigenvalue modes that are absent in NS networks, and these modes are sufficient to lead otherwise unshaped networks toward the shaped solution. This indicates that shaping reorganizes the recurrent weights in a way that reshapes the set of dynamical motifs the network can express. As we show in the next section, these structural changes have consequences for the dynamics: they alter the attractor landscape in ways that enable shaped networks to separate cue detection from representations of elapsed trial time, supporting a more flexible computational strategy.

Dynamical motifs predict network behavior

Because our analysis of the RNN connection weights resembled models of attractor dynamics, we next asked whether the RNNs’ activity during the task could be explained by identifying underlying dynamical motifs48. We systematically searched for fixed and slow points within the region of state space occupied by the RNNs during the tDNMS task. We performed this analysis after training, and the RNN weights are unchanging, meaning that the network evolution is determined by the current location in state space and the external input only. Focusing on the timed cue (because the start cue was brief and identical across trials), we separated network dynamics into two main ‘modes’: Cue On and Cue Off. Using numerical methods57,58, we identified fixed points across NS, Only Shaping and S/FT networks. We found that network activity naturally settled onto a stable cyclic trajectory (limit cycle) in S/FT networks during the Cue Off condition. Limit cycles, however, were a prominent feature only in networks that had undergone the shaping procedure (Only Shaping and S/FT). When the cue switched on, network dynamics shifted toward a strong fixed point that pulled the activity away from the limit cycle (Fig. 4a). Switching the cue on or off toggled the active attractor structure, fully accounting for the task-dependent changes in network state. This attractor switching provided a simple and reliable mechanism for flexibly controlling behavior based on task cues.

Fig. 4. During shaping, networks learn distinct dynamical mechanisms that improve task performance.

Fig. 4

a, Evolution of the network state in PCA space for Cue On and Cue Off conditions superimposed over the activity during the full task. Without shaping (left), the network dynamics are captured by two opposing trajectories depending on whether the timed cue is on or off. After shaping tasks (middle), a limit cycle is observed, which is further refined after training on the full task (right). b, Example PCA state space flow field for Cue On (left) and Cue Off (right) conditions for a network that did not get pretrained on the shaping task. c, Same as b except for an RNN that was exposed to the shaping task prior to training on the full task. d, Comparison of the dynamical states learned by an RNN after training on the shaping task (dashed lines) and after training on the full task (solid lines). Subspaces spanned by PC1 and PC2 (top), PC3 (middle) and the response/output node (bottom) are shown. e, NS RNNs learn to perform a leaky integration on cue duration. Plot shows the distance from the Cue On fixed point normalized to the straight line trajectory between the two points. The y axis is angular deviation from the straight-line trajectory for example NS RNN. Red arrows indicate the path taken from the Cue On fixed point (FP) when the cue is off. Black arrows indicate Cue On trajectories at various locations. Arrow length represents change in state over 1 second. Response area indicates that the approximate location of the output node value is >0.45. f, S/FT RNNs learn to track the phase (that is, time within a trial) as well as total cue duration. Trial timing information is largely stored on the limit cycle in PC1/PC2, whereas cue duration is represented in PC3. The x axis indicates phase along the limit cycle. Example S/FT RNN trajectories are superimposed in trial-type-specific colors; red arrows indicate the limit cycle traversed if the cue remains off; black arrows indicate Cue On trajectories at various locations. The response area (red box; output node value >0.45) is restricted both in PC3/cue detection axis and along the trial timing limit cycle. g, Extending the length of the second cue from 2 seconds to 5 seconds forces the network into the response potent space once the duration is sufficiently longer than the ‘short’ 2-second cue length (between 2.8 seconds and 3.5 seconds). h, Mean and standard deviation of n = 13 S/FT RNNs maximum response value for different cue lengths between SS and SL trials as well as longer-than-long trials (gray). i, Same as g except the first timed cue is varied between the S (2-second) and L (5-second) duration. j, Same as h, except the first cue length is tested. Max, maximum; Norm., normalized.

In NS networks, we observed two regions containing attractor points that occupy opposite extremes along the main axis of variance (PC1), corresponding to Cue On and Cue Off states (Fig. 4a,b and Extended Data Fig. 3a). This geometry pulls network activity along one of two approximate line attractors, depending on the cue state. During Cue On, activity drifts toward a fixed point positioned within the output-potent space, meaning the longer a cue is presented, the greater the likelihood of triggering a response. During the ISI, and inter-trial periods, activity recedes away from the output-potent space. Thus, NS networks behaved like leaky evidence accumulators, where prolonged cues gradually increased response probability (Fig. 4e and Supplementary Video 3). However, network stability in NS networks was poor: input noise during LS trials often pushed activity prematurely toward the Cue On fixed point, leading to aberrant early responses (Extended Data Fig. 4a). We validated this by showing a direct relationship between proximity to the fixed point at the offset of the first cue and the amplitude of erroneous responses (Extended Data Fig. 4b,c). Because the response magnitude of these errors overlapped with correct Go responses, it is impossible to define a clear decision boundary that would identify the response window. By contrast, although S/FT networks also approached the Cue On fixed point, they suppressed premature responses due to additional dynamical constraints learned during shaping (Extended Data Fig. 4d−f).

Extended Data Fig. 3. Dynamical motifs reveal how training approach affects RNNs’ strategy.

Extended Data Fig. 3

(a) Example (n = 1 RNN) fixed/slow points for each trial type for both Cue On and Cue Off modes are shown with state space trajectories superimposed for an NS RNN. Top. PC1 vs PC2. Middle. PC1 vs PC3. Bottom. Response vs PC1. (b) Same as a but for an RNN trained on Only Shaping. (c) Same as a but for an S/FT RNN.

Extended Data Fig. 4. Additional analysis on LS error trials.

Extended Data Fig. 4

(a) Comparison of response value between the 10% highest response to the first cue on LS trials (early response error) and the lowest for 1 example NS RNN. (b) Top. PCA state space plots spanning the onset of the first cue until the end of the ISI for 10% largest early response trials. Bottom. 10% lowest early response. Note trials where the RNN state is closer to the Cue On fixed point when the cue turns off (square) are more likely to exhibit a response. (c) Left. Peak response during the ISI compared to euclidean distance to fixed point at the beginning of the ISI shows a strong relationship between how close the RNN is to the fixed point and the likelihood of an early response for n = 400 trials in example NS RNN. Right. ISI response magnitude peak compared to response window peak magnitude. Overlaps (red) indicates inability to reliably separate “Go” from “No-Go” trials. (d) Same as c but for S/FT RNN. Note there is no overlap in the ISI and response window output. (e) Same as a but for an example S/FT RNN. (f) Same as b but for an example S/FT RNN.

We found that shaping alters computation, not just performance, through investigation of the dynamical motifs that govern how RNNs encode trial timing and context. This analysis reveals the computational strategies that each network learns and why those strategies differ across training histories. After shaping (but prior to full task training), S/FT networks developed critical structure: a stable limit cycle during Cue Off epochs and a fixed point during Cue On epochs offset from that limit cycle (Fig. 4a and Extended Data Fig. 3b). This organization already separated response dynamics from basic timing information, preventing simple drift-to-threshold behavior. After full task training, these dynamics were further refined: the Cue Off limit cycle flattened, keeping network activity away from response-potent dimensions unless specific sequences of Cue On and Cue Off periods had been completed (Fig. 4a,c and Extended Data Fig. 3c). The strategy learned by the S/FT networks separates information about the phase of the trial (for example, Cue 1, ISI; Cue 2, response window) represented by the limit cycle from the cue duration, mainly in PC3. We refer to this strategy as a ‘Detector + Timer’ strategy, because cue detection is orthogonal to representations of the trial time in PC1 and PC2. With this structure, the rate at which evidence accumulates along the decision-to-act dimension adjusts automatically at the different phases of the trial. This means that RNNs learning the trial timer strategy can leverage the additional information about trial structure to suppress responses outside of the correct window, reducing errors (Fig. 4f, Extended Data Fig. 5 and Supplementary Video 2). This strategy involves the following during each trial: (1) activity is initially governed by the Cue Off limit cycle; (2) during the first timed cue, a trajectory terminating at the Cue On fixed-point offset in PC3 state space emerges; (3) during the ISI, the first cue turns off and network variance along PC3 begins to collapse back toward the limit cycle while still evolving around the timing axis; and (4) the second cue puts the network back to a trajectory terminating at the Cue On fixed point. If the second cue is long enough, the network rapidly moves toward the response space, whereas, for an LS trial, the duration of the first cue is long enough that network states do not reach the limit cycle during the ISI, allowing a short second cue to move the network to a response-potent space. We found evidence for the Detector + Timer strategy in all S/FT RNNs, quantified as the offset between fixed and slow points in the Cue Off mode compared to Cue On. NS RNNs exhibit directional bias in the Cue Off mode (consistent with single fixed-point strategies implementing leaky integration). Evaluating all RNNs, we find that NS and S/FT are separated by these two dimensions (Cue Off directional bias and PC3 offset), demonstrating that features of the dynamics discretely cluster and suggesting that unique strategies are being employed by each type of RNN (Extended Data Fig. 6).

Extended Data Fig. 5. Separating trial timing and cue detection provides a gating mechanism for trial response.

Extended Data Fig. 5

(a) Additional detail on the Detector + Timer strategy (See Fig. 4f). Trial timing information is largely stored on the limit cycle in PC1/2, while cue duration is represented in PC3. Here, the x-axis indicates phase along the limit cycle, and red box indicates where value of the response node is > 0.45. Red arrows indicate the limit cycle traversed if the cue remains off, black arrows indicate Cue On trajectories at various locations. An example trajectory of each trial type is superimposed for only the epochs when the cue is on; transparent gray arrows indicate Cue Off epochs on the same trials. (b) Same as a but highlighting Cue Off trajectories, gray arrows indicate Cue On epochs. (c) The timing of the first cue impacts how long the network remains in a “critical window,” where it is most susceptible to being pushed toward response-potent regions of the state space by the second cue. For an example S/FT RNN, yellow boxes indicate regions in state space where a 2s Short cue will elicit a response, while dark gray regions show where a 5s Long cue is sufficient (longer cue durations needed elsewhere, indicated by light gray). The limit cycle and example Cue On trajectory shown as in a. Importantly, the limit cycle accelerates in states proximal to the response window, pushing the network out of this region if no further input is detected. (d) NS RNNs are susceptible to early responses during the ISI in the face of ambiguous or noisy input, consistent with the implementation of a leaky integrator strategy. During LS trials, these networks are very close to the “Go” decision boundary after the first cue and applying a 1s cue is sufficient to push RNNs into the response area (calibrated for each network based on responses during the tDNMS task). Conversely, S/FT RNNs maintain low response probability across the ISI despite the ambiguous 1s cue, except for a critical window in line with the task structure. NS networks show significantly more responses; linear mixed effects linear models fit with or without model type as a feature (χ2 likelihood ratio test p = 2.48 × 10−21); Bonferroni-corrected 2-sided t-test for post-hoc comparisons on each time bin tested, p-values as indicated, mean response rate across 10 trials with n = 12 from NS RNNs and n = 12 S/FT RNNs, *** − p < 0.001, ** − p < 0.01. p-values for each time bin - 8: 9.05 × 10−8, 8.5: 3.02 × 10−10, 9: 8.06 × 10−8, 9.6: 4.45 × 10−8, 10: 1.27 × 10−4, 10.5: 1.65 × 10−5, 11: 3.64 × 10−2.

Extended Data Fig. 6. Key features of RNN dynamics cluster based on training experience.

Extended Data Fig. 6

(a) NS RNNs exhibit a directional bias when the timed cue is left in the off state, consistent with a single fixed point. Arrows show the direction an example network moves through state space in PCs 1 and 2 as the RNN updates. (b) S/FT RNNs exhibit rotational dynamics when the timed cue is left in the off state (and therefore less directional bias), consistent with a single fixed point. Arrows show the direction an example network moves through state space in PCs 1 and 2 as the RNN updates. (c) NS and S/FT RNNs have distinct dynamical structures consistent with unique strategies being implemented. NS networks show directional bias in the Cue Off mode, while S/FT networks have an offset between the fixed and slow points in the Cue off Mode compared to the Cue On mode. n = 12 NS RNNs and n = 12 S/FT RNNs, PC3 offset larger for S/FT networks t = 19.138, p = 3.340 × 10−15, NS RNNs exhibit larger directional bias, t = 10.503, p = 4.909 × 10−10, two-sided t-test.

To test the generalization of these motifs, we systematically modified cue durations and examined RNN responses. In S/FT networks, activity predictably alternated between the Cue Off limit cycle and the Cue On fixed point, with the network’s proximity to the fixed point, especially along PC3, scaling the strength of the output (Fig. 4g). This structured mapping between internal network state and behavioral output held robustly across novel cue manipulations (n = 13 RNNs; Fig. 4h). Furthermore, varying the duration of the first cue revealed that the initial cue exposure shifted the starting state for the second cue, effectively gating whether the network entered a response-potent trajectory (Fig. 4i,j). Critically, the correct sequencing of Cue On and Cue Off epochs, not just the long cue duration alone, was necessary for generating responses: if the first cue was omitted, network activity remained on the Cue Off limit cycle and no response occurred (Extended Data Fig. 7a). Thus, the networks learned not only isolated stimulus−response mappings but also structured trajectories through state space that dynamically linked prior experience to future behavior.

Extended Data Fig. 7. Dynamical motifs make predictions about how RNNs learned strategy extend to novel temporal contexts.

Extended Data Fig. 7

(a) Both cues contribute to the RNNs decisions to respond. For each trial type, fixed/slow points for both Cue On and Cue Off modes are shown with state space trajectories superimposed for an example S/FT RNN when the first cue is omitted. Note: SS and LS result is effectively the same in this case. Top. PC1 vs PC2. Middle. PC1 vs PC3. Bottom. Response vs PC1. (b) The strategy adopted by S/FT RNNs predict a response in reaction to several untrained cue configurations. Left. Long-Long (LL) trial type comprised of two 5s cues. Middle. Medium-Medium (MM) trial type comprised of two 3.5s cues. Right. XL trial type comprised of a single 10s cue.

Choice of shaping task critical for learning abstraction

Learning is proposed to be compositional2,4, and previous training episodes are thought to make up building blocks that can be assembled in the future to construct strategies for solving more complex tasks. In fact, it has been shown that training RNNs on very simple tasks can alter the solutions during future learning by constructing important landmarks in the dynamical landscape48,59. Therefore, we wondered: Does the choice of shaping task matter? Specifically, if we train an RNN on any subset of the task, do we alter the network in ways that improve future learning on the full task? To investigate this, we trained RNNs on a modified shaping task that included only one of the non-match trial types to see if that would still aid learning. When we train RNNs on only the SL trial type during shaping (SL/FT networks), we find no significant improvement over networks trained without any shaping phase (Fig. 5a,b,h). The SL/FT RNNs adopt the predictable strategy of responding after any long cue (Fig. 5c), which leaves them with a suboptimal solution during the full task that is also difficult to refine with additional training. Interestingly, we observe that these SL/FT RNNs follow similar activity patterns during the full task as the NS ones (Fig. 5d and Extended Data Fig. 8).

Fig. 5. Choice of shaping task dictates networks’ ability to learn necessary abstraction.

Fig. 5

a, Schematic of shaping on SL trials only (SL/FT RNNs). b, Model performance plateaus after training at similar level as not including the shaping task. Data are presented are mean (line) and standard deviation (shaded region) (n = 12 NS RNNs and n = 10 SL/FT RNNs). c, Left, example of the model response after 300 blocks of the SL-Only task; right, example response after 700 blocks of training on the full task. Note the early responses on LS trials (1.) and the relatively low amplitude response on SL (2.). d, Representation of network activity after training including different shaping tasks. Top, training on SL-Only results in similar population activity as not including any shaping; middle/bottom, training on LS-Only results in variable outcomes with some networks (A.) able to perform the task, whereas others (B.) are not able to perform the task. e, Schematic of shaping on LS trials only (LS/FT RNNs). f, Model performance plateaus after training but is variable across models. Data are presented are mean (line) and standard deviation (shaded region) (n = 12 NS RNNs and n = 11 SL/FT RNNs). g, Left, example of the model responses after 300 blocks of the shaping task; middle, high-performing model after LS-Only shaping and 700 blocks of training on the full task; right, example low-performing model after LS-Only shaping and full task training. Note the RNN that makes errors (B.) shows early responses on LS trials (1.) and the relatively low amplitude response on SL (2.). h, MSE on full task after training is complete (n = 12 NS, 12 S/FT, 11 LS-Only, 10 SL-Only, F3,41 = 7.91, P = 2.82 × 10−4, followed by two-sided Tukey’s HSD pairwise comparisons corrected for multiple comparisons). Significant differences were NS versus S/FT, P = 1.120 × 10−4 and S/FT versus SL only, P = 0.0354; all others were not significant. For box plots, center line indicates the median; box bounds indicate 25th and 75th percentiles; whiskers extend to the most extreme values within 1.5× the IQR; and points beyond whiskers indicate outliers. HSD, honestly significant difference.

Extended Data Fig. 8. SL/FT networks fail to learn critical abstractions about trial structure.

Extended Data Fig. 8

(a) Example within- and across-context time decoding for an S/FT RNN. Left. LDA based cross-validated decoders trained on LS trials and tested on held out data. Middle. The same LS trained decoders tested on SL trials. Right. LS trained decoder tested on SS trials. (b) Same as a but for decoder trained on SL trials. (c) Error comparison for decoding trial time between SL/FT and S/FT RNNs. SL/FT RNNs show decreased performance at cross-context time decoding relative to within, t = 17.0, p = 2.40 × 10−13, two-sided independent two-sample t-test, n = 10 SL/FT RNNs, 12 S/FT RNNs. (d) SL/FT RNNs show significantly more tangling than S/FT networks. n = 10 SL/FT RNNs, n = 12 S/FT RNNs, t = 3.2, p = 4.62 × 10−3, two-sided independent two-sample t-test.

Alternatively, shaping the RNNs only on the LS trial type (LS/FT networks; Fig. 5e) results in a roughly bimodal response: some RNNs perform the full task almost as well as the RNNs with the standard non-match shaping procedure, but others fail to find a solution and have performance similar to SL/FT and NS networks (Fig. 5f,g). We observe different structure in the principal component analysis (PCA) state space plots between RNNs with these two results. The high-performing LS/FT networks form a ring structure that is conserved among the three trial types, whereas the low-performing LS/FT networks do not (Fig. 5d). This result implies that the randomized initialization of the networks and the noise present during training led some networks to generalize the temporal structure between trial types, whereas others could not learn the abstraction. This observation validates our central hypothesis that the shaping task embeds critical structure into the networks that aid future learning, but the question remains: Why does this happen sometimes for LS/FT networks and never on the SL/FT ones? Critically, the added complexity of having to identify the longer cue (which indicates that this is a Go trial), but then waiting until after the second cue to respond, requires a more nuanced strategy and may sometimes be sufficient to train RNNs to perform the full task well. More generally, as it relates to the tDNMS task, we observe that shaping on only the SL or LS trial type is suboptimal compared to shaping on both of the non-match types (Fig. 5h). The inclusion of two trial types exposes the networks to multiple temporal contexts during the pretraining phase of learning, forcing them to learn the abstraction that is necessary to adopt the more optimal strategy.

RNN predictions demonstrate how shaping procedures are critical to the development of key task abstractions in animals

To test the predictions of our RNN-based analysis in animals, we trained a cohort of mice on the SL-Only shaping task rather than the standard non-match procedure. We then continued to track mouse behavior over 8 days of training on the full task, a time sufficient for most animals to reach proficiency24. We selected the SL-Only shaping because the RNNs make specific testable predictions about how the strategy would be altered in this case. Specifically, SL-Only shaping should reliably develop strategies on the full task that closely match the NS RNNs (Extended Data Fig. 8) while providing animals with a task that familiarizes them with the recording setup, reward port and cue-ISI−cue-respond task structure. After the animals reached proficiency in the shaping task (Methods), we chronically implanted Neuropixels 2.0 probes60,61 and then tracked the behavior and neural activity of the animals on the full task (Fig. 6a and Extended Data Fig. 9a,b).

Fig. 6. Past experience predicts abstraction learning in animals performing tDNMS task.

Fig. 6

a, Mice perform an analogous cue timing task with an odor cue and and licking for water rewards. Separate cohorts were trained with SL+LS shaping and SL-Only shaping. b, Comparison of animal performance by trial type based on shaping experience across the first 8 days of full task training (n = 16 mice SL+LS shaping, n = 4 mice SL-Only shaping). Data are presented as mean ± s.d. across mice for each trial type and training day. c, Example licking behavior of a well-trained mouse on the full task. Top, after SL-Only shaping; bottom, after standard LS+SL shaping. d, Performance averaged across all trial types (n = 16 mice SL+LS shaping, n = 4 mice SL-Only shaping). SL-Only mice are significantly worse after 8 days of training (t = 4.2, P = 0.001, Welch’s unequal variances t-test, two-sided, on day 8 performance). Data are presented as mean ± s.d. across mice at each training day. e, Example spike raster and tuning curves for mice recorded during the full task. Top, for an animal after LS+SL shaping; bottom, for an animal that went through SL-Only shaping. f, Error comparison decoding trial time from animal MEC based on shaping experience. Similar to the RNN trained without proper shaping. SL-Only trained mice show decreased performance at cross-context time decoding (t = 3.2, P = 8.72 × 10−3, two-sided independent two-sample t-test, n = 8 SL-Only sessions, 4 mice × 2 sessions per mouse, n = 5 sessions, n = 4 mice SL+LS shaping). g, Confusion matrix for time decoding on mice trained with LS+SL shaping (10-fold cross-validated), decoder trained on LS trials and then tested on LS (left), SL (middle) and SS trials (right). Average of n = 5 sessions from n = 4 mice. h, Same as g for SL-Only trained animals. Average of n = 6 sessions from n = 3 mice. i, Cross-context time decoding error on individual LS/SL trials shows a significant effect of shaping experience and trial outcome (two-way mixed-effect ANOVA with session ID as random variable, significant effect of shaping experience; n = 145 trials, n = 5 sessions and n = 4 mice LS+SL shaping; n = 101 trials, n = 4 mice and n = 8 sessions SL-Only shaping; F1:700 = 8.360, P = 0.004, trial outcome, F1:700 = 54.591, P = 4.240 × 10−13 and the interaction of experience and outcome F1:700 = 4.551, P = 0.033; post hoc Tukey’s HSD P values as indicated). j, PCA projection of pseudo-population task-aligned units recorded from MEC during tDNMS task. Left, animals trained on SL-Only shaping prior to introducing the full task; right, animals with SL+LS shaping (S/FT); top, plot of PC1 and PC2; bottom, plot of PC1 and PC3; inset, S/FT RNN prediction for comparison. Dashed lines indicate response window. k, PCA projection of the pseudo-population task-aligned units shows increase percentage of variance in the first three PCs from animals with SL+LS shaping (n = 4 random splits of pseudo-population data, t = 4.9, P = 2.73 × 10−3 two-sided independent two-sample t-test). For box plots, center line indicates the median; box bounds indicate 25th and 75th percentiles; whiskers extend to the most extreme values within 1.5× the IQR; and points beyond whiskers indicate outliers. In all panels: P > 0.5 (NS), *P < 0.05, **P < 0.01, ***P < 0.001. NS, not significant; sp s−1, spikes per second.

Extended Data Fig. 9. Animals learn shared time-coding axes across trial types-mirroring the dynamics predicted by RNNs.

Extended Data Fig. 9

(a) Representative brain section from animal trained on S/FT. Nissl stain in black, red dye (DiI/DiD) indicates Neuropixels probe location. Channels collected separately, pseudo-colored and then merged. Scale bar is 1 mm. (b) Same as a but for SL/FT mice. (c) Licking activity of all mice trained with SL+LS shaping and then trained on the full task (S/FT mice) on the recording days used for the time decoding analysis (n = 605 trials from n = 4 mice). (d) Same as c except for the mice trained on SL Only shaping (SL/FT mice). SL/FT mice tend to lick early on LS trials (or not lick at all) resulting in no water reward delivery (n = 802 trials from n = 4 mice). (e) S/FT shows less tangling than SL/FT (S/FT correct trials only) S/FT n = 125 trials from 4 mice, SL/FT n = 200 trials from 4 mice, p = 1.56 × 10−3 two-sided independent two-sample t-test. Tangling calculated on all recorded units across 25 trials per session. (f) Confusion matrix for time decoding on mice trained with LS+SL shaping (10-fold cross validated). Decoder trained on SL trials then tested on LS, SL, and SS trials. Average of n = 5 sessions from 4 mice. See 6g for LS decoder. (g) Same as g for SL Only trained animals. Average of n = 6 sessions from 3 mice. See 6h for LS decoder.

We first sought to answer the question: Do animals learn the same abstracted temporal representations as observed in the RNNs? Our goal in this comparison is not to treat SL-Only and standard shaping animals as parallel behavioral strategies but, rather, to evaluate a specific prediction of the RNN model: that well-trained animals should converge on the same abstract, context-dependent temporal representations learned by the S/FT networks, whereas SL-Only shaping should yield NS-like behavior and limited abstractions of task structure. To do this, we first compared the behavior of animals trained on the SL-Only shaping to animals trained with the standard non-match shaping task. We find that the SL-Only shaping animals are unable to learn to adapt their behavior to find an optimal solution to the task, perseverating on a ‘lick-after-long’ strategy (Extended Data Fig. 9c,d). Although not a solution capable of gaining the maximum possible rewards on the task, this strategy can still result in 75% of the trials correct—all of the SL and SS trials and none of the LS ones (Fig. 6b–d). Mouse behavior thus closely matches the response of both the SL/FT RNNs (Fig. 5c) and the most common errors made by NS networks (Fig. 1h and Extended Data Fig. 4). One important caveat when comparing animal behavior to SL-Only shaped RNNs is that the mice do not typically produce subsequent licking in the actual response window. This difference likely arises from a limitation of the RNN training: supervised learning forces the model to match the target output at each timepoint, leading it to generate an additional peak at the correct response time even after an early lick has already failed the trial. By contrast, mice receive no benefit from emitting any subsequent licking; once an early response occurs, the trial will be unrewarded. Notably, both mice and RNNs are unable to unlearn the early response behavior after otherwise sufficient training time, indicating that the model correctly captures this critical aspect of how animal learning is linked to the task performance.

The RNN model predicts that proper shaping tasks should embed between-trial-type abstractions about the structure of the task as evidenced by improved cross-context time decoding. NS and SL/FT networks demonstrate less evidence for task structure coding (Fig. 2d and Extended Data Fig. 8). We target recordings to the MEC because it was previously shown to be necessary to learn the tDNMS task and correlate with choice of strategy24. Additionally, MEC is a highly recurrently connected region with computational mechanisms that could have strong parallels to the RNN model32. In line with previous results, we find cells that appear to have trial-time-locked tuned fields (Fig. 6e). Performing both within-context and between-context trial time decoding, we find that the mice trained on the SL-Only shaping procedure have much worse between-context decoding compared to within-context, whereas mice with the standard ‘no match’ shaping procedure have more similar decoding errors in both cases (P = 8.72 × 10−3, two-sample t-test; Fig. 6f). In fact, when we look at the errors made by the time decoding, we see very similar error patterns on the cross-context decoding test to those predicted by the RNNs (Figs. 2d and 6g,h and Extended Data Fig. 9f,g).

Furthermore, if animals trained using the standard (LS and SL) shaping protocol are employing a Detector + Timer strategy, the error rate should be influenced by the animals’ ability to estimate time within the trial. To test for this, we investigated the cross-context time decoding performance on individual LS and SL trials and found significant effects of trial outcome on decoding error (two-way mixed-effect ANOVA, significant effect of shaping experience, F1:700 = 8.360, P = 0.004, trial outcome, F1:700 = 54.591, P = 4.240 × 10−13 and the interaction of experience and outcome F1:700 = 4.551, P = 0.033; Fig. 6i). This effect is larger in animals that went through the standard shaping protocol, consistent with representations of trial timing supporting animals’ response decision strategy.

To visualize population activity within MEC during the task, we generated a pseudo-population of task-responding neurons (n = 384 units, Pearson’s P > 0.25) and calculated the first three PCs (Methods). We found distinct responses between mice trained with SL-Only shaping (SL/FT) compared to animals trained with standard shaping (S/FT) (Fig. 6j). Additionally, the S/FT trained animals show structured dynamics in PCA space similar to the S/FT RNN networks, subject to rotations of the state space, with circular representation in the first two PCs and response valence visible in the plot of PC1 and PC3. Lastly, we look at the percentage of explained variance in the first three PCs and find that the S/FT mice have a lower-dimensional representation of the state space compared to SL/FT trained animals (P = 2.73 × 10−3, n = 4 splits of pseudo-population data for both SL/FT and S/FT trained animals; Fig. 6k), similar to the RNN model (Fig. 2b). We also find instances of higher tangling in MEC dynamics during the tDNMS task in SL/FT trained mice than S/FT (Extended Data Fig. 9e). These results demonstrate that using RNNs to model the underlying dynamics that evolve with experience has permitted us not only to resolve predictions about the behavior of animals but also to discover essential aspects of the neural computations supporting task performance. Particularly, we make these observations in a brain region that has previously been shown to be critical to strategy development.

RNNs correctly predict behavioral responses to novel trial types

An observation of the dynamical mechanisms responsible for the strategy employed by S/FT networks is that the Cue On fixed point is in the output-potent space of the RNN. Furthermore, peak responses happen as the activity falls from the fixed point back to the Cue Off limit cycle (Fig. 4). This process means that, although the timing of the cues is necessary to get the RNN to respond, there exists a larger set of cue-timing configurations that should result in a response—beyond the two Go trial types (SL and LS) that the networks were trained on. Specifically, the RNN predicts that both a Long-Long (LL) and a Medium-Medium (MM) trial would result in a response (Fig. 7c and Extended Data Fig. 7b). This prediction is at odds with the explicit Non-Match ≡ Go paradigm that is implied by the non-match to sample task. To test this prediction, we validated this behavior with animals well trained on the tDNMS task. To test animals on the probe (LL or MM) trials without encouraging them to adjust strategy, we implemented a modified tDNMS task where 20% of trials were unrewarded, novel probes (Fig. 7a). Notably, animals maintain proficiency at the tDNMS trials, and, with 80% of the trials being the familiar trial types, mice continue to lick robustly in the response windows and withhold licking on the No-Go/SS trials (Fig. 7b,d). Additionally, animals do indeed lick in response to both the LL and MM trials (Fig. 7b,e,f). Previous modeling of the animals’ behavior indicates that mice use the presence of the long cue as an indication that they are in a Go context while timing both cues to know when to respond24. As such, the LL response is expected, and MM response is dependent only on how much longer-than-short the cue is before animals interpret the cue as being long (for example, how optimistic the animals are). The RNN analysis predicts that any cue longer than around 2.8 seconds would be long enough to elicit a response (Fig. 4g−j).

Fig. 7. RNNs predict animal responses to novel temporal contexts.

Fig. 7

a, To test behavioral response to previously untrained trial types (temporal context), novel cue durations were interleaved into the block structure of the tDNMS task. On each day, a single probe trial was selected and presented to the animal on 20% of trials. Probe trials were unrewarded so as not to reinforce the decision made by the animals. b, Animals robustly interpret probe trials as a Go trial type, responding significantly more than to the SS/No-Go trial type (n = 6 total probe days for each probe type (two sessions from n = 3 mice) and n = 18 non-probe sessions (pooled across all probe recording days)). Two-factor ANOVA, significant effect of trial type, F5,54 = 72.5, P = 1.03 × 10−22, F2,54 = 4.23, mouse, P = 0.02, but not the interaction between mouse and trial type, F10,54 = 0.9, P = 0.50. Response probabilities significantly greater than No-Go trials: LL,SS P = 1.24 × 10−14, LS,SS P = 1.24 × 10−14, MM,SS P = 1.27 × 10−14, SL,SS P = 1.24 × 10−14, XL,SS P = 1.29 × 10−14. All others are not significant; two-sided Tukey’s HSD post hoc test for multiple comparisons. Gray boxes indicate mean and 95% confidence interval for 1,000× response with shuffled trial type labels for comparison to animals performing at chance with bias between Go and No-Go. ***P < 0.001 for SS response compared to all others. c, After training, S/FT RNNs robustly respond after the offset of the second cue in each of the three probe trial types. d, All licking behavior during probe sessions. Mice continue to lick in the response window during tDNMS non-match trials when unchanged probe trials are interleaved. Data from three mice, each recorded six times (two per probe trial type). e, Mice lick in response to LL probes. Data from three mice recorded in two separate sessions per mouse. f, Mice lick in response to MM probes. Data from three mice recorded in two separate sessions per mouse. g, Mice lick in response to XL probes. Data from three mice recorded in two separate sessions per mouse. For box plots, center line indicates the median; box bounds indicate 25th and 75th percentiles; whiskers extend to the most extreme values within 1.5× the IQR; and points beyond whiskers indicate outliers. w/i, within.

Interestingly, there is only a single fixed point in the Cue On mode that the networks are pulled toward, which implies that a sufficiently long single cue should result in a response. We confirm this prediction by testing it with S/FT RNNs and find that a single, 10-second, extra-long (XL) cue reliably elicits RNN responses (Fig. 7c). We also validate this behavior in animals through a third probe trial session and find that mice do indeed lick in response to XL trials (Fig. 7b,g). We consider this a somewhat surprising result as animals (and RNNs) are always trained with the two-cue trial structure, and cue transitions are likely more salient than timing a persistent cue. This agreement between animal behavior and the strategies proposed by the RNNs provides further support for parallels between the mechanisms governing RNN dynamics and the approaches adopted by animals solving the tDNMS task.

Discussion

Using an odor timing task, we show that carefully structured prior experience helps both RNNs and animals learn abstractions that improve later performance. We specifically designed the tDNMS task to require cognitive demands beyond simple stimulus−response learning, allowing us to examine how early experience influences the strategies animals and networks construct. In motor learning, the building blocks, such as the steps of a dance, are often clear; by contrast, in cognitive tasks like the tDNMS task, animals must learn to integrate information about the cue durations and sequence over extended time periods and across gaps (the ISI) to infer whether they are in a Go or a No-Go context. Animals must recognize the current trial type through real-time observation of the cue and store that information to guide future actions—a process analogous to everyday situations where appropriate behavior depends on inferred, overlapping contexts. Prior experience constrains the state space traversed by the dynamical system producing less tangled and more consistently organized trajectories, simplifying the learning of key commonalities between the trial types. Together, these results identify a mechanism for curriculum learning in cognitive tasks that does not depend on explicit contextual cues or fully orthogonal input spaces, distinguishing this work from previous studies on learning dynamics and multitask training44,47,48,50.

The solutions adopted by the RNNs also matched key features of animal behavior and MEC activity. SL-Only mice showed skewed task representations that more closely matched the NS or SL/FT RNNs (Figs. 2d and 6h), whereas mice trained with ‘no match’ shaping performed the tasks well and generalized between trial types (Figs. 2f and 6g). Probe trials further confirmed key model predictions, including that animals could estimate the response window without the canonical two-odor sequence or an explicit ISI (Fig. 7b). Together, these findings suggest that structured prior experience builds a conceptual scaffold that constrains future activity to traverse prescribed states. When novel task demands are then introduced, the natural solutions are to move along dimensions orthogonal to that scaffold, resulting in the observed separation of the time-decoding generalization and response-generating states into orthogonal dimensions. This model−experiment pipeline allowed us not only to confirm that the general principles of abstraction learning apply to both artificial and biological systems but also to uncover dynamical motifs that would have been extremely difficult to detect without targeted hypotheses. Our approach thus provides a framework for understanding how structured experience shapes learning strategies at both behavioral and circuit levels.

Curriculum learning is often posed as a problem of training a system on the correct task primitives that can later be assembled into a strategy for solving a novel or more complex task. Although our results are not strictly in disagreement with this idea, we demonstrate that, for context-dependent tasks, the correct building blocks must be identified carefully. Training RNNs or animals on SL-Only shaping results in a suboptimal strategy that is difficult to unlearn, even though SL trials are explicitly a subtask of the full tDNMS task. As we aim to train animals on increasingly complex and ethologically relevant tasks, it becomes more difficult to ad-hoc design shaping curricula that support the task structure or to guess which strategies animals will learn. Resolving the strategies adopted by simulated dynamical systems gives important clues as to how early training experiences build lower-dimensional structure that supports later learning. Previous results42 as well as ours (Fig. 6c,f–h) indicate that appropriate pretraining steps cause artificial learning systems to adopt strategies that closely match those learned by animals. The cost in time and resources is dramatically lower for training RNNs compared to animal research. Because developing training strategies in simple models and fitting to existing observations allows us to reason about how future tasks will be learned, it is possible to test out curricula in silico before moving to in vivo experiments.

It is important to note that we did not fit biophysical models to neuronal data or employ ethologically plausible learning rules. Instead, we designed a simple model with parameters held constant across training conditions, to generate predictions about animal behavior and neural dynamics. Another important consideration is that the RNNs trained perform a single task, and we do not consider the case of ‘catastrophic’ forgetting46,62 or multitask learning. In our investigations, all shaping tasks are subsets of the full tDNMS task; future work should test how distinct tasks overlap in their representations and alter later strategy development. Finally, we show that past experiences can both amplify performance as well as interfere with finding optimal strategies. Investigating how these interactions reach across task domains could suggest potential mechanisms for improved learning strategies or offline learning that could be transferred to support more optimal performance on future complex tasks.

Methods

Experimental model and subjects

All experiments were conducted in accordance with National Institutes of Health (NIH) guidelines and with the approval of the University of Utah Institutional Animal Care and Use Committee (protocol no. 00001906). Experiments were performed with adult (8−16 weeks, five males, six females) C57Bl/6 mice (Charles River Laboratories). Animals were housed on a reversed 12-hour light/dark cycle, with a room temperature of approximately 21.1 ∘C and humidity between 25% and 45%.

RNN implementation and training

To train RNNs to perform the tDNMS task, we used a modified implementation of a ‘SimpleRNN’ from the Python package TensorFlow63 that was edited to provide for a ‘leak’ term to force the activity of the individual units to decay over time (in the absence of any input) as well as to implement a private noise for all units in the RNN. The activity of the networks is, therefore, governed by the equation:

ht+1=(1−γ)ht+γσwinxt+wrecht+b+𝛏t 1
yt=woutht+bout 2

where γ is the added activity decay bias; xt is the 2 × T input values; win is the N × 2 input values; b is unit biases; ξt is private unit noise; ht is unit activations on the current timestep; and wrec N × N is connection weights in the recurrent layer. σ represents the nonlinear activation function, which was tanh for all RNNs tested. To determine the value of the response node yt, wout 1 × N output weights and bout, the output bias, were used. For all RNNs, N = 128 units, the constant γ = 0.2 and each element of the unit noise vector ξt was independently drawn from N0,0.3 at each timestep. To prevent overfitting, the inputs were disturbed by adding noise randomly drawn from N0,0.15. win, wrec, b, wout and bout were learned while training the RNNs.

To train all RNNs, we used TensorFlowʼs implementation of backpropagation through time using the proved implementation of the Adam optimizer to perform adaptive gradient descent when determining weight updates64. For training, L2 regularization was applied to both the weights and activations with λ = 1 × 10−3 and Adam learning rate set as α = 1 × 10−5, and a limited batch size of 2 was used. RNNs were initialized such that the input weights were drawn from a uniform distribution, and the recurrent layer was initialized to be a random orthogonal matrix. Each RNN was initialized separately and trained with unique input and unit noise at each timestep. Additionally, the order of trial types was randomly shuffled within blocks of four trials, independently every time the RNN was run. All RNNs were trained for a total of 1,000 blocks of four trials; if shaping was used, it replaced the first 300 four-trial blocks. For training and analysis, time was discretized into 10-ms bins, such that there were 200 time bins per 20-second trial.

RNN analysis

Time decoding

Time decoding was conducted using an LDA-based classifier implemented in scikit-learn65. We first generated 60 trials worth of data (15 × 4 blocks of trials) and then split the resulting activity of the recurrent layer of the RNN into 10 folds for cross-validation (by trial). To calculate within-context versus across-context decoding scores, we trained four decoders for each split—one including only trials from one of the three trial types in the training set and a fourth with all trial types. We then tested the decoders on the held-out data from all trials and report within-context decoding as the subset of trials when the training decoder matched the testing trial type and across-context decoding otherwise and predicted elapsed trial time to the nearest 1 second. Results from the decoder trained on all trials are only provided in Fig. 2e for comparison.

Trajectory tangling metric

Tangling is a metric to quantify the degree of smoothness a trajectory takes in state space, and it has been shown that avoiding tangling is an important property of neurons in the motor cortex51. High tangling indicates that similar locations in state space are repurposed to represent distinct moments within or between temporal contexts. The tangling at each timestep Q (t) is calculated as:

Qt=maxt′x°t−x°t′2xt−xt′2+ϵ 3
x°t=xt−xt−Δt/Δt 4

where xt is the state at time t and xt° is the derivative (calculated numerically as in equation (4)) with Δt = 0.1, and ϵ was set to 0.1 times the average squared magnitude of xt for all values of t.

Eigenspectrum analysis of RNN weights

To investigate how RNNs are structurally distinct based on exposure to the shaping experience, we perform an eigendecomposition of the recurrent connections learned during training and plot the eigenspectrum. To achieve this, we leverage the NumPy numerical computing package66 in Python to factor the weights matrix W according to W = UΛU−1 where Λ is the diagonal matrix of eigenvalues. We identify four critical locations in the eigenspetcrum (two sets of conjugate pairs) shared by RNNs that have experienced the shaping procedure and learned to solve the tDNMS task with high proficiency. We confirm that this structure is predictive of prior experience by training a random forest classifier65 using cross-validation (leave one out of each RNN type) on the eight-dimensional space spanned by the real and imaginary parts of the dominant four eigenvalues for each Λ matrix (λ1, λ2, λ3, λ4). To show that these values are sufficient to bias RNNs to adopt the behavior of S/FT trained networks, we calculate the mean value across n = 12 S/FT trained RNNs (λ¯1S/FT,λ¯2S/FT,λ¯3S/FT,λ¯4S/FT) and train new NS RNNs with weights matrix W*, with W* = UΛ*U−1 and

Λ*=λ¯1S/FT00000λ¯2S/FT00⋯000λ¯3S/FT00000λ¯4S/FT0⋮⋱000000λ128 5

The specific values for U and λ5,…, λ128 are determined by the random orthogonal initialization of the weights matrix. At key points early in training (Fig. 3g), λ1,…, λ4 were set back to λ¯1S/FT,…,λ¯4S/FT to ensure that this scaffolding of expansion and rotation implied by these values was not trained out of the network early on. After the 300-th block of training, no more interventions were made. This procedure robustly led to networks with identical behavior to S/FT RNNs despite no direct training experience on the shaping task.

Fixed point and flow field analysis

We identify fixed points according to the methods developed in Sussillo and Barak57 and Golub and Sussillo58 and most closely resembling the techniques used to identify dynamic motifs in Driscoll et al.48. We use a modified version of the fixed point finder code (https://github.com/google-research/computation-thru-dynamics, Apache 2.0 license) implemented in Python using the JAX library67. In brief, this method identifies candidate fixed or slow points in the RNNs’ state space based on the trajectories traversed during the task and then uses an Adam-based optimizer to perform gradient descent to find where the network settles. This is possible because around the fixed points we can approximate the evolution of nonlinear RNN dynamics as a linear system using Taylor series expansion, around candidate fixed points h*:

dhdt=F(h,x) 6
F(h*+δh,x+δx)≈F(h*,x)+δFδh(h*,x)δh+δFδx(h*,x)δx 7

Particularly, we treat Cue On epochs and Cue Off epochs separately, meaning that δx = 0 in all cases, and, because ∥δh∥n≈0 for n > 1, the higher-order terms in the Taylor series can be ignored. Therefore, the linearized system (near fixed points) is approximated as δFδt≈δFδh(h*,x)δh. When identifying fixed points, candidate points are generated based on the states occupied by the RNNs during the full tDNMS task and set the input and internal noise terms to 0. Lastly, in addition to finding fixed points, we also identify points that are sufficiently slow on the timescale of the tDNMS task as approximate fixed points or slow points and define squared speed as q(h)=12∣F(h)∣2 and label points with q < 10−6 as fixed points for our analysis. We validated the fixed points and identified limit cycles by permitting networks to run for long durations (2× trial length) and found this method sufficient to identify the dynamical motifs governing the strategies adopted by the RNNs in our analysis.

Animal surgery and recordings

Neuropixels implant

A Neuropixels 2.0 probe (NP2014; imec), encased in a 3D-printed part61, was disinfected with 99% isopropyl alcohol for 1−2 minutes. The four shanks of the probe were dipped 10 times into a Vybrant cell-labeling solution (Thermo Fisher Scientific) to mark the probe track in the brain. C57BL/6 mice (Charles River Laboratories), aged 2−3 months, were chronically implanted with Neuropixels probes. Mice were anesthetized with 1−2% isoflurane and secured using ear bars and a tooth bar in a stereotaxic frame (Kopf Instruments). Eyes were protected with ophthalmic ointment. Fur over the scalp was removed using depilatory cream, and the scalp was sterilized with ethanol and iodine. An incision was made to expose the skull. Small holes for skull screws were drilled on the left hemisphere and over the cerebellum. One screw was inserted into the left hemisphere, and another screw connected to a silver wire was inserted into the cerebellum; the silver wire served as a ground for neural recordings. A mark for craniotomy was made by black ink at 3.3 mm lateral to bregma around the lambdoid suture line. A custom-designed titanium headplate (9.5 × 33 mm2) was placed on the dorsal surface of the skull, and an opaque Metabond (Parkell) was applied on the skull to fix the skull screws and headplate. After recovery from the surgery, mice began to train in the tDNMS task.

Once mice were proficient at the shaping task, a second surgery was performed. Anesthesia and fixation procedures were identical to the first surgery. The opaque Metabond was removed by drilling at the black mark on the skull. A craniotomy (2 mm × 1 mm) was performed on the right hemisphere, centered 3.3 mm lateral to bregma and slightly caudal to the lambdoid suture, exposing the anterior portion of the transverse sinus. A durotomy was performed under sterile saline. After removing the skull fragment, a ring-shaped well was built around the craniotomy using Charisma (Heraeus Kulzer). The Neuropixels probe was inserted at an angle of 11−13° anteriorly. The center of the four shanks was targeted at 3.3 mm lateral to bregma and anterior to the sinus. The probe was slowly lowered at 2 µm s−1 until either reaching a depth of 3.5 mm or one of the shanks began to bend. Upon reaching the target depth, Dura-Gel (Cambridge NeuroTech) was applied to the craniotomy to maintain brain health. Kwik-Sil (World Precision Instruments) was then applied around the probe to seal the shanks, followed by application of Metabond (Parkell) over the skull and Kwik-Sil to fix the probe case. After each surgery, carprofen (OstiFen) was administered subcutaneously (5 mg kg−1) for pain and inflammation management for 2 days or until the mouse had fully recovered.

For one mouse recorded under an acute setting rather than chronic implantation, the craniotomy was performed under anesthesia the day before recording. The probe was inserted into the brain while the mouse was awake and head-fixed in the behavioral rig. After each recording session, the probe was retracted, and the same craniotomy was reused for two additional days. Different fluorescent dyes (Vybrant Multicolor Cell-Labeling Solutions: DiO, DiI, DiD; Thermo Fisher Scientific) were applied to the probe to differentiate recording tracks across days. Between sessions, the craniotomy was covered with Kwik-Sil.

Electrophysiology recording

Neural recordings were processed on a headstage (HS-2010; imec) where signals were amplified, multiplexed, filtered and digitized. These signals were then transferred to an acquisition system (imec and National Instruments) and streamed into SpikeGLX software (https://billkarsh.github.io/SpikeGLX) for recording. Data were sampled at 30 kHz and digitized with a gain of 100. Behavioral signals, collected using BNC-2110 and PXIe-6341 hardware (National Instruments), were simultaneously streamed into SpikeGLX and time aligned with the neural data.

Single-unit spike sorting and analysis

To perform spike sorting and identify putative single units for subsequent analysis, we used the graph-based clustering algorithm implemented in Kilosort4 (ref. 68). The Python package SpikeInterface was used to preprocess the datasets, interface with Kilosort4 and apply quality control metrics to the output69. Recording channels were grouped by shank on the four-shank Neuropixels 2.0 probe and processed independently. We then high-pass filtered all channels at 400 Hz and applied phase shift correction and common reference averaging across all channels. Bad channels were identified and removed based on noise estimation and similarity to nearby channels. Motion artifacts were detected and removed using the modular motion detection package built into SpikeInterface70 and the Kilosort-like method68. Lastly, all units included in analysis were required to have a minimum ratio of 0.9, ISI violations ratio of less than 0.1 and amplitude cutoff of 0.1 (ref. 71), and these metrics were verified using the visualization tool Phy2 (https://github.com/cortex-lab/phy).

Time decoding and PCA were performed on the identified single units identically as performed on the RNNs (described above). To convert spiking into an analogous rate code to the RNNs, the spike times for each unit were grouped into 0.5-second bins, and Gaussian smoothing was applied with a σ = 2 seconds and a window size of 8 seconds and then z-scored. To generate a pseudo-population for PCA plots, task-responsive units were identified by calculating the mean trial-to-trial Pearson’s correlation. Highly correlated units (P > 0.25) were retained, and the S/FT and SL/FT datasets were downsampled to ensure an equal number of units in each. To pool data between mice while estimating the variability in the data, representative LS, SL and SS tuning curves were generated on four trial splits of the data, and PCA was calculated on the result. The variance explained by the first three PCs was calculated separately for each trial split of the resulting pseudo-population.

Animal training and behavior

Previously established protocols for tDNMS training were followed for the experimental portion of this study24. In summary, training started with habituation, where head-fixed mice were provided with water reward, and, after reliably licking more than 80% of the drops in a series of 50 drops, they began training. Training structure remained the same: 3 seconds before odor onset, a flash of green light cued trial start, and then the first odor came on, followed by a 3-second ISI, and then the second odor, with a response window after the second odor offset. Mice were trained on one session of 100 trials per day for 6 days a week. Training began with shaping, during which mice in the full shaping protocol were presented with randomly intermixed SL and LS trials, whereas mice in the SL shaping protocol were presented with only SL trials. In shaping phase 1, a drop (5 µl) of water was administered after second odor offset, until mice licked to take water in more than 80% of trials. Progressing to shaping phase 2, mice had to lick in a 3-second response window after second odor offset to earn reward. If mice failed to earn reward, the next trial was automatically rewarded. Shaping phase 2 continued until mice successfully triggered reward in more than 20 consecutive trials. Advancing to shaping phase 3, mice had to earn reward by licking during the response window and withhold licking during the first odor presentation and ISI. An incorrect trial was followed by a trial with automatic reward delivery as in shaping phase 2. Behavior was monitored until mice earned more than 20 consecutive rewards for two consecutive days. Subsequently, mice advanced to the tDNMS task, where all trial types were introduced. Mice were rewarded for non-match trials if they licked in the response window and withheld licking before the second odor onset and received no reward for match trials. For full shaping mice, Neuropixels 2.0 probes were implanted once the animals performed more than 70% correctness, and neural data were recorded after the recovery. SL shaping mice underwent Neuropixels 2.0 probe implant surgery after the completion of shaping phase 3. After recovery, mice were trained in the full tDNMS task, which continued until day 8 of the task. Electrophysiology data were recorded on the first 3 days of the task and then on alternating days until training was complete.

Probe trials

A separate cohort of mice that were proficient in the full tDNMS task were trained on a version of the task with varying probe trials. Following a day after performing well on tDNMS, mice underwent a session with blocks of five trials: two non-match trials, two match trials and one probe trial that were randomly shuffled for each block. Sessions with probe trials consisted of 3.5-second medium odor, 3-second ISI and 3.5-second medium odor (MM); 5-second-long odor, 3-second ISI and 5-second-long odor (LL); or one extra-long odor (XL) of 10 seconds. After probe trials, mice were returned to the tDNMS task schedule until they performed proficiently again, which would lead to another session of a different probe trial type the next day. All mice underwent each probe trial type twice.

Statistics and reproducibility

For paired data, unless otherwise indicated, significance was assessed with two-sided t-tests. In all cases, *P < 0.05, **P < 0.01, ***P < 0.001 and not significant. For box plots, the box depicts the first and third quartiles; whiskers extend to the furthest point within 1.5× the interquartile range (IQR); and fliers are depicted as points past the end of the whiskers. In the case of n ≤ 10, all points are superimposed over the box. The center line of box plots is drawn at the median value. Sample sizes were based on prior reports. No statistical method was used to predetermine sample size. No data were excluded from the analyses. The primary manipulations were behavioral and based on prior experience of the animals; the experiments were not randomized; and the investigators were not blinded to allocation during experiments and outcome assessment.

Reporting summary

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

Online content

Any methods, additional references, Nature Portfolio reporting summaries, source data, extended data, supplementary information, acknowledgements, peer review information; details of author contributions and competing interests; and statements of data and code availability are available at https://doi.org/10.1038/s41593-026-02409-7.

Supplementary information

Reporting Summary (61.1KB, pdf)
Supplementary Video 1 (2.1MB, mp4)

Video of example RNN performing the tDNMS task. Schematic diagram of an example RNN performing the tDNMS task. Input layer is shown at the top; dashed line surrounds the recurrent network and response node below as indicated. Activation values are indicated by node weight and color; arrow thickness is related to connection weight. Activation values indicate both unit and input noise sources. Target and actual behavior are indicated on the axes at the bottom.

Supplementary Video 2 (1.5MB, mp4)

Cue On and Cue Off modes interleave along separate cue detection and trial timing axes in S/FT RNNs. Example S/FT RNN trajectories through PCA state space with network mode are indicated. RNN state is shown in colored lines. Cue Off limit cycle is in red; example Cue On trajectory terminating at the fixed point is in black. Red shading appears when output node is responding above threshold. Upper right shows target behavior with response node value.

Supplementary Video 3 (933.4KB, mp4)

NS RNNs operate like approximate leaky integrators for total cue duration. Example NS RNN trajectories through PCA state space with network mode are indicated. RNN state is shown in colored lines. Example Cue Off trajectory terminating at the fixed point is in red; Cue On is in black. Red shading appears when output node is responding above threshold. Upper right shows target behavior with response node value.

Acknowledgements

We thank B. DePasquale and L. Driscoll for their valuable comments and feedback on earlier versions of this manuscript and J. Aljadeff for discussions during the revision process.

Extended data

Author contributions

J.C.B. and J.G.H. designed experiments and analysis and wrote the paper. J.C.B. and D.B.A. developed the RNN model and analysis. J.C.B., D.B.A., C.M.J. and H.-W.L. collected, analyzed and interpreted the data from animal experiments.

Peer review

Peer review information

Nature Neuroscience thanks the anonymous reviewers for their contribution to the peer review of this work.

Funding

This study was supported by the US National Institutes of Health (NIH); the National Science Foundation (NSF); the NIH/National Institute of Mental Health (grant no. 1 DP2 MH129958-01 to J.G.H.); an NSF CAREER Award (no. IOS-2145814 to J.G.H.); the Life Sciences Research Foundation with generous support from the Simons Foundation Collaboration on the Global Brain (J.C.B.); and the University of Utah (J.G.H.). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Data availability

Trained networks and the animal behavior and electrophysiology data presented in this study are publicly available on Zenodo (https://doi.org/10.5281/zenodo.20855879)72.

Code availability

We used publicly available Python packages to train RNNs (https://pypi.org/project/tensorflow/), identify fixed points (https://pypi.org/project/jax/) and process electrophysiology data (https://pypi.org/project/spikeinterface/). Custom scripts to process experiments and calculate statistics are publicly available at https://github.com/heyslab/StructuredExperience_NatNeuro_2026 and https://doi.org/10.5281/zenodo.20855879 (ref. 72).

Competing interests

The authors declare no competing interests.

Footnotes

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data

is available for this paper at https://doi.org/10.1038/s41593-026-02409-7.

Supplementary information

The online version contains supplementary material available at https://doi.org/10.1038/s41593-026-02409-7.

References

  • 1.Le, N. M. et al. Mixtures of strategies underlie rodent behavior during reversal learning. PLoS Comput. Biol.19, e1011430 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Chomsky, N. The language capacity: architecture and evolution. Psychon. Bull. Rev.24, 200–203 (2017). [DOI] [PubMed] [Google Scholar]
  • 3.Elman, J. L. Learning and development in neural networks: the importance of starting small. Cognition48, 71–99 (1993). [DOI] [PubMed] [Google Scholar]
  • 4.Lee, J. H., Mannelli, S. S. & Saxe, A. Why do animals need shaping? A theory of task composition and curriculum learning. In Proc. 41st International Conference on Machine Learning (eds Salakhutdinov, R. et al.) 26837–26855 (PMLR, 2024).
  • 5.Randløv, J. & Alstrøm, P. Learning to drive a bicycle using reinforcement learning and shaping. In ICML ʼ98: Proceedings of the Fifteenth International Conference on Machine Learning (ed. Shavlik, J. W.) 463–471 (Morgan Kaufmann Publishers, 1998).
  • 6.Bengio, Y., Louradour, J., Collobert, R. & Weston, J. Curriculum learning. In ICML ʼ09: Proceedings of the 26th Annual International Conference on Machine Learning 41–48 10.1145/1553374.1553380 (Association for Computing Machinery, 2009). [DOI]
  • 7.Krueger, K. A. & Dayan, P. Flexible shaping: how learning in small steps helps. Cognition110, 380–394 (2009). [DOI] [PubMed] [Google Scholar]
  • 8.Narvekar, S. et al. Curriculum learning for reinforcement learning domains: a framework and survey. J. Mach. Learn. Res.21, 1–50 (2020). [Google Scholar]
  • 9.Skinner, B. F. The Behavior of Organisms: An Experimental Analysis (D. Appleton-Century Company, 1938).
  • 10.Gagliardi, C. M. et al. Distinct neural mechanisms for heading retrieval and context recognition in the hippocampus during spatial reorientation. Nat. Commun.15, 5968 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Keene, C. S. et al. Complementary functional organization of neuronal activity patterns in the perirhinal, lateral entorhinal, and medial entorhinal cortices. J. Neurosci.36, 3660–3675 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Lee, I. & Lee, C.-H. Contextual behavior and neural circuits. Front. Neural Circuits7, 84 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Plitt, M. H. & Giocomo, L. M. Experience-dependent contextual codes in the hippocampus. Nat. Neurosci.24, 705–714 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Buzsáki, G. & Moser, E. I. Memory, navigation and theta rhythm in the hippocampal-entorhinal system. Nat. Neurosci.16, 130–138 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Eichenbaum, H. Hippocampus. Neuron44, 109–120 (2004). [DOI] [PubMed] [Google Scholar]
  • 16.Mishkin, M. Memory in monkeys severely impaired by combined but not by separate removal of amygdala and hippocampus. Nature273, 297–298 (1978). [DOI] [PubMed] [Google Scholar]
  • 17.Muller, R. U., Kubie, J. L. & Ranck, J. B. Spatial firing patterns of hippocampal complex-spike cells in a fixed environment. J. Neurosci.7, 1935−1950 (1987). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.O’Keefe, J. & Dostrovsky, J. The hippocampus as a spatial map. preliminary evidence from unit activity in the freely-moving rat. Brain Res.34, 171–175 (1971). [DOI] [PubMed] [Google Scholar]
  • 19.O’Keefe, J. & Nadel, L. The Hippocampus as a Cognitive Map (Clarendon Press, 1978).
  • 20.Scoville, W. B. & Milner, B. Loss of recent memory after bilateral hippocampal lesions. J. Neurol. Neurosurg. Psychiatry20, 11–21 (1957). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Squire, L. R. & Zola-Morgan, S. The medial temporal lobe memory system. Science253, 1380–1386 (1991). [DOI] [PubMed] [Google Scholar]
  • 22.Wilson, M. A. & McNaughton, B. L. Reactivation of hippocampal ensemble memories during sleep. Science265, 676–679 (1994). [DOI] [PubMed] [Google Scholar]
  • 23.Wood, E. R., Dudchenko, P. A. & Eichenbaum, H. The global record of memory in hippocampal neuronal activity. Nature397, 613–616 (1999). [DOI] [PubMed] [Google Scholar]
  • 24.Bigus, E. R., Lee, H.-W., Bowler, J. C., Shi, J. & Heys, J. G. Medial entorhinal cortex mediates learning of context-dependent interval timing behavior. Nat. Neurosci.27, 1587–1598 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Ferbinteanu, J. & Shapiro, M. L. Prospective and retrospective memory coding in the hippocampus. Neuron40, 1227–1239 (2003). [DOI] [PubMed] [Google Scholar]
  • 26.Jadhav, S. P., Kemere, C., German, P. W. & Frank, L. M. Awake hippocampal sharp-wave ripples support spatial memory. Science336, 1454–1458 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Wikenheiser, A. M. & Redish, A. D. Hippocampal theta sequences reflect current goals. Nat. Neurosci.18, 289–294 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Wood, E. R., Dudchenko, P. A., Robitsek, R. & Eichenbaum, H. Hippocampal neurons encode information about different types of memory episodes occurring in the same location. Neuron27, 623–633 (2000). [DOI] [PubMed] [Google Scholar]
  • 29.Buetfering, C., Allen, K. & Monyer, H. Parvalbumin interneurons provide grid cell-driven recurrent inhibition in the medial entorhinal cortex. Nat. Neurosci.17, 710–718 (2014). [DOI] [PubMed] [Google Scholar]
  • 30.Dhillon, A. & Jones, R. Laminar differences in recurrent excitatory transmission in the rat entorhinal cortex in vitro. Neuroscience99, 413–422 (2000). [DOI] [PubMed] [Google Scholar]
  • 31.Kumar, A., Schrader, S., Aertsen, A. & Rotter, S. The high-conductance state of cortical networks. Neural Comput.20, 1–43 (2008). [DOI] [PubMed] [Google Scholar]
  • 32.Zutshi, I. et al. Recurrent circuits within medial entorhinal cortex superficial layers support grid cell firing. Nat. Commun.9, 3701 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Hafting, T., Fyhn, M., Molden, S., Moser, M. & Moser, E. I. Microstructure of a spatial map in the entorhinal cortex. Nature436, 801–806 (2005). [DOI] [PubMed] [Google Scholar]
  • 34.Boccara, C. N., Nardin, M., Stella, F., O’Neill, J. & Csicsvari, J. The entorhinal cognitive map is attracted to goals. Science363, 1443–1447 (2019). [DOI] [PubMed] [Google Scholar]
  • 35.Butler, W. N., Hardcastle, K. & Giocomo, L. M. Remembered reward locations restructure entorhinal spatial maps. Science363, 1447–1452 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Fyhn, M., Hafting, T., Treves, A., Moser, M.-B. & Moser, E. I. Hippocampal remapping and grid realignment in entorhinal cortex. Nature446, 190–194 (2007). [DOI] [PubMed] [Google Scholar]
  • 37.Heys, J. G. & Dombeck, D. A. Evidence for a subcircuit in medial entorhinal cortex representing elapsed time during immobility. Nat. Neurosci.21, 1574–1582 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Heys, J. G., Wu, Z., Mascaro, A. L. A. & Dombeck, D. A. Inactivation of the medial entorhinal cortex selectively disrupts learning of interval timing. Cell Rep.32, 108163 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Kitamura, T. et al. Entorhinal cortical ocean cells encode specific contexts and drive context-specific fear memory. Neuron87, 1317–1331 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40.Issa, J. B., Tocker, G., Hasselmo, M. E., Heys, J. G. & Dombeck, D. A. Navigating through time: a spatial navigation perspective on how the brain may encode time. Annu. Rev. Neurosci.43, 73–93 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 41.Yoon, K. et al. Specific evidence of low-dimensional continuous attractor dynamics in grid cells. Nat. Neurosci.16, 1077–1084 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 42.Hocker, D., Constantinople, C. M. & Savin, C. Compositional pretraining improves computational efficiency and matches animal behaviour on complex tasks. Nat. Mach. Intell.7, 689–702 (2025). [Google Scholar]
  • 43.Ito, T. et al. Compositional generalization through abstract representations in human and artificial neural networks. In Advances in Neural Information Processing Systems (eds Oh, A. H. et al.) 10.52202/068431-2335 (Neural Information Processing Systems Foundation, Inc., 2022). [DOI]
  • 44.Lin, D., Huang, A. Z. & Richards, B. A. Temporal encoding in deep reinforcement learning agents. Sci. Rep.13, 22335 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 45.Zhou, S., Seay, M., Taxidis, J., Golshani, P. & Buonomano, D. V. Multiplexing working memory and time in the trajectories of neural networks. Nat. Hum. Behav.7, 1170–1184 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 46.Duncker, L., Driscoll, L., Shenoy, K. V., Sahani, M. & Sussillo, D. Organizing recurrent network dynamics by task-computation to enable continual learning. In Advances in Neural Information Processing Systems (eds Larochelle, H. et al.) 14387−14397 https://proceedings.neurips.cc/paper_files/paper/2020/file/a576eafbce762079f7d1f77fca1c5cc2-Paper.pdf (Curran Associates, 2020).
  • 47.Yang, G. R., Joglekar, M. R., Song, H. F., Newsome, W. T. & Wang, X.-J. Task representations in neural networks trained to perform many cognitive tasks. Nat. Neurosci.22, 297–306 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 48.Driscoll, L. N., Shenoy, K. & Sussillo, D. Flexible multitask computation in recurrent networks utilizes shared dynamical motifs. Nat. Neurosci.27, 1349–1363 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 49.Márton, C. D., Gagnon, L., Lajoie, G. & Rajan, K. Efficient and robust multi-task learning in the brain with modular latent primitives. Preprint at 10.48550/arXiv.2105.14108 (2022). [DOI]
  • 50.Mante, V., Sussillo, D., Shenoy, K. V. & Newsome, W. T. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature503, 78–84 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 51.Russo, A. A. et al. Motor cortex embeds muscle-like commands in an untangled population response. Neuron97, 953–966 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 52.Beiran, M., Meirhaeghe, N., Sohn, H., Jazayeri, M. & Ostojic, S. Parametric control of flexible timing through low-dimensional neural manifolds. Neuron111, 739–753 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 53.Bernardi, S. et al. The geometry of abstraction in the hippocampus and prefrontal cortex. Cell183, 954–967 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54.Fascianelli, V. et al. Neural representational geometries reflect behavioral differences in monkeys and recurrent neural networks. Nat. Commun.15, 6479 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 55.Pollock, E. & Jazayeri, M. Engineering recurrent neural networks from task-relevant manifolds and dynamics. PLoS Comput. Biol.16, e1008128 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 56.Huang, Y., Gao, K., Yang, D., Song, S., & Chen, G. Bridging scales: spectral theory reveals how local connectivity rules sculpt global neural dynamics in spatially extended networks. In Advances in Neural Information Processing Systems 38 (eds Belgrave, D. et al.) 66008–66045 (Curran Associates, Inc., 2025).
  • 57.Sussillo, D. & Barak, O. Opening the black box: low-dimensional dynamics in high-dimensional recurrent neural networks. Neural Comput.25, 626–649 (2013). [DOI] [PubMed] [Google Scholar]
  • 58.Golub, M. & Sussillo, D. FixedPointFinder: a TensorFlow toolbox for identifying and characterizing fixed points in recurrent neural networks. J. Open Source Softw.3, 1003 (2018). [Google Scholar]
  • 59.Turner, E. & Barak, O. The simplicity bias in multi-task RNNs: shared attractors, reuse of dynamics, and geometric representation. In Advances in Neural Information Processing Systems (eds Oh, A. et al.) 25495−25507 https://proceedings.neurips.cc/paper_files/paper/2023/file/50d6dbc809b0dc96f7f1090810537acc-Paper-Conference.pdf (Curran Associates, 2023).
  • 60.Steinmetz, N. A. et al. Neuropixels 2.0: a miniaturized high-density probe for stable, long-term brain recordings. Science372, eabf4588 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 61.Melin, M. D. et al. Large scale, simultaneous, chronic neural recordings from multiple brain areas. Preprint at bioRxiv 10.1101/2023.12.22.572441 (2024). [DOI]
  • 62.Kirkpatrick, J. et al. Overcoming catastrophic forgetting in neural networks. Proc. Natl Acad. Sci. USA114, 3521–3526 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 63.Abadi, Martín, et al. TensorFlow: a system for large-scale machine learning. In Proc. 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI ’16) 265–283 (USENIX Association, 2016).
  • 64.Kingma, D. P. & Ba, J. ADAM: a method for stochastic optimization. In Proc. 3rd International Conference on Learning Representations (eds Bengio, Y. & LeCun, L.) (ICLR, 2015).
  • 65.Pedregosa, F. et al. Scikit-learn: machine learning in Python. J. Mach. Learn. Res.12, 2825–2830 (2011). [Google Scholar]
  • 66.Harris, C. R. et al. Array programming with NumPy. Nature585, 357–362 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 67.Bradbury, J. et al. JAX: composable transformations of Python+NumPy programs. GitHubhttp://github.com/jax-ml/jax (2018).
  • 68.Pachitariu, M., Sridhar, S., Pennington, J. & Stringer, C. Spike sorting with Kilosort4. Nat. Methods21, 914–921 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 69.Buccino, A. P. et al. SpikeInterface, a unified framework for spike sorting. eLife9, e61834 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 70.Garcia, S. et al. A modular implementation to handle and benchmark drift correction for high-density extracellular recordings. eNeuro11, ENEURO.0229-23.2023 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 71.Hill, D. N., Mehta, S. B. & Kleinfeld, D. Quality metrics to accompany spike sorting of extracellular signals. J. Neurosci.31, 8699–8705 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 72.Bowler, J., Azhar, D., Jensen, C., Lee, H.-W. & Heys, J. Analysis and source files for ‘Structured experience shapes strategy learning and neural dynamics in the medial entorhinal cortex’. Zenodo 10.5281/zenodo.20855879 (2026). [DOI] [PMC free article] [PubMed]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Reporting Summary (61.1KB, pdf)
Supplementary Video 1 (2.1MB, mp4)

Video of example RNN performing the tDNMS task. Schematic diagram of an example RNN performing the tDNMS task. Input layer is shown at the top; dashed line surrounds the recurrent network and response node below as indicated. Activation values are indicated by node weight and color; arrow thickness is related to connection weight. Activation values indicate both unit and input noise sources. Target and actual behavior are indicated on the axes at the bottom.

Supplementary Video 2 (1.5MB, mp4)

Cue On and Cue Off modes interleave along separate cue detection and trial timing axes in S/FT RNNs. Example S/FT RNN trajectories through PCA state space with network mode are indicated. RNN state is shown in colored lines. Cue Off limit cycle is in red; example Cue On trajectory terminating at the fixed point is in black. Red shading appears when output node is responding above threshold. Upper right shows target behavior with response node value.

Supplementary Video 3 (933.4KB, mp4)

NS RNNs operate like approximate leaky integrators for total cue duration. Example NS RNN trajectories through PCA state space with network mode are indicated. RNN state is shown in colored lines. Example Cue Off trajectory terminating at the fixed point is in red; Cue On is in black. Red shading appears when output node is responding above threshold. Upper right shows target behavior with response node value.

Data Availability Statement

Trained networks and the animal behavior and electrophysiology data presented in this study are publicly available on Zenodo (https://doi.org/10.5281/zenodo.20855879)72.

We used publicly available Python packages to train RNNs (https://pypi.org/project/tensorflow/), identify fixed points (https://pypi.org/project/jax/) and process electrophysiology data (https://pypi.org/project/spikeinterface/). Custom scripts to process experiments and calculate statistics are publicly available at https://github.com/heyslab/StructuredExperience_NatNeuro_2026 and https://doi.org/10.5281/zenodo.20855879 (ref. 72).


Articles from Nature Neuroscience are provided here courtesy of Nature Publishing Group

RESOURCES