# Abstract

Hippocampal place cells in freely moving rodents display both theta phase precession and procession, which is thought to play important roles in cognition, but the neural mechanism for producing theta phase shift remains largely unknown. Here we show that firing rate adaptation within a continuous attractor neural network causes the neural activity bump to oscillate around the external input, resembling theta sweeps of decoded position during locomotion. These forward and backward sweeps naturally account for theta phase precession and procession of individual neurons, respectively. By tuning the adaptation strength, our model explains the difference between “bimodal cells” showing interleaved phase precession and procession, and “unimodal cells” in which phase precession predominates. Our model also explains the constant cycling of theta sweeps along different arms in a T-maze environment, the speed modulation of place cells’ firing frequency, and the continued phase shift after transient silencing of the hippocampus. We hope that this study will aid an understanding of the neural mechanism supporting theta phase coding in the brain.

**eLife assessment**

This work represents an **important** contribution to our understanding of how phenomena associated with the theta rhythm in the hippocampus could be generated even in the absence of theta. This **convincing** computational work provides a parsimonious continuous attractor network model of how hippocampal place cell networks can briefly sweep forward to represent future locations and then sweep back, even in animal species in which theta oscillations are only weakly (or not at all) present.

# Introduction

One of the strongest candidates for temporal coding of a cognitive variable by neural firing is the ‘theta phase precession’ shown by hippocampal place cells. As an animal runs through the firing field of a place cell, the cell fires at progressively earlier phases in successive cycles of the ongoing LFP theta oscillation, so that firing phase correlates with distance traveled (** (O’Keefe and Recce, 1993)**;

**) (see also (**

*(Skaggs et al., 1996)***)) (Fig. 1a&b). At the population level, phase precession of individual cells gives rise to forward theta sequences once starting phases are aligned across the population (**

*(Schmidt et al., 2009)***), where neurons representing successive locations along the trajectory of the animal display predictable firing sequences within individual theta cycles (**

*(Feng et al., 2015)***). These prospective sequential experiences (looking into the future) are potentially useful for a range of cognitive faculties, e.g., planning, imagination, and decision-making (**

*(Johnson and Redish, 2007)***).**

*(O’Keefe and Recce, 1993); (Skaggs et al., 1996); (Hassabis et al., 2007); (Wikenheiser and Redish, 2015); (Kay et al., 2020)*Besides prospective representation, flexible behaviors also require retrospective representation of sequential experiences (looking into the past). For instance, in goal-directed behaviors, it is important to relate the reward information that might only occur at the end of a sequence of events to preceding events in the sequence (** (Foster et al., 2000); (Foster and Wilson, 2006); (Diba and Buzsáki, 2007)**). A recent experimental study (

**) described retrospective sequences during online behaviors (also indicated by (**

*(Wang et al., 2020)***)), namely, reverse theta sequences, interleaved with forward theta sequences in individual theta cycles (Fig. 1c). Such retrospective sequences, together with the prospective sequences, may cooperate to establish higher-order associations in episodic memory (**

*(Skaggs et al., 1996); (Yamaguchi et al., 2002)***).**

*(Diba and Buzsáki, 2007); (Jaramillo and Kempter, 2017); (Pfeiffer, 2020)*While a large number of computational models of phase precession and the associated forward theta sequences have been proposed, e.g., the single cell oscillatory models (** (O’Keefe and Recce, 1993); (Kamondi et al., 1998); (Harris et al., 2002); (Lengyel et al., 2003); (Losonczy et al., 2010)**) and recurrent activity spreading models (

**), the underlying neural mechanism for interleaved forward-and reverse-ordered sequences remains largely unclear. Do reverse theta sequences share the same underlying neural mechanism as forward sequences, or do they reflect different mechanisms? If they do, what kind of neural architecture can support the emergence of both kinds of theta phase shift? Furthermore, since forward theta sequences are commonly seen, but reverse theta sequences are only seen in some circumstances (**

*(Tsodyks et al., 1996); (Romani and Tsodyks, 2015)***), are they commensurate with forward theta sequences? If not, to what degree are forward theta sequences more significant than the reverse ones?**

*(Wang et al., 2020)*To address these questions, we built a continuous attractor neural network (CANN) of the hippocampal place cell population (** (Amari, 1977); (Tsodyks and Sejnowski, 1995); (Samsonovich and McNaughton, 1997); (Tsodyks, 1999)**). The CANN conveys a map of the environment in its recurrent connections that affords a single bump of activity on a topographically organized sheet of cells which can move smoothly so as to represent the location of the animal as it moves in the environment. Each neuron exhibits firing rate adaptation which destabilizes the bump attractor state. When the adaptation is strong enough, the network bump can travel spontaneously in the attractor space, which we term as the intrinsic mobility. Intriguingly, we show that, under competition between the intrinsic mobility and the extrinsic mobility caused by location-dependent sensory inputs, the network displays an oscillatory tracking state, in which the network bump sweeps back and forth around the external sensory input. This phenomenon naturally explains the theta sweeps found in the hippocampus (

**), where the decoded position sweeps around the animal’s physical position at theta frequency. More specifically, phase precession occurs when the bump propagates forward while phase procession occurs when the network bump propagates backward. Moreover, we find that neurons can exhibit either only predominant phase precession (unimodal cells) when adaptation is relatively strong, or interleaved phase precession and procession (bimodal cells) when adaptation is relatively weak.**

*(Skaggs et al., 1996); (Burgess et al., 1994); (Foster and Wilson, 2007)*In addition to theta phase shift, our model also successfully explains the constant cycling of theta sweeps along different upcoming arms in a T-maze environment (** (Kay et al., 2020)**), and other phenomena related to phase precession of place cells (

**). We hope that this study facilitates our understanding of the neural mechanism underlying the rich dynamics of hippocampal neurons and lays the foundation for unveiling their computational functions.**

*(Geisler et al., 2007); (Zugaro et al., 2005)*# Results

## A network model of hippocampal place cells

To study the phase shift of hippocampal place cells, we focus on a one-dimensional (1D) continuous attractor neural network (CANN) (mimicking the animal moving on a linear track, see Fig. 2a), but generalization to the 2D case (mimicking the animal moving in a 2D arena) is straightforward (see Discussion for more details). Neurons in the 1D CANN can be viewed as place cells rearranged according to the locations of their firing fields on the linear track (measured during free exploration). The dynamics of the 1D CANN is written as

Here *U* (*x, t*) represents the presynaptic input to the neuron located at position *x* on the linear track, and *r*(*x, t*) represents the corresponding firing rate constrained by global inhibition (** (Hao et al., 2009)**).

*τ*is the time constant,

*ρ*the neuron density,

*k*the global inhibition strength, and

*g*is the gain factor. The dynamics of

*U*(

*x, t*) is determined by the leaky term −

*U*(

*x, t*), the recurrent input from other neurons, the firing rate adaptation −

*V*(

*x, t*), and the external input

*I*

_{ext}(

*x, t*). The recurrent connection strength

*J*(

*x, x*′) between two neurons decays with their distance. For simplicity, we set

*J*(

*x, x*′) to be the Gaussian form, i.e.,

*J*(

*x, x*′) =

*J*

_{0}/(2

*πa*) exp −(

*x*−

*x*′)

^{2}/(2

*a*

^{2}), with

*J*

_{0}controlling the connection strength and

*a*the range of neuronal interaction. Such connectivity gives rise to a synaptic weight matrix with the property of translation invariance. Together with the global inhibition, the translation invariant weight matrix ensures that the network can hold a continuous family of stationary states (attractors) when no external input and adaptation exist (

**), where each attractor is a localized firing bump representing a single spatial location (Fig. 2b). These bump states are expressed as (see Methods. for the parameter settings and SI.2 for the detailed mathematical derivation):**

*(Tsodyks and Sejnowski, 1995); (Samsonovich and McNaughton, 1997); (McNaughton et al., 2006); (Wu et al., 2008)*
where *A*_{r}(*t*) denotes the bump height and *z*(*t*) the bump center, i.e., the spatial location represented by the network. For convenience, we set the external input to be of the Gaussian form, which is written as *I*_{ext}(*x, t*) = *α* exp [−(*x* − *ν*_{ext}*t*)^{2}/(4*a*^{2})], with *ν*_{ext} representing the moving speed and *α* controlling the external input strength. Such external moving input represents location-dependent sensory inputs (i.e., corresponding to the animal’s physical location) which might be conveyed via the entorhinal-hippocampal or subcortical pathways (** (Van Strien et al., 2009)**). The term −

*V*(

*x, t*) represents the firing rate adaptation (

**), whose dynamics is written as**

*(Alonso and Klink, 1993); (Fuhrmann et al., 2002); (Benda and Herz, 2003)*
where *m* controls the adaptation strength, and *τ*_{ν} is the time constant. The condition *τ*_{ν} ≫ *τ* holds, implying that the firing rate adaptation is a much slower process compared to neuronal firing. In effect, the firing rate adaptation increases with the neuronal activity and contributes to destabilizing the active bump state, which induce rich dynamics of the network (see below).

## Oscillatory tracking of the network

Overall, the bump motion in the network is determined by two competing factors, i.e., the external input and the adaptation. The interplay between these two factors leads to the network exhibiting oscillatory tracking in an appropriate parameter regime. To elucidate the underlying mechanism clearly, we explore the effects of the external input and the adaptation on bump motion separately. First, when firing rate adaptation does not exist in the network (*m* = 0), the bump tracks the external moving input smoothly (see Fig. 2c). We refer to this as the **“smooth tracking state”**, where the internal location represented in the hippocampus (the bump position) is continuously tracking the animal’s physical location (the external input location). This smooth tracking property of CANNs has been widely used to model spatial navigation in the hippocampus (** (Tsodyks and Sejnowski, 1995); (Samsonovich and McNaughton, 1997); (McNaughton et al., 2006); (Battaglia and Treves, 1998)**). Second, when the external drive does not exist in the network (

*α*= 0) and the adaptation strength

*m*exceeds a threshold (

*m*>

*τ*/

*τ*

_{ν}), the bump moves spontaneously with a speed calculated as (see Fig. 2d&e and Methods. for more details). We refer to this as the

**“travelling wave state”**, where the internal representation of location in the hippocampus is sequentially reactivated without external drive, resembling replay-like dynamics during a quiescent state (see Discussion for more details). This intrinsic mobility of the bump dynamics can be intuitively understood as follows. Neurons around the bump center have the highest firing rates and hence receive the strongest adaptation. Such strong adaptation destabilizes the bump stability at the current location, and hence pushes the bump away. After moving to a new location, the bump will be continuously pushed away by the firing rate adaptation at the new location. As a result, the bump keeps moving on the linear track. Similar mechanisms have been applied to explain mental exploration (

**), preplay during sharp wave-ripple events in the hippocampus (**

*(Hopfield, 2010)***), and the free memory recall phenomenon in the brain (**

*(Azizi et al., 2013)***).**

*(Dong et al., 2021)*When both the external input and adaptation are applied to the CANN, the interplay between the extrinsic mobility (caused by the external input) and the intrinsic mobility (caused by the adaptation) will induce three different dynamical behaviors of the network (see **video 1** for demonstration), i.e., 1) when *m* is small and *α* is large, the network displays the smooth tracking state; 2) when *m* is large and *α* is small, the network displays the travelling wave state; 3) when both *m* and *α* have moderate values, the network bump displays an interesting state, called the **“oscillatory tracking state”**, where the bump tracks the external moving input in an oscillatory fashion (Fig. 2f&g). Intuitively, the mechanism for oscillatory tracking can be understood as follows. Due to the intrinsic mobility of the network, the bump tends to move at its own intrinsic speed (which is faster than the external moving input, see Fig. 2d), i.e., the bump tries to escape from the external input. However, due to the strong locking effect of the external input, the bump can not run too far away from the location input, but instead, is attracted back to the location input. Once the bump returns, it will keep moving in the opposite direction of the external input until it is pulled back by the external input again. Over time, the bump will sweep back and forth around the external moving input, displaying the oscillatory tracking behavior.

Our study shows that during oscillatory tracking, the bump shape is roughly unchanged (see Sec. for the condition of shape variability), and the bump oscillation can be well represented as the bump center sweeping around the external input location. The dynamics of the bump center can be approximated as a propagating sinusoidal wave (Fig. 2f), i.e.,

where *z*(*t*) is the bump center at time *t* (see Eq. 3). *s*(*t*) denotes the displacement between the bump center and the external input, which oscillates at the frequency *ω* with the amplitude *c*_{0} > 0 and a constant offset *d*_{0} > 0 (see Methods. for the values of these parameters and SI.3 for the detailed derivation). When the firing rate adaptation is relatively small, the bump oscillation frequency can be analytically solved to be (see also Fig.S1):

We see that the bump oscillation frequency *ω* increases sublinearly with the external input strength *α* and the adaptation strength *m* (Fig. 2h&i). By setting the parameters appropriately, the bump can oscillate in the theta band (6-10 Hz), thus approximating the experimentally observed theta sweeps (see below). Notably, LFP theta is not explicitly modelled in the network. However, since theta sweeps are bounded by individual LFP theta cycles in experiments, they share the same oscillation frequency as LFP theta. For convenience, we will frequently use LFP theta below and study firing phase shift in individual oscillation cycles.

## Oscillatory tracking accounts for both theta phase precession and procession of hippocampal place cells

In our model, the bump center and external input represent the decoded and physical positions of the animal, respectively, thus the oscillatory tracking of the bump around the external input naturally gives rise to the forward and backward theta sweeps observed empirically (Fig. 3a&b) (** (Wang et al., 2020)**). Here we show that oscillatory tracking of the bump accounts for the theta phase precession and procession of place cell firing.

Without loss of generality, we select the neuron at location *x* = 0 as the probe neuron and examine how its firing phase changes as the external input traverses its firing field (Fig. 3c). In the absence of explicitly simulated spike times, the firing phase of a neuron in each theta cycle is measured by the moment when the neuron reaches the peak firing rate (see Methods. for modeling spike times in the CANN). Based on Eqs. 3 & 5, the firing rate of the probe neuron, denoted as *r*_{0}(*t*), is expressed as

where *A*_{r}(*t*) is the bump height, and *h*(*t*) is an oscillatory moving term denoting the displacement between the bump center and the location of the probe neuron. It is composed of a moving signal *ν*_{ext}*t* and an oscillatory signal *c*_{0} sin *ωt* + *d*_{0}, with *c*_{0} the oscillation amplitude, *ω* the frequency and *d*_{0} an oscillation offset constant. It can be seen that the firing rate of the probe neuron is determined by two factors, *A*_{r}(*t*) and *h*(*t*). To simplify the analysis below, we assume that the bump height *A*_{r}(*t*) remains unchanged during bump oscillations (for the case of time-varying bump height, see Sec.). Thus, the firing rate only depends on *h*(*t*), which is further determined by two time-varying terms, the oscillation term *c*_{0} sin *ωt* and the location of the external input *ν*_{ext}*t*. The first term contributes to firing rate oscillations of the probe neuron, and the second term contributes to the envelope of neuronal oscillations exhibiting a waxing-and-waning profile over time, as the external input traverses the firing field (the absolute value |*ν*_{ext}*t*| first decreases and then increases; see Fig. 3d, also **video 2**). Such a waxing-and-waning profile agrees well with the experimental data (** (Skaggs et al., 1996)**). In each LFP theta cycle, the peak firing rate of the probe neuron is achieved when |

*h*(

*t*) | reaches a local minima (Fig. 3c&d). We differentiate three stages as the external input passes through the probe neuron (i.e., the animal travels through the place field of the probe neuron), i.e.,

**the entry stage**. As the external input enters the firing field of the probe neuron (moving from left to right),*h*(*t*) < 0 always holds (Fig. 3c). In this case, the peak firing rate of the probe neuron in each oscillatory cycle is achieved when*h*(*t*) reaches the maximum (i.e.,*h*(*t*) reaches the minimum). This corresponds to*c*_{0}sin*ωt*=*c*_{0}, i.e.,*ωt*=*π*/2 (Fig. 3e). This means that the firing phase of the probe neuron at the entry stage is constant, which agrees with experimental observations ().*(O’Keefe and Recce, 1993); (Skaggs et al., 1996)***the phase shift stage**. As the external input moves into the centre of the firing field,*h*(*t*) = 0 can be achieved in each oscillatory cycle (Fig. 3c). Notably, it is achieved twice in each cycle, once as the bump sweeps over the probe neuron in the forward direction and the other as the bump sweeps over the probe neuron in the backward direction. Therefore, there are two firing peaks in each bump oscillation cycle (Fig. 3d), which are expressed as (by solving+_{ext}t*c*_{0}sin*ωt*+*d*_{0}= 0):where

*t*_{f}and*t*_{b}denote the moments of peak firing in the forward and backward sweeps, respectively, and*ϕ*_{f}and*ϕ*_{b}the corresponding firing phases of the probe neuron. As the external input travels from (−*c*_{0}−*d*_{0}) to (*c*_{0}−*d*_{0}), the firing phase*ϕ*_{f}in the forward sweep decreases from*π*/2 to −*π*/2, while the firing phase*ϕ*_{r}in the backward sweep increases from*π*/2 to 3*π*/2 (Fig. 3e). These give rise to the phase precession and procession phenomena, respectively, agreeing well with experimental observations ().*(Skaggs et al., 1996); (Wang et al., 2020); (Yamaguchi et al., 2002)***the departure stage**. As the external input leaves the firing field,*h*(*t*) > 0 always holds (Fig. 3c), and the peak firing rate of the probe neuron is achieved when*h*(*t*) reaches its minimum in each oscillatory cycle, i.e.,*c*_{0}sin(*ωt*) = −*c*_{0}with*ωt*=*π*/2 (Fig.3e). Therefore, the firing phase of the probe neuron is also constant during the departure stage

In summary, oscillatory tracking of the CANN well explains the firing phase shift of place cells when the animal traverses their firing fields. Specifically, when the animal enters the place field, the firing phase of the neuron remains constant, i.e., no phase shift occurs, which agrees with experimental observations (** (O’Keefe and Recce, 1993); (Skaggs et al., 1996)**). As the animal approaches the centre of the place field, the firing phase of the neuron starts to shift in two streams, one to earlier phases during the forward sweeps and the other to later phases during the backward sweeps. Finally, when the animal leaves the place field, the firing phase of the neuron stops shifting and remains constant. Over the whole process, the firing phase of a place cell is shifted by 180 degrees, which agrees with experimental observations (

**).**

*(O’Keefe and Recce, 1993); (Skaggs et al., 1996)*## Different adaptation strengths account for bimodal and unimodal cells

The results above show that during oscillatory tracking, a place cell exhibits both significant phase precession and procession, which are associated with two firing peaks in a theta cycle. These neurons have been described as bimodal cells (** (Wang et al., 2020)**) (Fig. 4a). Conversely, previous experiments have primarily focused on the phase precession of place cell firing, while tending to ignore phase procession, which is a relatively weaker phenomenon (

**). Place cells with negligible phase procession have been described as unimodal cells (Fig. 4b). Here, we show that by adjusting a single parameter in the model, i.e., the adaptation strength**

*(O’Keefe and Recce, 1993); (Skaggs et al., 1996)**m*, neurons in the CANN can exhibit either interleaved phase precession and procession (bimodal cells) or predominant phase precession (unimodal cells). To understand this, we first recall that the firing rate adaptation is a much slower process compared to neural firing and its timescale is in the same order as the LFP theta (i.e.,

*τ*

_{ν}= 100 ms while

*τ*= 5 ms). This implies that when the bump sweeps over a neuron, the delayed adaptation it generates will suppress the bump height as it sweeps back to the same location. Furthermore, since the oscillatory tracking always begins with a forward sweep (as the initial sweep is triggered by the external input moving in the same direction), the suppression effects are asymmetric, that is, forward sweeps always strongly suppress backward sweeps. On the contrary, the opposite effect is much smaller, since neuronal activities in backward sweeps have already been suppressed, and they can only generate weak adaptation. Because of this asymmetric suppression, the bump height in the forward sweep is always higher than that in the backward sweep (see Fig. 4c and Fig.S2a). When the adaptation strength

*m*is small, the suppression effect is not significant, and the attenuation of the bump height during the backward sweep is small (Fig. 4d). In such case, the firing behavior of a place cell is similar to the situation as the bump height remains unchanged as analyzed in Sec., i.e., the neuron can generate two firing peaks in a theta cycle at the phase shift stage, manifesting the property of a bimodal cell of having both significant phase precession and procession (Fig. 4e&g and

**video 2**). When the adaptation strength

*m*is large, the bump height in the backward sweep attenuates dramatically (see Fig. 4c&d and the video demonstration). As a result, the firing peak of a place cell in the backward sweep becomes nearly invisible at the phase shift stage, and the neuron exhibits only predominant phase precession, manifesting the property of a unimodal cell (Fig. 4f&h and

**video 3**).

In summary, different adaptation strengths explain the emergence of bimodal and unimodal cells. In fact, there is no sharp separation between bimodal and unimodal cells. As the firing rate adaptation gets stronger, the network bump is more attenuated during the backwards sweep, and cells with the bimodal firing property will gradually behave more like those with the unimodal firing property (see Fig.S2b). Moreover, our model confirms that even though phase procession is weak, it still exist in unimodal cells (Fig. 4h lower panel), which has been reported in previous studies (** (Wang et al., 2020); (Yamaguchi et al., 2002)**). This implies that phase procession is not a characteristic feature of bimodal cells, but instead, is likely a common feature of hippocampal activity, with a strength controlled by adaptation. Furthermore, the experimental data (

**) has indicated that there is a laminar difference between unimodal cells and bimodal cells, with bimodal cells correlating more with the firing patterns of deep CA1 neurons and unimodal cells with the firing patterns of superficial CA1 neurons. Our model suggests that this difference may come from the different adaptation strengths in the two layers.**

*(Fernández-Ruiz et al., 2017)*## Constant cycling of multiple future scenarios in a T-maze environment

We have shown that our model can reproduce the forward and backward theta sweeps of decoded position when the animal runs on a linear track. It is noteworthy that there is only a single hypothetical future scenario in the linear track environment, i.e, ahead of the animal’s position, and hence place cells firing phase can only encode future positions in one direction. However, flexible behaviors requires the animal encoding multiple hypothetical future scenarios in a quick and constant manner, e.g., during decision-making and planning in complex environments (** (Johnson and Redish, 2007); (Wikenheiser and Redish, 2015)**). One recent study (

**) showed constant cycling of theta sweeps in a T-maze environment (Fig. 5a), that is, as the animal approaches the choice point, the decoded position from hippocampal activity propagates down one of the two arms alternatively in successive LFP theta cycles. To reproduce this phenomenon, we change the structure of the CANN from a linear track shape to a T-maze shape where the neurons are aligned according to the location of their firing fields in the T-maze environment. Neurons are connected with a strength proportional to the Euclidean distance between their firing fields on the T-maze and the parameters are set such that the network is in the oscillatory tracking state (see details in Methods.). Mimicking the experimental protocol, we let the external input (the artificial animal) move from the end of the center arm to the choice point. At the beginning, when the external input is far away from the choice point, the network bump sweeps back and forth along the center arm, similar to the situation on the linear track. As the external input approaches the choice point, the network bump starts to sweep onto left and right arms alternatively in successive theta cycles (Fig. 5b and**

*(Kay et al., 2020)***video 4**). The underlying mechanism is straightforward. Suppose that the bump first sweeps to the left arm from the current location, it will sweep back to the current location first due to the attraction of the external input. Then in the next round, the bump will sweep to the right arm, since the neurons on the left arm are suppressed due to adaptation. This cycling process repeats constantly between the two upcoming arms before the external input enters one of the two arms (i.e, before the decision is made). At the single cell level, this bump cycling phenomenon gives rise to the “cycle skipping” effect (

**), where a neuron whose place field is on one of the two arms fires on every other LFP theta cycle before the decision is made (Fig. 5c left panel and Fig. 5d upper panel). For example, a pair of cells with firing fields on each of the two arms will fire in regular alternation on every other theta cycle (Fig. 5c right panel and Fig. 5d lower panel). These cell-level firing patterns agree well the experimental observations (**

*(Kay et al., 2020); (Deshmukh et al., 2010); (Brandon et al., 2013)***).**

*(Kay et al., 2020)*In summary, our model, extended to a T-maze structure, explains the constant cycling of two possible future scenarios in a T-maze environment. The underlying mechanism relies on delayed adaptation, which alternately causes neurons on one arm to be more suppressed than those on the other arm. Such high-speed cycling may contribute to the quick and continuous sampling among multiple future scenarios in real-world decision-making and planning (see Discussion for more details).

## Robust phase coding of position with place cells

As the firing rate shows large variability when the animal runs through the firing field (** (Fenton and Muller, 1998)**), it has been suggested that the theta phase shift provides an additional mechanism to improve the localization of animals (

**). Indeed, (**

*(O’keefe and Burgess, 2005)***) showed that taking phase into account leads to a significant improvement in the accuracy of localizing the animal. To demonstrate the robustness of phase coding, previous experiments showed two intriguing findings: a linear relationship between the firing frequency of place cells and the animal moving speed (**

*(Jensen and Lisman, 2000)***), and the continued phase shift after interruption of hippocampal activity (**

*(Geisler et al., 2007)***). We show that our model can also reproduce these two phenomena.**

*(Zugaro et al., 2005)*To investigate the relationship between the single cell’s oscillation frequency and the animal’s running speed, we consider a unimodal cell with predominant phase precession as studied in the experiment (** (Geisler et al., 2007)**). Firstly, our model shows that the LFP theta frequency (the bump oscillation frequency

*ω*) is largely independent of the running speed of the animal (the speed of the external input, see Eq. 6) (Fig. 6c). The phase precession implies that the oscillation frequency of a place cell is higher than LFP theta frequency, since firing precesses to earlier phases over theta cycles (Fig. 6a&b). Secondly, we can analytically quantify how the single cell’s oscillation frequency is modulated by the external moving speed. As shown in Sec., the distance the animal travels during the phase shift stage is 2

*c*

_{0}, which gives the travelling time

*T*= 2

*c*

_{0}/

*ν*

_{ext}and the number of theta cycles for phase precession

*K*

_{f}=

*T ω*. Since the total amount of phase shift over the whole process is

*π*(i.e, half of the theta cycle, Fig. 3e), it means that

*K*

_{f}firing peaks are generated by a unimodal cell within

*T*

_{f}= (

*T ω*− 0.5)/

*ω*units of time. Thus, the firing frequency of the cell is calculated to be

*ω*

_{f}=

*K*

_{f}/

*T*

_{f}≈

*ω*+ 0.25

*ν*

_{ext}/

*c*

_{0}(where the condition

*K*

_{f}≫ 0.5 is used), which increases linearly with the animal speed

*ν*

_{ext}(Fig. 6c-e). This linear relationship ensures that the firing phase of a unimodal cell in each theta cycle is locked with the relative location of the animal in the firing field of that cell, which supports a robust phase-position code. Notably, in our model, the speed modulation of the place cells’ firing frequency is not the cause of theta phase shift, but rather a result of oscillatory tracking. This is different from the dual oscillator model (

**), which assumes that phase precession is caused by a speed-dependent increase in the dendritic oscillation frequency (see Discussion for more details).**

*(Lengyel et al., 2003)*In a different experiment, (** (Zugaro et al., 2005)**) found that the firing phase of a place cell continues to precess even after hippocampal activity was transiently silenced for up to 250 ms (around 2 theta cycles). To reproduce this phenomenon, we also study a unimodal cell by manually turning off the network activity for a few hundred milliseconds (by setting

*r*(

*x, t*) = 0 for all neurons) and then letting the network dynamics evolves again with all parameters unchanged. Based on the theoretical analysis (Eq. 8), we see that the firing phase of a place cell is determined by the location of the external input (i.e.,

*ν*

_{ext}

*t*), which means that as the external input moves forward on the linear track, the firing phase will precess accordingly in successive oscillatory cycles. Thus, once the network is recovered to the oscillatory tracking state and the external input conveys the new location of the animal to the network, phase precession is resumed from the new location. Therefore, the firing phase in the first bump oscillation cycle after the network perturbation is more advanced than the firing phase in the last bump oscillation cycle right before the perturbation, and the amount of precession is similar to that in the case without perturbation (Fig. 6h&i). This agrees well with the experimental observation, and indicates that the phase-position code is robust to the perturbation of the hippocampal dynamics.

Overall, our model reproduces these two experimental findings, and suggests that there exists a one-to-one correspondence between the firing phase of a place cell and the travelled distance in the neuron’s place field, which is independent of the animal’s running speed or the perturbation duration (Fig.S3). This agrees well with experimental observations (** (O’Keefe and Recce, 1993)**) that theta phase correlates better with the animal’s location than with time (Fig. 6f&g). In addition to the results for unimodal cells as introduced above, our model predicts new results for bimodal cells. First, in contrast to a unimodal cell, a bimodal cell will have two peaks in its firing frequency, with one slightly higher than the LFP theta baseline (due to phase precession) and the other slightly lower than the LFP theta baseline (due to phase procession). The precession-associated frequency positively correlates with the running speed of the animal, while the procession-associated frequency negatively correlates with the running speed (Fig. 6d). Second, similar to the preserved phase shift in unimodal cells, both the phase precession and procession of a bimodal cell after transient intrahippocampal perturbation continue from the new location of the animal (see SI), no matter how long the silencing period lasts. The two predictions could be tested by experiments.

# Discussion

## Model contributions

In this paper, we have proposed a CANN with firing rate adaptation to unveil the underlying mechanism of place cell phase shift during locomotion. We show that the interplay between intrinsic mobility (owing to firing rate adaptation) and extrinsic mobility (owing to the location-dependent sensory inputs) leads to an oscillatory tracking state, which naturally accounts for theta sweeps where the decoded position oscillates around the animal’s physical location at the theta rhythm. At the single neuron level, we show that the forward and backward bump sweeps account for, respectively, phase precession and phase procession. Furthermore, we show that the varied adaptation strength explains the emergence of bimodal and unimodal cells, that is, as the adaptation strength increases, forward sweeps of the bump gradually suppress backward sweeps, and as a result, neurons initially exhibiting both significant phase precession and procession (due to a low level adaptation) will gradually exhibit only predominant phase precession (due to a high level adaptation).

## Computational models for theta phase shift and theta sweeps

As a subject of network dynamics, oscillatory tracking has been studied previously in an excitatoryinhibitory neural network (** (Folias and Bressloff, 2004)**), where it was found that decreasing the external input strength can lead to periodic emission of traveling waves in the network (Hopf instability), which is analogous to the oscillatory tracking state in our model. However, their focus was on the mathematical analysis of such dynamical behavior, while our focus is on the biological implications of oscillatory tracking, i.e., how can it be linked to phase precession and procession of hippocampal place cells.

Due to their potential contributions to the temporal sequence learning involved in spatial navigation and episodic memory (** (Mehta et al., 1997), (2002); (Yamaguchi, 2003)**), theta phase precession and forward theta sweeps have been modelled in the field for decades. These models can be divided into two main categories, with one relying on the mechanism of single cell oscillation (

**), and the other relying on the mechanism of recurrent interactions between neurons (**

*(O’Keefe and Recce, 1993)*; (Kamondi et al., 1998); (Lengyel et al., 2003);*(O’keefe and Burgess, 2005); (Mehta et al., 2002)***). A representative example of the former is the oscillatory interference model (**

*(Tsodyks et al., 1996); (Romani and Tsodyks, 2015); (Kang and DeWeese, 2019)***), which produces phase precession via the superposition of two oscillatory signals, with one from the baseline somatic oscillation at the LFP theta frequency (reflecting the inputs from the medial septal pacemaker (**

*(O’Keefe and Recce, 1993); (Lengyel et al., 2003)***)), and the other from the dendritic oscillation whose frequency is slightly higher. While these models can explain a large variety of experimental phenomena, it remain unclear how oscillation of individual neurons has a frequency higher than the baseline theta frequency. Here, our model provides a network mechanism for how such higherfrequency oscillation emerges.**

*(Stewart and Fox, 1990)*A representative model relying on neuronal recurrent interactions is the activation spreading model (** (Tsodyks et al., 1996)**). This model produces phase precession via the propagation of neural activity along the movement direction, which relies on asymmetric synaptic connections. A later version of this model considers short-term synaptic plasticity (short-term depression) to implicitly implement asymmetric connections between place cells (

**), and reproduces many other interesting phenomena, such as phase precession in different environments. However, since the asymmetric connections always skew towards the moving direction (along which the connection strength is stronger than that in the opposite direction), the activity bump can only propagate along the moving direction. Therefore, these two models only reproduce theta phase precession. Rather than relying on neuronal asymmetric connections to induce activity spreading, our model considers firing rate adaptation at individual neurons, which allows the activity bump to propagate in both directions alternately, and hence generate interleaved phase precession and procession. Furthermore, to prevent the activity bump from spreading away, their model considers an external theta input to reset the bump location at the end of each theta cycle, whereas in our model, because of the oscillation of the bump, no external theta input is needed, and by choosing the model parameters properly, the bump can oscillate at the theta rhythm. Nevertheless, experimental studies have suggested that hippocampal neurons receive theta modulation from the medial septal pacemaker (**

*(Romani and Tsodyks, 2015)***). In our model, if we include such an external theta input, the bump oscillation will be locked at the theta rhythm more robustly without the need of fine tuning model parameters. Such a theta input may also have the role of coordinating theta phase shifts across brain regions. We will investigate this issue in future work.**

*(Stewart and Fox, 1990); (King et al., 1998); (Wang, 2002)*## Beyond the linear track environment

Besides the linear track environment, the mechanism of generating theta sweeps proposed in our model can also be generalized to more complex environments. For instance, in a T-maze environment, our model explains the constant cycling of theta sweeps between left and right arms. Such cycling behavior may be important for high-speed actions such as predating and escaping which require animals to make decision among several future scenarios at the sub-second level. Similar alternative activity sweeps in the T-maze environment has been studied in a previous paper (** (Romani and Tsodyks, 2015)**), which showed that the frequency of alternation correlates with overtly deliberative behaviors such as head scans (frequency at 1 Hz or less) (

**). In contrast to our model, the network activity in their model propagates continuously from the current location on the center arm till the end of the outer arm, which takes a few theta cycles (i.e., 1 second or more). In our model, the network bump alternately sweeps to one of the two outer arms at a much higher frequency (∼ 8 Hz), which may be related to fast decision-making or planing in natural environments (**

*(Johnson and Redish, 2007)***). Furthermore, our model can also be easily extended to the multiple-arms (> 2) environment (**

*(Kay et al., 2020)***) or the cascade-T environment (**

*(Gillespie et al., 2021)***) with the underlying mechanism of generating theta cycling remaining unchanged. In addition to the linear and T-maze environments, phase shift has also been reported when an animal navigates in an open field environment. However, due to the lack of recorded neurons, decoding theta sweeps in the 2D environment is not as straightforward as in the 1D case. While theta sweeps in the 1D case have been associated with goal-directed behaviors and spatial planning (**

*(Johnson and Redish, 2007)***), it remains unclear whether such conclusion is applicable to the 2D case. Our preliminary result shows that in the 2D CANN where neurons are arranged homogeneously according to their relative firing locations, the activity bump will sweep along the tangent direction of the movement trajectory, similar to the 1D case (see SI.4 and Fig.S4 for details). It will be interesting to explore theta sweeps in the open field environment in detail when more experimental data is available.**

*(Wikenheiser and Redish, 2015)*## Model implications and future works

In the current study, we have modeled the place cell population in the hippocampus with a CANN and adopted firing rate adaptation to generate theta phase shift. In fact, this model can be easily extended to the grid cell population without changing the underlying mechanism. For instance, we can induce the torus-like connection profile (periodic boundary in the 2D space) (** (Samsonovich and McNaughton, 1997); (McNaughton et al., 2006)**) or the locally inhibitory connection profile (

**) in the CANN structure to construct a grid cell model, and by imposing firing rate adaptation, neurons in the grid cell network will also exhibit phase shift as the animal moves through the grid field, as reported in previous experimental studies (**

*(Burak and Fiete, 2009); (Couey et al., 2013)***). Notably, although for both grid cells and place cells, CANNs can generate theta phase shift, it does not mean that they are independent from each other. Instead, they might be coordinated by the same external input from the environment, as well as by the medial septum which is known to be a pacemaker that synchronises theta oscillations across different brain regions (**

*(Hafting et al., 2008); (Van Der Meer and Redish, 2011)***). We will investigate this issue in future work.**

*(King et al., 1998); (Wang, 2002)*Our model suggests that the “online” theta sweep and the “offline” replay may share some common features in their underlying mechanisms (** (Romani and Tsodyks, 2015); (Hopfield, 2010); (Kang and DeWeese, 2019); (Jahnke et al., 2015)**). We have shown that the activity bump with strong adaptation can move spontaneously when the external input becomes weak enough (see Sec.). Such non-local spreading of neural activity has a speed much faster than the conventional speed of animals (the external input speed in our model, see Fig. 2d), which resembles the fast spreading of the decoded position during sharp-wave ripple events (

**). This indicates that these two phenomena may be generated by the same neural mechanism of firing rate adaptation, with theta sweeps originating from the interplay between the adaptation and the external input, while replay originating from only the adaptation, since the external input is relatively weak during the “offline” state. This hypothesis seems to be supported by the coordinated emergence of theta sequences and replays during the post-natal development period (**

*(Diba and Buzsáki, 2007); (Foster and Wilson, 2006); (Karlsson and Frank, 2009); (Dragoi and Tonegawa, 2011)***), as well as their simultaneous degradation when the animal travelled passively on a model train (**

*(Muessig et al., 2019)***).**

*(Drieu et al., 2018)*Nevertheless, it is important to note that the CANN we adopt in the current study is an idealized model for the place cell population, where many biological details are missed (** (Amari, 1977); (Tsodyks and Sejnowski, 1995); (Samsonovich and McNaughton, 1997); (Tsodyks, 1999)**). For instance, we have assumed that neuronal synaptic connections are translation-invariant in the space. In practice, such a connection pattern may be learned by a synaptic plasticity rule at the behavioral time scale when the animal navigates actively in the environment (

**). In future work, we will explore the detailed implementation of this connection pattern, as well as other biological correspondences of our idealized model, to establish a comprehensive picture of how theta phase shift is generated in the brain.**

*(Bittner et al., 2017)*# Materials and Methods

## General summary of the model

We consider a one-dimensional continuous attractor neural network (1D CANN), in which neurons are uniformly aligned according to their firing fields on a linear track (for the T-maze case, see Methods. below; for the case of the open field (2D CANN), see SI.4). Denote *U* (*x, t*) the synaptic input received by the place cell at location *x*, and *r*(*x, t*) the corresponding firing rate. The dynamics of the network is written as

where *τ* is the time constant of *U* (*x, t*) and *ρ* the neuron density. The firing rate *r*(*x, t*) is given by

where *k* controls the strength of the global inhibition (divisive normalization). *J* (*x, x*′) denotes the connection weight between place cells at location *x* and *x*′, which is written as:

where *J*_{0} controls the strength of the recurrent connection and *a* the range of neuronal interaction. Notably, *J* (*x, x*′) depends on the relative distance between two neurons, rather than the absolute locations of neurons. Such translation-invariant connection form is crucial for the neutral stability of the attractor states of CANNs (** (Wu et al., 2016)**).

*I*

_{ext}(

*x, t*) represents the external input which conveys the animal location information to the hippocampal network, which is written as:

with *ν*_{ext} denoting the animal’s running speed and *α* controlling the input strength to the hippocampus. *V* (*x, t*) denotes the adaptation effect of the place cell at location *x*, which increases with the synaptic input (and hence the place cell’s firing rate), i..e,

with *τ*_{ν} denoting the time constant of *V* (*x, t*) and *m* the adaptation strength. Note that *τ*_{ν} ≫ *τ*, meaning that adaptation is a much slower process compared to the neural firing.

## Stability analysis of the bump state

We derive the condition under which the bump activity is the stable state of the CANN. For simplicity, we consider the simplest case that there is no external input and adaptation in the network, i.e., *m* = *α* = 0. In this case, the network state is determined by the strength of the recurrent excitation and global inhibition. When the global inhibition is strong (*k* is large), the network is silent, i.e., no bump activity emerges in the CANN. When the global inhibition is small, an activity bump with the Gaussian-shaped profile emerges, which is written as:

with *A*_{u} and *A*_{r} representing the amplitudes of the synaptic input bump and the firing rate bump, respectively. *z*(*t*) represents the bump center, and *a* is the range of neuronal interaction (defined in Methods.). To solve the network dynamics, we substitute Eqs. 14&15 into Eqs. 9&10, which gives (see SI.2 for more details of the derivation):

These two equations describes how the bump amplitudes change with time. For instance, if neurons are weakly connected (small *J*_{0}) or they are connected sparsely (small *ρ*), the second term on the right-hand side of Eq. 16 is small, and *A*_{u} will decay to zero, implying that the CANN cannot sustain a bump activity. By setting *dA*_{u}/*dt* = 0, we obtain:

It is straightforward to check that only when have two real solutions (indicated by the ± sign in Eq. 18), i.e.,, the dynamic system (Eqs. 16&17) has two fixed points. It can be checked that only is the stable solution.

## Analysis of intrinsic mobility of the bump state

We derive the condition under which the bump of the CANN moves spontaneously in the attractor space without relying on external inputs. As the adaptation strength increases, the bump activity becomes unstable and has tendency to move away from its location spontaneously. Such intrinsic mobility of the CANN has been shown in previous studies (** (Bressloff, 2011); (Wu et al., 2016); (Mi et al., 2014)**). We set

*α*= 0 (no external input), and investigate the effect of adaptation strength

*m*on the bump dynamics. Our simulation result shows that during the spontaneous movement,

*V*(

*x, t*) can also be represented by a Gaussian-shaped bump, which is written as

where *A*_{r} denotes the amplitude of the adaptation bump, and *d*(*t*) the displacement between the bump centers of *U* (*x, t*) and *V* (*x, t*). This displacement originates from the slow dynamics of adaptation, which leads to that the adaptation bump always lags behind the neural activity bump. Similar to Methods., we substitute the bump profiles Eqs. (14, 15, 20) into the network dynamics Eqs. (9, 10, 13), and obtain:

where 𝒩 (*z*, 2*a*) = exp {− [*x* − *z*]^{2} /4*a*^{2}}.

Previous works have shown that the dynamics of a CANN is dominated by very few motion modes (** (Fung et al., 2010), (2012)**). To solve the CANN dynamics, we can project the network dynamics onto those dominating modes and simplify the analyses significantly. Here, we consider the first two motion modes, corresponding to the changes of the bump height and position, respectively, which are given by,

By projecting the network dynamics onto these two motion modes, we obtain:

Eqs. 24-28 describes the relationships between bump features *A*_{u}, *A*_{r}, *A*_{ν}, *ν*_{int} and *d*. By solving these equations, we obtain,

Eqs. 29-31 describe the amplitudes of the bumps of synaptic input, firing rate, and adaptation in the CANN, respectively, and Eq. 32 describes the displacement between the neural activity and adaptation bumps. From Eq. 33, we see that for the bump to travel spontaneously, it requires *m* > *τ*/*τ*_{ν}, i.e., the adaptation strength is larger than a threshold given by the ratio between two time constants *τ* and *τ*_{ν}. As the adaptation strength increases (larger *m*), the travelling speed of the bump increases (larger *ν*_{int}).

## Analysis of the oscillatory tracking behaviour of the bump state

When both the external input and the adaptation are applied to the CANN, the bump activity can oscillate around the external input if the strengths of the external input and the adaptation are appropriated. The simulation shows that during the oscillatory tracking, the bump shape is roughly unchanged, and the oscillation of the bump center can be approximated as a sinusoidal wave expressed as:

where *c*_{0} and *ω* denote, respectively, the oscillation amplitude and frequency, and *d*_{0} denotes a constant offset between the oscillation center and the external input.

Similar to the analysis in Methods., we substitute the expression of *z*(*t*) (Eq. 34) into Eqs. (14, 15, 20), and then simplify the network dynamics by applying the projection method (see SI.3 for more detailed derivation). We obtain,

Eqs. 35-39 describe the relationships among 6 oscillation features *A*_{u}, *A*_{r}, *A*_{ν}, *c*_{0}, *d*_{0} and *ω*. By solving these equations, we obtain:

It can be seen from Eq. 43 that for the bump activity to oscillate around the external input (i.e., the oscillation amplitude *c*_{0} > 0), it requires that 8*a*^{2} ln . This condition gives the boundary (on the parameter values of the input strength *α* and the adaptation strength *m*) that separate two tracking states, i.e., smooth tracking and oscillatory tracking (see Fig. 2g and Fig.S1 for the comparison between the simulation results and theoretical results).

Note that to get the results in Eqs. 35-39, we have assumed that the amplitudes of neural activity bumps and the adaptation bump remain unchanged during the oscillation (i.e., *A*_{u}, *A*_{ν}, *A*_{r} are constants). However, this assumption is not satisfied when the SFA strength *m* is large (see Sec. and Fig. 4). In such a case, we carry out simulation to analyze the network dynamics.

## Implementation details of the linear track environment

For the linear track environment, we simulate an 1D CANN with 512 place cells topographically organized on the one-dimensional neuronal track. Since we are interested in how the neuronal firing phase shifts as the animal moves through the firing field of a place cell, we investigate the place cell at location *x* = 0 and ignore the boundary effect, that is, we treat the linear track with the infinite length. The neural firing time constant is set to be 3 ms, while the time constant of spike frequency adaptation is much longer, which is set to be 144 ms. The density of place cells on the linear track is set to be 256/*π*. The excitatory interaction range of place cells is set to be 0.4*m*, while the maximum excitatory connection strength *J*_{0} is set to be 0.2. The gain factor is set to be 5. The global inhibition strength *k* is set to be 5. The moving speed of the virtual animal *ν*_{ext} is set to be 1.5 m/s. For the simulation details, we use the first-order Euler method with the time step *δt* set to be 0.3 the duration of simulation *T* set to be 10 s. These parameters are commonly used in all plots related to the linear track environment (see Table.1 for a summary).

For the two key parameters, i.e., the external input strength *α* and the adaptation strength *m*, we vary their values in different plots. Specifically, for illustrating the smooth tracking state in Fig. 2c, we set *α* = 0.19 and *m* = 0. For illustrating the travelling wave state (intrinsic mobility of the bump state) in Fig. 2d, we set *α* = 0 and *m* = 0.31. For plotting the relationship between the intrinsic speed *ν*_{int} and the adaptation strength *m* shown in Fig. 2e, we keep *α* = 0, but vary *m* in the range between 0 and 0.1 with a step of 0.05. For plotting the overall phase diagram including all three moving states as shown in Fig. 2g, we vary *α* in the range between 0.05 and 0.16 with a step of 0.001, and *m* in the range between 0.9 and 1.8 with a step of 0.01. To generate bimodal cell firing patterns in Fig. 3a and Fig. 4a,e&g, we choose *α* = 0.19 and *m* = 3.02. To generate unimodal firing patterns in Fig. 4b,f&h, we choose *α* = 0.19 but a relatively larger adaptation strength with *m* = 3.125. The values of these two parameters in different plots are summarized in Table. 2.

## Implementation details of the T-maze environment

### Parameter configurations during simulation

To simulate the T-maze environment, we consider a CANN in which place cells are topographically organized in a T-shaped area which consists of a vertical central arm and two horizontal left and right arms (Fig. 5a). The width of the central arm is set to be 0.84 m and the length is set to be 3.14 m. The widths of the two horizontal arms are also set to be 0.84 m, while the lengths of both arms are set to be 2.36 m. The connection strength between two neurons is determined by the distance between them, which is written as:

Here (*x, y*) and (*x*′, *y*′) represent the coordinates of two neurons in the T-maze environment, *a* is the recurrent connection range which is set to be 0.3, and *J*_{0} controls the connection strength which is set to be 0.0125. Since we are interested in investigating theta sweeps when the animal is running on the central arm towards the junction point, the external input is restricted on the central arm which is modelled by a Gaussian-like moving bump written as:

where *x*_{0} = 0 and *y*_{0} = *ν*_{ext}*t* represent the center location of the external input with a moving speed *ν*_{ext} = 1.5 m/s. In the simulation, we used the first-order Euler method with the time step *δt* = 0.3 s and the duration of simulation *T* = 4.2*s*. The parameters used are summarized in Table.3.

### Calculating auto-correlogram and cross-correlogram

To show the “cycle skipping” effect of a single place cell in the T-maze environment, we calculate the auto-correlogram of the firing rate trace of a place cell whose firing field encodes a location on the left arm (the upper panel in Fig. 5d). Assume the firing trace of the place cell is *f* (*t*) (showed in left panel in Fig. 5c), the auto-correlogram is calculated as:

where *τ* represents the time offset.

To show the “alternative cycling” effect of a pair of place cells with each of them encoding a location on each of the two outward arms, we calculate the cross-correlogram between their firing traces (the lower panel in Fig. 5d). It measures the similarity of the two firing traces as a function of the temporal offset of one relative to the other. Assume the firing traces of the two place cells are *f* (*t*) and *g*(*t*), respectively, the cross-correlogram is calculated as:

where *τ* represents the time offset.

## Details of generating the probability heatmap of theta phase shift

In Fig. 4g&h we described the smoothed probability heatmaps of theta phase versus normalized position in the place field of both bimodal and unimodal cells. Generally, these two plots are similar to the traditional spike plot of phase and position traveled in the place field (** (O’Keefe and Recce, 1993); (Skaggs et al., 1996)**). However, in our rate-based model, the phase of neuronal spike is not directly modelled, rather we use the phase of firing rate peak to represent the phase shift in neuronal firing. Here we describe the implementation details of generating the heatmaps.

The x-axis denotes the normalized position in the place field, with −1 representing the position where the animal just enters the place field, and 1 representing the position where the animal just leaves the place field. In our simulation, the firing field of a place cell with preferred location at *x*_{0} is defined as *x* ∈ (*x*_{0} − 2.5 * *a, x*_{0} + 2.5*a*), with *a* roughly the half size of the firing field. Consider the animal is at *x*_{t} at time *t* (note that *x*_{t} = *ν*_{ext}*t*), then its normalized position is calculated as . The y-axis represents the phase of neuronal activity, which is in the range of (0°, 720°). To calculate the phase at every time step, we divide the duration of the animal traversing the linear track into multiple theta cycles according to the bump’s oscillation. We can calculate the phase by *θ*_{t} = (*t* − *t*_{0})/*T*, with *t*_{0} referring to the beginning of the present theta cycle and T referring to the theta period. Denote the firing rate of the *i*-th neuron at time t as , the probability heatmap is calculated by,

where is the normalization factor.

## Spike generation from the firing rate

To understand phase shift based on spiking time rather than the peak firing rate, we convert the firing rate into spike trains according to the Poisson statistics (note that our analysis is rate-based, but converting to spike-based does not change the underlying mechanism). For the *i*th place cell which encodes position *x*_{i} on the linear track, the number of spikes *n*_{i} it generates within a time interval Δ*t* satisfies a Poisson distribution, which is expressed as,

where *z* is the animal’s location, and *f*_{i}(*z*) is the tuning function of cell *i*, which is given by

where *A*_{r} denotes the amplitude of the neural activity bump and *a* the range of recurrent interaction.

# Acknowledgements

We thank Brad Pheiffer for sharing the data. We also thank Brad Pheiffer, Cheng Wang, Li Yao for valuable discussions.

# Funding

This work was support by: Science and Technology Innovation 2030-Brain Science and Brain-inspired Intelligence Project (No. 2021ZD0200204, SW; No. 2021ZD0203700 / 2021ZD0203705, YM), the Wellcome Principal Research Fellowship (NB), the National Natural Science Foundation of China (No. T2122016, YM), and an International Postdoctoral Exchange Fellowship Program (No. PC2021005, ZJ).

# Author Contributions

TC, ZJ and SW conceptualized and designed the research. TC, ZJ, JZ, and YM analyzed the model and performed the simulations. ZJ, WZ, TH, NB and SW interpreted the results. ZJ, TC, DB, NB and SW wrote the manuscript.

# Competing interests

Authors declare that they have no competing interests.

# Data and materials availability

All code for reproducing the figures in the main text are available in the supplementary materials.

# List of material contained in the Supplementary Material

Supplementary text (pdf file)

Figures S1-S4

Video 1-4

Code for reproducing all the figures in the main text

# References

- Differential electroresponsiveness of stellate and pyramidal-like cells of medial entorhinal cortex layer ii
*Journal of neurophysiology***70:**128–143 - Dynamics of pattern formation in lateral-inhibition type neural fields
*Biological cybernetics***27:**77–87 - A computational model for preplay in the hippocampus
*Frontiers in computational neuroscience***7:**161 - Attractor neural networks storing multiple space representations: a model for hippocampal place fields
*Physical Review E***58:**7738 - A universal model for spike-frequency adaptation
*Neural computation***15:**2523–2564 - Behavioral time scale synaptic plasticity underlies ca1 place fields
*Science***357:**1033–1036 - Segregation of cortical head direction cell assemblies on alternating theta cycles
*Nature neuroscience***16:**739–748 - Spatiotemporal dynamics of continuum neural fields
*Journal of Physics A: Mathematical and Theoretical***45:**33001 - Accurate path integration in continuous attractor network models of grid cells
*PLoS computational biology***5:** - A model of hippocampal function
*Neural networks***7:**1065–1081 - Recurrent inhibitory circuitry as a mechanism for grid formation
*Nature neuroscience***16:**318–324 - Theta modulation in the medial and the lateral entorhinal cortices
*Journal of neurophysiology***104:**994–1006 - Forward and reverse hippocampal place-cell sequences during ripples
*Nature neuroscience***10:**1241–1242 - Noisy adaptation generates lévy flights in attractor neural networks
*Advances in Neural Information Processing Systems***34:**16791–16804 - Preplay of future place cell sequences by hippocampal cellular assemblies
*Nature***469:**397–401 - Nested sequences of hippocampal assemblies during behavior support subsequent sleep replay
*Science***362:**675–679 - Dissociation between the experience-dependent development of hippocampal theta sequences and single-trial phase precession
*Journal of Neuroscience***35:**4890–4902 - Place cell discharge is extremely variable during individual passes of the rat through the firing field
*Proceedings of the National Academy of Sciences***95:**3182–3187 - Entorhinal-ca3 dual-input control of spike timing in the hippocampus by theta-gamma coupling
*Neuron***93:**1213–1226 - Breathing pulses in an excitatory neural network
*SIAM Journal on Applied Dynamical Systems***3:**378–407 - A model of hippocampally dependent navigation, using the temporal difference learning rule
*Hippocampus***10:**1–16 - Reverse replay of behavioural sequences in hippocampal place cells during the awake state
*Nature***440:**680–683 - Hippocampal theta sequences
*Hippocampus***17:**1093–1099 - Spike frequency adaptation and neocortical rhythms
*Journal of neurophysiology***88:**761–770 - Delay compensation with dynamical synapses
*Advances in Neural Information Processing Systems***25:** - A moving bump in a continuous manifold: a comprehensive study of the tracking dynamics of continuous attractor neural networks
*Neural Computation***22:**752–792 - Hippocampal place cell assemblies are speed-controlled oscillators
*Proceedings of the National Academy of Sciences***104:**8149–8154 - Hippocampal replay reflects specific past experiences rather than a plan for subsequent choice
*Neuron***109:**3149–3163 - Hippocampus-independent phase precession in entorhinal grid cells
*Nature***453:**1248–1252 - An arithmetic rule for spatial summation of excitatory and inhibitory inputs in pyramidal neurons
*Proceedings of the National Academy of Sciences***106:**21906–21911 - Spike train dynamics predicts theta-related phase precession in hippocampal pyramidal cells
*Nature***417:**738–741 - Patients with hippocampal amnesia cannot imagine new experiences
*Proceedings of the National Academy of Sciences***104:**1726–1731 - Neurodynamics of mental exploration
*Proceedings of the National Academy of Sciences***107:**1648–1653 - A unified dynamic model for learning, replay, and sharp-wave/ripples
*Journal of Neuroscience***35:**16236–16258 - Phase precession: a neural code underlying episodic memory?
*Current opinion in neurobiology***43:**130–138 - Position reconstruction from an ensemble of hippocampal place cells: contribution of theta phase coding
*Journal of neurophysiology***83:**2602–2609 - Neural ensembles in ca3 transiently encode paths forward of the animal at a decision point
*Journal of Neuroscience***27:**12176–12189 - Theta oscillations in somata and dendrites of hippocampal pyramidal cells in vivo: Activity-dependent phase-precession of action potentials
*Hippocampus***8:**244–261 - Replay as wavefronts and theta sequences as bump oscillations in a grid cell attractor network
*Elife***8:** - Awake replay of remote experiences in the hippocampus
*Nature neuroscience***12:**913–918 - Constant sub-second cycling between representations of possible futures in the hippocampus
*Cell***180:**552–567 - The rhythmicity of cells of the medial septum/diagonal band of broca in the awake freely moving rat: relationships with behaviour and hippocampal theta
*European Journal of Neuroscience***10:**464–477 - Dynamically detuned oscillations account for the coupled rate and temporal code of place cell firing
*Hippocampus***13:**700–714 - Network mechanisms of theta related neuronal activity in hippocampal ca1 pyramidal neurons
*Nature neuroscience***13:**967–972 - Path integration and the neural basis of the’cognitive map’
*Nature Reviews Neuroscience***7:**663–678 - Role of experience and oscillations in transforming a rate code into a temporal code
*Nature***417:**741–746 - Experience-dependent, asymmetric expansion of hippocampal place fields
*Proceedings of the National Academy of Sciences***94:**8918–8921 - Spike frequency adaptation implements anticipative tracking in continuous attractor neural networks
*Advances in neural information processing systems***27:** - Coordinated emergence of hippocampal replay and theta sequences during post-natal development
*Current Biology***29:**834–840 - Dual phase and rate coding in hippocampal place cells: theoretical significance and relationship to entorhinal grid cells
*Hippocampus***15:**853–866 - Phase relationship between hippocampal place units and the eeg theta rhythm
*Hippocampus***3:**317–330 - The content of hippocampal “replay”
*Hippocampus***30:**6–18 - Short-term plasticity based network model of place cells dynamics
*Hippocampus***25:**94–105 - Path integration and cognitive mapping in a continuous attractor neural network model
*Journal of Neuroscience***17:**5900–5920 - Single-trial phase precession in the hippocampus
*Journal of Neuroscience***29:**13232–13241 - Theta phase precession in hippocampal neuronal populations and the compression of temporal sequences
*Hippocampus***6:**149–172 - Do septal neurons pace the hippocampal theta rhythm?
*Trends in neuro-sciences***13:**163–169 - Attractor neural network models of spatial maps in hippocampus
*Hippocampus***9:**481–489 - Associative memory and hippocampal place cells
*International journal of neural systems***6:**81–86 - Population dynamics and theta rhythm phase precession of hippocampal place cell firing: a spiking neuron model
*Hippocampus***6:**271–280 - Theta phase precession in rat ventral striatum links place and reward information
*Journal of neuroscience***31:**2843–2854 - The anatomy of memory: an interactive overview of the parahippocampal–hippocampal network
*Nature reviews neuroscience***10:**272–282 - Alternating sequences of future and past behavior encoded within hippocampal theta oscillations
*Science***370:**247–250 - Pacemaker neurons for the theta rhythm and their synchronization in the septohippocampal reciprocal loop
*Journal of neurophysiology***87:**889–900 - Hippocampal theta sequences reflect current goals
*Nature neuro-science***18:**289–294 - Dynamics and computation of continuous attractors
*Neural computation***20:**994–1025 - Continuous attractor neural networks: candidate of a canonical model for neural information representation
*F1000Research***5:** - A theory of hippocampal memory based on theta phase precession
*Biological cybernetics***89:**1–9 - Bimodality of theta phase precession in hip-pocampal place cells in freely running rats
*Journal of neurophysiology***87:**2629–2642 - Spike phase precession persists after transient intrahip-pocampal perturbation
*Nature neuroscience***8:**67–71